영상관리 목록, 상세 쿼리 수정

This commit is contained in:
2026-01-27 16:49:21 +09:00
parent 575c98f651
commit 77ac5e5b99

View File

@@ -100,48 +100,55 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
.then(1L) .then(1L)
.otherwise(0L) .otherwise(0L)
.sum(), .sum(),
new CaseBuilder()
.when(mapSheetMngHstEntity.syncState.eq("NOTPAIR"))
.then(1L)
.otherwise(0L)
.sum(),
new CaseBuilder() new CaseBuilder()
.when( .when(
mapSheetMngHstEntity mapInkx5kEntity
.syncCheckState .useInference
.eq("DONE") .eq(CommonUseStatus.USE)
.and(mapSheetMngHstEntity.syncState.eq("NOTPAIR"))) .and(mapSheetMngHstEntity.syncState.eq("NOTPAIR")))
.then(1L) .then(1L)
.otherwise(0L) .otherwise(0L)
.sum(), .sum(),
new CaseBuilder() 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) .then(1L)
.otherwise(0L) .otherwise(0L)
.sum(), .sum(),
new CaseBuilder() new CaseBuilder()
.when( .when(
mapSheetMngHstEntity mapInkx5kEntity
.syncCheckState .useInference
.eq("DONE") .eq(CommonUseStatus.USE)
.and(mapSheetMngHstEntity.syncState.eq("DUPLICATE"))) .and(mapSheetMngHstEntity.syncState.eq("DUPLICATE")))
.then(1L) .then(1L)
.otherwise(0L) .otherwise(0L)
.sum(), .sum(),
new CaseBuilder() new CaseBuilder()
.when( .when(
mapSheetMngHstEntity mapInkx5kEntity
.syncState .useInference
.eq("TYPEERROR") .eq(CommonUseStatus.USE)
.or(mapSheetMngHstEntity.syncState.eq("SIZEERROR"))) .and(
mapSheetMngHstEntity
.syncCheckState
.eq("DONE")
.and(mapSheetMngHstEntity.syncState.eq("DUPLICATE"))))
.then(1L) .then(1L)
.otherwise(0L) .otherwise(0L)
.sum(), .sum(),
new CaseBuilder() new CaseBuilder()
.when( .when(
mapSheetMngHstEntity mapInkx5kEntity
.syncCheckState .useInference
.eq("DONE") .eq(CommonUseStatus.USE)
.and( .and(
mapSheetMngHstEntity mapSheetMngHstEntity
.syncState .syncState
@@ -151,28 +158,53 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
.otherwise(0L) .otherwise(0L)
.sum(), .sum(),
new CaseBuilder() 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) .then(1L)
.otherwise(0L) .otherwise(0L)
.sum(), .sum(),
new CaseBuilder() new CaseBuilder()
.when( .when(
mapSheetMngHstEntity mapInkx5kEntity
.syncCheckState .useInference
.eq("DONE") .eq(CommonUseStatus.USE)
.and(mapSheetMngHstEntity.syncState.eq("NOFILE"))) .and(mapSheetMngHstEntity.syncState.eq("NOFILE")))
.then(1L) .then(1L)
.otherwise(0L) .otherwise(0L)
.sum(), .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, mapSheetMngEntity.createdDttm,
mapSheetMngHstEntity.syncEndDttm.max())) mapSheetMngHstEntity.syncEndDttm.max()))
.from(mapSheetMngEntity) .from(mapSheetMngEntity)
.leftJoin(mapSheetMngHstEntity) .leftJoin(mapSheetMngHstEntity)
.on(mapSheetMngEntity.mngYyyy.eq(mapSheetMngHstEntity.mngYyyy)) .on(mapSheetMngEntity.mngYyyy.eq(mapSheetMngHstEntity.mngYyyy))
.innerJoin(mapInkx5kEntity) .leftJoin(mapInkx5kEntity)
.on( .on(mapSheetMngHstEntity.mapSheetNum.eq(mapInkx5kEntity.mapidcdNo))
mapSheetMngHstEntity.mapSheetNum.eq(mapInkx5kEntity.mapidcdNo),
mapInkx5kEntity.useInference.eq(CommonUseStatus.USE))
.where(whereBuilder) .where(whereBuilder)
// .offset(pageable.getOffset()) // .offset(pageable.getOffset())
// .limit(pageable.getPageSize()) // .limit(pageable.getPageSize())
@@ -248,48 +280,55 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
.then(1L) .then(1L)
.otherwise(0L) .otherwise(0L)
.sum(), .sum(),
new CaseBuilder()
.when(mapSheetMngHstEntity.syncState.eq("NOTPAIR"))
.then(1L)
.otherwise(0L)
.sum(),
new CaseBuilder() new CaseBuilder()
.when( .when(
mapSheetMngHstEntity mapInkx5kEntity
.syncCheckState .useInference
.eq("DONE") .eq(CommonUseStatus.USE)
.and(mapSheetMngHstEntity.syncState.eq("NOTPAIR"))) .and(mapSheetMngHstEntity.syncState.eq("NOTPAIR")))
.then(1L) .then(1L)
.otherwise(0L) .otherwise(0L)
.sum(), .sum(),
new CaseBuilder() 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) .then(1L)
.otherwise(0L) .otherwise(0L)
.sum(), .sum(),
new CaseBuilder() new CaseBuilder()
.when( .when(
mapSheetMngHstEntity mapInkx5kEntity
.syncCheckState .useInference
.eq("DONE") .eq(CommonUseStatus.USE)
.and(mapSheetMngHstEntity.syncState.eq("DUPLICATE"))) .and(mapSheetMngHstEntity.syncState.eq("DUPLICATE")))
.then(1L) .then(1L)
.otherwise(0L) .otherwise(0L)
.sum(), .sum(),
new CaseBuilder() new CaseBuilder()
.when( .when(
mapSheetMngHstEntity mapInkx5kEntity
.syncState .useInference
.eq("TYPEERROR") .eq(CommonUseStatus.USE)
.or(mapSheetMngHstEntity.syncState.eq("SIZEERROR"))) .and(
mapSheetMngHstEntity
.syncCheckState
.eq("DONE")
.and(mapSheetMngHstEntity.syncState.eq("DUPLICATE"))))
.then(1L) .then(1L)
.otherwise(0L) .otherwise(0L)
.sum(), .sum(),
new CaseBuilder() new CaseBuilder()
.when( .when(
mapSheetMngHstEntity mapInkx5kEntity
.syncCheckState .useInference
.eq("DONE") .eq(CommonUseStatus.USE)
.and( .and(
mapSheetMngHstEntity mapSheetMngHstEntity
.syncState .syncState
@@ -299,28 +338,53 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
.otherwise(0L) .otherwise(0L)
.sum(), .sum(),
new CaseBuilder() 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) .then(1L)
.otherwise(0L) .otherwise(0L)
.sum(), .sum(),
new CaseBuilder() new CaseBuilder()
.when( .when(
mapSheetMngHstEntity mapInkx5kEntity
.syncCheckState .useInference
.eq("DONE") .eq(CommonUseStatus.USE)
.and(mapSheetMngHstEntity.syncState.eq("NOFILE"))) .and(mapSheetMngHstEntity.syncState.eq("NOFILE")))
.then(1L) .then(1L)
.otherwise(0L) .otherwise(0L)
.sum(), .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, mapSheetMngEntity.createdDttm,
mapSheetMngHstEntity.syncEndDttm.max())) mapSheetMngHstEntity.syncEndDttm.max()))
.from(mapSheetMngEntity) .from(mapSheetMngEntity)
.leftJoin(mapSheetMngHstEntity) .leftJoin(mapSheetMngHstEntity)
.on(mapSheetMngEntity.mngYyyy.eq(mapSheetMngHstEntity.mngYyyy)) .on(mapSheetMngEntity.mngYyyy.eq(mapSheetMngHstEntity.mngYyyy))
.innerJoin(mapInkx5kEntity) .leftJoin(mapInkx5kEntity)
.on( .on(mapSheetMngHstEntity.mapSheetNum.eq(mapInkx5kEntity.mapidcdNo))
mapSheetMngHstEntity.mapSheetNum.eq(mapInkx5kEntity.mapidcdNo),
mapInkx5kEntity.useInference.eq(CommonUseStatus.USE))
.where(whereBuilder) .where(whereBuilder)
.groupBy(mapSheetMngEntity.mngYyyy) .groupBy(mapSheetMngEntity.mngYyyy)
.fetchOne(); .fetchOne();