fix 修复 授权角色空数据问题

This commit is contained in:
疯狂的狮子li 2021-07-26 10:52:31 +08:00
parent 90d4fd8cf1
commit b7f6f73342
1 changed files with 6 additions and 2 deletions

View File

@ -364,6 +364,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
@Override
public int insertAuthUsers(Long roleId, Long[] userIds) {
// 新增用户与角色管理
int rows = 1;
List<SysUserRole> list = new ArrayList<SysUserRole>();
for (Long userId : userIds) {
SysUserRole ur = new SysUserRole();
@ -371,6 +372,9 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
ur.setRoleId(roleId);
list.add(ur);
}
return userRoleMapper.insertAll(list);
if (list.size() > 0) {
rows = userRoleMapper.insertAll(list);
}
return rows;
}
}