변화탐지 clazz API : enum -> 공통코드로 변경
This commit is contained in:
@@ -3,10 +3,8 @@ package com.kamco.cd.kamcoback.code;
|
||||
import com.kamco.cd.kamcoback.code.config.CommonCodeCacheManager;
|
||||
import com.kamco.cd.kamcoback.code.dto.CommonCodeDto;
|
||||
import com.kamco.cd.kamcoback.code.service.CommonCodeService;
|
||||
import com.kamco.cd.kamcoback.common.enums.DetectionClassification;
|
||||
import com.kamco.cd.kamcoback.common.utils.CommonCodeUtil;
|
||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Clazzes;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -14,8 +12,6 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
@@ -36,6 +32,7 @@ public class CommonCodeApiController {
|
||||
|
||||
private final CommonCodeService commonCodeService;
|
||||
private final CommonCodeCacheManager commonCodeCacheManager;
|
||||
private final CommonCodeUtil commonCodeUtil;
|
||||
|
||||
@Operation(summary = "목록 조회", description = "모든 공통코드 조회")
|
||||
@ApiResponses(
|
||||
@@ -213,12 +210,20 @@ public class CommonCodeApiController {
|
||||
}
|
||||
|
||||
@GetMapping("/clazz")
|
||||
public ApiResponseDto<List<InferenceResultDto.Clazzes>> getClasses() {
|
||||
public ApiResponseDto<List<CommonCodeDto.Clazzes>> getClasses() {
|
||||
|
||||
List<Clazzes> list =
|
||||
Arrays.stream(DetectionClassification.values())
|
||||
.sorted(Comparator.comparingInt(DetectionClassification::getOrder))
|
||||
.map(Clazzes::new)
|
||||
// List<Clazzes> list =
|
||||
// Arrays.stream(DetectionClassification.values())
|
||||
// .sorted(Comparator.comparingInt(DetectionClassification::getOrder))
|
||||
// .map(Clazzes::new)
|
||||
// .toList();
|
||||
|
||||
//변화탐지 clazz API : enum -> 공통코드로 변경
|
||||
List<CommonCodeDto.Clazzes> list =
|
||||
commonCodeUtil.getChildCodesByParentCode("0000").stream()
|
||||
.map(
|
||||
child ->
|
||||
new CommonCodeDto.Clazzes(child.getCode(), child.getName(), child.getOrder()))
|
||||
.toList();
|
||||
|
||||
return ApiResponseDto.ok(list);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.kamco.cd.kamcoback.code.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.kamco.cd.kamcoback.common.utils.html.HtmlEscapeDeserializer;
|
||||
@@ -71,15 +72,6 @@ public class CommonCodeDto {
|
||||
@NotNull private Integer order;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class OrderReqDetail {
|
||||
@NotNull private Long id;
|
||||
@NotNull private Integer order;
|
||||
}
|
||||
|
||||
@Schema(name = "CommonCode Basic", description = "공통코드 기본 정보")
|
||||
@Getter
|
||||
public static class Basic {
|
||||
@@ -139,4 +131,22 @@ public class CommonCodeDto {
|
||||
this.deletedDttm = deletedDttm;
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
public static class Clazzes {
|
||||
|
||||
private String code;
|
||||
private String name;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
private Double score;
|
||||
|
||||
private Integer order;
|
||||
|
||||
public Clazzes(String code, String name, Integer order) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
this.order = order;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user