diff --git a/src/main/java/com/kamco/cd/kamcoback/label/LabelWorkerApiController.java b/src/main/java/com/kamco/cd/kamcoback/label/LabelWorkerApiController.java index 5ca52652..17d8844e 100644 --- a/src/main/java/com/kamco/cd/kamcoback/label/LabelWorkerApiController.java +++ b/src/main/java/com/kamco/cd/kamcoback/label/LabelWorkerApiController.java @@ -32,29 +32,26 @@ public class LabelWorkerApiController { @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("/label-work-mng-list") public ApiResponseDto> labelWorkMngList( - @Schema(description = "변화탐지년도", example = "2024") - Integer detectYyyy, - @Schema(description = "시작일", example = "20260101") - String strtDttm, - @Schema(description = "종료일", example = "20261201") - String endDttm, - @Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0") - int page, - @Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20") - int size) { + @Schema(description = "변화탐지년도", example = "2024") Integer detectYyyy, + @Schema(description = "시작일", example = "20260101") String strtDttm, + @Schema(description = "종료일", example = "20261201") String endDttm, + @Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0") + int page, + @Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20") + int size) { LabelWorkDto.LabelWorkMngSearchReq searchReq = new LabelWorkMngSearchReq(); searchReq.setDetectYyyy(detectYyyy); searchReq.setStrtDttm(strtDttm); diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapSheetAnalInferenceEntity.java b/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapSheetAnalInferenceEntity.java index 5a68209e..195721e1 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapSheetAnalInferenceEntity.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapSheetAnalInferenceEntity.java @@ -25,8 +25,13 @@ import org.hibernate.type.SqlTypes; public class MapSheetAnalInferenceEntity { @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tb_map_sheet_anal_inference_id_gen") - @SequenceGenerator(name = "tb_map_sheet_anal_inference_id_gen", sequenceName = "tb_map_sheet_anal_inference_uid", allocationSize = 1) + @GeneratedValue( + strategy = GenerationType.SEQUENCE, + generator = "tb_map_sheet_anal_inference_id_gen") + @SequenceGenerator( + name = "tb_map_sheet_anal_inference_id_gen", + sequenceName = "tb_map_sheet_anal_inference_uid", + allocationSize = 1) @Column(name = "anal_uid", nullable = false) private Long id; @@ -144,5 +149,4 @@ public class MapSheetAnalInferenceEntity { @Column(name = "stage") private Integer stage; - } diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java index 0fc5874a..5c94e12f 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java @@ -17,20 +17,15 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC private final JPAQueryFactory queryFactory; - @PersistenceContext - private final EntityManager em; + @PersistenceContext private final EntityManager em; - /** - * tb_map_sheet_anal_data_inference - */ + /** tb_map_sheet_anal_data_inference */ private final QMapSheetAnalDataInferenceEntity inferenceEntity = - QMapSheetAnalDataInferenceEntity.mapSheetAnalDataInferenceEntity; + QMapSheetAnalDataInferenceEntity.mapSheetAnalDataInferenceEntity; - /** - * tb_map_sheet_anal_data_inference_geom - */ + /** tb_map_sheet_anal_data_inference_geom */ private final QMapSheetAnalDataInferenceGeomEntity inferenceGeomEntity = - QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity; + QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity; // =============================== // Upsert (Native only) @@ -39,7 +34,7 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC @Override public int upsertGroupsFromMapSheetAnal() { String sql = - """ + """ INSERT INTO tb_map_sheet_anal_inference ( compare_yyyy, @@ -60,7 +55,8 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC } /** - * inference_results 테이블을 기준으로 분석 데이터 단위(stage, compare_yyyy, target_yyyy, map_sheet_num)를 생성/갱신한다. + * inference_results 테이블을 기준으로 분석 데이터 단위(stage, compare_yyyy, target_yyyy, map_sheet_num)를 + * 생성/갱신한다. * *

- 최초 생성 시 file_created_yn = false - detecting_cnt는 inference_results 건수 기준 * @@ -70,7 +66,7 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC public int upsertGroupsFromInferenceResults() { String sql = - """ + """ INSERT INTO tb_map_sheet_anal_data_inference ( stage, compare_yyyy, @@ -113,7 +109,7 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC public int upsertGeomsFromInferenceResults() { String sql = - """ + """ INSERT INTO tb_map_sheet_anal_data_inference_geom ( uuid, stage, cd_prob, compare_yyyy, target_yyyy, map_sheet_num, class_before_cd, class_before_prob, class_after_cd, class_after_prob, @@ -188,12 +184,12 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC @Override public List findPendingDataUids(int limit) { return queryFactory - .select(inferenceEntity.id) - .from(inferenceEntity) - .where(inferenceEntity.fileCreatedYn.isFalse().or(inferenceEntity.fileCreatedYn.isNull())) - .orderBy(inferenceEntity.id.asc()) - .limit(limit) - .fetch(); + .select(inferenceEntity.id) + .from(inferenceEntity) + .where(inferenceEntity.fileCreatedYn.isFalse().or(inferenceEntity.fileCreatedYn.isNull())) + .orderBy(inferenceEntity.id.asc()) + .limit(limit) + .fetch(); } // =============================== @@ -212,13 +208,13 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC ZonedDateTime now = ZonedDateTime.now(); return (int) - queryFactory - .update(inferenceEntity) - .set(inferenceEntity.fileCreatedYn, false) - .set(inferenceEntity.fileCreatedDttm, (ZonedDateTime) null) - .set(inferenceEntity.updatedDttm, now) - .where(inferenceEntity.id.eq(dataUid)) - .execute(); + queryFactory + .update(inferenceEntity) + .set(inferenceEntity.fileCreatedYn, false) + .set(inferenceEntity.fileCreatedDttm, (ZonedDateTime) null) + .set(inferenceEntity.updatedDttm, now) + .where(inferenceEntity.id.eq(dataUid)) + .execute(); } /** @@ -231,13 +227,13 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC ZonedDateTime now = ZonedDateTime.now(); return (int) - queryFactory - .update(inferenceEntity) - .set(inferenceEntity.fileCreatedYn, true) - .set(inferenceEntity.fileCreatedDttm, now) - .set(inferenceEntity.updatedDttm, now) - .where(inferenceEntity.id.eq(dataUid)) - .execute(); + queryFactory + .update(inferenceEntity) + .set(inferenceEntity.fileCreatedYn, true) + .set(inferenceEntity.fileCreatedDttm, now) + .set(inferenceEntity.updatedDttm, now) + .where(inferenceEntity.id.eq(dataUid)) + .execute(); } /** @@ -250,13 +246,13 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC ZonedDateTime now = ZonedDateTime.now(); return (int) - queryFactory - .update(inferenceGeomEntity) - .set(inferenceGeomEntity.fileCreatedYn, false) - .set(inferenceGeomEntity.fileCreatedDttm, (ZonedDateTime) null) - .set(inferenceGeomEntity.updatedDttm, now) - .where(inferenceGeomEntity.dataUid.eq(dataUid)) - .execute(); + queryFactory + .update(inferenceGeomEntity) + .set(inferenceGeomEntity.fileCreatedYn, false) + .set(inferenceGeomEntity.fileCreatedDttm, (ZonedDateTime) null) + .set(inferenceGeomEntity.updatedDttm, now) + .where(inferenceGeomEntity.dataUid.eq(dataUid)) + .execute(); } /** @@ -274,13 +270,13 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC ZonedDateTime now = ZonedDateTime.now(); return (int) - queryFactory - .update(inferenceGeomEntity) - .set(inferenceGeomEntity.fileCreatedYn, true) - .set(inferenceGeomEntity.fileCreatedDttm, now) - .set(inferenceGeomEntity.updatedDttm, now) - .where(inferenceGeomEntity.geoUid.in(geoUids)) - .execute(); + queryFactory + .update(inferenceGeomEntity) + .set(inferenceGeomEntity.fileCreatedYn, true) + .set(inferenceGeomEntity.fileCreatedDttm, now) + .set(inferenceGeomEntity.updatedDttm, now) + .where(inferenceGeomEntity.geoUid.in(geoUids)) + .execute(); } // =============================== @@ -294,18 +290,18 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC */ @Override public List findGeomEntitiesByDataUid( - Long dataUid, int limit) { + Long dataUid, int limit) { return queryFactory - .selectFrom(inferenceGeomEntity) - .where( - inferenceGeomEntity.dataUid.eq(dataUid), - inferenceGeomEntity.geom.isNotNull(), - inferenceGeomEntity - .fileCreatedYn - .isFalse() - .or(inferenceGeomEntity.fileCreatedYn.isNull())) - .orderBy(inferenceGeomEntity.geoUid.asc()) - .limit(limit) - .fetch(); + .selectFrom(inferenceGeomEntity) + .where( + inferenceGeomEntity.dataUid.eq(dataUid), + inferenceGeomEntity.geom.isNotNull(), + inferenceGeomEntity + .fileCreatedYn + .isFalse() + .or(inferenceGeomEntity.fileCreatedYn.isNull())) + .orderBy(inferenceGeomEntity.geoUid.asc()) + .limit(limit) + .fetch(); } }