Esempio n. 1
0
 // @RequiresPermissions("gen:genTable:edit")
 @RequestMapping(value = "save")
 public String save(GenTable genTable, Model model, RedirectAttributes redirectAttributes) {
   if (!beanValidator(model, genTable)) {
     return form(genTable, model);
   }
   // 验证表是否已经存在
   if (StringUtils.isBlank(genTable.getId())
       && !genTableService.checkTableName(genTable.getName())) {
     addMessage(model, "保存失败!" + genTable.getName() + " 表已经存在!");
     genTable.setName("");
     return form(genTable, model);
   }
   genTableService.save(genTable);
   addMessage(redirectAttributes, "保存业务表'" + genTable.getName() + "'成功");
   return "redirect:" + adminPath + "/gen/genTable/?repage";
 }
Esempio n. 2
0
 @ModelAttribute
 public GenTable get(@RequestParam(required = false) Long id) {
   if (StringUtils.isNotBlank(id)) {
     return genTableService.get(id);
   } else {
     return new GenTable();
   }
 }
Esempio n. 3
0
 // @RequiresPermissions("gen:genTable:view")
 @RequestMapping(value = "form")
 public String form(GenTable genTable, Model model) {
   // 获取物理表列表
   List<GenTable> tableList = genTableService.findTableListFormDb(new GenTable());
   model.addAttribute("tableList", tableList);
   // 验证表是否存在
   if (StringUtils.isBlank(genTable.getId())
       && !genTableService.checkTableName(genTable.getName())) {
     addMessage(model, "下一步失败!" + genTable.getName() + " 表已经添加!");
     genTable.setName("");
   }
   // 获取物理表字段
   else {
     genTable = genTableService.getTableFormDb(genTable);
   }
   model.addAttribute("genTable", genTable);
   model.addAttribute("config", GenUtils.getConfig());
   return "admin/gen/genTableForm";
 }
Esempio n. 4
0
 // @RequiresPermissions("gen:genTable:view")
 @RequestMapping(value = {"list", ""})
 public String list(@PageableDefault Pageable pageable, GenTable genTable, Model model) {
   UserToken user = UserUtils.getUserToken();
   if (!user.isAdmin()) {
     genTable.setCreatedBy(user);
   }
   Page<GenTable> page = genTableService.find(genTable, pageable);
   model.addAttribute("page", page);
   return "admin/gen/genTableList";
 }
Esempio n. 5
0
 // @RequiresPermissions("gen:genTable:edit")
 @RequestMapping(value = "delete")
 public String delete(GenTable genTable, RedirectAttributes redirectAttributes) {
   genTableService.delete(genTable);
   addMessage(redirectAttributes, "删除业务表成功");
   return "redirect:" + adminPath + "/gen/genTable/?repage";
 }