예제 #1
0
  public Integer saveRole(Role role) {
    try {
      int ret = -101;
      if (roleDao.checkRoleName(role) <= 0) {

        ret = roleDao.saveRole(role);
      }
      return ret;
    } catch (Exception e) {
      e.printStackTrace();
    }
    return -1;
  }
예제 #2
0
 public String updateRoleFuncMapByRoleIdOrFuncId(List<RoleFuncMap> rfms, Integer roleId) {
   String result = "修改失败";
   try {
     if (roleDao.deleteRoleFuncMapByRoleIds(roleId) != -1) {
       for (RoleFuncMap rfm : rfms) {
         roleDao.saveRoleFuncMap(rfm);
       }
     }
     return "2";
   } catch (Exception e) {
     e.printStackTrace();
     // result+=e.toString();
   }
   return result;
 }
예제 #3
0
 public Integer getRoleTotalCount(int userId) {
   try {
     return roleDao.getRoleTotalCount(userId);
   } catch (Exception e) {
     e.printStackTrace();
   }
   return -1;
 }
예제 #4
0
  public Role getRoleById(Integer roleId) {

    try {
      return roleDao.getRoleById(roleId);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return null;
  }
예제 #5
0
  public Role getRoleByName(Role role) {

    try {
      return roleDao.getRoleByName(role);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return null;
  }
예제 #6
0
  public String deleteRoleByIds(String roleIds) {
    String result = "";
    try {
      // 先删除该角色所有权限
      String[] ids = roleIds.split(",");
      int size = ids.length;
      for (int i = 0; i < size; i++) {
        int roleId = Integer.parseInt(ids[i]);
        if (roleDao.deleteRoleFuncMapByRoleIds(roleId) != -1) {
          roleDao.deleteRoleByIds(roleId);
        }
      }
      return "1";

    } catch (Exception e) {
      e.printStackTrace();
      result = e.toString();
    }
    return result;
  }
예제 #7
0
 public String saveRoleFuncMap(List<RoleFuncMap> rfms) {
   String result = "添加失败";
   try {
     for (RoleFuncMap rfm : rfms) {
       roleDao.saveRoleFuncMap(rfm);
     }
     return "1";
   } catch (Exception e) {
     e.printStackTrace();
   }
   return result;
 }
예제 #8
0
  public Integer updateRole(Role role) {

    try {
      // if(roleDao.checkRoleName(role)<=0){

      int ret = roleDao.updateRole(role);
      // }
      return ret;
    } catch (Exception e) {
      e.printStackTrace();
    }
    return -1;
  }
예제 #9
0
  public List<Func> findRoleFuncMapByUserId(User user) {

    return roleDao.findRoleFuncMapByUserId(user);
  }
예제 #10
0
  public List<Role> findRolesAll(Role role) {

    return roleDao.findRolesAll(role);
  }
예제 #11
0
  public Integer checkRoleName(Role role) {

    return roleDao.checkRoleName(role);
  }
예제 #12
0
  public List<Role> findRolesAllByIsSuper(Integer userId) {

    return roleDao.findRolesAllByIsSuper(userId);
  }
예제 #13
0
  public List<Func> getRoleFuncMapAllByRoleId(User user) {

    return roleDao.getRoleFuncMapAllByRoleId(user);
  }