|
|
@ -4,14 +4,18 @@ package com.storeroom.modules.dictionary.controller; |
|
|
|
import com.storeroom.annotaion.rest.AnonymousGetMapping; |
|
|
|
import com.storeroom.annotaion.rest.AnonymousPostMapping; |
|
|
|
import com.storeroom.exception.BaseException; |
|
|
|
import com.storeroom.exception.constant.ResponseStatus; |
|
|
|
import com.storeroom.modules.common.ArchivesTypeEnum; |
|
|
|
import com.storeroom.modules.dictionary.service.ArchivesDictionaryService; |
|
|
|
import com.storeroom.modules.dictionary.service.ArchivesTypeService; |
|
|
|
import com.storeroom.modules.dictionary.service.dto.ArchivesDictionaryDTO; |
|
|
|
import com.storeroom.modules.dictionary.service.dto.ArchivesTypeDTO; |
|
|
|
import com.storeroom.utils.ApiResponse; |
|
|
|
import com.storeroom.utils.StringUtils; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
@ -26,6 +30,7 @@ import java.util.*; |
|
|
|
public class ArchivesTypeController { |
|
|
|
|
|
|
|
private final ArchivesTypeService archivesTypeService; |
|
|
|
private final ArchivesDictionaryService archivesDictionaryService; |
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("门类类型") |
|
|
@ -36,7 +41,7 @@ public class ArchivesTypeController { |
|
|
|
list.put(ArchivesTypeEnum.project.getCode(), ArchivesTypeEnum.project.getType()); |
|
|
|
list.put(ArchivesTypeEnum.archives.getCode(), ArchivesTypeEnum.archives.getType()); |
|
|
|
list.put(ArchivesTypeEnum.inChive.getCode(), ArchivesTypeEnum.inChive.getType()); |
|
|
|
list.put(ArchivesTypeEnum.files.getCode(), ArchivesTypeEnum.folder.getType()); |
|
|
|
list.put(ArchivesTypeEnum.files.getCode(), ArchivesTypeEnum.files.getType()); |
|
|
|
list.put(ArchivesTypeEnum.Template.getCode(), ArchivesTypeEnum.Template.getType()); |
|
|
|
return ApiResponse.success(list); |
|
|
|
} |
|
|
@ -45,13 +50,13 @@ public class ArchivesTypeController { |
|
|
|
@AnonymousPostMapping("create") |
|
|
|
//TODO:权限未添加 |
|
|
|
public ApiResponse<Object> save(@RequestBody ArchivesTypeDTO archivesTypeDTO) { |
|
|
|
if (archivesTypeDTO.getId() != null) { |
|
|
|
if (!StringUtils.isEmpty(archivesTypeDTO.getId())) { |
|
|
|
throw new BaseException("this is not empty Data"); |
|
|
|
} |
|
|
|
if (archivesTypeDTO.getIsType() == null) { |
|
|
|
throw new BaseException("type cannot be Null"); |
|
|
|
} |
|
|
|
if (archivesTypeDTO.getCnName().isEmpty()) { |
|
|
|
if (StringUtils.isEmpty(archivesTypeDTO.getCnName())) { |
|
|
|
throw new BaseException("Name canot be null"); |
|
|
|
} |
|
|
|
archivesTypeService.create(archivesTypeDTO); |
|
|
@ -64,4 +69,33 @@ public class ArchivesTypeController { |
|
|
|
public ApiResponse<Object> getMenuTree() { |
|
|
|
return ApiResponse.success(archivesTypeService.buildTree()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("门类字段管理") |
|
|
|
@AnonymousGetMapping("manage") |
|
|
|
public ApiResponse<Object> getFieldName(String categoryId) { |
|
|
|
if (!StringUtils.isEmpty(categoryId)) { |
|
|
|
return ApiResponse.success(archivesDictionaryService.getAll(categoryId)); |
|
|
|
} |
|
|
|
throw new BaseException("id异常"); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("通过id查询门类字典") |
|
|
|
@AnonymousGetMapping("query") |
|
|
|
public ApiResponse<Object> getArcDic(String arcdicId) { |
|
|
|
if (!StringUtils.isEmpty(arcdicId)) { |
|
|
|
return ApiResponse.success(archivesDictionaryService.findById(arcdicId)); |
|
|
|
} |
|
|
|
throw new BaseException("id异常"); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("修改数据") |
|
|
|
@AnonymousPostMapping("update") |
|
|
|
public ApiResponse<Object> update(@RequestBody ArchivesDictionaryDTO arcdicDto) { |
|
|
|
if (!StringUtils.isEmpty(arcdicDto.getId())) { |
|
|
|
archivesDictionaryService.update(arcdicDto); |
|
|
|
return ApiResponse.success(ResponseStatus.SUCCESS); |
|
|
|
} |
|
|
|
throw new BaseException("id异常"); |
|
|
|
} |
|
|
|
} |