示例#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);
  }