변화결과지도 년도선택 리스트 조회 수정
This commit is contained in:
@@ -19,6 +19,8 @@ import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapSheetLis
|
|||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Status;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Status;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceEntity;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity;
|
||||||
import com.querydsl.core.types.Projections;
|
import com.querydsl.core.types.Projections;
|
||||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||||
import com.querydsl.core.types.dsl.CaseBuilder;
|
import com.querydsl.core.types.dsl.CaseBuilder;
|
||||||
@@ -174,27 +176,33 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ChangeDetectionDto.AnalYearList> getChangeDetectionYearList() {
|
public List<ChangeDetectionDto.AnalYearList> getChangeDetectionYearList() {
|
||||||
|
QMapSheetLearnEntity l = mapSheetLearnEntity;
|
||||||
|
QMapSheetAnalInferenceEntity a = mapSheetAnalInferenceEntity;
|
||||||
QMapSheetAnalDataInferenceEntity d = new QMapSheetAnalDataInferenceEntity("d2");
|
QMapSheetAnalDataInferenceEntity d = new QMapSheetAnalDataInferenceEntity("d2");
|
||||||
|
|
||||||
|
StringExpression mapSheetNumExpr =
|
||||||
|
Expressions.stringTemplate(
|
||||||
|
"cast({0} as string)",
|
||||||
|
JPAExpressions.select(d.mapSheetNum.max()).from(d).where(d.analUid.eq(a.id)));
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(
|
.select(
|
||||||
Projections.constructor(
|
Projections.constructor(
|
||||||
ChangeDetectionDto.AnalYearList.class,
|
ChangeDetectionDto.AnalYearList.class,
|
||||||
mapSheetLearnEntity.uuid,
|
l.uuid,
|
||||||
mapSheetLearnEntity.id,
|
l.id,
|
||||||
mapSheetLearnEntity.title,
|
l.title,
|
||||||
mapSheetLearnEntity.compareYyyy.as("beforeYear"),
|
l.compareYyyy.as("beforeYear"),
|
||||||
mapSheetLearnEntity.targetYyyy.as("afterYear"),
|
l.targetYyyy.as("afterYear"),
|
||||||
Expressions.stringTemplate(
|
mapSheetNumExpr))
|
||||||
"cast({0} as string)",
|
.from(l)
|
||||||
JPAExpressions.select(d.mapSheetNum.max())
|
.leftJoin(a)
|
||||||
.from(d)
|
.on(a.learnId.eq(l.id))
|
||||||
.where(d.analUid.eq(mapSheetAnalInferenceEntity.id)))))
|
.where(
|
||||||
.from(mapSheetLearnEntity)
|
l.status
|
||||||
.leftJoin(mapSheetAnalInferenceEntity)
|
.eq(Status.END.getId())
|
||||||
.on(mapSheetAnalInferenceEntity.learnId.eq(mapSheetLearnEntity.id))
|
.and(JPAExpressions.selectOne().from(d).where(d.analUid.eq(a.id)).exists()))
|
||||||
.where(mapSheetLearnEntity.status.eq(Status.END.getId()))
|
.orderBy(l.id.asc())
|
||||||
.orderBy(mapSheetLearnEntity.id.asc())
|
|
||||||
.fetch();
|
.fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user