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