|
@@ -65,29 +65,40 @@ public class CmSmalltypeController extends BaseController {
|
|
@RequiresPermissions("product:cmSmalltype:view")
|
|
@RequiresPermissions("product:cmSmalltype:view")
|
|
@RequestMapping(value = {"list", ""})
|
|
@RequestMapping(value = {"list", ""})
|
|
public String list(CmSmalltype cmSmalltype, HttpServletRequest request, HttpServletResponse response, Model model) {
|
|
public String list(CmSmalltype cmSmalltype, HttpServletRequest request, HttpServletResponse response, Model model) {
|
|
|
|
+ cmSmalltype.setMallType(null == cmSmalltype.getMallType() ? 1 : cmSmalltype.getMallType());
|
|
Page<CmSmalltype> page = cmSmalltypeService.findPage(new Page<CmSmalltype>(request, response), cmSmalltype);
|
|
Page<CmSmalltype> page = cmSmalltypeService.findPage(new Page<CmSmalltype>(request, response), cmSmalltype);
|
|
model.addAttribute("page", page);
|
|
model.addAttribute("page", page);
|
|
CmBigtype cmBigtype = cmBigtypeService.get(cmSmalltype.getBigTypeID());
|
|
CmBigtype cmBigtype = cmBigtypeService.get(cmSmalltype.getBigTypeID());
|
|
model.addAttribute("bigTypeID", cmSmalltype.getBigTypeID());
|
|
model.addAttribute("bigTypeID", cmSmalltype.getBigTypeID());
|
|
model.addAttribute("bigTypeName", cmBigtype.getName());
|
|
model.addAttribute("bigTypeName", cmBigtype.getName());
|
|
model.addAttribute("typeSort", cmSmalltype.getTypeSort());
|
|
model.addAttribute("typeSort", cmSmalltype.getTypeSort());
|
|
- return "modules/product/cmSmalltypeList";
|
|
|
|
|
|
+ if (2 == cmSmalltype.getMallType()) {
|
|
|
|
+ return "modules/hehe/cmHeheSmalltypeList";
|
|
|
|
+ } else {
|
|
|
|
+ return "modules/product/cmSmalltypeList";
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
@RequiresPermissions("product:cmSmalltype:view")
|
|
@RequiresPermissions("product:cmSmalltype:view")
|
|
@RequestMapping(value = "form")
|
|
@RequestMapping(value = "form")
|
|
public String form(CmSmalltype cmSmalltype, Model model) {
|
|
public String form(CmSmalltype cmSmalltype, Model model) {
|
|
|
|
+ cmSmalltype.setMallType(null == cmSmalltype.getMallType() ? 1 : cmSmalltype.getMallType());
|
|
if(null == cmSmalltype.getSortIndex()){
|
|
if(null == cmSmalltype.getSortIndex()){
|
|
cmSmalltype.setSortIndex(1);
|
|
cmSmalltype.setSortIndex(1);
|
|
}
|
|
}
|
|
model.addAttribute("cmSmalltype", cmSmalltype);
|
|
model.addAttribute("cmSmalltype", cmSmalltype);
|
|
model.addAttribute("bigTypeID", cmSmalltype.getBigTypeID());
|
|
model.addAttribute("bigTypeID", cmSmalltype.getBigTypeID());
|
|
- return "modules/product/cmSmalltypeForm";
|
|
|
|
|
|
+ if (2 == cmSmalltype.getMallType()) {
|
|
|
|
+ return "modules/hehe/cmHeheSmalltypeForm";
|
|
|
|
+ } else {
|
|
|
|
+ return "modules/product/cmSmalltypeForm";
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
@RequiresPermissions("product:cmSmalltype:edit")
|
|
@RequiresPermissions("product:cmSmalltype:edit")
|
|
@RequestMapping(value = "save")
|
|
@RequestMapping(value = "save")
|
|
public String save(CmSmalltype cmSmalltype, Model model, RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
|
public String save(CmSmalltype cmSmalltype, Model model, RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
|
|
|
+ cmSmalltype.setMallType(null == cmSmalltype.getMallType() ? 1 : cmSmalltype.getMallType());
|
|
if (checkValidator(model, cmSmalltype)){
|
|
if (checkValidator(model, cmSmalltype)){
|
|
return form(cmSmalltype, model);
|
|
return form(cmSmalltype, model);
|
|
}
|
|
}
|
|
@@ -95,40 +106,48 @@ public class CmSmalltypeController extends BaseController {
|
|
cmSmalltype.setAddTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
cmSmalltype.setAddTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
}
|
|
}
|
|
cmSmalltypeService.save(cmSmalltype);
|
|
cmSmalltypeService.save(cmSmalltype);
|
|
- cleanRedisCache();
|
|
|
|
|
|
+ if (1 == cmSmalltype.getMallType()) {
|
|
|
|
+ cleanRedisCache();
|
|
|
|
+ }
|
|
// if (flag){
|
|
// if (flag){
|
|
// cmSmalltypeService.mutiUpdateCode(cmSmalltype.getSmallTypeID());
|
|
// cmSmalltypeService.mutiUpdateCode(cmSmalltype.getSmallTypeID());
|
|
// }
|
|
// }
|
|
addMessage(redirectAttributes, "保存二级分类成功");
|
|
addMessage(redirectAttributes, "保存二级分类成功");
|
|
- return "redirect:"+Global.getAdminPath()+"/product/cmSmalltype/?repage&bigTypeID="+cmSmalltype.getBigTypeID()+"&typeSort="+cmSmalltype.getTypeSort();
|
|
|
|
|
|
+ return "redirect:" + Global.getAdminPath() + "/product/cmSmalltype/?repage&bigTypeID=" + cmSmalltype.getBigTypeID() + "&typeSort=" + cmSmalltype.getTypeSort() + "&mallType=" + cmSmalltype.getMallType();
|
|
}
|
|
}
|
|
|
|
|
|
private boolean checkValidator(Model model, CmSmalltype cmSmalltype) {
|
|
private boolean checkValidator(Model model, CmSmalltype cmSmalltype) {
|
|
if (!beanValidator(model, cmSmalltype)){
|
|
if (!beanValidator(model, cmSmalltype)){
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
- if(StringUtils.getStringLength(cmSmalltype.getName())>16){
|
|
|
|
|
|
+ if(1 == cmSmalltype.getMallType() && StringUtils.getStringLength(cmSmalltype.getName())>16){
|
|
model.addAttribute("errorMsg", "名称过长!");
|
|
model.addAttribute("errorMsg", "名称过长!");
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
- List<CmSmalltype> cmSmalltypeList = cmSmalltypeService.getByCode(cmSmalltype.getSmallTypeCode(),cmSmalltype.getBigTypeID());
|
|
|
|
- if (null!=cmSmalltype&&cmSmalltype.getSmallTypeID()==null&&cmSmalltypeList!=null&&cmSmalltypeList.size()>0){
|
|
|
|
- model.addAttribute("errorMsg", "同一大分类下小分类编码不能相同!");
|
|
|
|
- return true;
|
|
|
|
|
|
+ if (1 == cmSmalltype.getMallType()) {
|
|
|
|
+ List<CmSmalltype> cmSmalltypeList = cmSmalltypeService.getByCode(cmSmalltype.getSmallTypeCode(),cmSmalltype.getBigTypeID());
|
|
|
|
+ if (cmSmalltype.getSmallTypeID()==null&&cmSmalltypeList!=null&&cmSmalltypeList.size()>0){
|
|
|
|
+ model.addAttribute("errorMsg", "同一大分类下小分类编码不能相同!");
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isEmpty(cmSmalltype.getWwwIcon())) {
|
|
|
|
+ model.addAttribute("errorMsg", "请上传网站图标!");
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isEmpty(cmSmalltype.getTypeSort())) {
|
|
|
|
+ model.addAttribute("errorMsg", "请输入分类类型!");
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- if (StringUtils.isEmpty(cmSmalltype.getWwwIcon())) {
|
|
|
|
- model.addAttribute("errorMsg", "请上传网站图标!");
|
|
|
|
- return true;
|
|
|
|
- }
|
|
|
|
- if (StringUtils.isEmpty(cmSmalltype.getCrmIcon())) {
|
|
|
|
|
|
+ /*if (StringUtils.isEmpty(cmSmalltype.getCrmIcon())) {
|
|
model.addAttribute("errorMsg", "请上传小程序图标!");
|
|
model.addAttribute("errorMsg", "请上传小程序图标!");
|
|
return true;
|
|
return true;
|
|
- }
|
|
|
|
- if (StringUtils.isEmpty(cmSmalltype.getTypeSort())) {
|
|
|
|
- model.addAttribute("errorMsg", "请输入排序值!");
|
|
|
|
- return true;
|
|
|
|
- }
|
|
|
|
- if (Integer.parseInt(cmSmalltype.getTypeSort()) <= 0) {
|
|
|
|
|
|
+ }*/
|
|
|
|
+ if (null ==cmSmalltype.getSortIndex()) {
|
|
|
|
+ model.addAttribute("errorMsg", "请输入排序值!");
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (cmSmalltype.getSortIndex() <= 0) {
|
|
model.addAttribute("errorMsg", "排序值只能输入大于0的正整数!");
|
|
model.addAttribute("errorMsg", "排序值只能输入大于0的正整数!");
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
@@ -175,13 +194,14 @@ public class CmSmalltypeController extends BaseController {
|
|
* @param redirectAttributes
|
|
* @param redirectAttributes
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- @RequiresPermissions("product:cmSmalltype:delete")
|
|
|
|
@RequestMapping(value = "delete")
|
|
@RequestMapping(value = "delete")
|
|
public String delete(CmSmalltype cmSmalltype, RedirectAttributes redirectAttributes) {
|
|
public String delete(CmSmalltype cmSmalltype, RedirectAttributes redirectAttributes) {
|
|
cmSmalltypeService.delete(cmSmalltype);
|
|
cmSmalltypeService.delete(cmSmalltype);
|
|
- cleanRedisCache();
|
|
|
|
|
|
+ if (1 == cmSmalltype.getMallType()) {
|
|
|
|
+ cleanRedisCache();
|
|
|
|
+ }
|
|
addMessage(redirectAttributes, "删除小分类成功");
|
|
addMessage(redirectAttributes, "删除小分类成功");
|
|
- return "redirect:"+Global.getAdminPath()+"/product/cmSmalltype/?repage&bigTypeID="+cmSmalltype.getBigTypeID();
|
|
|
|
|
|
+ return "redirect:" + Global.getAdminPath() + "/product/cmSmalltype/?repage&bigTypeID=" + cmSmalltype.getBigTypeID() + "&mallType=" + cmSmalltype.getMallType();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|