public void addRole(Role role, List<Integer> selectedActions) { role.setRoleName(stringSplitter.splitter(role.getRoleName(), 30)); role.setDescription(stringSplitter.splitter(role.getDescription(), 30)); roleMapper.addRole(role); role.setSelectedActionList(selectedActions); roleMapper.addRoleActions(role); }
public Role validateUpdateRole(String roleName, String roleNote, int id) { Role role = null; String roleOldName = roleDaoImpl.getRole(id).getRoleName(); long count = roleDaoImpl.getCountWithName(roleName); if (count > 0 && !roleOldName.equals(roleName)) { // 重复、不能通过 role = new Role(roleOldName, roleNote); role.setRoleId(id); } return role; }
public void addRole(String roleName, String roleNote, String[] rolePermissions) { Role role = new Role(roleName, roleNote); roleDaoImpl.addRole(role); int permissionID = -1; for (String permissionId : rolePermissions) { permissionID = Integer.parseInt(permissionId); rolePermissionDaoImpl.addRolePermission(role.getRoleId(), permissionID); } }