int companyManCount=Integer.parseInt(request.getParameter("companyManCount"));
String companyContactList=request.getParameter("companyContactList");
int creditRatingId=Integer.parseInt(request.getParameter("creditRatingId")==null?"0":request.getParameter("creditRatingId"));
String companyMemo=request.getParameter("companyMemo");
System.out.println("companyTypeId=="+companyTypeId);
if(new TbCompanyDAO().add(new TbCompany(companyCode,companyTypeId,companyName,parentCompanyName,companyAddress,companyTelphone,companyMobile,companyCreateTime,companyManCount,companyContactList,creditRatingId,companyMemo,new UtilDAO().decodeDate()))){
request.getSession().setAttribute("result", "添加成功");
}else{
request.getSession().setAttribute("result", "添加失败");
}
request.getSession(true).setAttribute("tbCompanyList",new TbCompanyDAO().getTbCompanyAll());
response.sendRedirect("CompanyModule/TbCompanyList.jsp");
}
if("del".equals(method)){
if(UtilDAO.delin("Tb_Company", "CompanyId", request.getParameter("delIds"))){
request.getSession().setAttribute("result", "删除成功");
}else{
request.getSession().setAttribute("result", "删除失败");
}
request.getSession(true).setAttribute("tbCompanyList",new TbCompanyDAO().getTbCompanyAll());
response.sendRedirect("CompanyModule/TbCompanyList.jsp");
}
if("edit".equals(method)){
int companyId=Integer.parseInt(request.getParameter("companyId"));
String companyCode=request.getParameter("companyCode");
String companyTypeIdAll [] = request.getParameterValues("companyTypeId");
String companyTypeId="";
for(String typeId :companyTypeIdAll){
companyTypeId="".equals(companyTypeId)?typeId:companyTypeId+","+typeId;
}
String companyName=request.getParameter("companyName");
String parentCompanyName=request.getParameter("parentCompanyName");
String companyAddress=request.getParameter("companyAddress");
String companyTelphone=request.getParameter("companyTelphone");
String companyMobile=request.getParameter("companyMobile");
String companyCreateTime=request.getParameter("companyCreateTime");
int companyManCount=Integer.parseInt(request.getParameter("companyManCount"));
String companyContactList=request.getParameter("companyContactList");
int creditRatingId=Integer.parseInt(request.getParameter("creditRatingId")==null?"0":request.getParameter("creditRatingId"));
String companyMemo=request.getParameter("companyMemo");
if(new TbCompanyDAO().edit(new TbCompany(companyId,companyCode,companyTypeId,companyName,parentCompanyName,companyAddress,companyTelphone,companyMobile,companyCreateTime,companyManCount,companyContactList,creditRatingId,companyMemo,new UtilDAO().decodeDate()))){
request.getSession().setAttribute("result", "修改成功");
}else{
request.getSession().setAttribute("result", "修改失败");
}
request.getSession(true).setAttribute("tbCompanyList",new TbCompanyDAO().getTbCompanyAll());
response.sendRedirect("CompanyModule/TbCompanyList.jsp");
}
if ("list".equals(method)) {
request.getSession().setAttribute("tbCompanyTypeListAll", new TbCompanyTypeDAO().getTbCompanyTypeAll());
request.getSession(true).setAttribute("tbCompanyList",new TbCompanyDAO().getTbCompanyAll());
response.sendRedirect("CompanyModule/TbCompanyList.jsp");
}
if ("listById".equals(method)) {
request.getSession(true).setAttribute("tbCompany",new TbCompanyDAO().getTbCompanyByCompanyId(Integer.parseInt(request.getParameter("companyId"))));
response.sendRedirect("CompanyModule/TbCompanyOperate.jsp");
}
if("showadd".equals(method)){
response.sendRedirect("CompanyModule/TbCompanyOperate.jsp");
}