From 6f1da5b2eeeae52dcc55357fb35a4a5fc1bc0596 Mon Sep 17 00:00:00 2001 From: caihaohan Date: Wed, 24 Apr 2024 17:36:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=81=E6=A0=87=E5=88=B6=E4=BF=AE?= =?UTF-8?q?=E8=AE=A2=E6=B5=81=E7=A8=8B=E7=BB=93=E6=9D=9F=E4=B8=8D=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E4=BC=81=E6=A0=87BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/service/impl/LawsCommonServiceImpl.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/laws-modules/src/main/java/com/jero/modules/laws/common/service/impl/LawsCommonServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/laws/common/service/impl/LawsCommonServiceImpl.java index 6670ba87..35810970 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/common/service/impl/LawsCommonServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/common/service/impl/LawsCommonServiceImpl.java @@ -729,12 +729,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService { // 对默认的字段赋值 String existId = parameterMap.get(FieldCommon.ID) == null ? "" : parameterMap.get(FieldCommon.ID).toString(); //先新增后面在编辑 - String id = ""; - if (StrUtil.isBlank(existId)) { - id = executeInsertByModel(module); - } else { - id = existId; - } + String id = executeInsertByModel(module, existId); // 更新语句 UpdateWrapper updateWrapper = new UpdateWrapper(); updateWrapper.eq("id", id); @@ -966,21 +961,25 @@ public class LawsCommonServiceImpl implements ILawsCommonService { } } - private String executeInsertByModel(String module) { + private String executeInsertByModel(String module, String id) { if (TableNameEnum.DOMESTIC_REGULATIONS.getValue().equals(module)) { LawsDomesticStandard lawsDomesticStandard = new LawsDomesticStandard(); + lawsDomesticStandard.setId(id); lawsDomesticStandardService.save(lawsDomesticStandard); return lawsDomesticStandard.getId(); } else if (TableNameEnum.FOREIGN_REGULATIONS.getValue().equals(module)) { LawsOverseasStandard lawsOverseasStandard = new LawsOverseasStandard(); + lawsOverseasStandard.setId(id); lawsOverseasStandardService.save(lawsOverseasStandard); return lawsOverseasStandard.getId(); } else if (TableNameEnum.ENTERPRISE_STANDARDS.getValue().equals(module)) { LawsEnterpriseStandard lawsEnterpriseStandard = new LawsEnterpriseStandard(); + lawsEnterpriseStandard.setId(id); lawsEnterpriseStandardService.save(lawsEnterpriseStandard); return lawsEnterpriseStandard.getId(); } else { LawsDocumentSplit lawsDocumentSplit = new LawsDocumentSplit(); + lawsDocumentSplit.setId(id); documentSplitMapper.insert(lawsDocumentSplit); return lawsDocumentSplit.getId(); }