| | |
| | | * @param roleIds 选择的角色id集合 |
| | | * @return 插入用户与角色关联记录数量 |
| | | */ |
| | | public int setRoles(String userId, String[] roleIds) { |
| | | this.urDao.deleteByUserId(Long.parseLong(userId)); |
| | | public int setRoles(Long userId, String[] roleIds) { |
| | | this.urDao.deleteByUserId(userId); |
| | | int count = 0; |
| | | if (roleIds != null && roleIds.length > 0) { |
| | | for (String roleId : roleIds) { |
| | | count += this.urDao.insertSelective(new BaUserRole(Long.parseLong(userId), Long.parseLong(roleId))); |
| | | count += this.urDao.insertSelective(new BaUserRole(userId, Long.parseLong(roleId))); |
| | | } |
| | | } |
| | | return count; |