diff --git a/archives/src/main/java/com/storeroom/modules/dictionary/domain/ArchivesNoSetting.java b/archives/src/main/java/com/storeroom/modules/dictionary/domain/ArchivesNoSetting.java index f5b5061..451d121 100644 --- a/archives/src/main/java/com/storeroom/modules/dictionary/domain/ArchivesNoSetting.java +++ b/archives/src/main/java/com/storeroom/modules/dictionary/domain/ArchivesNoSetting.java @@ -27,12 +27,12 @@ public class ArchivesNoSetting extends BaseEntity implements Serializable { private String id; @ApiModelProperty(value = "列名") - @Column(name = "filed_cn_name") - private String filedCnName; + @Column(name = "field_cn_name") + private String fieldCnName; @ApiModelProperty(value = "字段名") - @Column(name = "filed_name") - private String filedName; + @Column(name = "field_name") + private String fieldName; @ApiModelProperty(value = "连接符") @Column(name = "connector") @@ -55,11 +55,11 @@ public class ArchivesNoSetting extends BaseEntity implements Serializable { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ArchivesNoSetting that = (ArchivesNoSetting) o; - return Objects.equals(id, that.id) && Objects.equals(filedCnName, that.filedCnName) && Objects.equals(filedName, that.filedName) && Objects.equals(connector, that.connector) && Objects.equals(sequence, that.sequence) && Objects.equals(categoryId, that.categoryId) && Objects.equals(dictionaryId, that.dictionaryId); + return Objects.equals(id, that.id) && Objects.equals(fieldCnName, that.fieldCnName) && Objects.equals(fieldName, that.fieldName) && Objects.equals(connector, that.connector) && Objects.equals(sequence, that.sequence) && Objects.equals(categoryId, that.categoryId) && Objects.equals(dictionaryId, that.dictionaryId); } @Override public int hashCode() { - return Objects.hash(id, filedCnName, filedName, connector, sequence, categoryId, dictionaryId); + return Objects.hash(id, fieldCnName, fieldName, connector, sequence, categoryId, dictionaryId); } } diff --git a/archives/src/main/java/com/storeroom/modules/dictionary/repository/ArchivesNoSettingRepository.java b/archives/src/main/java/com/storeroom/modules/dictionary/repository/ArchivesNoSettingRepository.java index 70c9d29..0caf3c7 100644 --- a/archives/src/main/java/com/storeroom/modules/dictionary/repository/ArchivesNoSettingRepository.java +++ b/archives/src/main/java/com/storeroom/modules/dictionary/repository/ArchivesNoSettingRepository.java @@ -3,6 +3,7 @@ package com.storeroom.modules.dictionary.repository; import com.storeroom.modules.dictionary.domain.ArchivesNoSetting; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; public interface ArchivesNoSettingRepository extends JpaRepository, JpaSpecificationExecutor { @@ -16,4 +17,8 @@ public interface ArchivesNoSettingRepository extends JpaRepository archivesNoSettingDTO) { archivesNoSettingDTO.forEach(item -> { + + Integer num = ansRepostiory.findByMax(); + if (num == 0) { + item.setSequence(1); + } item.setId(NanoIdUtils.randomNanoId()); + item.setSequence(num + 1); ArchivesNoSetting as = archivesNoSettingMapper.toEntity(item); ansRepostiory.save(as); + }); } @@ -60,12 +66,13 @@ public class ArchivesNoSettingImpl implements ArchivesNoSettingService { archivesNoSettingDTOS.forEach(item -> { ArchivesNoSetting as = ansRepostiory.findById(item.getId()).orElseGet(ArchivesNoSetting::new); if (as != null) { + as.setId(item.getId()); as.setCategoryId(item.getCategoryId()); as.setConnector(item.getConnector()); - as.setFiledCnName(item.getFiledCnName()); + as.setFieldCnName(item.getFieldCnName()); as.setSequence(item.getSequence()); - as.setFiledName(item.getFiledName()); + as.setFieldName(item.getFieldName()); as.setDictionaryId(item.getDictionaryId()); ansRepostiory.save(as); }