角色删除
This commit is contained in:
@@ -25,6 +25,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.njzscloud.common.security.contant.Constants.ROLE_ADMIN;
|
||||
|
||||
/**
|
||||
* 角色表
|
||||
*/
|
||||
@@ -85,6 +87,8 @@ public class SysRoleService extends ServiceImpl<SysRoleMapper, SysRoleEntity> im
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void del(List<Long> ids) {
|
||||
List<SysRoleEntity> list = this.listByIds(ids);
|
||||
Assert.isFalse(list.stream().anyMatch(it -> it.getRoleCode().equals(ROLE_ADMIN)), () -> Exceptions.exception("当前角色不允许删除"));
|
||||
this.removeBatchByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user