|
@@ -577,7 +577,10 @@ public class SysDeptController {
|
|
}
|
|
}
|
|
// 企业类型
|
|
// 企业类型
|
|
if (record.getLevel() != null) {
|
|
if (record.getLevel() != null) {
|
|
- record.setLevelName(Objects.requireNonNull(DeptLevelEnum.getEnumByVal(record.getLevel())).getName());
|
|
|
|
|
|
+ DeptLevelEnum enumByVal = DeptLevelEnum.getEnumByVal(record.getLevel());
|
|
|
|
+ if (enumByVal != null) {
|
|
|
|
+ record.setLevelName(enumByVal.getName());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
// 上级企业
|
|
// 上级企业
|
|
List<SysDeptRelation> deptRelations = sysDeptRelationMapper.selectList(Wrappers.<SysDeptRelation>lambdaQuery()
|
|
List<SysDeptRelation> deptRelations = sysDeptRelationMapper.selectList(Wrappers.<SysDeptRelation>lambdaQuery()
|
|
@@ -623,17 +626,19 @@ public class SysDeptController {
|
|
return R.failed("deptIds必填");
|
|
return R.failed("deptIds必填");
|
|
}
|
|
}
|
|
|
|
|
|
- Map<Integer, SysDeptCsm> deptCsmMap = new HashMap<>();
|
|
|
|
- List<SysDeptCsm> sysDeptCsms = sysDeptCsmMapper.listDistinctUserCsm(cmsUserIds);
|
|
|
|
- if (CollUtil.isNotEmpty(sysDeptCsms)) {
|
|
|
|
- deptCsmMap.putAll(sysDeptCsms.stream().collect(Collectors.toMap(SysDeptCsm::getUserId, Function.identity())));
|
|
|
|
- }
|
|
|
|
|
|
|
|
// 删除关联关系
|
|
// 删除关联关系
|
|
sysDeptCsmMapper.delete(Wrappers.<SysDeptCsm>lambdaUpdate()
|
|
sysDeptCsmMapper.delete(Wrappers.<SysDeptCsm>lambdaUpdate()
|
|
.in(SysDeptCsm::getDeptId, deptIds));
|
|
.in(SysDeptCsm::getDeptId, deptIds));
|
|
|
|
|
|
if (CollUtil.isNotEmpty(cmsUserIds)) {
|
|
if (CollUtil.isNotEmpty(cmsUserIds)) {
|
|
|
|
+ // 查询已有的csm的配置信息, 用于复制到新增的数据
|
|
|
|
+ Map<Integer, SysDeptCsm> deptCsmMap = new HashMap<>();
|
|
|
|
+ List<SysDeptCsm> sysDeptCsms = sysDeptCsmMapper.listDistinctUserCsm(cmsUserIds);
|
|
|
|
+ if (CollUtil.isNotEmpty(sysDeptCsms)) {
|
|
|
|
+ deptCsmMap.putAll(sysDeptCsms.stream().collect(Collectors.toMap(SysDeptCsm::getUserId, Function.identity())));
|
|
|
|
+ }
|
|
|
|
+
|
|
// 建立关联关系
|
|
// 建立关联关系
|
|
deptIds.forEach(deptId -> {
|
|
deptIds.forEach(deptId -> {
|
|
cmsUserIds.forEach(userId -> {
|
|
cmsUserIds.forEach(userId -> {
|