diff --git a/archives/src/main/java/com/storeroom/modules/dictionary/controller/ArchivesTypeController.java b/archives/src/main/java/com/storeroom/modules/dictionary/controller/ArchivesTypeController.java index 984f442..26f0f1e 100644 --- a/archives/src/main/java/com/storeroom/modules/dictionary/controller/ArchivesTypeController.java +++ b/archives/src/main/java/com/storeroom/modules/dictionary/controller/ArchivesTypeController.java @@ -58,13 +58,13 @@ public class ArchivesTypeController { //TODO:权限未添加 public ApiResponse save(@RequestBody ArchivesTypeDTO archivesTypeDTO) { if (!StringUtils.isEmpty(archivesTypeDTO.getId())) { - throw new BaseException("this is not empty Data"); + throw new BaseException("id不为空"); } if (archivesTypeDTO.getIsType() == null) { - throw new BaseException("type cannot be Null"); + throw new BaseException("类型不能为空"); } if (StringUtils.isEmpty(archivesTypeDTO.getCnName())) { - throw new BaseException("Name canot be null"); + throw new BaseException("名称不能为空"); } archivesTypeService.create(archivesTypeDTO); return ApiResponse.success("保存成功"); @@ -139,17 +139,14 @@ public class ArchivesTypeController { if (StringUtils.isEmpty(arcdicDto.getIsDataTypeDetails())) { throw new BaseException("数据类型不能为空"); } - archivesDictionaryService.create(arcdicDto); return ApiResponse.success(ResponseStatus.SUCCESS); - } @ApiOperation("获取档案配置下拉列表") @AnonymousGetMapping("arc-config") public ApiResponse getArcConfig() { return ApiResponse.success(dictionaryService.findDictrionaryMenu()); - } @ApiOperation("删除门类字典字段") diff --git a/archives/src/main/java/com/storeroom/modules/dictionary/service/ArchivesDictionaryService.java b/archives/src/main/java/com/storeroom/modules/dictionary/service/ArchivesDictionaryService.java index 62742ee..cfa0742 100644 --- a/archives/src/main/java/com/storeroom/modules/dictionary/service/ArchivesDictionaryService.java +++ b/archives/src/main/java/com/storeroom/modules/dictionary/service/ArchivesDictionaryService.java @@ -51,4 +51,13 @@ public interface ArchivesDictionaryService { */ void delete(String id); + + /** + * 字段字典排序 + * @param archivesDictionaryDTO / + * @return / + */ + ArchivesDictionaryDTO upSort(ArchivesDictionaryDTO archivesDictionaryDTO); + + } diff --git a/archives/src/main/java/com/storeroom/modules/dictionary/service/impl/ArchivesDictionaryImpl.java b/archives/src/main/java/com/storeroom/modules/dictionary/service/impl/ArchivesDictionaryImpl.java index 9db6341..5cb12ff 100644 --- a/archives/src/main/java/com/storeroom/modules/dictionary/service/impl/ArchivesDictionaryImpl.java +++ b/archives/src/main/java/com/storeroom/modules/dictionary/service/impl/ArchivesDictionaryImpl.java @@ -106,5 +106,14 @@ public class ArchivesDictionaryImpl implements ArchivesDictionaryService { archivesDictionaryRepository.deleteById(id); } + @Override + public ArchivesDictionaryDTO upSort(ArchivesDictionaryDTO archivesDictionaryDTO) { + ArchivesDictionary archivesDictionary = archivesDictionaryMapper.toEntity(archivesDictionaryDTO); + ArchivesDictionary archivesDictionary1 = archivesDictionaryRepository.findById(archivesDictionary.getId()).orElseGet(ArchivesDictionary::new); + archivesDictionary1.setIsSequence(archivesDictionary.getIsSequence()); + archivesDictionaryRepository.save(archivesDictionary1); + return archivesDictionaryMapper.toDto(archivesDictionary1); + } + } diff --git a/archives/src/main/java/com/storeroom/modules/dictionary/service/impl/ArchivesTypeServiceImpl.java b/archives/src/main/java/com/storeroom/modules/dictionary/service/impl/ArchivesTypeServiceImpl.java index 8a4f3a6..40bf23c 100644 --- a/archives/src/main/java/com/storeroom/modules/dictionary/service/impl/ArchivesTypeServiceImpl.java +++ b/archives/src/main/java/com/storeroom/modules/dictionary/service/impl/ArchivesTypeServiceImpl.java @@ -11,6 +11,7 @@ import com.storeroom.modules.dictionary.service.dto.ArchivesTypeDTO; import com.storeroom.modules.dictionary.service.mapstruct.ArchivesTypeMapper; import com.storeroom.utils.DateUtils; import com.storeroom.utils.NanoIdUtils; +import com.storeroom.utils.SpringUtils; import com.storeroom.utils.ValidationUtil; import lombok.RequiredArgsConstructor; @@ -33,13 +34,14 @@ public class ArchivesTypeServiceImpl implements ArchivesTypeService { private final ArchivesTypeRepository archivesTypeRepository; private final DynamicTableService dynamicTableService; - @Value("${table-template.archive}") - private String tableName; + @Override @Transactional(rollbackFor = Exception.class) public void create(ArchivesTypeDTO archivesTypeDTO) { + //#生成表名称 + String tableName="tb_"; ArchivesType archivesType = archivesTypeMapper.toEntity(archivesTypeDTO); List archivesType1 = archivesTypeRepository.findByCnName(archivesType.getCnName()); if (archivesType1.size() == 0) { @@ -48,6 +50,7 @@ public class ArchivesTypeServiceImpl implements ArchivesTypeService { archivesType.setEnName(tableName); archivesTypeRepository.save(archivesType); dynamicTableService.DynamicCreate(archivesType.getIsType(), archivesType.getId(), tableName); + } else { throw new BaseException("门类名称不能重复"); } @@ -60,7 +63,9 @@ public class ArchivesTypeServiceImpl implements ArchivesTypeService { List trees = new ArrayList<>(); Set ids = new HashSet<>(); for (ArchivesTypeDTO archivesTypeDTO : archivesTypeDTOS) { + //如果父节点id为空就是一级菜单 if (archivesTypeDTO.getPid() == null) { + //直接加入树列表 trees.add(archivesTypeDTO); } for (ArchivesTypeDTO at : archivesTypeDTOS) { diff --git a/archives/src/main/java/com/storeroom/modules/dictionary/service/impl/DynamicTableImpl.java b/archives/src/main/java/com/storeroom/modules/dictionary/service/impl/DynamicTableImpl.java index bbfc29d..2cb5625 100644 --- a/archives/src/main/java/com/storeroom/modules/dictionary/service/impl/DynamicTableImpl.java +++ b/archives/src/main/java/com/storeroom/modules/dictionary/service/impl/DynamicTableImpl.java @@ -30,14 +30,15 @@ public class DynamicTableImpl implements DynamicTableService { private final JdbcTemplate jdbcTemplate; - @Value("${table-template.file}") - private String fileTableName; @Override public void DynamicCreate(Integer type, String archiveTypeId, String tableName) { + List integerList = new ArrayList<>(); if (type == 4 || type == 5) { + //#生成文件表名称 + String fileTableName="file_tb_"; integerList.add(1); integerList.add(2); @@ -57,6 +58,7 @@ public class DynamicTableImpl implements DynamicTableService { List fieldList = fieldService.findGroupType(integerList); DynamicInsert(fieldList, archiveTypeId); DynamicCreateFileTable(fieldList, tableName); + } } @@ -95,7 +97,7 @@ public class DynamicTableImpl implements DynamicTableService { archivesDictionaryDTO.setIsSequence(j.getIsSequence()); archivesDictionaryDTO.setIsType(j.getIsType()); archivesDictionaryDTO.setIsSystem(j.getIsSystem()); - archivesDictionaryDTO.setIsColumnType(j.getIsType()==3?2:1); + archivesDictionaryDTO.setIsColumnType(j.getIsType() == 3 ? 2 : 1); newList.add(archivesDictionaryDTO); } diff --git a/system/src/main/resources/application.yml b/system/src/main/resources/application.yml index cd2e77e..585d907 100644 --- a/system/src/main/resources/application.yml +++ b/system/src/main/resources/application.yml @@ -76,9 +76,4 @@ user-cache: hand-held: ip: 47.98.148.152:8057 -# 生成表模板 -table-template: - #生成表名称 - archive: tb_ - #生成文件表 - file: file_tb_ +