feat: format error

This commit is contained in:
2025-11-20 14:50:02 +09:00
parent 5c030869fd
commit 04678b6b6e
33 changed files with 1031 additions and 852 deletions

View File

@@ -30,19 +30,19 @@ public class CommonCodeApiController {
private final CommonCodeService commonCodeService;
@Operation(summary = "목록 조회", description = "모든 공통코드 조회")
@Operation(summary = "목록 조회", description = "모든 공통코드 조회")
@ApiResponses(
value = {
@ApiResponse(
responseCode = "200",
description = "조회 성공",
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = CommonCodeDto.Basic.class))),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
value = {
@ApiResponse(
responseCode = "200",
description = "조회 성공",
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = CommonCodeDto.Basic.class))),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
@GetMapping
public ApiResponseDto<List<CommonCodeDto.Basic>> getFindAll() {
return ApiResponseDto.createOK(commonCodeService.getFindAll());
@@ -50,139 +50,160 @@ public class CommonCodeApiController {
@Operation(summary = "단건 조회", description = "단건 조회")
@ApiResponses(
value = {
@ApiResponse(
responseCode = "200",
description = "조회 성공",
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = CommonCodeDto.Basic.class))),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
value = {
@ApiResponse(
responseCode = "200",
description = "조회 성공",
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = CommonCodeDto.Basic.class))),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
@GetMapping("/{id}")
public ApiResponseDto<CommonCodeDto.Basic> getOneById(
@io.swagger.v3.oas.annotations.parameters.RequestBody(
description = "단건 조회",
required = true)
@PathVariable Long id) {
@io.swagger.v3.oas.annotations.parameters.RequestBody(description = "단건 조회", required = true)
@PathVariable
Long id) {
return ApiResponseDto.ok(commonCodeService.getOneById(id));
}
@Operation(summary = "저장", description = "공통코드를 저장 합니다.")
@ApiResponses(
value = {
@ApiResponse(responseCode = "201", description = "공통코드 저장 성공", content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = Long.class))),
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
value = {
@ApiResponse(
responseCode = "201",
description = "공통코드 저장 성공",
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = Long.class))),
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
@PostMapping
public ApiResponseDto<Long> save(
@io.swagger.v3.oas.annotations.parameters.RequestBody(
description = "공통코드 생성 요청 정보",
required = true,
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = CommonCodeDto.AddReq.class)))
@RequestBody
@Valid CommonCodeDto.AddReq req) {
@io.swagger.v3.oas.annotations.parameters.RequestBody(
description = "공통코드 생성 요청 정보",
required = true,
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = CommonCodeDto.AddReq.class)))
@RequestBody
@Valid
CommonCodeDto.AddReq req) {
return ApiResponseDto.createOK(commonCodeService.save(req));
}
@Operation(summary = "수정", description = "공통코드를 수정 합니다.")
@ApiResponses(
value = {
@ApiResponse(responseCode = "204", description = "공통코드 수정 성공", content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = Long.class))),
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
value = {
@ApiResponse(
responseCode = "204",
description = "공통코드 수정 성공",
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = Long.class))),
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
@PutMapping("/{id}")
public ApiResponseDto<Void> update(
@io.swagger.v3.oas.annotations.parameters.RequestBody(
description = "공통코드 수정 요청 정보",
required = true,
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = CommonCodeDto.ModifyReq.class)))
@PathVariable Long id, @RequestBody @Valid CommonCodeDto.ModifyReq req) {
@io.swagger.v3.oas.annotations.parameters.RequestBody(
description = "공통코드 수정 요청 정보",
required = true,
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = CommonCodeDto.ModifyReq.class)))
@PathVariable
Long id,
@RequestBody @Valid CommonCodeDto.ModifyReq req) {
commonCodeService.update(id, req);
return ApiResponseDto.deleteOk(null);
}
@Operation(summary = "삭제", description = "공통코드를 삭제 합니다.")
@ApiResponses(
value = {
@ApiResponse(responseCode = "204", description = "공통코드 삭제 성공", content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = Long.class))),
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
value = {
@ApiResponse(
responseCode = "204",
description = "공통코드 삭제 성공",
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = Long.class))),
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
@DeleteMapping("/{id}")
public ApiResponseDto<Long> remove(
@io.swagger.v3.oas.annotations.parameters.RequestBody(
description = "공통코드 삭제 요청 정보",
required = true)
@PathVariable Long id) {
commonCodeService.remove(id);
@io.swagger.v3.oas.annotations.parameters.RequestBody(
description = "공통코드 삭제 요청 정보",
required = true)
@PathVariable
Long id) {
commonCodeService.remove(id);
return ApiResponseDto.deleteOk(id);
}
@Operation(summary = "순서 변경", description = "공통코드 순서를 변경 합니다.")
@ApiResponses(
value = {
@ApiResponse(responseCode = "204", description = "공통코드 순서 변경 성공", content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = Long.class))),
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
value = {
@ApiResponse(
responseCode = "204",
description = "공통코드 순서 변경 성공",
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = Long.class))),
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
@PutMapping("/order")
public ApiResponseDto<Void> updateOrder(
@io.swagger.v3.oas.annotations.parameters.RequestBody(
description = "공통코드 순서변경 요청 정보",
required = true,
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = CommonCodeDto.OrderReq.class)))
@RequestBody @Valid CommonCodeDto.OrderReq req) {
commonCodeService.updateOrder(req);
@io.swagger.v3.oas.annotations.parameters.RequestBody(
description = "공통코드 순서변경 요청 정보",
required = true,
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = CommonCodeDto.OrderReq.class)))
@RequestBody
@Valid
CommonCodeDto.OrderReq req) {
commonCodeService.updateOrder(req);
return ApiResponseDto.deleteOk(null);
}
@Operation(summary = "code 기반 조회", description = "code 기반 조회")
@ApiResponses(
value = {
@ApiResponse(responseCode = "200", description = "공통코드 순서 변경 성공", content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = Long.class))),
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
value = {
@ApiResponse(
responseCode = "200",
description = "공통코드 순서 변경 성공",
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = Long.class))),
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
@GetMapping("/used")
public ApiResponseDto<List<CommonCodeDto.Basic>> getByCode(
@io.swagger.v3.oas.annotations.parameters.RequestBody(
description = "공통코드 순서변경 요청 정보",
required = true)
@RequestParam String code) {
@io.swagger.v3.oas.annotations.parameters.RequestBody(
description = "공통코드 순서변경 요청 정보",
required = true)
@RequestParam
String code) {
return ApiResponseDto.ok(commonCodeService.findByCode(code));
}
}

