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); }