From 77ac5e5b995ceb716c6ed103227a23344d20a6da Mon Sep 17 00:00:00 2001 From: "gayoun.park" Date: Tue, 27 Jan 2026 16:49:21 +0900 Subject: [PATCH] =?UTF-8?q?=EC=98=81=EC=83=81=EA=B4=80=EB=A6=AC=20?= =?UTF-8?q?=EB=AA=A9=EB=A1=9D,=20=EC=83=81=EC=84=B8=20=EC=BF=BC=EB=A6=AC?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapsheet/MapSheetMngRepositoryImpl.java | 172 ++++++++++++------ 1 file changed, 118 insertions(+), 54 deletions(-) diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/mapsheet/MapSheetMngRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/mapsheet/MapSheetMngRepositoryImpl.java index e67af416..00bf82ef 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/mapsheet/MapSheetMngRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/mapsheet/MapSheetMngRepositoryImpl.java @@ -100,48 +100,55 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport .then(1L) .otherwise(0L) .sum(), - new CaseBuilder() - .when(mapSheetMngHstEntity.syncState.eq("NOTPAIR")) - .then(1L) - .otherwise(0L) - .sum(), new CaseBuilder() .when( - mapSheetMngHstEntity - .syncCheckState - .eq("DONE") + mapInkx5kEntity + .useInference + .eq(CommonUseStatus.USE) .and(mapSheetMngHstEntity.syncState.eq("NOTPAIR"))) .then(1L) .otherwise(0L) .sum(), new CaseBuilder() - .when(mapSheetMngHstEntity.syncState.eq("DUPLICATE")) + .when( + mapInkx5kEntity + .useInference + .eq(CommonUseStatus.USE) + .and( + mapSheetMngHstEntity + .syncCheckState + .eq("DONE") + .and(mapSheetMngHstEntity.syncState.eq("NOTPAIR")))) .then(1L) .otherwise(0L) .sum(), new CaseBuilder() .when( - mapSheetMngHstEntity - .syncCheckState - .eq("DONE") + mapInkx5kEntity + .useInference + .eq(CommonUseStatus.USE) .and(mapSheetMngHstEntity.syncState.eq("DUPLICATE"))) .then(1L) .otherwise(0L) .sum(), new CaseBuilder() .when( - mapSheetMngHstEntity - .syncState - .eq("TYPEERROR") - .or(mapSheetMngHstEntity.syncState.eq("SIZEERROR"))) + mapInkx5kEntity + .useInference + .eq(CommonUseStatus.USE) + .and( + mapSheetMngHstEntity + .syncCheckState + .eq("DONE") + .and(mapSheetMngHstEntity.syncState.eq("DUPLICATE")))) .then(1L) .otherwise(0L) .sum(), new CaseBuilder() .when( - mapSheetMngHstEntity - .syncCheckState - .eq("DONE") + mapInkx5kEntity + .useInference + .eq(CommonUseStatus.USE) .and( mapSheetMngHstEntity .syncState @@ -151,28 +158,53 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport .otherwise(0L) .sum(), new CaseBuilder() - .when(mapSheetMngHstEntity.syncState.eq("NOFILE")) + .when( + mapInkx5kEntity + .useInference + .eq(CommonUseStatus.USE) + .and( + mapSheetMngHstEntity + .syncCheckState + .eq("DONE") + .and( + mapSheetMngHstEntity + .syncState + .eq("TYPEERROR") + .or( + mapSheetMngHstEntity.syncState.eq( + "SIZEERROR"))))) .then(1L) .otherwise(0L) .sum(), new CaseBuilder() .when( - mapSheetMngHstEntity - .syncCheckState - .eq("DONE") + mapInkx5kEntity + .useInference + .eq(CommonUseStatus.USE) .and(mapSheetMngHstEntity.syncState.eq("NOFILE"))) .then(1L) .otherwise(0L) .sum(), + new CaseBuilder() + .when( + mapInkx5kEntity + .useInference + .eq(CommonUseStatus.USE) + .and( + mapSheetMngHstEntity + .syncCheckState + .eq("DONE") + .and(mapSheetMngHstEntity.syncState.eq("NOFILE")))) + .then(1L) + .otherwise(0L) + .sum(), mapSheetMngEntity.createdDttm, mapSheetMngHstEntity.syncEndDttm.max())) .from(mapSheetMngEntity) .leftJoin(mapSheetMngHstEntity) .on(mapSheetMngEntity.mngYyyy.eq(mapSheetMngHstEntity.mngYyyy)) - .innerJoin(mapInkx5kEntity) - .on( - mapSheetMngHstEntity.mapSheetNum.eq(mapInkx5kEntity.mapidcdNo), - mapInkx5kEntity.useInference.eq(CommonUseStatus.USE)) + .leftJoin(mapInkx5kEntity) + .on(mapSheetMngHstEntity.mapSheetNum.eq(mapInkx5kEntity.mapidcdNo)) .where(whereBuilder) // .offset(pageable.getOffset()) // .limit(pageable.getPageSize()) @@ -248,48 +280,55 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport .then(1L) .otherwise(0L) .sum(), - new CaseBuilder() - .when(mapSheetMngHstEntity.syncState.eq("NOTPAIR")) - .then(1L) - .otherwise(0L) - .sum(), new CaseBuilder() .when( - mapSheetMngHstEntity - .syncCheckState - .eq("DONE") + mapInkx5kEntity + .useInference + .eq(CommonUseStatus.USE) .and(mapSheetMngHstEntity.syncState.eq("NOTPAIR"))) .then(1L) .otherwise(0L) .sum(), new CaseBuilder() - .when(mapSheetMngHstEntity.syncState.eq("DUPLICATE")) + .when( + mapInkx5kEntity + .useInference + .eq(CommonUseStatus.USE) + .and( + mapSheetMngHstEntity + .syncCheckState + .eq("DONE") + .and(mapSheetMngHstEntity.syncState.eq("NOTPAIR")))) .then(1L) .otherwise(0L) .sum(), new CaseBuilder() .when( - mapSheetMngHstEntity - .syncCheckState - .eq("DONE") + mapInkx5kEntity + .useInference + .eq(CommonUseStatus.USE) .and(mapSheetMngHstEntity.syncState.eq("DUPLICATE"))) .then(1L) .otherwise(0L) .sum(), new CaseBuilder() .when( - mapSheetMngHstEntity - .syncState - .eq("TYPEERROR") - .or(mapSheetMngHstEntity.syncState.eq("SIZEERROR"))) + mapInkx5kEntity + .useInference + .eq(CommonUseStatus.USE) + .and( + mapSheetMngHstEntity + .syncCheckState + .eq("DONE") + .and(mapSheetMngHstEntity.syncState.eq("DUPLICATE")))) .then(1L) .otherwise(0L) .sum(), new CaseBuilder() .when( - mapSheetMngHstEntity - .syncCheckState - .eq("DONE") + mapInkx5kEntity + .useInference + .eq(CommonUseStatus.USE) .and( mapSheetMngHstEntity .syncState @@ -299,28 +338,53 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport .otherwise(0L) .sum(), new CaseBuilder() - .when(mapSheetMngHstEntity.syncState.eq("NOFILE")) + .when( + mapInkx5kEntity + .useInference + .eq(CommonUseStatus.USE) + .and( + mapSheetMngHstEntity + .syncCheckState + .eq("DONE") + .and( + mapSheetMngHstEntity + .syncState + .eq("TYPEERROR") + .or( + mapSheetMngHstEntity.syncState.eq( + "SIZEERROR"))))) .then(1L) .otherwise(0L) .sum(), new CaseBuilder() .when( - mapSheetMngHstEntity - .syncCheckState - .eq("DONE") + mapInkx5kEntity + .useInference + .eq(CommonUseStatus.USE) .and(mapSheetMngHstEntity.syncState.eq("NOFILE"))) .then(1L) .otherwise(0L) .sum(), + new CaseBuilder() + .when( + mapInkx5kEntity + .useInference + .eq(CommonUseStatus.USE) + .and( + mapSheetMngHstEntity + .syncCheckState + .eq("DONE") + .and(mapSheetMngHstEntity.syncState.eq("NOFILE")))) + .then(1L) + .otherwise(0L) + .sum(), mapSheetMngEntity.createdDttm, mapSheetMngHstEntity.syncEndDttm.max())) .from(mapSheetMngEntity) .leftJoin(mapSheetMngHstEntity) .on(mapSheetMngEntity.mngYyyy.eq(mapSheetMngHstEntity.mngYyyy)) - .innerJoin(mapInkx5kEntity) - .on( - mapSheetMngHstEntity.mapSheetNum.eq(mapInkx5kEntity.mapidcdNo), - mapInkx5kEntity.useInference.eq(CommonUseStatus.USE)) + .leftJoin(mapInkx5kEntity) + .on(mapSheetMngHstEntity.mapSheetNum.eq(mapInkx5kEntity.mapidcdNo)) .where(whereBuilder) .groupBy(mapSheetMngEntity.mngYyyy) .fetchOne();