Browse Source

fix bug

master
刘力 3 years ago
parent
commit
79d5d97299
  1. 2
      archives/src/main/java/com/storeroom/modules/dictionary/service/DynamicTableService.java
  2. 18
      archives/src/main/java/com/storeroom/modules/dictionary/service/dto/ArchivesDictionaryDTO.java
  3. 10
      archives/src/main/java/com/storeroom/modules/dictionary/service/impl/ArchivesTypeServiceImpl.java
  4. 4
      archives/src/main/java/com/storeroom/modules/dictionary/service/impl/DynamicTableImpl.java

2
archives/src/main/java/com/storeroom/modules/dictionary/service/DynamicTableService.java

@ -11,7 +11,7 @@ public interface DynamicTableService {
/* /*
* 生成表 * 生成表
*/ */
void DynamicCreate(Integer type,String archiveTypeId);
void DynamicCreate(Integer type,String archiveTypeId,String tableName);

18
archives/src/main/java/com/storeroom/modules/dictionary/service/dto/ArchivesDictionaryDTO.java

@ -68,18 +68,8 @@ public class ArchivesDictionaryDTO extends BaseDTO implements Serializable {
private String displayformatType; private String displayformatType;
private Integer displayformatWidth;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ArchivesDictionaryDTO that = (ArchivesDictionaryDTO) o;
return Objects.equals(id, that.id) && Objects.equals(categoryId, that.categoryId) && Objects.equals(sysDictionaryId, that.sysDictionaryId) && Objects.equals(fieldName, that.fieldName) && Objects.equals(fieldCnName, that.fieldCnName) && Objects.equals(isDefaultValue, that.isDefaultValue) && Objects.equals(isInputClass, that.isInputClass) && Objects.equals(isDataType, that.isDataType) && Objects.equals(isDataTypeDetails, that.isDataTypeDetails) && Objects.equals(isColumnLength, that.isColumnLength) && Objects.equals(isColumnType, that.isColumnType) && Objects.equals(isSequence, that.isSequence) && Objects.equals(isType, that.isType) && Objects.equals(isSystem, that.isSystem) && Objects.equals(isLine, that.isLine) && Objects.equals(isInput, that.isInput) && Objects.equals(isRequired, that.isRequired) && Objects.equals(isAutomatic, that.isAutomatic) && Objects.equals(isAdd, that.isAdd) && Objects.equals(isSearch, that.isSearch) && Objects.equals(isInherit, that.isInherit) && Objects.equals(isFilling, that.isFilling) && Objects.equals(fillingDigit, that.fillingDigit) && Objects.equals(isRepeat, that.isRepeat) && Objects.equals(isDisplay, that.isDisplay) && Objects.equals(displayOrder, that.displayOrder) && Objects.equals(isDisplayformat, that.isDisplayformat) && Objects.equals(displayformatType, that.displayformatType) && Objects.equals(displayformatWidth, that.displayformatWidth);
}
@Override
public int hashCode() {
return Objects.hash(id, categoryId, sysDictionaryId, fieldName, fieldCnName, isDefaultValue, isInputClass, isDataType, isDataTypeDetails, isColumnLength, isColumnType, isSequence, isType, isSystem, isLine, isInput, isRequired, isAutomatic, isAdd, isSearch, isInherit, isFilling, fillingDigit, isRepeat, isDisplay, displayOrder, isDisplayformat, displayformatType, displayformatWidth);
}
private Integer editLength;
private Integer displayLength;
} }

10
archives/src/main/java/com/storeroom/modules/dictionary/service/impl/ArchivesTypeServiceImpl.java

@ -32,26 +32,20 @@ public class ArchivesTypeServiceImpl implements ArchivesTypeService {
@Value("${table-template.archive}") @Value("${table-template.archive}")
private String tableName; private String tableName;
@Value("${table-template.file}")
private String fileTableName;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void create(ArchivesTypeDTO archivesTypeDTO) { public void create(ArchivesTypeDTO archivesTypeDTO) {
ArchivesType archivesType = archivesTypeMapper.toEntity(archivesTypeDTO); ArchivesType archivesType = archivesTypeMapper.toEntity(archivesTypeDTO);
List<ArchivesType> archivesType1 = archivesTypeRepository.findByCnName(archivesType.getCnName()); List<ArchivesType> archivesType1 = archivesTypeRepository.findByCnName(archivesType.getCnName());
if (archivesType1 == null) {
if (archivesType1.size() == 0) {
tableName += DateUtils.getNowDateTime(); tableName += DateUtils.getNowDateTime();
archivesType.setId(NanoIdUtils.randomNanoId()); archivesType.setId(NanoIdUtils.randomNanoId());
archivesType.setEnName(tableName); archivesType.setEnName(tableName);
archivesTypeRepository.save(archivesType); archivesTypeRepository.save(archivesType);
dynamicTableService.DynamicCreate(archivesType.getIsType(), archivesType.getId());
dynamicTableService.DynamicCreate(archivesType.getIsType(), archivesType.getId(), tableName);
} else { } else {
throw new BaseException("门类名称不能重复"); throw new BaseException("门类名称不能重复");
} }
} }
} }

4
archives/src/main/java/com/storeroom/modules/dictionary/service/impl/DynamicTableImpl.java

@ -28,15 +28,13 @@ public class DynamicTableImpl implements DynamicTableService {
private final ArchivesDictionaryService archivesDictionaryService; private final ArchivesDictionaryService archivesDictionaryService;
private final JdbcTemplate jdbcTemplate; private final JdbcTemplate jdbcTemplate;
@Value("${table-template.archive}")
private String tableName;
@Value("${table-template.file}") @Value("${table-template.file}")
private String fileTableName; private String fileTableName;
@Override @Override
public void DynamicCreate(Integer type, String archiveTypeId) {
public void DynamicCreate(Integer type, String archiveTypeId,String tableName) {
List<Integer> integerList = new ArrayList<>(); List<Integer> integerList = new ArrayList<>();
if (type == 4 || type == 5) { if (type == 4 || type == 5) {
integerList.add(1); integerList.add(1);

Loading…
Cancel
Save