issues-I9RU4S

This commit is contained in:
sunl19ht 2024-05-24 16:02:02 +08:00
parent 721535c69a
commit 6a8029235d

View File

@ -64,13 +64,11 @@ public class EmployeeManager extends ServiceImpl<EmployeeDao, EmployeeEntity> {
* ISSUES:I9RU4S (对员工赋角色后不能取消员工的角色只能修改员工角色) * ISSUES:I9RU4S (对员工赋角色后不能取消员工的角色只能修改员工角色)
* https://gitee.com/lab1024/smart-admin/issues/I9RU4S * https://gitee.com/lab1024/smart-admin/issues/I9RU4S
* 问题如果员工的角色仅剩一个则不能删除 * 问题如果员工的角色仅剩一个则不能删除
* 解决如果roleIdList.size() == 0 roleIdList.isEmpty() 则删除当前员工下的所有角色 * 解决如果roleIdList为空则删除该员工所有角色
*/ */
if (roleIdList.isEmpty()) { if (CollectionUtils.isEmpty(roleIdList)) {
this.updateEmployeeRole(employee.getEmployeeId(), null); this.updateEmployeeRole(employee.getEmployeeId(), null);
} } else if(CollectionUtils.isNotEmpty(roleIdList)) {
if (CollectionUtils.isNotEmpty(roleIdList)) {
List<RoleEmployeeEntity> roleEmployeeList = roleIdList.stream().map(e -> new RoleEmployeeEntity(e, employee.getEmployeeId())).collect(Collectors.toList()); List<RoleEmployeeEntity> roleEmployeeList = roleIdList.stream().map(e -> new RoleEmployeeEntity(e, employee.getEmployeeId())).collect(Collectors.toList());
this.updateEmployeeRole(employee.getEmployeeId(), roleEmployeeList); this.updateEmployeeRole(employee.getEmployeeId(), roleEmployeeList);
} }