浏览代码

Merge branch 'refs/heads/feature-lihb-20250610' into test-merge-02

LHB 3 月之前
父节点
当前提交
4d550dfa9b

+ 30 - 10
blade-service/blade-business/src/main/java/org/springblade/business/controller/StandardInfoController.java

@@ -4,6 +4,7 @@ package org.springblade.business.controller;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springblade.business.dto.StandardInfoDTO;
 import org.springblade.business.dto.StandardInfoJoinDTO;
@@ -40,7 +41,7 @@ public class StandardInfoController {
     /**
      * 分页查询所有数据
      *
-     * @param query         分页对象
+     * @param query        分页对象
      * @param standardInfo 查询实体
      * @return 所有数据
      */
@@ -110,14 +111,14 @@ public class StandardInfoController {
      * 条件设置
      *
      * @param standardInfoJoins 条件设置对象
-     * @param id 规范文件id
+     * @param id                规范文件id
      * @return 结果
      */
     @ApiOperation(value = "条件设置")
     @PostMapping("saveConditionSet")
     public R<Boolean> setCondition(@RequestBody @Validated List<StandardInfoVO> standardInfoJoins,
                                    @RequestParam Long id) {
-        Boolean b = this.uStandardInfoService.setCondition(standardInfoJoins,id);
+        Boolean b = this.uStandardInfoService.setCondition(standardInfoJoins, id);
         return R.data(b);
     }
 
@@ -131,12 +132,13 @@ public class StandardInfoController {
     @PostMapping("saveElementJoin")
     public R<Boolean> setElementJoin(@RequestBody @Validated List<StandardInfoPrivateJoinVO> standardInfoPrivateJoins,
                                      @RequestParam Long id) {
-        Boolean b = this.uStandardInfoService.setElementJoin(standardInfoPrivateJoins,id);
+        Boolean b = this.uStandardInfoService.setElementJoin(standardInfoPrivateJoins, id);
         return R.data(b);
     }
 
     /**
      * 删除条件设置
+     *
      * @param leftId 主关联id
      * @return 删除结果
      */
@@ -150,6 +152,7 @@ public class StandardInfoController {
 
     /**
      * 删除关联元素
+     *
      * @param leftId 主关联id
      * @return 删除结果
      */
@@ -163,30 +166,47 @@ public class StandardInfoController {
 
     /**
      * 查询条件设置
+     *
      * @param id 规范文件id
+     * @param leftId 条件设置组id
+     * @param groupId 文件信息组id
      */
     @ApiOperation(value = "查询条件设置")
-    @ApiImplicitParam(name = "id", value = "规范文件id", required = true)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "规范文件id", required = true),
+            @ApiImplicitParam(name = "leftId", value = "条件设置组id"),
+            @ApiImplicitParam(name = "groupId", value = "文件信息组id", required = true)
+
+    })
     @GetMapping("getConditionSet")
-    public R<List<StandardInfoVO>> getConditionSet(Long id,Long leftId) {
-        List<StandardInfoVO> list = this.uStandardInfoService.getConditionSet(id,leftId);
+    public R<List<StandardInfoVO>> getConditionSet(Long id, Long leftId, Long groupId) {
+        List<StandardInfoVO> list = this.uStandardInfoService.getConditionSet(id, leftId, groupId);
         return R.data(list);
     }
 
     /**
      * 查询关联元素
+     *
      * @param id 规范文件id
+     * @param leftId 文件信息Id
+     * @param groupId 文件信息组id
      */
     @ApiOperation(value = "查询关联元素")
-    @ApiImplicitParam(name = "id", value = "规范文件id", required = true)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "规范文件id", required = true),
+            @ApiImplicitParam(name = "leftId", value = "文件信息Id"),
+            @ApiImplicitParam(name = "groupId", value = "文件信息组id", required = true)
+
+    })
     @GetMapping("getElementJoin")
