From 8ff216c9504c34241c4e6d9d18a1bc24af67f00e Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Sun, 7 Sep 2025 11:15:38 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E5=B0=86=E6=B6=89?= =?UTF-8?q?=E5=8F=8Ascence=5Fipobject=5Fdetail=E8=A7=86=E5=9B=BE=E7=9A=84S?= =?UTF-8?q?QL=E8=AF=AD=E5=8F=A5=E6=94=B9=E6=88=90=E5=8A=A8=E6=80=81sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1469827334504448]将涉及scence_ipobject_detail视图的SQL语句改成动态sql http://192.168.0.96:8090/demo/rdm.html#/task-detail/939050947543040/939050947543050/1469827334504448 --- .../inspect/service/InspectService.java | 62 ++ .../inspect/service/InspectServiceImpl.java | 538 ++++++++++++++++++ 2 files changed, 600 insertions(+) create mode 100644 src/main/java/neatlogic/module/inspect/service/InspectService.java create mode 100644 src/main/java/neatlogic/module/inspect/service/InspectServiceImpl.java diff --git a/src/main/java/neatlogic/module/inspect/service/InspectService.java b/src/main/java/neatlogic/module/inspect/service/InspectService.java new file mode 100644 index 0000000..580a6d9 --- /dev/null +++ b/src/main/java/neatlogic/module/inspect/service/InspectService.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2025 深圳极向量科技有限公司 All Rights Reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package neatlogic.module.inspect.service; + +import neatlogic.framework.cmdb.dto.resourcecenter.ResourceSearchVo; +import neatlogic.framework.inspect.dto.InspectConfigFilePathSearchVo; +import neatlogic.framework.inspect.dto.InspectConfigFilePathVo; +import neatlogic.framework.inspect.dto.InspectResourceVo; + +import java.util.List; + +public interface InspectService { + + List getInspectResourceListByIdList(List idList); + + List getInspectResourceListByIdList(List idList, List selectFieldNameList); + + List getInspectResourceListByIdListAndJobId(List idList, Long jobId); + + List getInspectResourceListByIdListAndJobId(List idList, Long jobId, List selectFieldNameList); + + int getInspectResourceCount(ResourceSearchVo searchVo); + + int getInspectResourceCountByIpKeyword(ResourceSearchVo searchVo); + + int getInspectResourceCountByNameKeyword(ResourceSearchVo searchVo); + + List getInspectResourceIdList(ResourceSearchVo searchVo); + + int getInspectAutoexecJobNodeResourceCount(ResourceSearchVo searchVo, Long jobId); + + int getInspectAutoexecJobNodeResourceCountByIpKeyword(ResourceSearchVo searchVo, Long jobId); + + int getInspectAutoexecJobNodeResourceCountByNameKeyword(ResourceSearchVo searchVo, Long jobId); + + List getInspectAutoexecJobNodeResourceIdList(ResourceSearchVo searchVo, Long jobId); + + List getInspectConfigFileResourceIdList(ResourceSearchVo inspectConfigFilePathSearchVo); + + int getInspectConfigFilePathCount(InspectConfigFilePathSearchVo inspectConfigFilePathSearchVo); + + List getInspectConfigFilePathIdList(InspectConfigFilePathSearchVo inspectConfigFilePathSearchVo); + + List getInspectConfigFilePathList(List idList); + + List getInspectConfigFilePathListByJobId(Long jobId); +} diff --git a/src/main/java/neatlogic/module/inspect/service/InspectServiceImpl.java b/src/main/java/neatlogic/module/inspect/service/InspectServiceImpl.java new file mode 100644 index 0000000..c909d46 --- /dev/null +++ b/src/main/java/neatlogic/module/inspect/service/InspectServiceImpl.java @@ -0,0 +1,538 @@ +/* + * Copyright (C) 2025 深圳极向量科技有限公司 All Rights Reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package neatlogic.module.inspect.service; + +import com.alibaba.fastjson.JSONObject; +import neatlogic.framework.cmdb.crossover.IResourceBuildSqlCrossoverService; +import neatlogic.framework.cmdb.crossover.IResourceCrossoverMapper; +import neatlogic.framework.cmdb.dto.resourcecenter.ResourceSearchVo; +import neatlogic.framework.cmdb.enums.CmdbTenantConfig; +import neatlogic.framework.config.ConfigManager; +import neatlogic.framework.crossover.CrossoverServiceFactory; +import neatlogic.framework.inspect.dao.mapper.InspectMapper; +import neatlogic.framework.inspect.dto.InspectConfigFilePathSearchVo; +import neatlogic.framework.inspect.dto.InspectConfigFilePathVo; +import neatlogic.framework.inspect.dto.InspectResourceVo; +import neatlogic.module.inspect.dao.mapper.InspectConfigFileMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Objects; + +@Service +public class InspectServiceImpl implements InspectService { + + private final Logger logger = LoggerFactory.getLogger(InspectServiceImpl.class); + + private final String MYBATIS_MODE = "mybatis"; + + private final String JSQLPARSER_MODE = "jsqlparser"; + + private final String COMPARISON_ENABLED = "1"; + + @Resource + private InspectConfigFileMapper inspectConfigFileMapper; + + @Resource + private InspectMapper inspectMapper; + + @Override + public List getInspectResourceListByIdList(List idList) { + String enable = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_DATA_COMPARISON_MODE_ENABLE); + String mode = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_SQL_MODE); + List newResourceList = new ArrayList<>(); + List oldResourceList = new ArrayList<>(); + if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); + String newSql = resourceBuildSqlCrossoverService.buildGetInspectResourceListByIdListSql(idList); + newResourceList = inspectMapper.getInspectResourceListByIdListSql(newSql); + } + if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + oldResourceList = inspectMapper.getInspectResourceListByIdList(idList); + } + if (Objects.equals(enable, COMPARISON_ENABLED)) { + checkInspectResourceListIsEquals(newResourceList, oldResourceList); + } + if (Objects.equals(mode, JSQLPARSER_MODE)) { + return newResourceList; + } else if (Objects.equals(mode, MYBATIS_MODE)) { + return oldResourceList; + } + return new ArrayList<>(); + } + + @Override + public List getInspectResourceListByIdList(List idList, List selectFieldNameList) { + IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); + String newSql = resourceBuildSqlCrossoverService.buildGetInspectResourceListByIdListSql(idList, selectFieldNameList); + return inspectMapper.getInspectResourceListByIdListSql(newSql); + } + + @Override + public List getInspectResourceListByIdListAndJobId(List idList, Long jobId) { + String enable = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_DATA_COMPARISON_MODE_ENABLE); + String mode = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_SQL_MODE); + List newResourceList = new ArrayList<>(); + List oldResourceList = new ArrayList<>(); + if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); + String newSql = resourceBuildSqlCrossoverService.buildGetInspectResourceListByIdListAndJobIdSql(idList, jobId); + newResourceList = inspectMapper.getInspectResourceListByIdListSql(newSql); + } + if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + oldResourceList = inspectMapper.getInspectResourceListByIdListAndJobId(idList, jobId); + } + if (Objects.equals(enable, COMPARISON_ENABLED)) { + checkInspectResourceListIsEquals(newResourceList, oldResourceList); + } + if (Objects.equals(mode, JSQLPARSER_MODE)) { + return newResourceList; + } else if (Objects.equals(mode, MYBATIS_MODE)) { + return oldResourceList; + } + return new ArrayList<>(); + } + + @Override + public List getInspectResourceListByIdListAndJobId(List idList, Long jobId, List selectFieldNameList) { + IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); + String newSql = resourceBuildSqlCrossoverService.buildGetInspectResourceListByIdListAndJobIdSql(idList, jobId, selectFieldNameList); + return inspectMapper.getInspectResourceListByIdListSql(newSql); + } + + @Override + public int getInspectResourceCount(ResourceSearchVo searchVo) { + String enable = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_DATA_COMPARISON_MODE_ENABLE); + String mode = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_SQL_MODE); + int newCount = 0; + int oldCount = 0; + if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + IResourceCrossoverMapper resourceCrossoverMapper = CrossoverServiceFactory.getApi(IResourceCrossoverMapper.class); + IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); + String newSql = resourceBuildSqlCrossoverService.buildGetInspectResourceCountSql(searchVo); + newCount = resourceCrossoverMapper.getCountBySql(newSql); + } + if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + oldCount = inspectMapper.getInspectResourceCount(searchVo); + } + if (Objects.equals(enable, COMPARISON_ENABLED)) { + checkIntIsEquals(newCount, oldCount); + } + if (Objects.equals(mode, JSQLPARSER_MODE)) { + return newCount; + } else if (Objects.equals(mode, MYBATIS_MODE)) { + return oldCount; + } + return 0; + } + + @Override + public int getInspectResourceCountByIpKeyword(ResourceSearchVo searchVo) { + String enable = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_DATA_COMPARISON_MODE_ENABLE); + String mode = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_SQL_MODE); + int newCount = 0; + int oldCount = 0; + if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + IResourceCrossoverMapper resourceCrossoverMapper = CrossoverServiceFactory.getApi(IResourceCrossoverMapper.class); + IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); + String newSql = resourceBuildSqlCrossoverService.buildGetInspectResourceCountByIpKeywordSql(searchVo); + newCount = resourceCrossoverMapper.getCountBySql(newSql); + } + if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + oldCount = inspectMapper.getInspectResourceCountByIpKeyword(searchVo); + } + if (Objects.equals(enable, COMPARISON_ENABLED)) { + checkIntIsEquals(newCount, oldCount); + } + if (Objects.equals(mode, JSQLPARSER_MODE)) { + return newCount; + } else if (Objects.equals(mode, MYBATIS_MODE)) { + return oldCount; + } + return 0; + } + + @Override + public int getInspectResourceCountByNameKeyword(ResourceSearchVo searchVo) { + String enable = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_DATA_COMPARISON_MODE_ENABLE); + String mode = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_SQL_MODE); + int newCount = 0; + int oldCount = 0; + if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + IResourceCrossoverMapper resourceCrossoverMapper = CrossoverServiceFactory.getApi(IResourceCrossoverMapper.class); + IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); + String newSql = resourceBuildSqlCrossoverService.buildGetInspectResourceCountByNameKeywordSql(searchVo); + newCount = resourceCrossoverMapper.getCountBySql(newSql); + } + if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + oldCount = inspectMapper.getInspectResourceCountByNameKeyword(searchVo); + } + if (Objects.equals(enable, COMPARISON_ENABLED)) { + checkIntIsEquals(newCount, oldCount); + } + if (Objects.equals(mode, JSQLPARSER_MODE)) { + return newCount; + } else if (Objects.equals(mode, MYBATIS_MODE)) { + return oldCount; + } + return 0; + } + + @Override + public List getInspectResourceIdList(ResourceSearchVo searchVo) { + String enable = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_DATA_COMPARISON_MODE_ENABLE); + String mode = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_SQL_MODE); + List newIdList = new ArrayList<>(); + List oldIdList = new ArrayList<>(); + if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + IResourceCrossoverMapper resourceCrossoverMapper = CrossoverServiceFactory.getApi(IResourceCrossoverMapper.class); + IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); + String getResourceIdListSql = resourceBuildSqlCrossoverService.buildGetInspectResourceIdListSql(searchVo); + newIdList = resourceCrossoverMapper.getIdListBySql(getResourceIdListSql); + } + if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + oldIdList = inspectMapper.getInspectResourceIdList(searchVo); + } + if (Objects.equals(enable, COMPARISON_ENABLED)) { + checkLongListIsEquals(newIdList, oldIdList); + } + if (Objects.equals(mode, JSQLPARSER_MODE)) { + return newIdList; + } else if (Objects.equals(mode, MYBATIS_MODE)) { + return oldIdList; + } + return new ArrayList<>(); + } + + @Override + public int getInspectAutoexecJobNodeResourceCount(ResourceSearchVo searchVo, Long jobId) { + String enable = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_DATA_COMPARISON_MODE_ENABLE); + String mode = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_SQL_MODE); + int newCount = 0; + int oldCount = 0; + if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + IResourceCrossoverMapper resourceCrossoverMapper = CrossoverServiceFactory.getApi(IResourceCrossoverMapper.class); + IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); + String newSql = resourceBuildSqlCrossoverService.buildGetInspectAutoexecJobNodeResourceCountSql(searchVo, jobId); + newCount = resourceCrossoverMapper.getCountBySql(newSql); + } + if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + oldCount = inspectMapper.getInspectAutoexecJobNodeResourceCount(searchVo, jobId); + } + if (Objects.equals(enable, COMPARISON_ENABLED)) { + checkIntIsEquals(newCount, oldCount); + } + if (Objects.equals(mode, JSQLPARSER_MODE)) { + return newCount; + } else if (Objects.equals(mode, MYBATIS_MODE)) { + return oldCount; + } + return 0; + } + + @Override + public int getInspectAutoexecJobNodeResourceCountByIpKeyword(ResourceSearchVo searchVo, Long jobId) { + String enable = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_DATA_COMPARISON_MODE_ENABLE); + String mode = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_SQL_MODE); + int newCount = 0; + int oldCount = 0; + if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + IResourceCrossoverMapper resourceCrossoverMapper = CrossoverServiceFactory.getApi(IResourceCrossoverMapper.class); + IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); + String newSql = resourceBuildSqlCrossoverService.buildGetInspectAutoexecJobNodeResourceCountByIpKeywordSql(searchVo, jobId); + newCount = resourceCrossoverMapper.getCountBySql(newSql); + } + if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + oldCount = inspectMapper.getInspectAutoexecJobNodeResourceCountByIpKeyword(searchVo, jobId); + } + if (Objects.equals(enable, COMPARISON_ENABLED)) { + checkIntIsEquals(newCount, oldCount); + } + if (Objects.equals(mode, JSQLPARSER_MODE)) { + return newCount; + } else if (Objects.equals(mode, MYBATIS_MODE)) { + return oldCount; + } + return 0; + } + + @Override + public int getInspectAutoexecJobNodeResourceCountByNameKeyword(ResourceSearchVo searchVo, Long jobId) { + String enable = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_DATA_COMPARISON_MODE_ENABLE); + String mode = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_SQL_MODE); + int newCount = 0; + int oldCount = 0; + if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + IResourceCrossoverMapper resourceCrossoverMapper = CrossoverServiceFactory.getApi(IResourceCrossoverMapper.class); + IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); + String newSql = resourceBuildSqlCrossoverService.buildGetInspectAutoexecJobNodeResourceCountByNameKeywordSql(searchVo, jobId); + newCount = resourceCrossoverMapper.getCountBySql(newSql); + } + if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + oldCount = inspectMapper.getInspectAutoexecJobNodeResourceCountByNameKeyword(searchVo, jobId); + } + if (Objects.equals(enable, COMPARISON_ENABLED)) { + checkIntIsEquals(newCount, oldCount); + } + if (Objects.equals(mode, JSQLPARSER_MODE)) { + return newCount; + } else if (Objects.equals(mode, MYBATIS_MODE)) { + return oldCount; + } + return 0; + } + + @Override + public List getInspectAutoexecJobNodeResourceIdList(ResourceSearchVo searchVo, Long jobId) { + String enable = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_DATA_COMPARISON_MODE_ENABLE); + String mode = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_SQL_MODE); + List newIdList = new ArrayList<>(); + List oldIdList = new ArrayList<>(); + if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + IResourceCrossoverMapper resourceCrossoverMapper = CrossoverServiceFactory.getApi(IResourceCrossoverMapper.class); + IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); + String sql = resourceBuildSqlCrossoverService.buildGetInspectAutoexecJobNodeResourceIdListSql(searchVo, jobId); + newIdList = resourceCrossoverMapper.getIdListBySql(sql); + } + if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + oldIdList = inspectMapper.getInspectAutoexecJobNodeResourceIdList(searchVo, jobId); + } + if (Objects.equals(enable, COMPARISON_ENABLED)) { + checkLongListIsEquals(newIdList, oldIdList); + } + if (Objects.equals(mode, JSQLPARSER_MODE)) { + return newIdList; + } else if (Objects.equals(mode, MYBATIS_MODE)) { + return oldIdList; + } + return new ArrayList<>(); + } + + @Override + public List getInspectConfigFileResourceIdList(ResourceSearchVo searchVo) { + String enable = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_DATA_COMPARISON_MODE_ENABLE); + String mode = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_SQL_MODE); + List newIdList = new ArrayList<>(); + List oldIdList = new ArrayList<>(); + if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + IResourceCrossoverMapper resourceCrossoverMapper = CrossoverServiceFactory.getApi(IResourceCrossoverMapper.class); + IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); + String sql = resourceBuildSqlCrossoverService.buildGetInspectConfigFileResourceIdListSql(searchVo); + newIdList = resourceCrossoverMapper.getIdListBySql(sql); + } + if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + oldIdList = inspectConfigFileMapper.getInspectResourceIdList(searchVo); + } + if (Objects.equals(enable, COMPARISON_ENABLED)) { + checkLongListIsEquals(newIdList, oldIdList); + } + if (Objects.equals(mode, JSQLPARSER_MODE)) { + return newIdList; + } else if (Objects.equals(mode, MYBATIS_MODE)) { + return oldIdList; + } + return new ArrayList<>(); + } + + @Override + public int getInspectConfigFilePathCount(InspectConfigFilePathSearchVo inspectConfigFilePathSearchVo) { + String enable = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_DATA_COMPARISON_MODE_ENABLE); + String mode = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_SQL_MODE); + int newCount = 0; + int oldCount = 0; + if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + IResourceCrossoverMapper resourceCrossoverMapper = CrossoverServiceFactory.getApi(IResourceCrossoverMapper.class); + IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); + ResourceSearchVo searchVo = JSONObject.parseObject(JSONObject.toJSONString(inspectConfigFilePathSearchVo), ResourceSearchVo.class); + String newSql = resourceBuildSqlCrossoverService.buildGetInspectConfigFilePathCountSql(searchVo); + newCount = resourceCrossoverMapper.getCountBySql(newSql); + } + if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + oldCount = inspectConfigFileMapper.getInspectConfigFilePathCount(inspectConfigFilePathSearchVo); + } + if (Objects.equals(enable, COMPARISON_ENABLED)) { + checkIntIsEquals(newCount, oldCount); + } + if (Objects.equals(mode, JSQLPARSER_MODE)) { + return newCount; + } else if (Objects.equals(mode, MYBATIS_MODE)) { + return oldCount; + } + return 0; + } + + @Override + public List getInspectConfigFilePathIdList(InspectConfigFilePathSearchVo inspectConfigFilePathSearchVo) { + String enable = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_DATA_COMPARISON_MODE_ENABLE); + String mode = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_SQL_MODE); + List newIdList = new ArrayList<>(); + List oldIdList = new ArrayList<>(); + if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + IResourceCrossoverMapper resourceCrossoverMapper = CrossoverServiceFactory.getApi(IResourceCrossoverMapper.class); + IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); + ResourceSearchVo searchVo = JSONObject.parseObject(JSONObject.toJSONString(inspectConfigFilePathSearchVo), ResourceSearchVo.class); + String newSql = resourceBuildSqlCrossoverService.buildGetInspectConfigFilePathIdListSql(searchVo); + newIdList = resourceCrossoverMapper.getIdListBySql(newSql); + } + if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + oldIdList = inspectConfigFileMapper.getInspectConfigFilePathIdList(inspectConfigFilePathSearchVo); + } + if (Objects.equals(enable, COMPARISON_ENABLED)) { + checkLongListIsEquals(newIdList, oldIdList); + } + if (Objects.equals(mode, JSQLPARSER_MODE)) { + return newIdList; + } else if (Objects.equals(mode, MYBATIS_MODE)) { + return oldIdList; + } + return new ArrayList<>(); + } + + @Override + public List getInspectConfigFilePathList(List idList) { + String enable = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_DATA_COMPARISON_MODE_ENABLE); + String mode = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_SQL_MODE); + List newResourceList = new ArrayList<>(); + List oldResourceList = new ArrayList<>(); + if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); + String newSql = resourceBuildSqlCrossoverService.buildGetInspectConfigFilePathListSql(idList); + newResourceList = inspectConfigFileMapper.getInspectConfigFilePathListBySql(newSql); + } + if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + oldResourceList = inspectConfigFileMapper.getInspectConfigFilePathList(idList); + } + if (Objects.equals(enable, COMPARISON_ENABLED)) { + checkInspectConfigFilePathListIsEquals(newResourceList, oldResourceList); + } + if (Objects.equals(mode, JSQLPARSER_MODE)) { + return newResourceList; + } else if (Objects.equals(mode, MYBATIS_MODE)) { + return oldResourceList; + } + return new ArrayList<>(); + } + + @Override + public List getInspectConfigFilePathListByJobId(Long jobId) { + String enable = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_DATA_COMPARISON_MODE_ENABLE); + String mode = ConfigManager.getConfig(CmdbTenantConfig.RESOURCECENTER_SQL_MODE); + List newResourceList = new ArrayList<>(); + List oldResourceList = new ArrayList<>(); + if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); + String newSql = resourceBuildSqlCrossoverService.buildGetInspectConfigFilePathListByJobIdSql(jobId); + newResourceList = inspectConfigFileMapper.getInspectConfigFilePathListBySql(newSql); + } + if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { + oldResourceList = inspectConfigFileMapper.getInspectConfigFilePathListByJobId(jobId); + } + if (Objects.equals(enable, COMPARISON_ENABLED)) { + checkInspectConfigFilePathListIsEquals(newResourceList, oldResourceList); + } + if (Objects.equals(mode, JSQLPARSER_MODE)) { + return newResourceList; + } else if (Objects.equals(mode, MYBATIS_MODE)) { + return oldResourceList; + } + return new ArrayList<>(); + } + + private boolean checkLongListIsEquals(List newIdList, List oldIdList) { + if (!Objects.equals(oldIdList, newIdList)) { + JSONObject resultObj = new JSONObject(); + resultObj.put("idList", newIdList); + resultObj.put("oldIdList", oldIdList); + logger.error("资产清单新旧SQL获取结果不一致:{}", resultObj); + return false; + } + return true; + } + + private boolean checkIntIsEquals(int newCount, int oldCount) { + if (!Objects.equals(oldCount, newCount)) { + JSONObject resultObj = new JSONObject(); + resultObj.put("newCount", newCount); + resultObj.put("oldCount", oldCount); + logger.error("资产清单新旧SQL获取结果不一致:{}", resultObj); + return false; + } + return true; + } + + private boolean checkInspectResourceListIsEquals(List resourceList, List oldResourceList) { + if (oldResourceList.size() != resourceList.size()) { + JSONObject errorObj = new JSONObject(); + errorObj.put("resourceList.size()", resourceList.size()); + errorObj.put("oldResourceList.size()", oldResourceList.size()); + logger.error("资产清单新旧SQL获取tbodyList结果不一致:{}", errorObj); + return false; + } + boolean flag = true; + resourceList.sort(Comparator.comparing(InspectResourceVo::getId)); + oldResourceList.sort(Comparator.comparing(InspectResourceVo::getId)); + for (int i = 0; i < resourceList.size(); i++) { + InspectResourceVo resourceVo = resourceList.get(i); + InspectResourceVo oldResourceVo = oldResourceList.get(i); + String resourceString = JSONObject.toJSONString(resourceVo); + String oldResourceString = JSONObject.toJSONString(oldResourceVo); + if (!Objects.equals(resourceString, oldResourceString)) { + JSONObject errorObj = new JSONObject(); + errorObj.put("index", i); + errorObj.put("resourceVo", resourceVo); + errorObj.put("oldResourceVo", oldResourceVo); + logger.error("资产清单新旧SQL获取tbodyObj结果不一致:{}", errorObj); + flag = false; + } + } + return flag; + } + + private boolean checkInspectConfigFilePathListIsEquals(List resourceList, List oldResourceList) { + if (oldResourceList.size() != resourceList.size()) { + JSONObject errorObj = new JSONObject(); + errorObj.put("resourceList.size()", resourceList.size()); + errorObj.put("oldResourceList.size()", oldResourceList.size()); + logger.error("资产清单新旧SQL获取tbodyList结果不一致:{}", errorObj); + return false; + } + boolean flag = true; + resourceList.sort(Comparator.comparing(InspectConfigFilePathVo::getId)); + oldResourceList.sort(Comparator.comparing(InspectConfigFilePathVo::getId)); + for (int i = 0; i < resourceList.size(); i++) { + InspectConfigFilePathVo resourceVo = resourceList.get(i); + InspectConfigFilePathVo oldResourceVo = oldResourceList.get(i); + String resourceString = JSONObject.toJSONString(resourceVo); + String oldResourceString = JSONObject.toJSONString(oldResourceVo); + if (!Objects.equals(resourceString, oldResourceString)) { + JSONObject errorObj = new JSONObject(); + errorObj.put("index", i); + errorObj.put("resourceVo", resourceVo); + errorObj.put("oldResourceVo", oldResourceVo); + logger.error("资产清单新旧SQL获取tbodyObj结果不一致:{}", errorObj); + flag = false; + } + } + return flag; + } +} -- Gitee From 7b830382acf578a5d590c70751c9732ab8b2fd64 Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Sun, 7 Sep 2025 13:37:10 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E5=B0=86=E6=B6=89?= =?UTF-8?q?=E5=8F=8Ascence=5Fipobject=5Fdetail=E8=A7=86=E5=9B=BE=E7=9A=84S?= =?UTF-8?q?QL=E8=AF=AD=E5=8F=A5=E6=94=B9=E6=88=90=E5=8A=A8=E6=80=81sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1469827334504448]将涉及scence_ipobject_detail视图的SQL语句改成动态sql http://192.168.0.96:8090/demo/rdm.html#/task-detail/939050947543040/939050947543050/1469827334504448 --- .../inspect/service/InspectServiceImpl.java | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/main/java/neatlogic/module/inspect/service/InspectServiceImpl.java b/src/main/java/neatlogic/module/inspect/service/InspectServiceImpl.java index c909d46..0df2bdc 100644 --- a/src/main/java/neatlogic/module/inspect/service/InspectServiceImpl.java +++ b/src/main/java/neatlogic/module/inspect/service/InspectServiceImpl.java @@ -64,8 +64,8 @@ public class InspectServiceImpl implements InspectService { List oldResourceList = new ArrayList<>(); if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); - String newSql = resourceBuildSqlCrossoverService.buildGetInspectResourceListByIdListSql(idList); - newResourceList = inspectMapper.getInspectResourceListByIdListSql(newSql); + String sql = resourceBuildSqlCrossoverService.buildGetInspectResourceListByIdListSql(idList); + newResourceList = inspectMapper.getInspectResourceListByIdListSql(sql); } if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { oldResourceList = inspectMapper.getInspectResourceListByIdList(idList); @@ -84,8 +84,8 @@ public class InspectServiceImpl implements InspectService { @Override public List getInspectResourceListByIdList(List idList, List selectFieldNameList) { IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); - String newSql = resourceBuildSqlCrossoverService.buildGetInspectResourceListByIdListSql(idList, selectFieldNameList); - return inspectMapper.getInspectResourceListByIdListSql(newSql); + String sql = resourceBuildSqlCrossoverService.buildGetInspectResourceListByIdListSql(idList, selectFieldNameList); + return inspectMapper.getInspectResourceListByIdListSql(sql); } @Override @@ -96,8 +96,8 @@ public class InspectServiceImpl implements InspectService { List oldResourceList = new ArrayList<>(); if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); - String newSql = resourceBuildSqlCrossoverService.buildGetInspectResourceListByIdListAndJobIdSql(idList, jobId); - newResourceList = inspectMapper.getInspectResourceListByIdListSql(newSql); + String sql = resourceBuildSqlCrossoverService.buildGetInspectResourceListByIdListAndJobIdSql(idList, jobId); + newResourceList = inspectMapper.getInspectResourceListByIdListSql(sql); } if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { oldResourceList = inspectMapper.getInspectResourceListByIdListAndJobId(idList, jobId); @@ -116,8 +116,8 @@ public class InspectServiceImpl implements InspectService { @Override public List getInspectResourceListByIdListAndJobId(List idList, Long jobId, List selectFieldNameList) { IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); - String newSql = resourceBuildSqlCrossoverService.buildGetInspectResourceListByIdListAndJobIdSql(idList, jobId, selectFieldNameList); - return inspectMapper.getInspectResourceListByIdListSql(newSql); + String sql = resourceBuildSqlCrossoverService.buildGetInspectResourceListByIdListAndJobIdSql(idList, jobId, selectFieldNameList); + return inspectMapper.getInspectResourceListByIdListSql(sql); } @Override @@ -129,8 +129,8 @@ public class InspectServiceImpl implements InspectService { if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { IResourceCrossoverMapper resourceCrossoverMapper = CrossoverServiceFactory.getApi(IResourceCrossoverMapper.class); IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); - String newSql = resourceBuildSqlCrossoverService.buildGetInspectResourceCountSql(searchVo); - newCount = resourceCrossoverMapper.getCountBySql(newSql); + String sql = resourceBuildSqlCrossoverService.buildGetInspectResourceCountSql(searchVo); + newCount = resourceCrossoverMapper.getCountBySql(sql); } if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { oldCount = inspectMapper.getInspectResourceCount(searchVo); @@ -155,8 +155,8 @@ public class InspectServiceImpl implements InspectService { if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { IResourceCrossoverMapper resourceCrossoverMapper = CrossoverServiceFactory.getApi(IResourceCrossoverMapper.class); IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); - String newSql = resourceBuildSqlCrossoverService.buildGetInspectResourceCountByIpKeywordSql(searchVo); - newCount = resourceCrossoverMapper.getCountBySql(newSql); + String sql = resourceBuildSqlCrossoverService.buildGetInspectResourceCountByIpKeywordSql(searchVo); + newCount = resourceCrossoverMapper.getCountBySql(sql); } if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { oldCount = inspectMapper.getInspectResourceCountByIpKeyword(searchVo); @@ -181,8 +181,8 @@ public class InspectServiceImpl implements InspectService { if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { IResourceCrossoverMapper resourceCrossoverMapper = CrossoverServiceFactory.getApi(IResourceCrossoverMapper.class); IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); - String newSql = resourceBuildSqlCrossoverService.buildGetInspectResourceCountByNameKeywordSql(searchVo); - newCount = resourceCrossoverMapper.getCountBySql(newSql); + String sql = resourceBuildSqlCrossoverService.buildGetInspectResourceCountByNameKeywordSql(searchVo); + newCount = resourceCrossoverMapper.getCountBySql(sql); } if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { oldCount = inspectMapper.getInspectResourceCountByNameKeyword(searchVo); @@ -207,8 +207,8 @@ public class InspectServiceImpl implements InspectService { if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { IResourceCrossoverMapper resourceCrossoverMapper = CrossoverServiceFactory.getApi(IResourceCrossoverMapper.class); IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); - String getResourceIdListSql = resourceBuildSqlCrossoverService.buildGetInspectResourceIdListSql(searchVo); - newIdList = resourceCrossoverMapper.getIdListBySql(getResourceIdListSql); + String sql = resourceBuildSqlCrossoverService.buildGetInspectResourceIdListSql(searchVo); + newIdList = resourceCrossoverMapper.getIdListBySql(sql); } if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { oldIdList = inspectMapper.getInspectResourceIdList(searchVo); @@ -233,8 +233,8 @@ public class InspectServiceImpl implements InspectService { if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { IResourceCrossoverMapper resourceCrossoverMapper = CrossoverServiceFactory.getApi(IResourceCrossoverMapper.class); IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); - String newSql = resourceBuildSqlCrossoverService.buildGetInspectAutoexecJobNodeResourceCountSql(searchVo, jobId); - newCount = resourceCrossoverMapper.getCountBySql(newSql); + String sql = resourceBuildSqlCrossoverService.buildGetInspectAutoexecJobNodeResourceCountSql(searchVo, jobId); + newCount = resourceCrossoverMapper.getCountBySql(sql); } if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { oldCount = inspectMapper.getInspectAutoexecJobNodeResourceCount(searchVo, jobId); @@ -259,8 +259,8 @@ public class InspectServiceImpl implements InspectService { if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { IResourceCrossoverMapper resourceCrossoverMapper = CrossoverServiceFactory.getApi(IResourceCrossoverMapper.class); IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); - String newSql = resourceBuildSqlCrossoverService.buildGetInspectAutoexecJobNodeResourceCountByIpKeywordSql(searchVo, jobId); - newCount = resourceCrossoverMapper.getCountBySql(newSql); + String sql = resourceBuildSqlCrossoverService.buildGetInspectAutoexecJobNodeResourceCountByIpKeywordSql(searchVo, jobId); + newCount = resourceCrossoverMapper.getCountBySql(sql); } if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { oldCount = inspectMapper.getInspectAutoexecJobNodeResourceCountByIpKeyword(searchVo, jobId); @@ -285,8 +285,8 @@ public class InspectServiceImpl implements InspectService { if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { IResourceCrossoverMapper resourceCrossoverMapper = CrossoverServiceFactory.getApi(IResourceCrossoverMapper.class); IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); - String newSql = resourceBuildSqlCrossoverService.buildGetInspectAutoexecJobNodeResourceCountByNameKeywordSql(searchVo, jobId); - newCount = resourceCrossoverMapper.getCountBySql(newSql); + String sql = resourceBuildSqlCrossoverService.buildGetInspectAutoexecJobNodeResourceCountByNameKeywordSql(searchVo, jobId); + newCount = resourceCrossoverMapper.getCountBySql(sql); } if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { oldCount = inspectMapper.getInspectAutoexecJobNodeResourceCountByNameKeyword(searchVo, jobId); @@ -364,8 +364,8 @@ public class InspectServiceImpl implements InspectService { IResourceCrossoverMapper resourceCrossoverMapper = CrossoverServiceFactory.getApi(IResourceCrossoverMapper.class); IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); ResourceSearchVo searchVo = JSONObject.parseObject(JSONObject.toJSONString(inspectConfigFilePathSearchVo), ResourceSearchVo.class); - String newSql = resourceBuildSqlCrossoverService.buildGetInspectConfigFilePathCountSql(searchVo); - newCount = resourceCrossoverMapper.getCountBySql(newSql); + String sql = resourceBuildSqlCrossoverService.buildGetInspectConfigFilePathCountSql(searchVo); + newCount = resourceCrossoverMapper.getCountBySql(sql); } if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { oldCount = inspectConfigFileMapper.getInspectConfigFilePathCount(inspectConfigFilePathSearchVo); @@ -391,8 +391,8 @@ public class InspectServiceImpl implements InspectService { IResourceCrossoverMapper resourceCrossoverMapper = CrossoverServiceFactory.getApi(IResourceCrossoverMapper.class); IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); ResourceSearchVo searchVo = JSONObject.parseObject(JSONObject.toJSONString(inspectConfigFilePathSearchVo), ResourceSearchVo.class); - String newSql = resourceBuildSqlCrossoverService.buildGetInspectConfigFilePathIdListSql(searchVo); - newIdList = resourceCrossoverMapper.getIdListBySql(newSql); + String sql = resourceBuildSqlCrossoverService.buildGetInspectConfigFilePathIdListSql(searchVo); + newIdList = resourceCrossoverMapper.getIdListBySql(sql); } if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { oldIdList = inspectConfigFileMapper.getInspectConfigFilePathIdList(inspectConfigFilePathSearchVo); @@ -416,8 +416,8 @@ public class InspectServiceImpl implements InspectService { List oldResourceList = new ArrayList<>(); if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); - String newSql = resourceBuildSqlCrossoverService.buildGetInspectConfigFilePathListSql(idList); - newResourceList = inspectConfigFileMapper.getInspectConfigFilePathListBySql(newSql); + String sql = resourceBuildSqlCrossoverService.buildGetInspectConfigFilePathListSql(idList); + newResourceList = inspectConfigFileMapper.getInspectConfigFilePathListBySql(sql); } if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { oldResourceList = inspectConfigFileMapper.getInspectConfigFilePathList(idList); @@ -441,8 +441,8 @@ public class InspectServiceImpl implements InspectService { List oldResourceList = new ArrayList<>(); if (Objects.equals(mode, JSQLPARSER_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { IResourceBuildSqlCrossoverService resourceBuildSqlCrossoverService = CrossoverServiceFactory.getApi(IResourceBuildSqlCrossoverService.class); - String newSql = resourceBuildSqlCrossoverService.buildGetInspectConfigFilePathListByJobIdSql(jobId); - newResourceList = inspectConfigFileMapper.getInspectConfigFilePathListBySql(newSql); + String sql = resourceBuildSqlCrossoverService.buildGetInspectConfigFilePathListByJobIdSql(jobId); + newResourceList = inspectConfigFileMapper.getInspectConfigFilePathListBySql(sql); } if (Objects.equals(mode, MYBATIS_MODE) || Objects.equals(enable, COMPARISON_ENABLED)) { oldResourceList = inspectConfigFileMapper.getInspectConfigFilePathListByJobId(jobId); -- Gitee