Esempio n. 1
0
  /*
   * 锁定菜谱
   */
  @RequestMapping("/disable")
  public String disable(String userId) {

    User user = userService.findById(Long.parseLong(userId));
    user.setDeleted(1);
    userService.update(user);

    return "redirect:list";
  }
Esempio n. 2
0
 @RequestMapping("/query")
 public String query(@ModelAttribute User user, Integer pageNum, Model model) {
   pageNum = pageNum == null || pageNum == 0 ? 1 : pageNum;
   QueryHelper queryHelper =
       new QueryHelper(User.class, "u")
           .addWhereCondition(
               user.getUsername() != null && !"".equals(user.getUsername()),
               "u.username like '%" + user.getUsername() + "%'")
           .addWhereCondition(
               user.getRealName() != null && !"".equals(user.getRealName()),
               "u.realName like '%" + user.getRealName() + "%'")
           .addOrderByProperty("createDate", true);
   Page page = userService.getPage(pageNum, queryHelper);
   // Page page = cookbookService.getPage(pageNum, list);
   model.addAttribute("page", page);
   return "admin/user/list";
 }