분석결과 상세 목록 class cd 조건 lower 비교로 수정

This commit is contained in:
2025-12-01 15:44:28 +09:00
parent b35d2fcfd7
commit 6f25a5462c

View File

@@ -32,11 +32,11 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
private final QModelVerEntity tmv = QModelVerEntity.modelVerEntity; private final QModelVerEntity tmv = QModelVerEntity.modelVerEntity;
private final QMapSheetAnalEntity mapSheetAnalEntity = QMapSheetAnalEntity.mapSheetAnalEntity; private final QMapSheetAnalEntity mapSheetAnalEntity = QMapSheetAnalEntity.mapSheetAnalEntity;
private final QMapSheetAnalDataEntity mapSheetAnalDataEntity = private final QMapSheetAnalDataEntity mapSheetAnalDataEntity =
QMapSheetAnalDataEntity.mapSheetAnalDataEntity; QMapSheetAnalDataEntity.mapSheetAnalDataEntity;
private final QMapSheetAnalDataGeomEntity mapSheetAnalDataGeomEntity = private final QMapSheetAnalDataGeomEntity mapSheetAnalDataGeomEntity =
QMapSheetAnalDataGeomEntity.mapSheetAnalDataGeomEntity; QMapSheetAnalDataGeomEntity.mapSheetAnalDataGeomEntity;
private final QMapSheetAnalSttcEntity mapSheetAnalSttcEntity = private final QMapSheetAnalSttcEntity mapSheetAnalSttcEntity =
QMapSheetAnalSttcEntity.mapSheetAnalSttcEntity; QMapSheetAnalSttcEntity.mapSheetAnalSttcEntity;
/** /**
* 분석결과 목록 조회 * 분석결과 목록 조회
@@ -46,7 +46,7 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
*/ */
@Override @Override
public Page<InferenceResultDto.AnalResList> getInferenceResultList( public Page<InferenceResultDto.AnalResList> getInferenceResultList(
InferenceResultDto.SearchReq searchReq) { InferenceResultDto.SearchReq searchReq) {
Pageable pageable = searchReq.toPageable(); Pageable pageable = searchReq.toPageable();
// "0000" 전체조회 // "0000" 전체조회
BooleanBuilder builder = new BooleanBuilder(); BooleanBuilder builder = new BooleanBuilder();
@@ -60,35 +60,35 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
} }
List<InferenceResultDto.AnalResList> content = List<InferenceResultDto.AnalResList> content =
queryFactory queryFactory
.select( .select(
Projections.constructor( Projections.constructor(
InferenceResultDto.AnalResList.class, InferenceResultDto.AnalResList.class,
mapSheetAnalEntity.id, mapSheetAnalEntity.id,
mapSheetAnalEntity.analTitle, mapSheetAnalEntity.analTitle,
mapSheetAnalEntity.analMapSheet, mapSheetAnalEntity.analMapSheet,
mapSheetAnalEntity.detectingCnt, mapSheetAnalEntity.detectingCnt,
mapSheetAnalEntity.analStrtDttm, mapSheetAnalEntity.analStrtDttm,
mapSheetAnalEntity.analEndDttm, mapSheetAnalEntity.analEndDttm,
mapSheetAnalEntity.analSec, mapSheetAnalEntity.analSec,
mapSheetAnalEntity.analPredSec, mapSheetAnalEntity.analPredSec,
mapSheetAnalEntity.analState, mapSheetAnalEntity.analState,
Expressions.stringTemplate( Expressions.stringTemplate(
"fn_code_name({0}, {1})", "0002", mapSheetAnalEntity.analState), "fn_code_name({0}, {1})", "0002", mapSheetAnalEntity.analState),
mapSheetAnalEntity.gukyuinUsed)) mapSheetAnalEntity.gukyuinUsed))
.from(mapSheetAnalEntity) .from(mapSheetAnalEntity)
.where(builder) .where(builder)
.offset(pageable.getOffset()) .offset(pageable.getOffset())
.limit(pageable.getPageSize()) .limit(pageable.getPageSize())
.orderBy(mapSheetAnalEntity.createdDttm.desc()) .orderBy(mapSheetAnalEntity.createdDttm.desc())
.fetch(); .fetch();
long total = long total =
queryFactory queryFactory
.select(mapSheetAnalEntity.id) .select(mapSheetAnalEntity.id)
.from(mapSheetAnalEntity) .from(mapSheetAnalEntity)
.where(builder) .where(builder)
.fetchCount(); .fetchCount();
return new PageImpl<>(content, pageable, total); return new PageImpl<>(content, pageable, total);
} }
@@ -104,37 +104,37 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
// 1. 최신 버전 UID를 가져오는 서브쿼리 // 1. 최신 버전 UID를 가져오는 서브쿼리
JPQLQuery<Long> latestVerUidSub = JPQLQuery<Long> latestVerUidSub =
JPAExpressions.select(tmv.id.max()).from(tmv).where(tmv.modelUid.eq(tmm.id)); JPAExpressions.select(tmv.id.max()).from(tmv).where(tmv.modelUid.eq(tmm.id));
Optional<InferenceResultDto.AnalResSummary> content = Optional<InferenceResultDto.AnalResSummary> content =
Optional.ofNullable( Optional.ofNullable(
queryFactory queryFactory
.select( .select(
Projections.constructor( Projections.constructor(
InferenceResultDto.AnalResSummary.class, InferenceResultDto.AnalResSummary.class,
mapSheetAnalEntity.id, mapSheetAnalEntity.id,
mapSheetAnalEntity.analTitle, mapSheetAnalEntity.analTitle,
tmm.modelNm.concat(" ").concat(tmv.modelVer).as("modelInfo"), tmm.modelNm.concat(" ").concat(tmv.modelVer).as("modelInfo"),
mapSheetAnalEntity.targetYyyy, mapSheetAnalEntity.targetYyyy,
mapSheetAnalEntity.compareYyyy, mapSheetAnalEntity.compareYyyy,
mapSheetAnalEntity.analMapSheet, mapSheetAnalEntity.analMapSheet,
mapSheetAnalEntity.analStrtDttm, mapSheetAnalEntity.analStrtDttm,
mapSheetAnalEntity.analEndDttm, mapSheetAnalEntity.analEndDttm,
mapSheetAnalEntity.analSec, mapSheetAnalEntity.analSec,
mapSheetAnalEntity.analPredSec, mapSheetAnalEntity.analPredSec,
mapSheetAnalEntity.resultUrl, mapSheetAnalEntity.resultUrl,
mapSheetAnalEntity.detectingCnt, mapSheetAnalEntity.detectingCnt,
mapSheetAnalEntity.accuracy, mapSheetAnalEntity.accuracy,
mapSheetAnalEntity.analState, mapSheetAnalEntity.analState,
Expressions.stringTemplate( Expressions.stringTemplate(
"fn_code_name({0}, {1})", "0002", mapSheetAnalEntity.analState))) "fn_code_name({0}, {1})", "0002", mapSheetAnalEntity.analState)))
.from(mapSheetAnalEntity) .from(mapSheetAnalEntity)
.leftJoin(tmm) .leftJoin(tmm)
.on(mapSheetAnalEntity.modelUid.eq(tmm.id)) .on(mapSheetAnalEntity.modelUid.eq(tmm.id))
.leftJoin(tmv) .leftJoin(tmv)
.on(tmv.modelUid.eq(tmm.id).and(tmv.id.eq(latestVerUidSub))) .on(tmv.modelUid.eq(tmm.id).and(tmv.id.eq(latestVerUidSub)))
.where(mapSheetAnalEntity.id.eq(id)) .where(mapSheetAnalEntity.id.eq(id))
.fetchOne()); .fetchOne());
return content; return content;
} }
@@ -147,16 +147,16 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
@Override @Override
public List<Dashboard> getDashboard(Long id) { public List<Dashboard> getDashboard(Long id) {
return queryFactory return queryFactory
.select( .select(
Projections.constructor( Projections.constructor(
Dashboard.class, Dashboard.class,
mapSheetAnalSttcEntity.id.classAfterCd, mapSheetAnalSttcEntity.id.classAfterCd,
mapSheetAnalSttcEntity.classAfterCnt.sum())) mapSheetAnalSttcEntity.classAfterCnt.sum()))
.from(mapSheetAnalSttcEntity) .from(mapSheetAnalSttcEntity)
.where(mapSheetAnalSttcEntity.id.analUid.eq(id)) .where(mapSheetAnalSttcEntity.id.analUid.eq(id))
.groupBy(mapSheetAnalSttcEntity.id.classAfterCd) .groupBy(mapSheetAnalSttcEntity.id.classAfterCd)
.orderBy(mapSheetAnalSttcEntity.id.classAfterCd.asc()) .orderBy(mapSheetAnalSttcEntity.id.classAfterCd.asc())
.fetch(); .fetch();
} }
/** /**
@@ -175,12 +175,20 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
// 기준년도 분류 // 기준년도 분류
if (searchGeoReq.getTargetClass() != null && !searchGeoReq.getTargetClass().equals("")) { if (searchGeoReq.getTargetClass() != null && !searchGeoReq.getTargetClass().equals("")) {
builder.and(mapSheetAnalDataGeomEntity.classAfterCd.toLowerCase().eq(searchGeoReq.getTargetClass().toLowerCase())); builder.and(
mapSheetAnalDataGeomEntity
.classAfterCd
.toLowerCase()
.eq(searchGeoReq.getTargetClass().toLowerCase()));
} }
// 비교년도 분류 // 비교년도 분류
if (searchGeoReq.getCompareClass() != null && !searchGeoReq.getCompareClass().equals("")) { if (searchGeoReq.getCompareClass() != null && !searchGeoReq.getCompareClass().equals("")) {
builder.and(mapSheetAnalDataGeomEntity.classBeforeCd.toLowerCase().eq(searchGeoReq.getCompareClass().toLowerCase())); builder.and(
mapSheetAnalDataGeomEntity
.classBeforeCd
.toLowerCase()
.eq(searchGeoReq.getCompareClass().toLowerCase()));
} }
// 분석도엽 // 분석도엽
@@ -190,39 +198,39 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
} }
List<InferenceResultDto.Geom> content = List<InferenceResultDto.Geom> content =
queryFactory queryFactory
.select( .select(
Projections.constructor( Projections.constructor(
InferenceResultDto.Geom.class, InferenceResultDto.Geom.class,
mapSheetAnalDataGeomEntity.compareYyyy, mapSheetAnalDataGeomEntity.compareYyyy,
mapSheetAnalDataGeomEntity.targetYyyy, mapSheetAnalDataGeomEntity.targetYyyy,
mapSheetAnalDataGeomEntity.classBeforeCd, mapSheetAnalDataGeomEntity.classBeforeCd,
mapSheetAnalDataGeomEntity.classBeforeProb, mapSheetAnalDataGeomEntity.classBeforeProb,
mapSheetAnalDataGeomEntity.classAfterCd, mapSheetAnalDataGeomEntity.classAfterCd,
mapSheetAnalDataGeomEntity.classAfterProb, mapSheetAnalDataGeomEntity.classAfterProb,
mapSheetAnalDataGeomEntity.mapSheetNum, mapSheetAnalDataGeomEntity.mapSheetNum,
mapSheetAnalDataGeomEntity.geom, mapSheetAnalDataGeomEntity.geom,
mapSheetAnalDataGeomEntity.geomCenter)) mapSheetAnalDataGeomEntity.geomCenter))
.from(mapSheetAnalEntity) .from(mapSheetAnalEntity)
.join(mapSheetAnalDataEntity) .join(mapSheetAnalDataEntity)
.on(mapSheetAnalDataEntity.analUid.eq(mapSheetAnalEntity.id)) .on(mapSheetAnalDataEntity.analUid.eq(mapSheetAnalEntity.id))
.join(mapSheetAnalDataGeomEntity) .join(mapSheetAnalDataGeomEntity)
.on(mapSheetAnalDataGeomEntity.dataUid.eq(mapSheetAnalDataEntity.id)) .on(mapSheetAnalDataGeomEntity.dataUid.eq(mapSheetAnalDataEntity.id))
.where(builder) .where(builder)
.offset(pageable.getOffset()) .offset(pageable.getOffset())
.limit(pageable.getPageSize()) .limit(pageable.getPageSize())
.fetch(); .fetch();
long total = long total =
queryFactory queryFactory
.select(mapSheetAnalDataGeomEntity.id) .select(mapSheetAnalDataGeomEntity.id)
.from(mapSheetAnalEntity) .from(mapSheetAnalEntity)
.join(mapSheetAnalDataEntity) .join(mapSheetAnalDataEntity)
.on(mapSheetAnalDataEntity.analUid.eq(mapSheetAnalEntity.id)) .on(mapSheetAnalDataEntity.analUid.eq(mapSheetAnalEntity.id))
.join(mapSheetAnalDataGeomEntity) .join(mapSheetAnalDataGeomEntity)
.on(mapSheetAnalDataGeomEntity.dataUid.eq(mapSheetAnalDataEntity.id)) .on(mapSheetAnalDataGeomEntity.dataUid.eq(mapSheetAnalDataEntity.id))
.where(builder) .where(builder)
.fetchCount(); .fetchCount();
return new PageImpl<>(content, pageable, total); return new PageImpl<>(content, pageable, total);
} }
@@ -236,12 +244,12 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
@Override @Override
public List<Long> getSheets(Long id) { public List<Long> getSheets(Long id) {
return queryFactory return queryFactory
.select(mapSheetAnalDataEntity.mapSheetNum) .select(mapSheetAnalDataEntity.mapSheetNum)
.from(mapSheetAnalEntity) .from(mapSheetAnalEntity)
.join(mapSheetAnalDataEntity) .join(mapSheetAnalDataEntity)
.on(mapSheetAnalDataEntity.analUid.eq(mapSheetAnalEntity.id)) .on(mapSheetAnalDataEntity.analUid.eq(mapSheetAnalEntity.id))
.where(mapSheetAnalEntity.id.eq(id)) .where(mapSheetAnalEntity.id.eq(id))
.groupBy(mapSheetAnalDataEntity.mapSheetNum) .groupBy(mapSheetAnalDataEntity.mapSheetNum)
.fetch(); .fetch();
} }
} }