Skip to content

Commit

Permalink
fix: 添加null的角色
Browse files Browse the repository at this point in the history
  • Loading branch information
oddfar committed Feb 21, 2024
1 parent 798bc3a commit 2ea91d7
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,12 @@ public void insertUserRole(Long userId, Long[] roleIds) {
// 新增用户与角色管理
List<SysUserRoleEntity> list = new ArrayList<SysUserRoleEntity>(roleIds.length);
for (Long roleId : roleIds) {
SysUserRoleEntity ur = new SysUserRoleEntity();
ur.setUserId(userId);
ur.setRoleId(roleId);
list.add(ur);
if (roleId != null) {
SysUserRoleEntity ur = new SysUserRoleEntity();
ur.setUserId(userId);
ur.setRoleId(roleId);
list.add(ur);
}
}
userRoleMapper.insertBatch(list);
}
Expand Down

0 comments on commit 2ea91d7

Please sign in to comment.