diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/trainingdata/TrainingDataLabelRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/trainingdata/TrainingDataLabelRepositoryImpl.java index 0aade587..c7259da1 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/trainingdata/TrainingDataLabelRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/trainingdata/TrainingDataLabelRepositoryImpl.java @@ -616,7 +616,9 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport .select( labelingAssignmentEntity.assignmentUid, labelingAssignmentEntity.createdDate, - labelingAssignmentEntity.inferenceGeomUid) + labelingAssignmentEntity.inferenceGeomUid, + mapSheetAnalInferenceEntity.targetYyyy, + mapSheetAnalInferenceEntity.compareYyyy) .from(labelingAssignmentEntity) .innerJoin(mapSheetAnalInferenceEntity) .on(labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id)) @@ -641,21 +643,38 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport UUID firstAssignedUid = firstAssigned.get(labelingAssignmentEntity.assignmentUid); ZonedDateTime createdDttm = firstAssigned.get(labelingAssignmentEntity.createdDate); Long inferenceGeomUid = firstAssigned.get(labelingAssignmentEntity.inferenceGeomUid); + Integer targetYyyy = firstAssigned.get(mapSheetAnalInferenceEntity.targetYyyy); + Integer compareYyyy = firstAssigned.get(mapSheetAnalInferenceEntity.compareYyyy); BooleanExpression beforeCondition = - labelingAssignmentEntity - .createdDate - .lt(createdDttm) + mapSheetAnalInferenceEntity + .targetYyyy + .lt(targetYyyy) .or( - labelingAssignmentEntity - .createdDate - .eq(createdDttm) + mapSheetAnalInferenceEntity + .targetYyyy + .eq(targetYyyy) + .and(mapSheetAnalInferenceEntity.compareYyyy.lt(compareYyyy))) + .or( + mapSheetAnalInferenceEntity + .targetYyyy + .eq(targetYyyy) + .and(mapSheetAnalInferenceEntity.compareYyyy.eq(compareYyyy)) + .and(labelingAssignmentEntity.createdDate.lt(createdDttm))) + .or( + mapSheetAnalInferenceEntity + .targetYyyy + .eq(targetYyyy) + .and(mapSheetAnalInferenceEntity.compareYyyy.eq(compareYyyy)) + .and(labelingAssignmentEntity.createdDate.eq(createdDttm)) .and(labelingAssignmentEntity.inferenceGeomUid.lt(inferenceGeomUid))); Long beforeCnt = queryFactory .select(labelingAssignmentEntity.count()) .from(labelingAssignmentEntity) + .innerJoin(mapSheetAnalInferenceEntity) + .on(mapSheetAnalInferenceEntity.id.eq(labelingAssignmentEntity.analUid)) .where( labelingAssignmentEntity.workerUid.eq(userId), beforeCondition.and(stateCondition)) .fetchOne(); diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/trainingdata/TrainingDataReviewRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/trainingdata/TrainingDataReviewRepositoryImpl.java index ba9e36ab..295eb0b4 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/trainingdata/TrainingDataReviewRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/trainingdata/TrainingDataReviewRepositoryImpl.java @@ -645,8 +645,12 @@ public class TrainingDataReviewRepositoryImpl extends QuerydslRepositorySupport .select( labelingAssignmentEntity.assignmentUid, labelingAssignmentEntity.createdDate, - labelingAssignmentEntity.inferenceGeomUid) + labelingAssignmentEntity.inferenceGeomUid, + mapSheetAnalInferenceEntity.targetYyyy, + mapSheetAnalInferenceEntity.compareYyyy) .from(labelingAssignmentEntity) + .innerJoin(mapSheetAnalInferenceEntity) + .on(labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id)) .where( labelingAssignmentEntity.inspectorUid.eq(userId), stateCondition, @@ -654,6 +658,8 @@ public class TrainingDataReviewRepositoryImpl extends QuerydslRepositorySupport ? labelingAssignmentEntity.inspectState.eq(InspectState.UNCONFIRM.getId()) : labelingAssignmentEntity.assignmentUid.eq(UUID.fromString(operatorUid))) .orderBy( + mapSheetAnalInferenceEntity.targetYyyy.asc(), + mapSheetAnalInferenceEntity.compareYyyy.asc(), labelingAssignmentEntity.createdDate.asc(), labelingAssignmentEntity.inferenceGeomUid.asc()) .limit(1) @@ -666,21 +672,38 @@ public class TrainingDataReviewRepositoryImpl extends QuerydslRepositorySupport UUID firstAssignedUid = firstAssigned.get(labelingAssignmentEntity.assignmentUid); ZonedDateTime createdDttm = firstAssigned.get(labelingAssignmentEntity.createdDate); Long inferenceGeomUid = firstAssigned.get(labelingAssignmentEntity.inferenceGeomUid); + Integer targetYyyy = firstAssigned.get(mapSheetAnalInferenceEntity.targetYyyy); + Integer compareYyyy = firstAssigned.get(mapSheetAnalInferenceEntity.compareYyyy); BooleanExpression beforeCondition = - labelingAssignmentEntity - .createdDate - .lt(createdDttm) + mapSheetAnalInferenceEntity + .targetYyyy + .lt(targetYyyy) .or( - labelingAssignmentEntity - .createdDate - .eq(createdDttm) + mapSheetAnalInferenceEntity + .targetYyyy + .eq(targetYyyy) + .and(mapSheetAnalInferenceEntity.compareYyyy.lt(compareYyyy))) + .or( + mapSheetAnalInferenceEntity + .targetYyyy + .eq(targetYyyy) + .and(mapSheetAnalInferenceEntity.compareYyyy.eq(compareYyyy)) + .and(labelingAssignmentEntity.createdDate.lt(createdDttm))) + .or( + mapSheetAnalInferenceEntity + .targetYyyy + .eq(targetYyyy) + .and(mapSheetAnalInferenceEntity.compareYyyy.eq(compareYyyy)) + .and(labelingAssignmentEntity.createdDate.eq(createdDttm)) .and(labelingAssignmentEntity.inferenceGeomUid.lt(inferenceGeomUid))); Long beforeCnt = queryFactory .select(labelingAssignmentEntity.count()) .from(labelingAssignmentEntity) + .innerJoin(mapSheetAnalInferenceEntity) + .on(mapSheetAnalInferenceEntity.id.eq(labelingAssignmentEntity.analUid)) .where( labelingAssignmentEntity.inspectorUid.eq(userId), beforeCondition.and(stateCondition))