mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-09-17 19:06:39 +08:00
issues-I9RU4S
This commit is contained in:
parent
3c4e683ff0
commit
721535c69a
@ -60,6 +60,16 @@ public class EmployeeManager extends ServiceImpl<EmployeeDao, EmployeeEntity> {
|
|||||||
// 保存员工 获得id
|
// 保存员工 获得id
|
||||||
employeeDao.updateById(employee);
|
employeeDao.updateById(employee);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ISSUES:I9RU4S (对员工赋角色后,不能取消员工的角色,只能修改员工角色)
|
||||||
|
* https://gitee.com/lab1024/smart-admin/issues/I9RU4S
|
||||||
|
* 问题:如果员工的角色仅剩一个,则不能删除
|
||||||
|
* 解决:如果roleIdList.size() == 0 即 roleIdList.isEmpty() 则删除当前员工下的所有角色
|
||||||
|
*/
|
||||||
|
if (roleIdList.isEmpty()) {
|
||||||
|
this.updateEmployeeRole(employee.getEmployeeId(), null);
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user