|
@@ -223,7 +223,19 @@ public class UStandardInfoServiceImpl extends ServiceImpl<StandardInfoMapper, St
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Boolean setElementJoin(List<StandardInfoPrivateJoinVO> standardInfoPrivateJoins) {
|
|
|
+ public Boolean setElementJoin(List<StandardInfoPrivateJoinVO> standardInfoPrivateJoins, Long id) {
|
|
|
+ List<StandardInfo> standardInfoIds = baseMapper.selectList(Wrappers.<StandardInfo>lambdaQuery()
|
|
|
+ .eq(StandardInfo::getStandardId, id)
|
|
|
+ .eq(StandardInfo::getIsDeleted, 0));
|
|
|
+ if(CollectionUtil.isEmpty(standardInfoIds)){
|
|
|
+ throw new ServiceException("未查询到规范文件的信息");
|
|
|
+ }
|
|
|
+ List<Long> collect = standardInfoIds.stream().map(StandardInfo::getId).collect(Collectors.toList());
|
|
|
+ //删除当前规范文件下的条件设置
|
|
|
+ standardInfoPrivateJoinService.remove(Wrappers.<StandardInfoPrivateJoin>lambdaQuery()
|
|
|
+ .in(StandardInfoPrivateJoin::getStandardInfoId, collect));
|
|
|
+
|
|
|
+
|
|
|
BladeUser user = SecureUtil.getUser();
|
|
|
List<StandardInfoPrivateJoin> saveData = new ArrayList<>();
|
|
|
List<Long> leftIds = new ArrayList<>();
|
|
@@ -252,10 +264,6 @@ public class UStandardInfoServiceImpl extends ServiceImpl<StandardInfoMapper, St
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- //删除之前的关联关系
|
|
|
- standardInfoPrivateJoinService.remove(Wrappers.<StandardInfoPrivateJoin>lambdaQuery()
|
|
|
- .in(StandardInfoPrivateJoin::getStandardInfoId, leftIds));
|
|
|
-
|
|
|
return standardInfoPrivateJoinService.saveOrUpdateBatch(saveData);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -325,52 +333,6 @@ public class UStandardInfoServiceImpl extends ServiceImpl<StandardInfoMapper, St
|
|
|
List<Long> collect = Arrays.stream(ids.split(",")).map(Long::parseLong).collect(Collectors.toList());
|
|
|
return baseMapper.effectPreview(collect);
|
|
|
}
|
|
|
-
|
|
|
- @Override
|
|
|
- @Transactional
|
|
|
- public Boolean editConditionSet(List<StandardInfoVO> standardInfoJoins) {
|
|
|
- BladeUser user = SecureUtil.getUser();
|
|
|
- //先删除,在添加
|
|
|
- List<Long> leftIds = new ArrayList<>();
|
|
|
- //获取参宿
|
|
|
- List<StandardInfoJoinDTO> list = new ArrayList<>();
|
|
|
- //新增数据
|
|
|
- List<StandardInfoJoin> saveData = new ArrayList<>();
|
|
|
- //解析参数
|
|
|
- for (StandardInfoVO standardInfoJoin : standardInfoJoins) {
|
|
|
- StandardInfoJoinDTO standardInfoJoinDTO = new StandardInfoJoinDTO();
|
|
|
-
|
|
|
- Long leftId = standardInfoJoin.getId();
|
|
|
- standardInfoJoinDTO.setLeftId(leftId);
|
|
|
- leftIds.add(leftId);
|
|
|
- List<StandardInfoConditionVo> standardInfos = standardInfoJoin.getStandardInfos();
|
|
|
- for (StandardInfoConditionVo standardInfo : standardInfos) {
|
|
|
- StandardInfoGroupNameVO standardInfoGroupNameVO = standardInfo.getStandardInfoGroupNameVO();
|
|
|
- List<Long> ids = standardInfoGroupNameVO.getIds();
|
|
|
- standardInfoJoinDTO.getRightIds().addAll(ids);
|
|
|
- }
|
|
|
- list.add(standardInfoJoinDTO);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- for (StandardInfoJoinDTO standardInfoJoin : list) {
|
|
|
-
|
|
|
- List<Long> rightIds = standardInfoJoin.getRightIds();
|
|
|
- for (Long rightId : rightIds) {
|
|
|
- StandardInfoJoin uStandardInfoJoin = new StandardInfoJoin();
|
|
|
- uStandardInfoJoin.setId(SnowFlakeUtil.getId());
|
|
|
- uStandardInfoJoin.setStandardInfoLeftId(standardInfoJoin.getLeftId());
|
|
|
- uStandardInfoJoin.setStandardInfoRightId(rightId);
|
|
|
- uStandardInfoJoin.setCreateUser(user.getUserId());
|
|
|
- saveData.add(uStandardInfoJoin);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- boolean remove = standardInfoJoinService.remove(Wrappers.<StandardInfoJoin>lambdaQuery()
|
|
|
- .in(StandardInfoJoin::getStandardInfoLeftId, leftIds));
|
|
|
-
|
|
|
- return standardInfoJoinService.saveOrUpdateBatch(saveData);
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
|