角色删除
parent
2b82a0911a
commit
d0a871cd40
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue