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; }
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; }
public Integer getRoleTotalCount(int userId) { try { return roleDao.getRoleTotalCount(userId); } catch (Exception e) { e.printStackTrace(); } return -1; }
public Role getRoleById(Integer roleId) { try { return roleDao.getRoleById(roleId); } catch (Exception e) { e.printStackTrace(); } return null; }
public Role getRoleByName(Role role) { try { return roleDao.getRoleByName(role); } catch (Exception e) { e.printStackTrace(); } return null; }
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; }
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; }
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; }
public List<Func> findRoleFuncMapByUserId(User user) { return roleDao.findRoleFuncMapByUserId(user); }
public List<Role> findRolesAll(Role role) { return roleDao.findRolesAll(role); }
public Integer checkRoleName(Role role) { return roleDao.checkRoleName(role); }
public List<Role> findRolesAllByIsSuper(Integer userId) { return roleDao.findRolesAllByIsSuper(userId); }
public List<Func> getRoleFuncMapAllByRoleId(User user) { return roleDao.getRoleFuncMapAllByRoleId(user); }