예제 #1
0
 @RequestMapping("/authDataList")
 public void authDataList(HttpServletRequest request, HttpServletResponse response) {
   Map<String, Object> map = new HashMap<String, Object>();
   map.put("code", ServletRequestUtils.getStringParameter(request, "code", "").trim());
   map.put("name", ServletRequestUtils.getStringParameter(request, "name", "").trim());
   map.put("authType", ServletRequestUtils.getStringParameter(request, "authType", "").trim());
   map.put("isvalid", Constants.ISVALIAD_SHOW);
   String menuCode = ServletRequestUtils.getStringParameter(request, "menuCode", "").trim();
   List<String> menuIds = new ArrayList<String>();
   List<Menu> menuList = menuBusiness.findListByCode(menuCode);
   for (Menu menu : menuList) {
     menuIds.add(menu.getId().toString());
   }
   if (menuIds.size() > 0) {
     map.put("menuIds", menuIds);
   }
   Page<Auth> page = PageUtil.getPageObj(request);
   page = authBusiness.queryPage(map, page);
   List<Auth> authList = new ArrayList<Auth>();
   for (Auth auth : page.getResult()) {
     auth.setFullName(authBusiness.getFullParentName(auth.getId()));
     authList.add(auth);
   }
   page.setResult(authList);
   // 设置页面数据
   Map<String, Object> jsonMap = new HashMap<String, Object>();
   jsonMap.put("total", page.getTotalCount());
   jsonMap.put("rows", page.getResult());
   HtmlUtil.writerJson(response, jsonMap);
 }
예제 #2
0
 @RequestMapping("/getAuthIdsByRole")
 public void getAuthIdsByRole(String id, HttpServletResponse response) {
   List<String> authIds = new ArrayList<String>();
   List<Auth> authList = authBusiness.findAuthByRole(id);
   for (Auth auth : authList) {
     authIds.add(auth.getId());
   }
   HtmlUtil.writerJson(response, authIds);
 }
예제 #3
0
  @RequestMapping("/viewAuth")
  public void viewAuth(HttpServletRequest request, HttpServletResponse response) {
    String roleId = ServletRequestUtils.getStringParameter(request, "roleId", "");
    Role role = roleBusiness.findRoleById(roleId);
    List<Auth> findList = null;
    if (role.getCode().equals(Constants.ROLE_ADMIN_CODE)) {
      Map<String, Object> map = new HashMap<String, Object>();
      map.put("status", Constants.STATUS_DEFAULT);
      findList = authBusiness.findListBy(map);
    } else {
      findList = roleBusiness.findAuthByRole(roleId);
    }
    List<Auth> authList = new ArrayList<Auth>();
    for (Auth auth : findList) {
      auth.setFullName(authBusiness.getFullParentName(auth.getId()));
      authList.add(auth);
    }

    // 设置页面数据
    Map<String, Object> jsonMap = new HashMap<String, Object>();
    jsonMap.put("rows", authList);
    HtmlUtil.writerJson(response, jsonMap);
  }