Beispiel #1
0
 @RequiresPermissions("sys:dict:view")
 @RequestMapping(value = {"list", ""})
 public String list(
     Dict dict, HttpServletRequest request, HttpServletResponse response, Model model) {
   List<String> typeList = dictService.findTypeList();
   model.addAttribute("typeList", typeList);
   Page<Dict> page = dictService.find(new Page<Dict>(request, response), dict);
   model.addAttribute("page", page);
   return "modules/sys/dictList";
 }
Beispiel #2
0
 @ModelAttribute
 public Dict get(@RequestParam(required = false) String id) {
   if (StringUtils.isNotBlank(id)) {
     return dictService.get(id);
   } else {
     return new Dict();
   }
 }
Beispiel #3
0
 @RequiresPermissions("sys:dict:edit")
 @RequestMapping(value = "delete")
 public String delete(String id, RedirectAttributes redirectAttributes) {
   if (Global.isDemoMode()) {
     addMessage(redirectAttributes, "演示模式,不允许操作!");
     return "redirect:" + Global.getAdminPath() + "/sys/dict/?repage";
   }
   dictService.delete(id);
   addMessage(redirectAttributes, "删除字典成功");
   return "redirect:" + Global.getAdminPath() + "/sys/dict/?repage";
 }
Beispiel #4
0
 @RequiresPermissions("sys:dict:edit")
 @RequestMapping(value = "save") // @Valid
 public String save(
     Dict dict, HttpServletRequest request, Model model, RedirectAttributes redirectAttributes) {
   if (Global.isDemoMode()) {
     addMessage(redirectAttributes, "演示模式,不允许操作!");
     return "redirect:" + Global.getAdminPath() + "/sys/dict/?repage&type=" + dict.getType();
   }
   if (!beanValidator(model, dict)) {
     return form(dict, model);
   }
   dictService.save(dict);
   addMessage(redirectAttributes, "保存字典'" + dict.getLabel() + "'成功");
   return "redirect:" + Global.getAdminPath() + "/sys/dict/?repage&type=" + dict.getType();
 }