View File

@@ -1,13 +1,10 @@
package com.kamco.cd.kamcoback.code.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
import com.kamco.cd.kamcoback.postgres.entity.CommonCodeEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.PositiveOrZero;
import java.time.ZonedDateTime;
import java.util.List;
import lombok.AllArgsConstructor;
@@ -15,7 +12,6 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
public class CommonCodeDto {
@Schema(name = "CodeAddReq", description = "공통코드 저장 정보")
@@ -25,10 +21,8 @@ public class CommonCodeDto {
@AllArgsConstructor
public static class AddReq {
@NotEmpty
private String code;
@NotEmpty
private String name;
@NotEmpty private String code;
@NotEmpty private String name;
private String description;
private int order;
private boolean used;
@@ -41,8 +35,7 @@ public class CommonCodeDto {
@NoArgsConstructor
@AllArgsConstructor
public static class ModifyReq {
@NotEmpty
private String name;
@NotEmpty private String name;
private String description;
private int order;
private boolean used;
@@ -54,8 +47,7 @@ public class CommonCodeDto {
@NoArgsConstructor
@AllArgsConstructor
public static class OrderReq {
@Valid
List<OrderReqDetail> orders;
@Valid List<OrderReqDetail> orders;
}
@Getter
@@ -63,11 +55,9 @@ public class CommonCodeDto {
@NoArgsConstructor
@AllArgsConstructor
public static class OrderReqDetail {
@NotNull
private Long id;
@NotNull private Long id;
@NotNull
private Integer order;
@NotNull private Integer order;
}
@Schema(name = "CommonCode Basic", description = "공통코드 기본 정보")
@@ -83,23 +73,21 @@ public class CommonCodeDto {
private Boolean deleted;
private List<CommonCodeDto.Basic> children;
@JsonFormatDttm
private ZonedDateTime createdDttm;
@JsonFormatDttm private ZonedDateTime createdDttm;
@JsonFormatDttm
private ZonedDateTime updatedDttm;
@JsonFormatDttm private ZonedDateTime updatedDttm;
public Basic(
Long id,
String code,
String description,
String name,
Integer order,
Boolean used,
Boolean deleted,
List<CommonCodeDto.Basic> children,
ZonedDateTime createdDttm,
ZonedDateTime updatedDttm) {
Long id,
String code,
String description,
String name,
Integer order,
Boolean used,
Boolean deleted,
List<CommonCodeDto.Basic> children,
ZonedDateTime createdDttm,
ZonedDateTime updatedDttm) {
this.id = id;
this.code = code;
this.description = description;

View File

@@ -17,9 +17,9 @@ public class CommonCodeService {
private final CommonCodeCoreService commonCodeCoreService;
/**
* 공통코드 목록 조회
*
* @return 모튼 코드 정보
*/
public List<Basic> getFindAll() {
@@ -28,6 +28,7 @@ public class CommonCodeService {
/**
* 공통코드 단건 조회
*
* @param id
* @return 코드 아이디로 조회한 코드 정보
*/
@@ -37,6 +38,7 @@ public class CommonCodeService {
/**
* 공통코드 생성 요청
*
* @param req 생성요청 정보
* @return 생성된 코드 id
*/
@@ -47,6 +49,7 @@ public class CommonCodeService {
/**
* 공통코드 수정 요청
*
* @param id 코드 아이디
* @param req 수정요청 정보
*/
@@ -57,6 +60,7 @@ public class CommonCodeService {
/**
* 공통코드 삭제 처리
*
* @param id 코드 아이디
*/
@Transactional
@@ -66,6 +70,7 @@ public class CommonCodeService {
/**
* 공통코드 순서 변경
*
* @param req id, order 정보를 가진 List
*/
@Transactional
@@ -75,6 +80,7 @@ public class CommonCodeService {
/**
* 코드기반 조회
*
* @param code 코드
* @return 코드로 조회한 공통코드 정보
*/