String productTypeName=request.getParameter("productTypeName");
int parentTypeId=Integer.parseInt(request.getParameter("parentTypeId"));
int isMaxProductType=Integer.parseInt(request.getParameter("isMaxProductType"));
String productTypeMemo=request.getParameter("productTypeMemo");
if(new TbProductTypeDAO().add(new TbProductType(productTypeLevel,productTypeName,parentTypeId,isMaxProductType,productTypeMemo))){
request.getSession().setAttribute("result", "添加成功");
}else{
request.getSession().setAttribute("result", "添加失败");
}
request.getSession(true).setAttribute("tbProductTypeList",new TbProductTypeDAO().getTbProductTypeAll());
response.sendRedirect("ProducttypeModule/TbProductTypeList.jsp");
}
if("del".equals(method)){
if(UtilDAO.delin("Tb_ProductType", "ProductTypeId", request.getParameter("delIds"))){
request.getSession().setAttribute("result", "删除成功");
}else{
request.getSession().setAttribute("result", "删除失败");
}
request.getSession(true).setAttribute("tbProductTypeList",new TbProductTypeDAO().getTbProductTypeAll());
response.sendRedirect("ProducttypeModule/TbProductTypeList.jsp");
}
if("edit".equals(method)){
int productTypeId=Integer.parseInt(request.getParameter("productTypeId"));
int productTypeLevel=Integer.parseInt(request.getParameter("productTypeLevel"));
String productTypeName=request.getParameter("productTypeName");
int parentTypeId=Integer.parseInt(request.getParameter("parentTypeId"));
int isMaxProductType=Integer.parseInt(request.getParameter("isMaxProductType"));
String productTypeMemo=request.getParameter("productTypeMemo");
if(new TbProductTypeDAO().edit(new TbProductType(productTypeId,productTypeLevel,productTypeName,parentTypeId,isMaxProductType,productTypeMemo))){
request.getSession().setAttribute("result", "修改成功");
}else{
request.getSession().setAttribute("result", "修改失败");
}
request.getSession(true).setAttribute("tbProductTypeList",new TbProductTypeDAO().getTbProductTypeAll());