-    public R<List<StandardInfoPrivateJoinVO>> getElementJoin(Long id,Long leftId) {
-        List<StandardInfoPrivateJoinVO> list = this.uStandardInfoService.getElementJoin(id,leftId);
+    public R<List<StandardInfoPrivateJoinVO>> getElementJoin(Long id, Long leftId, Long groupId) {
+        List<StandardInfoPrivateJoinVO> list = this.uStandardInfoService.getElementJoin(id, leftId, groupId);
         return R.data(list);
     }
 
     /**
      * 效果预览
+     *
      * @param ids standardInfo type=1的子级id集合
      */
     @ApiOperation(value = "效果预览")

+ 4 - 2
blade-service/blade-business/src/main/java/org/springblade/business/mapper/StandardInfoMapper.java

@@ -25,10 +25,12 @@ public interface StandardInfoMapper extends BaseMapper<StandardInfo> {
     StandardInfoDTO selectMyOne(@Param("id") Long id);
 
     List<StandardInfoVO> getConditionSet(@Param("id") Long id,
-                                         @Param("leftId") Long leftId);
+                                         @Param("leftId") Long leftId,
+                                         @Param("groupId") Long groupId);
 
     List<StandardInfoPrivateJoinVO> getElementJoin(@Param("id") Long id,
-                                                   @Param("leftId") Long leftId);
+                                                   @Param("leftId") Long leftId,
+                                                   @Param("groupId") Long groupId);
 
     List<StandardInfoPrivateJoinVO> effectPreview(@Param("rightIds") List<Long> rightIds);
 }

+ 8 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/StandardInfoMapper.xml

@@ -113,6 +113,7 @@
             <include refid="Base_Column_Join_List"/>, concat(a.symbol,a.name) symbolName
         from
             u_standard_info a
+            INNER join u_standard_info p on a.parent_id = p.id and a.is_deleted = p.is_deleted
             INNER JOIN u_standard_info_join b on a.id = b.standard_info_left_id and a.is_deleted = b.is_deleted
         where
             a.is_deleted = 0
@@ -122,6 +123,9 @@
             <if test="leftId != null">
                 and  b.standard_info_left_id = #{leftId}
             </if>
+            <if test="groupId != null">
+                and  p.id = #{groupId}
+            </if>
 
         GROUP BY
             b.standard_info_left_id
@@ -197,6 +201,7 @@
             <include refid="Base_Column_Join_List"/>, concat(a.symbol,a.name) symbolName
         from
             u_standard_info a
+            INNER JOIN u_standard_info c on a.parent_id = c.id and a.is_deleted = c.is_deleted
             INNER JOIN u_standard_info_private_join b on a.id = b.standard_info_id and a.is_deleted = b.is_deleted
         where
             a.is_deleted = 0
@@ -206,6 +211,9 @@
             <if test="leftId != null">
                 and  b.standard_info_id = #{leftId}
             </if>
+            <if test="groupId != null">
+                and  c.id = #{groupId}
+            </if>
         GROUP BY
             b.standard_info_id
     </select>

+ 3 - 3
blade-service/blade-business/src/main/java/org/springblade/business/service/StandardInfoService.java

