コード例 #1
0
 @RequiresPermissions("biz:direct:view")
 @RequestMapping(value = "form")
 public String form(DirectBalanceHis directBalanceHis, Model model) {
   if (directBalanceHis.getDirect() != null && directBalanceHis.getDirect().getId() != null) {
     Direct direct = directService.get(directBalanceHis.getDirect().getId());
     directBalanceHis.setDirect(direct);
   }
   model.addAttribute("directBalanceHis", directBalanceHis);
   return "modules/biz/directBalanceHisForm";
 }
コード例 #2
0
 @RequiresPermissions("biz:direct:edit")
 @RequestMapping(value = {"list", ""})
 public String list(
     DirectBalanceHis directBalanceHis,
     HttpServletRequest request,
     HttpServletResponse response,
     Model model) {
   User user = UserUtils.getUser();
   if (!user.isAdmin()) {
     directBalanceHis.setCreateBy(user);
   }
   Page<DirectBalanceHis> page =
       directBalanceHisService.find(
           new Page<DirectBalanceHis>(request, response), directBalanceHis);
   if (directBalanceHis.getDirect() != null && directBalanceHis.getDirect().getId() != null) {
     Direct direct = directService.get(directBalanceHis.getDirect().getId());
     model.addAttribute("direct", direct);
   }
   model.addAttribute("page", page);
   return "modules/biz/directBalanceHisList";
 }
コード例 #3
0
 @RequiresPermissions("biz:direct:edit")
 @RequestMapping(value = "save")
 public String save(
     DirectBalanceHis directBalanceHis, Model model, RedirectAttributes redirectAttributes) {
   if (!beanValidator(model, directBalanceHis)) {
     return form(directBalanceHis, model);
   }
   if (directBalanceHis.getDirect() != null && directBalanceHis.getDirect().getId() != null) {
     Direct direct = directService.get(directBalanceHis.getDirect().getId());
     directBalanceHis.setDirect(direct);
     directBalanceHis.setBegin(direct.getBalance());
     direct.setBalance(direct.getBalance() + directBalanceHis.getAmount());
     directBalanceHis.setEnd(direct.getBalance());
   }
   directBalanceHis.setStatus("0");
   directBalanceHisService.save(directBalanceHis);
   addMessage(redirectAttributes, "保存余额成功");
   return "redirect:"
       + Global.getAdminPath()
       + "/biz/directBalanceHis/list?direct.id="
       + directBalanceHis.getDirect().getId();
 }