示例#1
0
 /**
  * 查询子站点
  *
  * @return
  */
 public String authSon() {
   try {
     List<Site> list = null;
     // 提取子站点
     list = siteService.selectByParId(root);
     // 生成树
     StringBuilder stringBuilder = new StringBuilder();
     stringBuilder.append("[");
     if (list != null && list.size() > 0) {
       for (int i = 0; i < list.size(); i++) {
         if (site != null
             && site.getId() != null
             && site.getId().trim().length() > 0
             && site.getId().equals(list.get(i).getId())) {
           continue;
         }
         if (!"[".equals(stringBuilder.toString())) {
           stringBuilder.append(",");
         }
         stringBuilder.append("{ \"text\": \"<a  onclick=");
         if (onclick != null && onclick.trim().length() > 0) {
           stringBuilder.append(onclick);
         } else {
           stringBuilder.append("showDetail");
         }
         stringBuilder.append("('");
         stringBuilder.append(list.get(i).getId());
         stringBuilder.append(
             "','"
                 + list.get(i).getName().replaceAll(" ", "")
                 + "','"
                 + (site != null && site.getId() != null ? site.getId() : "")
                 + "')>");
         stringBuilder.append(list.get(i).getName());
         // 判断是否有权限
         if (role != null
             && role.getId().trim().length() > 0
             && roleSiteService.have(list.get(i).getId(), role.getId())) {
           stringBuilder.append(" ★");
         }
         stringBuilder.append("\", \"hasChildren\": ");
         if (siteService.hasChildren(list.get(i).getId())) {
           stringBuilder.append("true");
         } else {
           stringBuilder.append("false");
         }
         stringBuilder.append(",\"id\":\"");
         stringBuilder.append(list.get(i).getId());
         stringBuilder.append("\" }");
       }
     }
     stringBuilder.append("]");
     ResponseUtil.writeUTF(getHttpResponse(), stringBuilder.toString());
   } catch (Exception e) {
     e.printStackTrace();
   }
   return null;
 }
示例#2
0
 /**
  * 查询子站点
  *
  * @return
  */
 public String checkSon() {
   try {
     List<Site> list = null;
     // 提取子站点
     list = siteService.selectByParId(root);
     // 生成树
     StringBuilder stringBuilder = new StringBuilder();
     stringBuilder.append("[");
     if (list != null && list.size() > 0) {
       for (int i = 0; i < list.size(); i++) {
         if (site != null
             && site.getId() != null
             && site.getId().trim().length() > 0
             && site.getId().equals(list.get(i).getId())) {
           continue;
         }
         if (!"[".equals(stringBuilder.toString())) {
           stringBuilder.append(",");
         }
         stringBuilder.append("{ \"text\": \"<input onclick='siteCheck(this)' type=checkbox ");
         if (sites != null
             && sites.trim().length() > 0
             && sites.indexOf(list.get(i).getId() + ";") > -1) {
           stringBuilder.append("checked");
         }
         stringBuilder.append(
             " name=sites value=" + list.get(i).getId() + " show=" + list.get(i).getName() + ">");
         stringBuilder.append(list.get(i).getName());
         stringBuilder.append("\", \"hasChildren\": ");
         if (siteService.hasChildren(list.get(i).getId())) {
           stringBuilder.append("true");
         } else {
           stringBuilder.append("false");
         }
         stringBuilder.append(",\"id\":\"");
         stringBuilder.append(list.get(i).getId());
         stringBuilder.append("\" }");
       }
     }
     stringBuilder.append("]");
     ResponseUtil.writeUTF(getHttpResponse(), stringBuilder.toString());
   } catch (Exception e) {
     e.printStackTrace();
   }
   return null;
 }
示例#3
0
 /**
  * 查询站点列表(树结构使用)
  *
  * @return
  */
 public String site() {
   if (isAdminLogin()) {
     // 提取一级站点
     siteList = siteService.selectByParId("");
   } else {
     // 普通用户只提取有自己有权限的站点
     siteList = siteService.selectByRoles(getLoginRoleIdsSql());
   }
   if ("select".equals(type)) {
     return "siteSelect";
   } else if ("selectPar".equals(type)) {
     return "siteSelectPar";
   } else if ("siteSelectPage".equals(type)) {
     return "siteSelectPage";
   }
   return "site";
 }
示例#4
0
 /**
  * 多项选择站点
  *
  * @return
  */
 public String siteCheck() {
   if (isAdminLogin()) {
     // 查询一级站点
     siteList = siteService.selectByParId("");
   } else {
     // 非管理员只查询有权限的站点
     siteList = siteService.selectByRoles(getLoginRoleIdsSql());
   }
   if (siteList != null && siteList.size() > 0) {
     if (role != null) {
       for (int i = 0; i < siteList.size(); i++) {
         if (roleSiteService.have(siteList.get(i).getId(), role.getId())) {
           siteList.get(i).setHaveSiteRole("1");
         }
       }
     }
   }
   return "siteCheck";
 }
示例#5
0
 /**
  * 授权页面
  *
  * @return
  */
 public String auth() {
   // 如果是管理员登录则提取一级站点
   if (isAdminLogin()) {
     siteList = siteService.selectByParId("");
   } else {
     // 普通用户只提取有自己有权限的站点
     siteList = siteService.selectByRoles(getLoginRoleIdsSql());
   }
   // 设置、
   if (siteList != null && siteList.size() > 0) {
     if (role != null) {
       for (int i = 0; i < siteList.size(); i++) {
         if (roleSiteService.have(siteList.get(i).getId(), role.getId())) {
           siteList.get(i).setHaveSiteRole(" <font color='blue'>★</font>");
         }
       }
     }
   }
   return "auth";
 }