@@ -30,15 +30,15 @@ public interface StandardInfoService extends IService<StandardInfo> {
 
     Boolean setCondition(List<StandardInfoVO> standardInfoJoins, Long id);
 
-    Boolean setElementJoin(List<StandardInfoPrivateJoinVO> standardInfoPrivateJoins,Long id);
+    Boolean setElementJoin(List<StandardInfoPrivateJoinVO> standardInfoPrivateJoins, Long id);
 
     Boolean deleteConditionSet(Long leftId);
 
     Boolean deleteElementJoin(Long leftId);
 
-    List<StandardInfoVO> getConditionSet(Long id, Long leftId);
+    List<StandardInfoVO> getConditionSet(Long id, Long leftId, Long groupId);
 
-    List<StandardInfoPrivateJoinVO> getElementJoin(Long id, Long leftId);
+    List<StandardInfoPrivateJoinVO> getElementJoin(Long id, Long leftId, Long groupId);
 
     List<StandardInfoPrivateJoinVO> effectPreview(String ids);
 

+ 92 - 78
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/PrivateStandardServiceImpl.java

@@ -207,16 +207,16 @@ public class PrivateStandardServiceImpl extends ServiceImpl<PrivateStandardMappe
         BladeUser user = SecureUtil.getUser();
         //先删除文件
         try {
-            if(CollectionUtils.isNotEmpty(delFileIds)){
+            if (CollectionUtils.isNotEmpty(delFileIds)) {
                 List<StandardFile> standardFiles = standardFileService.listByIds(delFileIds);
-                if(CollectionUtils.isNotEmpty(standardFiles)){
+                if (CollectionUtils.isNotEmpty(standardFiles)) {
                     for (StandardFile standardFile : standardFiles) {
                         this.deleteFile(standardFile.getId());
                     }
                 }
             }
             //删除规范文件
-            if(CollectionUtils.isNotEmpty(delIds)){
+            if (CollectionUtils.isNotEmpty(delIds)) {
                 for (Long delId : delIds) {
                     delete(delId);
                 }
@@ -231,7 +231,7 @@ public class PrivateStandardServiceImpl extends ServiceImpl<PrivateStandardMappe
             //空文件曲中
             List<MultipartFile> files = new ArrayList<>();
             for (MultipartFile allFile : allFiles) {
-                if(allFile != null){
+                if (allFile != null) {
                     files.add(allFile);
                 }
             }
@@ -241,17 +241,17 @@ public class PrivateStandardServiceImpl extends ServiceImpl<PrivateStandardMappe
             for (PrivateStandardDTO dto : data) {
                 // 获取当前对象需要的文件数量
                 int fileCount = dto.getFilesCount();
-                if(files != null && files.size() > 0){
-                    if(fileCount > 0 && fileIndex < files.size()){
+                if (files != null && files.size() > 0) {
+                    if (fileCount > 0 && fileIndex < files.size()) {
                         dto.setFile(files.get(fileIndex++));
                     }
                     //先上传文件,上传成功在执行添加
-                    if(dto.getFile() != null){
+                    if (dto.getFile() != null) {
                         //再去查询当前规范文件是否在数据库中存在未删除的文件
                         List<StandardFile> list = standardFileService.list(Wrappers.<StandardFile>lambdaQuery()
                                 .eq(StandardFile::getStandardId, dto.getId())
                                 .eq(StandardFile::getIsDeleted, 0));
-                        if(CollectionUtils.isNotEmpty(list)){
+                        if (CollectionUtils.isNotEmpty(list)) {
                             //删除文件
                             for (StandardFile standardFile : list) {
                                 String pdfName = standardFile.getStandardFileUrl().split("upload")[1];
@@ -290,7 +290,7 @@ public class PrivateStandardServiceImpl extends ServiceImpl<PrivateStandardMappe
             return true;
         } catch (Exception e) {
             //删除之前上传的文件
-            if(CollectionUtils.isNotEmpty(standardFiles)){
+            if (CollectionUtils.isNotEmpty(standardFiles)) {
                 for (StandardFile standardFile : standardFiles) {
                     String pdfName = standardFile.getStandardFileUrl().split("upload")[1];
                     this.newIOSSClient.removeFile("upload" + pdfName);
@@ -308,22 +308,31 @@ public class PrivateStandardServiceImpl extends ServiceImpl<PrivateStandardMappe
         BladeUser user = SecureUtil.getUser();
         //获取当前规范文件信息
         PrivateStandard privateStandard = baseMapper.selectById(id);
-
+        if(privateStandard == null){
+            throw new ServiceException("未查询到规范文件");
+        }
 
         //获取信息
         List<StandardInfo> standardInfos = standardInfoMapper.selectList(Wrappers.<StandardInfo>lambdaQuery()
                 .eq(StandardInfo::getStandardId, id)
                 .eq(StandardInfo::getIsDeleted, 0));
-        List<Long> infoIds = standardInfos.stream().filter(f -> f.getType() == 2).map(StandardInfo::getId).collect(Collectors.toList());
 
-        //获取绑定信息
-        List<StandardInfoJoin> standardInfoJoins = standardInfoJoinMapper.selectList(Wrappers.<StandardInfoJoin>lambdaQuery()
-                .in(StandardInfoJoin::getStandardInfoLeftId, infoIds));
+        List<Long> infoIds = null;
+        if (CollectionUtils.isNotEmpty(standardInfos)) {
+            infoIds = standardInfos.stream().filter(f -> f.getType() == 2).map(StandardInfo::getId).collect(Collectors.toList());
+        }
 
-        //获取绑定表单信息
-        List<StandardInfoPrivateJoin> standardInfoPrivateJoins = standardInfoPrivateJoinMapper.selectList(Wrappers.<StandardInfoPrivateJoin>lambdaQuery()
-                .in(StandardInfoPrivateJoin::getStandardInfoId, infoIds));
+        List<StandardInfoJoin> standardInfoJoins = null;
+        List<StandardInfoPrivateJoin> standardInfoPrivateJoins = null;
+        if (CollectionUtils.isNotEmpty(infoIds)) {
+            //获取绑定信息
+            standardInfoJoins = standardInfoJoinMapper.selectList(Wrappers.<StandardInfoJoin>lambdaQuery()
+                    .in(StandardInfoJoin::getStandardInfoLeftId, infoIds));
 
+            //获取绑定表单信息
+            standardInfoPrivateJoins = standardInfoPrivateJoinMapper.selectList(Wrappers.<StandardInfoPrivateJoin>lambdaQuery()
+                    .in(StandardInfoPrivateJoin::getStandardInfoId, infoIds));
+        }
         //获取文件信息
         List<StandardFile> standardFiles = standardFileService.list(Wrappers.<StandardFile>lambdaQuery()
                 .eq(StandardFile::getStandardId, id)
@@ -337,7 +346,7 @@ public class PrivateStandardServiceImpl extends ServiceImpl<PrivateStandardMappe
 
         privateStandard.setId(newId);
         if (privateStandard.getStatus() == 2) {
-            privateStandard.setName(privateStandard.getName().replace("-已过期",""));
+            privateStandard.setName(privateStandard.getName().replace("-已过期", ""));
             privateStandard.setStatus(1);
         }
         privateStandard.setCreateTime(LocalDateTime.now());
@@ -349,76 +358,81 @@ public class PrivateStandardServiceImpl extends ServiceImpl<PrivateStandardMappe
 
             baseMapper.insert(privateStandard);
 
-            //旧id与新id的映射关系
-            Map<Long, Long> map = new HashMap<>();
-            standardInfos.forEach(f -> {
-                Long newInfoId = SnowFlakeUtil.getId();
-                map.put(f.getId(),newInfoId);
-            });
-            standardInfos.forEach(f -> {
-                f.setId(map.get(f.getId()));
-                f.setParentId(map.get(f.getParentId())==null?0:map.get(f.getParentId()));
-                f.setStandardId(newId);
-                f.setCreateTime(DateTime.now());
-                f.setCreateUser(user.getUserId());
-                standardInfoMapper.insert(f);
-            });
-
-
-            standardInfoJoins.forEach(f -> {
-                f.setId(SnowFlakeUtil.getId());
-                f.setStandardInfoLeftId(map.get(f.getStandardInfoLeftId()));
-                f.setStandardInfoRightId(map.get(f.getStandardInfoRightId()));
-                f.setCreateTime(DateTime.now());
-                f.setCreateUser(user.getUserId());
-                standardInfoJoinMapper.insert(f);
-            });
-
-            standardInfoPrivateJoins.forEach(f -> {
-                f.setId(SnowFlakeUtil.getId());
-                f.setStandardInfoId(map.get(f.getStandardInfoId()));
-                f.setCreateTime(DateTime.now());
-                f.setCreateUser(user.getUserId());
-                standardInfoPrivateJoinMapper.insert(f);
-            });
+            if(CollectionUtils.isNotEmpty(standardInfos)){
+                //旧id与新id的映射关系
+                Map<Long, Long> map = new HashMap<>();
+                standardInfos.forEach(f -> {
+                    Long newInfoId = SnowFlakeUtil.getId();
+                    map.put(f.getId(), newInfoId);
+                });
+                standardInfos.forEach(f -> {
+                    f.setId(map.get(f.getId()));
+                    f.setParentId(map.get(f.getParentId()) == null ? 0 : map.get(f.getParentId()));
+                    f.setStandardId(newId);
+                    f.setCreateTime(DateTime.now());
+                    f.setCreateUser(user.getUserId());
+                    standardInfoMapper.insert(f);
+                });
+                if(CollectionUtils.isNotEmpty(standardInfoJoins)){
+                    standardInfoJoins.forEach(f -> {
+                        f.setId(SnowFlakeUtil.getId());
+                        f.setStandardInfoLeftId(map.get(f.getStandardInfoLeftId()));
+                        f.setStandardInfoRightId(map.get(f.getStandardInfoRightId()));
+                        f.setCreateTime(DateTime.now());
+                        f.setCreateUser(user.getUserId());
+                        standardInfoJoinMapper.insert(f);
+                    });
+                }
+                if(CollectionUtils.isNotEmpty(standardInfoPrivateJoins)){
+                    standardInfoPrivateJoins.forEach(f -> {
+                        f.setId(SnowFlakeUtil.getId());
+                        f.setStandardInfoId(map.get(f.getStandardInfoId()));
+                        f.setCreateTime(DateTime.now());
+                        f.setCreateUser(user.getUserId());
+                        standardInfoPrivateJoinMapper.insert(f);
+                    });
+                }
+            }
         } catch (Exception e) {
             e.printStackTrace();
             throw new ServiceException("复制失败");
         }
 
 
-        //文件集合
-        List<String> urls = new ArrayList<>();
-        try {
-            for (StandardFile f : standardFiles) {
-                f.setId(SnowFlakeUtil.getId());
-                f.setStandardId(newId);
-                f.setCreateTime(DateTime.now());
-                f.setCreateUser(user.getUserId());
-                if(StringUtils.isNotEmpty(f.getStandardFileUrl())){
-                    URL urlFile = new URL(f.getStandardFileUrl());
-                    InputStream inputStream = urlFile.openStream();
-                    String originalFilename = "standard/" + f.getId() + "|" + f.getFileName();
-                    MockMultipartFile multipartFile = new MockMultipartFile("file", originalFilename, "application/pdf", inputStream);
-                    //Oss上传 传特殊文件名 在oss中做特殊路径处理
-                    BladeFile bladeFile = newIOSSClient.uploadFileByInputStream(multipartFile);
-                    if (bladeFile == null) {
-                        throw new ServiceException("Oss异常");
+
+        if(CollectionUtils.isNotEmpty(standardFiles)){
+            //文件集合
+            List<String> urls = new ArrayList<>();
+            try {
+                for (StandardFile f : standardFiles) {
+                    f.setId(SnowFlakeUtil.getId());
+                    f.setStandardId(newId);
+                    f.setCreateTime(DateTime.now());
+                    f.setCreateUser(user.getUserId());
+                    if (StringUtils.isNotEmpty(f.getStandardFileUrl())) {
+                        URL urlFile = new URL(f.getStandardFileUrl());
+                        InputStream inputStream = urlFile.openStream();
+                        String originalFilename = "standard/" + f.getId() + "|" + f.getFileName();
+                        MockMultipartFile multipartFile = new MockMultipartFile("file", originalFilename, "application/pdf", inputStream);
+                        //Oss上传 传特殊文件名 在oss中做特殊路径处理
+                        BladeFile bladeFile = newIOSSClient.uploadFileByInputStream(multipartFile);
+                        if (bladeFile == null) {
+                            throw new ServiceException("Oss异常");
+                        }
+                        f.setStandardFileUrl(bladeFile.getLink());
+                        urls.add(bladeFile.getLink());
                     }
-                    f.setStandardFileUrl(bladeFile.getLink());
-                    urls.add(bladeFile.getLink());
                 }
+            } catch (Exception e) {
+                for (String url : urls) {
+                    String pdfName = url.split("upload")[1];
+                    this.newIOSSClient.removeFile("upload" + pdfName);
+                }
+                e.printStackTrace();
+                throw new ServiceException("Oss异常");
             }
-        } catch (Exception e) {
-            for (String url : urls) {
-                String pdfName = url.split("upload")[1];
-                this.newIOSSClient.removeFile("upload" + pdfName);
-            }
-            e.printStackTrace();
-            throw new ServiceException("Oss异常");
+            standardFileService.saveBatch(standardFiles);
         }
-
-        standardFileService.saveBatch(standardFiles);
         return newId;
     }
 }

+ 56 - 55
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/UStandardInfoServiceImpl.java

@@ -165,22 +165,21 @@ public class UStandardInfoServiceImpl extends ServiceImpl<StandardInfoMapper, St
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Boolean setCondition(List<StandardInfoVO> standardInfoJoins, 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());
-        //删除当前规范文件下的条件设置
-        standardInfoJoinService.remove(Wrappers.<StandardInfoJoin>lambdaQuery()
-                .in(StandardInfoJoin::getStandardInfoLeftId, collect));
+        if (CollectionUtil.isNotEmpty(standardInfoJoins)) {
+            //按照组进行删除
+            StandardInfoVO standardInfoVO = standardInfoJoins.get(0);
+            Long parentId = standardInfoVO.getParentId();
 
+            List<StandardInfo> standardInfoIds = baseMapper.selectList(Wrappers.<StandardInfo>lambdaQuery()
+                    .eq(StandardInfo::getParentId, parentId)
+                    .eq(StandardInfo::getIsDeleted, 0));
+            List<Long> collect = standardInfoIds.stream().map(StandardInfo::getId).collect(Collectors.toList());
+
+            //删除当前规范文件当前组下的条件设置
+            standardInfoJoinService.remove(Wrappers.<StandardInfoJoin>lambdaQuery()
+                    .in(StandardInfoJoin::getStandardInfoLeftId, collect));
 
-        if (CollectionUtil.isNotEmpty(standardInfoJoins)) {
             BladeUser user = SecureUtil.getUser();
-            //先删除,在添加
-            List<Long> leftIds = new ArrayList<>();
             //获取参宿
             List<StandardInfoJoinDTO> list = new ArrayList<>();
             //新增数据
@@ -191,7 +190,6 @@ public class UStandardInfoServiceImpl extends ServiceImpl<StandardInfoMapper, St
 
                 Long leftId = standardInfoJoin.getId();
                 standardInfoJoinDTO.setLeftId(leftId);
-                leftIds.add(leftId);
                 List<StandardInfoConditionVo> standardInfos = standardInfoJoin.getStandardInfos();
                 if (CollectionUtil.isNotEmpty(standardInfos)) {
                     for (StandardInfoConditionVo standardInfo : standardInfos) {
@@ -224,51 +222,54 @@ public class UStandardInfoServiceImpl extends ServiceImpl<StandardInfoMapper, St
     @Override
     @Transactional(rollbackFor = Exception.class)
     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<>();
 
-        try {
 
-            for (StandardInfoPrivateJoinVO standardInfoPrivateJoin : standardInfoPrivateJoins) {
-                Long leftId = standardInfoPrivateJoin.getId();
-                leftIds.add(leftId);
-                List<StandardInfoPrivateJoinGroupVO> group = standardInfoPrivateJoin.getGroup();
-                //项目组
-                for (StandardInfoPrivateJoinGroupVO standardInfoPrivateJoinGroupVO : group) {
-                    //项目id
-                    Long privateId = standardInfoPrivateJoinGroupVO.getPrivateId();
-                    List<StandardElementVo> keys = standardInfoPrivateJoinGroupVO.getKeys();
-
-                    for (StandardElementVo key : keys) {
-                        StandardInfoPrivateJoin join = new StandardInfoPrivateJoin();
-                        join.setStandardInfoId(leftId);
-                        join.setId(SnowFlakeUtil.getId());
-                        join.setPrivateId(privateId);
-                        join.setColKey(key.getColKey());
-                        join.setColName(key.getColName());
-                        join.setCreateUser(user.getUserId());
-                        saveData.add(join);
+        if (CollectionUtil.isNotEmpty(standardInfoPrivateJoins)) {
+            //根据
+            StandardInfoPrivateJoinVO standardInfoPrivateJoinVO = standardInfoPrivateJoins.get(0);
+            Long parentId = standardInfoPrivateJoinVO.getParentId();
+
+            List<StandardInfo> standardInfoIds = baseMapper.selectList(Wrappers.<StandardInfo>lambdaQuery()
+                    .eq(StandardInfo::getParentId, parentId)
+                    .eq(StandardInfo::getIsDeleted, 0));
+            List<Long> collect = standardInfoIds.stream().map(StandardInfo::getId).collect(Collectors.toList());
+
+
+            //删除当前规范文件下的条件设置
+            standardInfoPrivateJoinService.remove(Wrappers.<StandardInfoPrivateJoin>lambdaQuery()
+                    .in(StandardInfoPrivateJoin::getStandardInfoId, collect));
+
+            try {
+                for (StandardInfoPrivateJoinVO standardInfoPrivateJoin : standardInfoPrivateJoins) {
+                    Long leftId = standardInfoPrivateJoin.getId();
+                    List<StandardInfoPrivateJoinGroupVO> group = standardInfoPrivateJoin.getGroup();
+                    //项目组
+                    for (StandardInfoPrivateJoinGroupVO standardInfoPrivateJoinGroupVO : group) {
+                        //项目id
+                        Long privateId = standardInfoPrivateJoinGroupVO.getPrivateId();
+                        List<StandardElementVo> keys = standardInfoPrivateJoinGroupVO.getKeys();
+
+                        for (StandardElementVo key : keys) {
+                            StandardInfoPrivateJoin join = new StandardInfoPrivateJoin();
+                            join.setStandardInfoId(leftId);
+                            join.setId(SnowFlakeUtil.getId());
+                            join.setPrivateId(privateId);
+                            join.setColKey(key.getColKey());
+                            join.setColName(key.getColName());
+                            join.setCreateUser(user.getUserId());
+                            saveData.add(join);
+                        }
                     }
                 }
+                return standardInfoPrivateJoinService.saveOrUpdateBatch(saveData);
+            } catch (Exception e) {
+                e.printStackTrace();
+                throw new ServiceException("元素关联失败");
             }
-            return standardInfoPrivateJoinService.saveOrUpdateBatch(saveData);
-        } catch (Exception e) {
-            e.printStackTrace();
-            throw new ServiceException("元素关联失败");
         }
+        return false;
     }
 
     @Override
@@ -302,8 +303,8 @@ public class UStandardInfoServiceImpl extends ServiceImpl<StandardInfoMapper, St
     }
 
     @Override
-    public List<StandardInfoVO> getConditionSet(Long id, Long leftId) {
-        List<StandardInfoVO> conditionSet = baseMapper.getConditionSet(id, leftId);
+    public List<StandardInfoVO> getConditionSet(Long id, Long leftId, Long groupId) {
+        List<StandardInfoVO> conditionSet = baseMapper.getConditionSet(id, leftId, groupId);
         for (StandardInfoVO standardInfoVO : conditionSet) {
             List<StandardInfoConditionVo> standardInfos = standardInfoVO.getStandardInfos();
             for (StandardInfoConditionVo standardInfo : standardInfos) {
@@ -323,8 +324,8 @@ public class UStandardInfoServiceImpl extends ServiceImpl<StandardInfoMapper, St
     }
 
     @Override
-    public List<StandardInfoPrivateJoinVO> getElementJoin(Long id, Long leftId) {
-        return baseMapper.getElementJoin(id, leftId);
+    public List<StandardInfoPrivateJoinVO> getElementJoin(Long id, Long leftId, Long groupId) {
+        return baseMapper.getElementJoin(id, leftId, groupId);
 
     }