private Page<Article> joinUserPage(Page<Article> page) { userService.join(page, "user_id"); return page; }
public static final boolean hasRole(long userId, String roleFlag) { RoleService roleService = Jboot.bean(RoleService.class); return roleService.hasRole(userId, roleFlag); }
public void doMenuSave() { Menu menu = getModel(Menu.class); ms.saveOrUpdate(menu); redirect("/admin/template/menu"); }
private boolean exeOtherAction(User user) { String action = getPara("action", "base"); if ("utm".equals(action)) { Page<Utm> page = utmService._paginateByUserId(getPagePara(), 20, user.getId()); setAttr("page", page); } if ("role".equals(action)) { //不是超级管理员,不让修改用户角色 if (permissionService.hasPermission(getLoginedUser().getId(), USER_ROLE_EDIT_ACTION) == false) { renderErrorForNoPermission(); return false; } List<Role> roles = roleService.findAll(); setAttr("roles", roles); } return true; }
public void detail() { Long uid = getParaToLong(); User user = userService.findById(uid); setAttr("user", user); exeOtherAction(user); if (exeOtherAction(user)) { render(getRenderHtml()); } }
@AdminMenu(text = "用户管理", groupId = JPressConsts.SYSTEM_MENU_USER, order = 0) public void index() { Page<User> page = userService._paginate(getPagePara(), 10, getPara("username"), getPara("email"), getPara("status")); int lockedCount = userService.findCountByStatus(User.STATUS_LOCK); int regCount = userService.findCountByStatus(User.STATUS_REG); int okCount = userService.findCountByStatus(User.STATUS_OK); setAttr("lockedCount", lockedCount); setAttr("regCount", regCount); setAttr("okCount", okCount); setAttr("totalCount", lockedCount + regCount + okCount); setAttr("page", page); List<Role> roles = roleService.findAll(); setAttr("roles", roles); render("user/list.html"); }
public void browse() { Page<Attachment> page = as._paginate(getPagePara(), 10, getPara("title")); setAttr("page", page); render("attachment/browse.html"); }
public void doReplySave() { WechatReply reply = getBean(WechatReply.class, ""); replyService.saveOrUpdate(reply); redirect("/admin/wechat/keyword"); }
public void doMenuSave() { WechatMenu menu = getModel(WechatMenu.class, "menu"); wechatMenuService.saveOrUpdate(menu); redirect("/admin/wechat/menu"); }
public void replyWrite() { int id = getParaToInt(0, 0); if (id > 0) { WechatReply wechatReply = replyService.findById(id); setAttr("reply", wechatReply); } render("wechat/reply_write.html"); }
public void doUpdate() { Attachment attachment = getBean(Attachment.class); as.saveOrUpdate(attachment); renderJson(Ret.ok()); }
@AdminMenu(text = "角色", groupId = JPressConsts.SYSTEM_MENU_USER, order = 5) public void role() { List<Role> roles = roleService.findAll(); setAttr("roles", roles); render("user/role.html"); }
/** * 删除角色 */ public void doRoleDel() { roleService.deleteById(getIdPara()); renderJson(Ret.ok()); }
public void doMenuDel() { int id = getParaToInt(0, 0); if (id == 0) { renderError(404); return; } ms.deleteById(id); renderJson(Ret.ok()); }
@AdminMenu(text = "自动回复", groupId = JPressConsts.SYSTEM_MENU_WECHAT_PUBULIC_ACCOUNT, order = 2) public void keyword() { Page<WechatReply> page = replyService._paginate(getPagePara(), 10, getPara("keyword"), getPara("content")); setAttr("page", page); render("wechat/reply_list.html"); }
@Override public Page<Article> paginate(int page, int pagesize) { Page<Article> articlePage = DAO.paginate(page, pagesize, "id desc"); userService.join(articlePage, "user_id"); return articlePage; }
@AdminMenu(text = "所有附件", groupId = JPressConsts.SYSTEM_MENU_ATTACHMENT, order = 0) public void index() { Page<Attachment> page = as._paginate(getPagePara(), 15, getPara("title")); setAttr("page", page); render("attachment/list.html"); }
public static final boolean hasRole(long userId, long roleId) { RoleService roleService = Jboot.bean(RoleService.class); return roleService.hasRole(userId, roleId); }
@Override public Page<ArticleComment> paginate(int page, int pageSize) { Page p = super.paginate(page, pageSize); articleService.join(p, "article_id"); userService.join(p, "user_id"); return p; }