From fb0e38dc67fa168fd574801fe784ac7b3517ce9a Mon Sep 17 00:00:00 2001 From: gaosong Date: Wed, 27 Dec 2023 10:28:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8F=82=E6=95=B0=E6=B8=85?= =?UTF-8?q?=E5=8D=95=E4=B8=80=E9=94=AE=E5=BC=95=E7=94=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ParamsCollectManifestEOController.java | 15 ++++++++ .../IParamsCollectManifestEOService.java | 3 +- .../ParamsCollectManifestEOServiceImpl.java | 34 +++++++++++++++++++ .../impl/ParamsConfigDataEOServiceImpl.java | 5 ++- 4 files changed, 55 insertions(+), 2 deletions(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/controller/ParamsCollectManifestEOController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/controller/ParamsCollectManifestEOController.java index 2bbd9f6f1..6f10f611d 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/controller/ParamsCollectManifestEOController.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/controller/ParamsCollectManifestEOController.java @@ -475,6 +475,21 @@ public class ParamsCollectManifestEOController extends JeroController referParamsAll(String paramsManifestId, String sourceConfigId, String targetConfigId) { + boolean isSuccess = paramsCollectManifestEOService.referParamsAll(paramsManifestId, sourceConfigId, targetConfigId); + if (isSuccess) { + return Result.OK("引用参数成功!"); + } else { + return Result.error("引用参数失败!"); + } + } + /** * 引用参数 * diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/IParamsCollectManifestEOService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/IParamsCollectManifestEOService.java index 650fa9640..c7089a3bf 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/IParamsCollectManifestEOService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/IParamsCollectManifestEOService.java @@ -155,7 +155,8 @@ public interface IParamsCollectManifestEOService extends IService queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ParamsCollectManifestEO::getParamsManifestId, paramsManifestId) + .notIn(ParamsCollectManifestEO::getControlType, ControlTypeEnum.Title.getValue()) + .orderByDesc(ParamsCollectManifestEO::getUpdateTime); // 按修改时间降序 + List paramsCollectManifestList = list(queryWrapper); + + List addConfigDataEOList = new ArrayList<>(); + for (ParamsCollectManifestEO paramsCollectManifest : paramsCollectManifestList) { + List sourceConfigDataEOList = this.paramsConfigDataEOService.queryListByConfigIdAndCollectManifestId(sourceConfigId, paramsCollectManifest.getId()); + if (CollectionUtils.isNotEmpty(sourceConfigDataEOList)) { + for (ParamsConfigDataEO sourceConfigDataEO : sourceConfigDataEOList) { + if (ObjectUtil.isNotEmpty(sourceConfigDataEO)) { + // 根据配置id、参数清单id,将被引用参数列的数据删掉,重新加 + QueryWrapper targetConfigDataRemoveWrap = new QueryWrapper<>(); + targetConfigDataRemoveWrap.lambda().eq(ParamsConfigDataEO::getParamsConfigId, targetConfigId); + targetConfigDataRemoveWrap.lambda().eq(ParamsConfigDataEO::getParamsCollectManifestId, paramsCollectManifest.getId()); + this.paramsConfigDataEOService.remove(targetConfigDataRemoveWrap); + + ParamsConfigDataEO targetConfigDataEO = new ParamsConfigDataEO(); + BeanUtils.copyProperties(sourceConfigDataEO, targetConfigDataEO); + targetConfigDataEO.setId(null); + targetConfigDataEO.setParamsConfigId(targetConfigId); + targetConfigDataEO.setParamsCollectManifestId(paramsCollectManifest.getId()); + addConfigDataEOList.add(targetConfigDataEO); + } + } + } + } + paramsConfigDataEOService.saveBatch(addConfigDataEOList); + return true; + } + @Override public boolean referParams(ParamsCollectManifestVO paramsCollectManifestVO) { if (StringUtils.isEmpty(paramsCollectManifestVO.getIds()) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsConfigDataEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsConfigDataEOServiceImpl.java index b2c4791f6..63ab80deb 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsConfigDataEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsConfigDataEOServiceImpl.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.jero.modules.cert.collect.entity.ParamsConfigDataEO; import com.jero.modules.cert.collect.mapper.ParamsConfigDataEOMapper; import com.jero.modules.cert.collect.service.IParamsConfigDataEOService; +import com.jero.modules.system.util.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; @@ -109,7 +110,9 @@ public class ParamsConfigDataEOServiceImpl extends ServiceImpl queryListByConfigIdAndCollectManifestId(String paramsConfigId, String paramsCollectManifestId) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(ParamsConfigDataEO::getParamsConfigId, paramsConfigId); - queryWrapper.eq(ParamsConfigDataEO::getParamsCollectManifestId, paramsCollectManifestId); + if(StringUtils.isNotBlank(paramsCollectManifestId)){ + queryWrapper.eq(ParamsConfigDataEO::getParamsCollectManifestId, paramsCollectManifestId); + } queryWrapper.orderByAsc(ParamsConfigDataEO::getOrderNum); return this.list(queryWrapper); }