|
@@ -101,11 +101,12 @@ public class UserCommonModuleServiceImpl extends ServiceImpl<UserCommonModuleMap
|
|
return httpRespMsg;
|
|
return httpRespMsg;
|
|
}
|
|
}
|
|
if(StringUtils.isBlank(moduleIds)){
|
|
if(StringUtils.isBlank(moduleIds)){
|
|
- httpRespMsg.setError("模块id不能为空");
|
|
|
|
- return httpRespMsg;
|
|
|
|
- }
|
|
|
|
- List<Integer> moduleIdList = Arrays.stream(moduleIds.split(",")).map(Integer::parseInt).collect(Collectors.toList());
|
|
|
|
- //是否已存在
|
|
|
|
|
|
+ userCommonModuleMapper.delete(new LambdaQueryWrapper<UserCommonModule>()
|
|
|
|
+ .eq(UserCommonModule::getUserId, user.getId())
|
|
|
|
+ );
|
|
|
|
+ }else{
|
|
|
|
+ List<Integer> moduleIdList = Arrays.stream(moduleIds.split(",")).map(Integer::parseInt).collect(Collectors.toList());
|
|
|
|
+ //是否已存在
|
|
// Integer count = userCommonModuleMapper.selectCount(new LambdaQueryWrapper<UserCommonModule>()
|
|
// Integer count = userCommonModuleMapper.selectCount(new LambdaQueryWrapper<UserCommonModule>()
|
|
// .in(UserCommonModule::getModuleId, moduleIdList)
|
|
// .in(UserCommonModule::getModuleId, moduleIdList)
|
|
// .eq(UserCommonModule::getUserId, user.getId())
|
|
// .eq(UserCommonModule::getUserId, user.getId())
|
|
@@ -114,38 +115,39 @@ public class UserCommonModuleServiceImpl extends ServiceImpl<UserCommonModuleMap
|
|
// httpRespMsg.setError("已存在选中的常用模块");
|
|
// httpRespMsg.setError("已存在选中的常用模块");
|
|
// return httpRespMsg;
|
|
// return httpRespMsg;
|
|
// }
|
|
// }
|
|
- //是否有权限
|
|
|
|
- Integer roleModuleCount = sysRoleModuleMapper.selectCount(new LambdaQueryWrapper<SysRoleModule>()
|
|
|
|
- .in(SysRoleModule::getModuleId, moduleIdList)
|
|
|
|
- .eq(SysRoleModule::getRoleId, user.getRoleId())
|
|
|
|
- );
|
|
|
|
- if(roleModuleCount < moduleIdList.size()){
|
|
|
|
- httpRespMsg.setError("无模块权限");
|
|
|
|
- return httpRespMsg;
|
|
|
|
- }
|
|
|
|
- //12-20 修改为删除覆盖逻辑
|
|
|
|
- //计算seq
|
|
|
|
|
|
+ //是否有权限
|
|
|
|
+ Integer roleModuleCount = sysRoleModuleMapper.selectCount(new LambdaQueryWrapper<SysRoleModule>()
|
|
|
|
+ .in(SysRoleModule::getModuleId, moduleIdList)
|
|
|
|
+ .eq(SysRoleModule::getRoleId, user.getRoleId())
|
|
|
|
+ );
|
|
|
|
+ if(roleModuleCount < moduleIdList.size()){
|
|
|
|
+ httpRespMsg.setError("无模块权限");
|
|
|
|
+ return httpRespMsg;
|
|
|
|
+ }
|
|
|
|
+ //12-20 修改为删除覆盖逻辑
|
|
|
|
+ //计算seq
|
|
// UserCommonModule lastModule = userCommonModuleMapper.selectOne(new LambdaQueryWrapper<UserCommonModule>()
|
|
// UserCommonModule lastModule = userCommonModuleMapper.selectOne(new LambdaQueryWrapper<UserCommonModule>()
|
|
// .eq(UserCommonModule::getUserId, user.getId())
|
|
// .eq(UserCommonModule::getUserId, user.getId())
|
|
// .orderByDesc(UserCommonModule::getSeq)
|
|
// .orderByDesc(UserCommonModule::getSeq)
|
|
// .last("limit 1")
|
|
// .last("limit 1")
|
|
// );
|
|
// );
|
|
// int index = null==lastModule?1:lastModule.getSeq()+1;
|
|
// int index = null==lastModule?1:lastModule.getSeq()+1;
|
|
- int index = 1;
|
|
|
|
- List<UserCommonModule> toAddList = new ArrayList<>();
|
|
|
|
- for (Integer moduleId : moduleIdList) {
|
|
|
|
- UserCommonModule entity = new UserCommonModule();
|
|
|
|
- entity.setModuleId(moduleId);
|
|
|
|
- entity.setUserId(user.getId());
|
|
|
|
- entity.setCompanyId(user.getCompanyId());
|
|
|
|
- entity.setSeq(index);
|
|
|
|
- toAddList.add(entity);
|
|
|
|
- index++;
|
|
|
|
|
|
+ int index = 1;
|
|
|
|
+ List<UserCommonModule> toAddList = new ArrayList<>();
|
|
|
|
+ for (Integer moduleId : moduleIdList) {
|
|
|
|
+ UserCommonModule entity = new UserCommonModule();
|
|
|
|
+ entity.setModuleId(moduleId);
|
|
|
|
+ entity.setUserId(user.getId());
|
|
|
|
+ entity.setCompanyId(user.getCompanyId());
|
|
|
|
+ entity.setSeq(index);
|
|
|
|
+ toAddList.add(entity);
|
|
|
|
+ index++;
|
|
|
|
+ }
|
|
|
|
+ userCommonModuleMapper.delete(new LambdaQueryWrapper<UserCommonModule>()
|
|
|
|
+ .eq(UserCommonModule::getUserId, user.getId())
|
|
|
|
+ );
|
|
|
|
+ userCommonModuleMapper.insertBatch(toAddList);
|
|
}
|
|
}
|
|
- userCommonModuleMapper.delete(new LambdaQueryWrapper<UserCommonModule>()
|
|
|
|
- .eq(UserCommonModule::getUserId, user.getId())
|
|
|
|
- );
|
|
|
|
- userCommonModuleMapper.insertBatch(toAddList);
|
|
|
|
return httpRespMsg;
|
|
return httpRespMsg;
|
|
}
|
|
}
|
|
|
|
|