From 409a078e2d259f56dc4107a688e0ccc024c64592 Mon Sep 17 00:00:00 2001 From: gxwebsoft <170083662@qq.com> Date: Wed, 25 Feb 2026 12:59:50 +0800 Subject: [PATCH] =?UTF-8?q?feat(batch-import):=20=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=8A=9F=E8=83=BD=E6=94=AF=E6=8C=81=E4=BC=81?= =?UTF-8?q?=E4=B8=9A=E5=90=8D=E7=A7=B0=E5=9B=9E=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 BatchImportSupport 中新增 refreshCompanyIdByCompanyName 方法用于按企业名称匹配并回填 companyId 和 companyName - 在 CreditAdministrativeLicenseController、CreditBranchController、CreditHistoricalLegalPersonController、CreditNearbyCompanyController 和 CreditSuspectedRelationshipController 中添加公司名称回填逻辑 - 修改实体类中 companyName 字段的 TableField 注解从 exist=false 改为 company_name - 更新各个 Mapper XML 文件中的查询 SQL,使用 COALESCE 函数确保当关联企业名称为空时使用本地存储的公司名称 - 在批量导入过程中增加固定公司名称的获取和设置逻辑 --- .../credit/controller/BatchImportSupport.java | 85 +++++++++++++++++++ ...CreditAdministrativeLicenseController.java | 18 ++++ .../controller/CreditBranchController.java | 10 +++ ...CreditHistoricalLegalPersonController.java | 10 +++ .../CreditNearbyCompanyController.java | 10 +++ ...CreditSuspectedRelationshipController.java | 10 +++ .../entity/CreditAdministrativeLicense.java | 2 +- .../gxwebsoft/credit/entity/CreditBranch.java | 2 +- .../entity/CreditHistoricalLegalPerson.java | 2 +- .../credit/entity/CreditNearbyCompany.java | 2 +- .../entity/CreditSuspectedRelationship.java | 2 +- .../xml/CreditAdministrativeLicenseMapper.xml | 2 +- .../credit/mapper/xml/CreditBranchMapper.xml | 2 +- .../xml/CreditHistoricalLegalPersonMapper.xml | 2 +- .../mapper/xml/CreditNearbyCompanyMapper.xml | 2 +- .../xml/CreditSuspectedRelationshipMapper.xml | 2 +- 16 files changed, 153 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/gxwebsoft/credit/controller/BatchImportSupport.java b/src/main/java/com/gxwebsoft/credit/controller/BatchImportSupport.java index 07f4873..407b0cb 100644 --- a/src/main/java/com/gxwebsoft/credit/controller/BatchImportSupport.java +++ b/src/main/java/com/gxwebsoft/credit/controller/BatchImportSupport.java @@ -178,6 +178,43 @@ public class BatchImportSupport { nameGetter); } + /** + * 按企业名称匹配 CreditCompany(name / matchName) 并回填 companyId + companyName。 + * + *

companyNameSetter 为空时等价于仅回填 companyId。

+ */ + public CompanyIdRefreshStats refreshCompanyIdByCompanyName(IService service, + CreditCompanyService creditCompanyService, + Integer currentTenantId, + Boolean onlyNull, + Integer limit, + SFunction idGetter, + BiConsumer idSetter, + SFunction nameGetter, + SFunction companyIdGetter, + BiConsumer companyIdSetter, + BiConsumer companyNameSetter, + SFunction hasDataGetter, + BiConsumer hasDataSetter, + SFunction tenantIdGetter, + Supplier patchFactory) { + return refreshCompanyIdByCompanyNames(service, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + idGetter, + idSetter, + companyIdGetter, + companyIdSetter, + companyNameSetter, + hasDataGetter, + hasDataSetter, + tenantIdGetter, + patchFactory, + nameGetter); + } + /** * 按多列“当事人/企业名称”匹配 CreditCompany(name / matchName) 并回填 companyId。 * @@ -200,6 +237,44 @@ public class BatchImportSupport { SFunction tenantIdGetter, Supplier patchFactory, SFunction... nameGetters) { + return refreshCompanyIdByCompanyNames(service, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + idGetter, + idSetter, + companyIdGetter, + companyIdSetter, + null, + hasDataGetter, + hasDataSetter, + tenantIdGetter, + patchFactory, + nameGetters); + } + + /** + * 按多列“当事人/企业名称”匹配 CreditCompany(name / matchName) 并回填 companyId + companyName。 + * + *

companyNameSetter 为空时等价于仅回填 companyId。

+ */ + @SafeVarargs + public final CompanyIdRefreshStats refreshCompanyIdByCompanyNames(IService service, + CreditCompanyService creditCompanyService, + Integer currentTenantId, + Boolean onlyNull, + Integer limit, + SFunction idGetter, + BiConsumer idSetter, + SFunction companyIdGetter, + BiConsumer companyIdSetter, + BiConsumer companyNameSetter, + SFunction hasDataGetter, + BiConsumer hasDataSetter, + SFunction tenantIdGetter, + Supplier patchFactory, + SFunction... nameGetters) { boolean onlyNullFlag = (onlyNull == null) || Boolean.TRUE.equals(onlyNull); if (nameGetters == null || nameGetters.length == 0) { @@ -280,6 +355,7 @@ public class BatchImportSupport { // 3.1) 查询当前租户下的 companyId 映射 LinkedHashMap companyIdByName = new LinkedHashMap<>(); LinkedHashMap ambiguousByName = new LinkedHashMap<>(); + HashMap companyNameById = new HashMap<>(); LinkedHashSet nameSet = new LinkedHashSet<>(); for (T row : tenantRows) { if (row == null) { @@ -309,6 +385,9 @@ public class BatchImportSupport { if (c == null || c.getId() == null) { continue; } + if (c.getName() != null && !c.getName().trim().isEmpty()) { + companyNameById.putIfAbsent(c.getId(), c.getName().trim()); + } addCompanyNameMapping(companyIdByName, ambiguousByName, normalizeCompanyName(c.getName()), c.getId()); addCompanyNameMapping(companyIdByName, ambiguousByName, normalizeCompanyName(c.getMatchName()), c.getId()); } @@ -381,6 +460,12 @@ public class BatchImportSupport { T patch = patchFactory.get(); idSetter.accept(patch, id); companyIdSetter.accept(patch, companyId); + if (companyNameSetter != null) { + String companyName = companyNameById.get(companyId); + if (companyName != null && !companyName.trim().isEmpty()) { + companyNameSetter.accept(patch, companyName.trim()); + } + } hasDataSetter.accept(patch, Boolean.TRUE); updates.add(patch); if (updates.size() >= batchSize) { diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditAdministrativeLicenseController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditAdministrativeLicenseController.java index 6bd8ba8..f37fb09 100644 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditAdministrativeLicenseController.java +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditAdministrativeLicenseController.java @@ -6,6 +6,7 @@ import com.gxwebsoft.common.core.web.BaseController; import com.gxwebsoft.common.core.web.BatchParam; import com.gxwebsoft.common.core.web.PageResult; import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditCompany; import com.gxwebsoft.credit.entity.CreditAdministrativeLicense; import com.gxwebsoft.credit.param.CreditAdministrativeLicenseImportParam; import com.gxwebsoft.credit.param.CreditAdministrativeLicenseParam; @@ -170,6 +171,7 @@ public class CreditAdministrativeLicenseController extends BaseController { CreditAdministrativeLicense::getName, CreditAdministrativeLicense::getCompanyId, CreditAdministrativeLicense::setCompanyId, + CreditAdministrativeLicense::setCompanyName, CreditAdministrativeLicense::getHasData, CreditAdministrativeLicense::setHasData, CreditAdministrativeLicense::getTenantId, @@ -211,6 +213,11 @@ public class CreditAdministrativeLicenseController extends BaseController { Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; Map urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "决定文书/许可编号"); Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "决定文书/许可证名称"); + String fixedCompanyName = null; + if (companyId != null && companyId > 0) { + CreditCompany fixedCompany = creditCompanyService.getById(companyId); + fixedCompanyName = fixedCompany != null ? fixedCompany.getName() : null; + } final int chunkSize = 500; final int mpBatchSize = 500; @@ -234,6 +241,9 @@ public class CreditAdministrativeLicenseController extends BaseController { if (item.getCompanyId() == null && companyId != null) { item.setCompanyId(companyId); + if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) { + item.setCompanyName(fixedCompanyName); + } } if (item.getCompanyId() != null && item.getCompanyId() > 0) { touchedCompanyIds.add(item.getCompanyId()); @@ -346,6 +356,11 @@ public class CreditAdministrativeLicenseController extends BaseController { Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; Map urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "决定文书/许可编号"); Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "决定文书/许可证名称"); + String fixedCompanyName = null; + if (companyId != null && companyId > 0) { + CreditCompany fixedCompany = creditCompanyService.getById(companyId); + fixedCompanyName = fixedCompany != null ? fixedCompany.getName() : null; + } final int chunkSize = 500; final int mpBatchSize = 500; @@ -382,6 +397,9 @@ public class CreditAdministrativeLicenseController extends BaseController { if (item.getCompanyId() == null && companyId != null) { item.setCompanyId(companyId); + if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) { + item.setCompanyName(fixedCompanyName); + } } if (item.getUserId() == null && currentUserId != null) { item.setUserId(currentUserId); diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditBranchController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditBranchController.java index 53d46c1..f6f70cc 100644 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditBranchController.java +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditBranchController.java @@ -6,6 +6,7 @@ import com.gxwebsoft.common.core.web.BaseController; import com.gxwebsoft.common.core.web.BatchParam; import com.gxwebsoft.common.core.web.PageResult; import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditCompany; import com.gxwebsoft.credit.entity.CreditBranch; import com.gxwebsoft.credit.param.CreditBranchImportParam; import com.gxwebsoft.credit.param.CreditBranchParam; @@ -170,6 +171,7 @@ public class CreditBranchController extends BaseController { CreditBranch::getName, CreditBranch::getCompanyId, CreditBranch::setCompanyId, + CreditBranch::setCompanyName, CreditBranch::getHasData, CreditBranch::setHasData, CreditBranch::getTenantId, @@ -210,6 +212,11 @@ public class CreditBranchController extends BaseController { Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "分支机构名称"); + String fixedCompanyName = null; + if (companyId != null && companyId > 0) { + CreditCompany fixedCompany = creditCompanyService.getById(companyId); + fixedCompanyName = fixedCompany != null ? fixedCompany.getName() : null; + } final int chunkSize = 500; final int mpBatchSize = 500; @@ -229,6 +236,9 @@ public class CreditBranchController extends BaseController { if (item.getCompanyId() == null && companyId != null) { item.setCompanyId(companyId); + if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) { + item.setCompanyName(fixedCompanyName); + } } if (item.getUserId() == null && currentUserId != null) { item.setUserId(currentUserId); diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditHistoricalLegalPersonController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditHistoricalLegalPersonController.java index 28aa329..775dee9 100644 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditHistoricalLegalPersonController.java +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditHistoricalLegalPersonController.java @@ -6,6 +6,7 @@ import com.gxwebsoft.common.core.web.BaseController; import com.gxwebsoft.common.core.web.BatchParam; import com.gxwebsoft.common.core.web.PageResult; import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditCompany; import com.gxwebsoft.credit.entity.CreditHistoricalLegalPerson; import com.gxwebsoft.credit.param.CreditHistoricalLegalPersonImportParam; import com.gxwebsoft.credit.param.CreditHistoricalLegalPersonParam; @@ -170,6 +171,7 @@ public class CreditHistoricalLegalPersonController extends BaseController { CreditHistoricalLegalPerson::getName, CreditHistoricalLegalPerson::getCompanyId, CreditHistoricalLegalPerson::setCompanyId, + CreditHistoricalLegalPerson::setCompanyName, CreditHistoricalLegalPerson::getHasData, CreditHistoricalLegalPerson::setHasData, CreditHistoricalLegalPerson::getTenantId, @@ -210,6 +212,11 @@ public class CreditHistoricalLegalPersonController extends BaseController { Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "名称"); + String fixedCompanyName = null; + if (companyId != null && companyId > 0) { + CreditCompany fixedCompany = creditCompanyService.getById(companyId); + fixedCompanyName = fixedCompany != null ? fixedCompany.getName() : null; + } final int chunkSize = 500; final int mpBatchSize = 500; @@ -229,6 +236,9 @@ public class CreditHistoricalLegalPersonController extends BaseController { if (item.getCompanyId() == null && companyId != null) { item.setCompanyId(companyId); + if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) { + item.setCompanyName(fixedCompanyName); + } } if (item.getUserId() == null && currentUserId != null) { item.setUserId(currentUserId); diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditNearbyCompanyController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditNearbyCompanyController.java index 4411337..3144860 100644 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditNearbyCompanyController.java +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditNearbyCompanyController.java @@ -6,6 +6,7 @@ import com.gxwebsoft.common.core.web.BaseController; import com.gxwebsoft.common.core.web.BatchParam; import com.gxwebsoft.common.core.web.PageResult; import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditCompany; import com.gxwebsoft.credit.entity.CreditNearbyCompany; import com.gxwebsoft.credit.param.CreditNearbyCompanyImportParam; import com.gxwebsoft.credit.param.CreditNearbyCompanyParam; @@ -170,6 +171,7 @@ public class CreditNearbyCompanyController extends BaseController { CreditNearbyCompany::getName, CreditNearbyCompany::getCompanyId, CreditNearbyCompany::setCompanyId, + CreditNearbyCompany::setCompanyName, CreditNearbyCompany::getHasData, CreditNearbyCompany::setHasData, CreditNearbyCompany::getTenantId, @@ -213,6 +215,11 @@ public class CreditNearbyCompanyController extends BaseController { Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; Map urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "统一社会信用代码"); Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "企业名称"); + String fixedCompanyName = null; + if (companyId != null && companyId > 0) { + CreditCompany fixedCompany = creditCompanyService.getById(companyId); + fixedCompanyName = fixedCompany != null ? fixedCompany.getName() : null; + } // 避免逐行写库:按批处理,显著降低 SQL 次数与事务开销 final int chunkSize = 500; @@ -243,6 +250,9 @@ public class CreditNearbyCompanyController extends BaseController { } if (item.getCompanyId() == null && companyId != null) { item.setCompanyId(companyId); + if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) { + item.setCompanyName(fixedCompanyName); + } } if (item.getCompanyId() != null && item.getCompanyId() > 0) { touchedCompanyIds.add(item.getCompanyId()); diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditSuspectedRelationshipController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditSuspectedRelationshipController.java index 30670bf..10d94ee 100644 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditSuspectedRelationshipController.java +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditSuspectedRelationshipController.java @@ -6,6 +6,7 @@ import com.gxwebsoft.common.core.web.BaseController; import com.gxwebsoft.common.core.web.BatchParam; import com.gxwebsoft.common.core.web.PageResult; import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditCompany; import com.gxwebsoft.credit.entity.CreditSuspectedRelationship; import com.gxwebsoft.credit.param.CreditSuspectedRelationshipImportParam; import com.gxwebsoft.credit.param.CreditSuspectedRelationshipParam; @@ -170,6 +171,7 @@ public class CreditSuspectedRelationshipController extends BaseController { CreditSuspectedRelationship::getName, CreditSuspectedRelationship::getCompanyId, CreditSuspectedRelationship::setCompanyId, + CreditSuspectedRelationship::setCompanyName, CreditSuspectedRelationship::getHasData, CreditSuspectedRelationship::setHasData, CreditSuspectedRelationship::getTenantId, @@ -210,6 +212,11 @@ public class CreditSuspectedRelationshipController extends BaseController { Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "企业名称"); + String fixedCompanyName = null; + if (companyId != null && companyId > 0) { + CreditCompany fixedCompany = creditCompanyService.getById(companyId); + fixedCompanyName = fixedCompany != null ? fixedCompany.getName() : null; + } final int chunkSize = 500; final int mpBatchSize = 500; @@ -229,6 +236,9 @@ public class CreditSuspectedRelationshipController extends BaseController { if (item.getCompanyId() == null && companyId != null) { item.setCompanyId(companyId); + if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) { + item.setCompanyName(fixedCompanyName); + } } if (item.getUserId() == null && currentUserId != null) { item.setUserId(currentUserId); diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditAdministrativeLicense.java b/src/main/java/com/gxwebsoft/credit/entity/CreditAdministrativeLicense.java index 374408f..10211f4 100644 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditAdministrativeLicense.java +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditAdministrativeLicense.java @@ -72,7 +72,7 @@ public class CreditAdministrativeLicense implements Serializable { private Integer companyId; @Schema(description = "主体企业") - @TableField(exist = false) + @TableField("company_name") private String companyName; @Schema(description = "是否推荐") diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditBranch.java b/src/main/java/com/gxwebsoft/credit/entity/CreditBranch.java index 8cf0447..9725cd5 100644 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditBranch.java +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditBranch.java @@ -56,7 +56,7 @@ public class CreditBranch implements Serializable { private Integer companyId; @Schema(description = "主题企业") - @TableField(exist = false) + @TableField("company_name") private String companyName; @Schema(description = "是否推荐") diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditHistoricalLegalPerson.java b/src/main/java/com/gxwebsoft/credit/entity/CreditHistoricalLegalPerson.java index f8557e2..7fdc887 100644 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditHistoricalLegalPerson.java +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditHistoricalLegalPerson.java @@ -50,7 +50,7 @@ public class CreditHistoricalLegalPerson implements Serializable { private Integer companyId; @Schema(description = "主体企业") - @TableField(exist = false) + @TableField("company_name") private String companyName; @Schema(description = "是否推荐") diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditNearbyCompany.java b/src/main/java/com/gxwebsoft/credit/entity/CreditNearbyCompany.java index 6c844eb..b71cac2 100644 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditNearbyCompany.java +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditNearbyCompany.java @@ -80,7 +80,7 @@ public class CreditNearbyCompany implements Serializable { private Integer companyId; @Schema(description = "主体企业") - @TableField(exist = false) + @TableField("company_name") private String companyName; @Schema(description = "纳税人识别号") diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditSuspectedRelationship.java b/src/main/java/com/gxwebsoft/credit/entity/CreditSuspectedRelationship.java index 41898c8..59339c9 100644 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditSuspectedRelationship.java +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditSuspectedRelationship.java @@ -65,7 +65,7 @@ public class CreditSuspectedRelationship implements Serializable { private Integer companyId; @Schema(description = "主体企业") - @TableField(exist = false) + @TableField("company_name") private String companyName; @Schema(description = "是否推荐") diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditAdministrativeLicenseMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditAdministrativeLicenseMapper.xml index 68cfa78..3c512fe 100644 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditAdministrativeLicenseMapper.xml +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditAdministrativeLicenseMapper.xml @@ -4,7 +4,7 @@ - SELECT a.*, b.name AS companyName, u.real_name AS realName + SELECT a.*, COALESCE(b.name, a.company_name) AS companyName, u.real_name AS realName FROM credit_administrative_license a LEFT JOIN credit_company b ON a.company_id = b.id LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditBranchMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditBranchMapper.xml index d5e33ea..4aadd0b 100644 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditBranchMapper.xml +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditBranchMapper.xml @@ -4,7 +4,7 @@ - SELECT a.*, b.name AS companyName, u.real_name AS realName + SELECT a.*, COALESCE(b.name, a.company_name) AS companyName, u.real_name AS realName FROM credit_branch a LEFT JOIN credit_company b ON a.company_id = b.id LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditHistoricalLegalPersonMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditHistoricalLegalPersonMapper.xml index 2d25fd4..42e1f28 100644 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditHistoricalLegalPersonMapper.xml +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditHistoricalLegalPersonMapper.xml @@ -4,7 +4,7 @@ - SELECT a.*, b.name AS companyName, u.real_name AS realName + SELECT a.*, COALESCE(b.name, a.company_name) AS companyName, u.real_name AS realName FROM credit_historical_legal_person a LEFT JOIN credit_company b ON a.company_id = b.id LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditNearbyCompanyMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditNearbyCompanyMapper.xml index c461f3e..ad16c3f 100644 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditNearbyCompanyMapper.xml +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditNearbyCompanyMapper.xml @@ -4,7 +4,7 @@ - SELECT a.*,b.name AS companyName, u.real_name AS realName + SELECT a.*, COALESCE(b.name, a.company_name) AS companyName, u.real_name AS realName FROM credit_nearby_company a LEFT JOIN credit_company b ON a.company_id = b.id LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditSuspectedRelationshipMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditSuspectedRelationshipMapper.xml index 28c2722..b2062e8 100644 --- a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditSuspectedRelationshipMapper.xml +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditSuspectedRelationshipMapper.xml @@ -4,7 +4,7 @@ - SELECT a.*, b.name AS companyName, u.real_name AS realName + SELECT a.*, COALESCE(b.name, a.company_name) AS companyName, u.real_name AS realName FROM credit_suspected_relationship a LEFT JOIN credit_company b ON a.company_id = b.id LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id