라벨링 툴 라벨러 목록에 polygon, cog 추가

This commit is contained in:
2026-01-09 16:57:55 +09:00
parent 317f9ff38f
commit 40f2b09e0c
2 changed files with 97 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
package com.kamco.cd.kamcoback.postgres.repository.trainingdata;
import static com.kamco.cd.kamcoback.postgres.entity.QImageryEntity.imageryEntity;
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingAssignmentEntity.labelingAssignmentEntity;
import static com.kamco.cd.kamcoback.postgres.entity.QMapInkx5kEntity.mapInkx5kEntity;
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
@@ -8,6 +9,10 @@ import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingListDto;
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.searchReq;
import com.querydsl.core.types.Projections;
import com.querydsl.core.types.dsl.CaseBuilder;
import com.querydsl.core.types.dsl.Expressions;
import com.querydsl.core.types.dsl.NumberPath;
import com.querydsl.core.types.dsl.StringExpression;
import com.querydsl.jpa.impl.JPAQueryFactory;
import java.util.List;
import org.springframework.data.domain.Page;
@@ -40,7 +45,15 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
labelingAssignmentEntity.workState,
labelingAssignmentEntity.assignGroupId,
mapInkx5kEntity.mapidNm,
mapSheetAnalDataInferenceGeomEntity.pnu))
mapSheetAnalDataInferenceGeomEntity.pnu,
Expressions.stringTemplate(
"ST_AsGeoJSON({0})", mapSheetAnalDataInferenceGeomEntity.geom),
makeCogUrl(mapSheetAnalDataInferenceGeomEntity.compareYyyy)
.max()
.as("beforeCogUrl"),
makeCogUrl(mapSheetAnalDataInferenceGeomEntity.targetYyyy)
.max()
.as("afterCogUrl")))
.from(labelingAssignmentEntity)
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
.on(
@@ -48,7 +61,28 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
mapSheetAnalDataInferenceGeomEntity.geoUid))
.innerJoin(mapInkx5kEntity)
.on(labelingAssignmentEntity.assignGroupId.eq(mapInkx5kEntity.mapidcdNo))
.leftJoin(imageryEntity)
.on(
imageryEntity
.scene5k
.eq(labelingAssignmentEntity.assignGroupId)
.and(
imageryEntity
.year
.eq(mapSheetAnalDataInferenceGeomEntity.compareYyyy)
.or(
imageryEntity.year.eq(
mapSheetAnalDataInferenceGeomEntity.targetYyyy))))
.where(labelingAssignmentEntity.workerUid.eq(userId))
.groupBy(
labelingAssignmentEntity.assignmentUid,
labelingAssignmentEntity.inferenceGeomUid,
labelingAssignmentEntity.workerUid,
labelingAssignmentEntity.workState,
labelingAssignmentEntity.assignGroupId,
mapInkx5kEntity.mapidNm,
mapSheetAnalDataInferenceGeomEntity.pnu,
mapSheetAnalDataInferenceGeomEntity.geom)
.offset(pageable.getOffset())
.limit(pageable.getPageSize())
.orderBy(
@@ -66,9 +100,31 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
mapSheetAnalDataInferenceGeomEntity.geoUid))
.innerJoin(mapInkx5kEntity)
.on(labelingAssignmentEntity.assignGroupId.eq(mapInkx5kEntity.mapidcdNo))
.leftJoin(imageryEntity)
.on(
imageryEntity
.scene5k
.eq(labelingAssignmentEntity.assignGroupId)
.and(
imageryEntity
.year
.eq(mapSheetAnalDataInferenceGeomEntity.compareYyyy)
.or(
imageryEntity.year.eq(
mapSheetAnalDataInferenceGeomEntity.targetYyyy))))
.where(labelingAssignmentEntity.workerUid.eq(userId))
.groupBy(labelingAssignmentEntity.assignmentUid)
.fetchOne();
return new PageImpl<>(list, pageable, count);
}
private StringExpression makeCogUrl(NumberPath<Integer> year) {
return new CaseBuilder()
.when(imageryEntity.year.eq(year))
.then(
Expressions.stringTemplate(
"{0} || {1}", imageryEntity.cogMiddlePath, imageryEntity.cogFilename))
.otherwise("");
}
}