Exemplo n.º 1
0
  public String authorized() {
    User user = userService.findUserById(userid);

    if (user == null) {
      ret.put("retCode", "1001");
      ret.put("retMSG", "该用户不存在");
      return "success";
    }

    Permission per = permissionService.findPermissionById(permissionid);

    if (per == null) {
      ret.put("retCode", "1001");
      ret.put("retMSG", "该权限不存在");
      return "success";
    }

    if (Utils.authorized(user.getAuthorization(), per.getValue())) {
      ret.put("retCode", "1000");
      ret.put("retMSG", "有权限操作");
      return "success";
    } else {
      ret.put("retCode", "1001");
      ret.put("retMSG", "没有权限操作");
      return "success";
    }
  }
Exemplo n.º 2
0
 @Override
 public List<MonitorTask> findAllMonitorTasks(
     Integer pageIndex, Integer pageSize, Map<String, Object> map) {
   String queryString = " where s.del = 0 ";
   queryString = Utils.getQueryString(queryString, map);
   queryString = queryString + " order by time desc";
   return MonitorTaskDao.findByHql(" from MonitorTask s" + queryString, map, pageSize, pageIndex);
 }
Exemplo n.º 3
0
 @Override
 public Long findMonitorTaskPages(Integer pageSize, Map<String, Object> map) {
   String queryString = " where s.del = 0  ";
   queryString = Utils.getQueryString(queryString, map);
   String hql = "select count(*) from MonitorTask s" + queryString;
   Long pages = MonitorTaskDao.count(hql, map);
   if (pages % pageSize != 0) {
     pages = pages / pageSize + 1;
   } else {
     pages = pages / pageSize;
   }
   return pages;
 }