enum 공통코드로 추가

This commit is contained in:
2025-12-18 14:18:34 +09:00
parent 9c44c769b6
commit 52fbceb53c
3 changed files with 62 additions and 12 deletions

View File

@@ -291,7 +291,7 @@ public class CommonCodeApiController {
return ApiResponseDto.ok(count);
}
@Operation(summary = "코드 조회", description = "enum 코드 조회")
@Operation(summary = "코드 조회", description = "코드 리스트 조회")
@ApiResponses(
value = {
@ApiResponse(
@@ -303,8 +303,25 @@ public class CommonCodeApiController {
schema = @Schema(implementation = CodeDto.class))),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
@GetMapping("/enums")
public ApiResponseDto<Map<String, List<CodeDto>>> getCode() {
return ApiResponseDto.ok(commonCodeService.getAllCodes());
@GetMapping("/type/codes")
public ApiResponseDto<Map<String, List<CodeDto>>> getTypeCodes() {
return ApiResponseDto.ok(commonCodeService.getTypeCodes());
}
@Operation(summary = "코드 단건 조회", description = "코드 조회")
@ApiResponses(
value = {
@ApiResponse(
responseCode = "200",
description = "코드 조회 성공",
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = CodeDto.class))),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
@GetMapping("/type/{type}")
public ApiResponseDto<List<CodeDto>> getTypeCode(@PathVariable String type) {
return ApiResponseDto.ok(commonCodeService.getTypeCode(type));
}
}

View File

@@ -122,7 +122,16 @@ public class CommonCodeService {
return commonCodeCoreService.getCode(parentCodeCd, childCodeCd);
}
public Map<String, List<CodeDto>> getAllCodes() {
public List<CodeDto> getTypeCode(String type) {
return Enums.getCodes(type);
}
/**
* 공통코드 리스트 조회
*
* @return
*/
public Map<String, List<CodeDto>> getTypeCodes() {
return Enums.getAllCodes();
}
}