임시 데이터셋 폴더 생성 G4 추가
This commit is contained in:
@@ -522,9 +522,7 @@ public class DatasetRepositoryImpl implements DatasetRepositoryCustom {
|
||||
dataset.targetYyyy,
|
||||
dataset.memo,
|
||||
new CaseBuilder()
|
||||
.when(
|
||||
datasetObjEntity.targetClassCd.equalsIgnoreCase(
|
||||
DetectionClassification.SOLAR.getId()))
|
||||
.when(datasetObjEntity.targetClassCd.eq(DetectionClassification.SOLAR.getId()))
|
||||
.then(1)
|
||||
.otherwise(0)
|
||||
.sum()))
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.kamco.cd.training.postgres.repository.model;
|
||||
|
||||
import static com.kamco.cd.training.postgres.entity.QDatasetEntity.datasetEntity;
|
||||
import static com.kamco.cd.training.postgres.entity.QDatasetObjEntity.datasetObjEntity;
|
||||
import static com.kamco.cd.training.postgres.entity.QModelDatasetMappEntity.modelDatasetMappEntity;
|
||||
import static com.kamco.cd.training.postgres.entity.QModelMasterEntity.modelMasterEntity;
|
||||
|
||||
import com.kamco.cd.training.common.enums.DetectionClassification;
|
||||
import com.kamco.cd.training.common.enums.ModelType;
|
||||
import com.kamco.cd.training.postgres.entity.ModelDatasetMappEntity;
|
||||
import com.kamco.cd.training.postgres.entity.QDatasetObjEntity;
|
||||
@@ -11,6 +13,7 @@ import com.kamco.cd.training.postgres.entity.QDatasetTestObjEntity;
|
||||
import com.kamco.cd.training.postgres.entity.QDatasetValObjEntity;
|
||||
import com.kamco.cd.training.train.dto.ModelTrainLinkDto;
|
||||
import com.querydsl.core.types.Projections;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -33,9 +36,44 @@ public class ModelDatasetMappRepositoryImpl implements ModelDatasetMappRepositor
|
||||
|
||||
@Override
|
||||
public List<ModelTrainLinkDto> findDatasetTrainPath(Long modelId) {
|
||||
|
||||
QDatasetObjEntity datasetObjEntity = QDatasetObjEntity.datasetObjEntity;
|
||||
|
||||
// =====================
|
||||
// 조건 분리
|
||||
// =====================
|
||||
BooleanExpression g1 =
|
||||
modelMasterEntity
|
||||
.modelNo
|
||||
.eq(ModelType.G1.getId())
|
||||
.and(
|
||||
datasetObjEntity.targetClassCd.in(
|
||||
DetectionClassification.CONTAINER.getId(),
|
||||
DetectionClassification.BUILDING.getId()));
|
||||
|
||||
BooleanExpression g2 =
|
||||
modelMasterEntity
|
||||
.modelNo
|
||||
.eq(ModelType.G2.getId())
|
||||
.and(datasetObjEntity.targetClassCd.eq(DetectionClassification.WASTE.getId()));
|
||||
|
||||
BooleanExpression g4 =
|
||||
modelMasterEntity
|
||||
.modelNo
|
||||
.eq(ModelType.G4.getId())
|
||||
.and(datasetObjEntity.targetClassCd.eq(DetectionClassification.SOLAR.getId()));
|
||||
|
||||
// G3 = 전체 허용 (fallback)
|
||||
BooleanExpression g3 =
|
||||
modelMasterEntity
|
||||
.modelNo
|
||||
.eq(ModelType.G3.getId())
|
||||
.and(
|
||||
datasetObjEntity.targetClassCd.notIn(
|
||||
DetectionClassification.CONTAINER.getId(),
|
||||
DetectionClassification.BUILDING.getId(),
|
||||
DetectionClassification.WASTE.getId(),
|
||||
DetectionClassification.SOLAR.getId()));
|
||||
|
||||
return queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
@@ -60,17 +98,7 @@ public class ModelDatasetMappRepositoryImpl implements ModelDatasetMappRepositor
|
||||
datasetObjEntity
|
||||
.datasetUid
|
||||
.eq(modelDatasetMappEntity.datasetUid)
|
||||
.and(
|
||||
modelMasterEntity
|
||||
.modelNo
|
||||
.eq(ModelType.G1.getId())
|
||||
.and(datasetObjEntity.targetClassCd.upper().in("CONTAINER", "BUILDING"))
|
||||
.or(
|
||||
modelMasterEntity
|
||||
.modelNo
|
||||
.eq(ModelType.G2.getId())
|
||||
.and(datasetObjEntity.targetClassCd.upper().eq("WASTE")))
|
||||
.or(modelMasterEntity.modelNo.eq(ModelType.G3.getId()))))
|
||||
.and(g1.or(g2).or(g4).or(g3)))
|
||||
.where(modelMasterEntity.id.eq(modelId))
|
||||
.fetch();
|
||||
}
|
||||
@@ -80,6 +108,42 @@ public class ModelDatasetMappRepositoryImpl implements ModelDatasetMappRepositor
|
||||
|
||||
QDatasetValObjEntity datasetValObjEntity = QDatasetValObjEntity.datasetValObjEntity;
|
||||
|
||||
// =====================
|
||||
// 조건 분리
|
||||
// =====================
|
||||
BooleanExpression g1 =
|
||||
modelMasterEntity
|
||||
.modelNo
|
||||
.eq(ModelType.G1.getId())
|
||||
.and(
|
||||
datasetValObjEntity.targetClassCd.in(
|
||||
DetectionClassification.CONTAINER.getId(),
|
||||
DetectionClassification.BUILDING.getId()));
|
||||
|
||||
BooleanExpression g2 =
|
||||
modelMasterEntity
|
||||
.modelNo
|
||||
.eq(ModelType.G2.getId())
|
||||
.and(datasetValObjEntity.targetClassCd.eq(DetectionClassification.WASTE.getId()));
|
||||
|
||||
BooleanExpression g4 =
|
||||
modelMasterEntity
|
||||
.modelNo
|
||||
.eq(ModelType.G4.getId())
|
||||
.and(datasetValObjEntity.targetClassCd.eq(DetectionClassification.SOLAR.getId()));
|
||||
|
||||
// G3 = 전체 허용 (fallback)
|
||||
BooleanExpression g3 =
|
||||
modelMasterEntity
|
||||
.modelNo
|
||||
.eq(ModelType.G3.getId())
|
||||
.and(
|
||||
datasetValObjEntity.targetClassCd.notIn(
|
||||
DetectionClassification.CONTAINER.getId(),
|
||||
DetectionClassification.BUILDING.getId(),
|
||||
DetectionClassification.WASTE.getId(),
|
||||
DetectionClassification.SOLAR.getId()));
|
||||
|
||||
return queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
@@ -104,17 +168,7 @@ public class ModelDatasetMappRepositoryImpl implements ModelDatasetMappRepositor
|
||||
datasetValObjEntity
|
||||
.datasetUid
|
||||
.eq(modelDatasetMappEntity.datasetUid)
|
||||
.and(
|
||||
modelMasterEntity
|
||||
.modelNo
|
||||
.eq(ModelType.G1.getId())
|
||||
.and(datasetValObjEntity.targetClassCd.upper().in("CONTAINER", "BUILDING"))
|
||||
.or(
|
||||
modelMasterEntity
|
||||
.modelNo
|
||||
.eq(ModelType.G2.getId())
|
||||
.and(datasetValObjEntity.targetClassCd.upper().eq("WASTE")))
|
||||
.or(modelMasterEntity.modelNo.eq(ModelType.G3.getId()))))
|
||||
.and(g1.or(g2).or(g4).or(g3)))
|
||||
.where(modelMasterEntity.id.eq(modelId))
|
||||
.fetch();
|
||||
}
|
||||
@@ -124,6 +178,42 @@ public class ModelDatasetMappRepositoryImpl implements ModelDatasetMappRepositor
|
||||
|
||||
QDatasetTestObjEntity datasetTestObjEntity = QDatasetTestObjEntity.datasetTestObjEntity;
|
||||
|
||||
// =====================
|
||||
// 조건 분리
|
||||
// =====================
|
||||
BooleanExpression g1 =
|
||||
modelMasterEntity
|
||||
.modelNo
|
||||
.eq(ModelType.G1.getId())
|
||||
.and(
|
||||
datasetTestObjEntity.targetClassCd.in(
|
||||
DetectionClassification.CONTAINER.getId(),
|
||||
DetectionClassification.BUILDING.getId()));
|
||||
|
||||
BooleanExpression g2 =
|
||||
modelMasterEntity
|
||||
.modelNo
|
||||
.eq(ModelType.G2.getId())
|
||||
.and(datasetTestObjEntity.targetClassCd.eq(DetectionClassification.WASTE.getId()));
|
||||
|
||||
BooleanExpression g4 =
|
||||
modelMasterEntity
|
||||
.modelNo
|
||||
.eq(ModelType.G4.getId())
|
||||
.and(datasetTestObjEntity.targetClassCd.eq(DetectionClassification.SOLAR.getId()));
|
||||
|
||||
// G3 = 전체 허용 (fallback)
|
||||
BooleanExpression g3 =
|
||||
modelMasterEntity
|
||||
.modelNo
|
||||
.eq(ModelType.G3.getId())
|
||||
.and(
|
||||
datasetTestObjEntity.targetClassCd.notIn(
|
||||
DetectionClassification.CONTAINER.getId(),
|
||||
DetectionClassification.BUILDING.getId(),
|
||||
DetectionClassification.WASTE.getId(),
|
||||
DetectionClassification.SOLAR.getId()));
|
||||
|
||||
return queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
@@ -148,17 +238,7 @@ public class ModelDatasetMappRepositoryImpl implements ModelDatasetMappRepositor
|
||||
datasetTestObjEntity
|
||||
.datasetUid
|
||||
.eq(modelDatasetMappEntity.datasetUid)
|
||||
.and(
|
||||
modelMasterEntity
|
||||
.modelNo
|
||||
.eq(ModelType.G1.getId())
|
||||
.and(datasetTestObjEntity.targetClassCd.upper().in("CONTAINER", "BUILDING"))
|
||||
.or(
|
||||
modelMasterEntity
|
||||
.modelNo
|
||||
.eq(ModelType.G2.getId())
|
||||
.and(datasetTestObjEntity.targetClassCd.upper().eq("WASTE")))
|
||||
.or(modelMasterEntity.modelNo.eq(ModelType.G3.getId()))))
|
||||
.and(g1.or(g2).or(g4).or(g3)))
|
||||
.where(modelMasterEntity.id.eq(modelId))
|
||||
.fetch();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user