diff --git a/src/main/java/com/kamco/cd/training/dataset/dto/DatasetDto.java b/src/main/java/com/kamco/cd/training/dataset/dto/DatasetDto.java index 73cb7a9..18cd63e 100644 --- a/src/main/java/com/kamco/cd/training/dataset/dto/DatasetDto.java +++ b/src/main/java/com/kamco/cd/training/dataset/dto/DatasetDto.java @@ -248,13 +248,13 @@ public class DatasetDto { private Integer targetYyyy; private String memo; @JsonIgnore private Long classCount; - private Integer buildingCnt; - private Integer containerCnt; + private Long buildingCnt; + private Long containerCnt; private String dataTypeName; private Long wasteCnt; private Long landCoverCnt; - private Integer solarPanelCnt; + private Long solarPanelCnt; public SelectDataSet( String modelNo, @@ -267,6 +267,7 @@ public class DatasetDto { Integer targetYyyy, String memo, Long classCount) { + this.modelNo = modelNo; this.datasetId = datasetId; this.uuid = uuid; this.dataType = dataType; @@ -281,6 +282,8 @@ public class DatasetDto { this.wasteCnt = classCount; } else if (modelNo.equals(ModelType.G3.getId())) { this.landCoverCnt = classCount; + } else if (modelNo.equals(ModelType.G4.getId())) { + this.solarPanelCnt = classCount; } } @@ -294,8 +297,9 @@ public class DatasetDto { Integer compareYyyy, Integer targetYyyy, String memo, - Integer buildingCnt, - Integer containerCnt) { + Long buildingCnt, + Long containerCnt) { + this.modelNo = modelNo; this.datasetId = datasetId; this.uuid = uuid; this.dataType = dataType; @@ -309,29 +313,6 @@ public class DatasetDto { this.containerCnt = containerCnt; } - public SelectDataSet( - String modelNo, - Long datasetId, - UUID uuid, - String dataType, - String title, - Long roundNo, - Integer compareYyyy, - Integer targetYyyy, - String memo, - Integer solarPanelCnt) { - this.datasetId = datasetId; - this.uuid = uuid; - this.dataType = dataType; - this.dataTypeName = getDataTypeName(dataType); - this.title = title; - this.roundNo = roundNo; - this.compareYyyy = compareYyyy; - this.targetYyyy = targetYyyy; - this.memo = memo; - this.solarPanelCnt = solarPanelCnt; - } - public String getDataTypeName(String groupTitleCd) { LearnDataType type = Enums.fromId(LearnDataType.class, groupTitleCd); return type == null ? null : type.getText(); diff --git a/src/main/java/com/kamco/cd/training/postgres/repository/dataset/DatasetRepositoryImpl.java b/src/main/java/com/kamco/cd/training/postgres/repository/dataset/DatasetRepositoryImpl.java index 9c600cf..0506c7f 100644 --- a/src/main/java/com/kamco/cd/training/postgres/repository/dataset/DatasetRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/training/postgres/repository/dataset/DatasetRepositoryImpl.java @@ -125,15 +125,15 @@ public class DatasetRepositoryImpl implements DatasetRepositoryCustom { new CaseBuilder() .when( datasetObjEntity.targetClassCd.eq(DetectionClassification.BUILDING.getId())) - .then(1) - .otherwise(0) + .then(1L) + .otherwise(0L) .sum(), new CaseBuilder() .when( datasetObjEntity.targetClassCd.eq( DetectionClassification.CONTAINER.getId())) - .then(1) - .otherwise(0) + .then(1L) + .otherwise(0L) .sum())) .from(dataset) .leftJoin(datasetObjEntity) @@ -262,6 +262,7 @@ public class DatasetRepositoryImpl implements DatasetRepositoryCustom { builder.and(dataset.deleted.isFalse()); NumberExpression selectedCnt = null; + // G2 NumberExpression wasteCnt = datasetObjEntity .targetClassCd @@ -270,7 +271,7 @@ public class DatasetRepositoryImpl implements DatasetRepositoryCustom { .otherwise(0L) .sum(); - // G1, G2, G4 제외 + // G3 (G1, G2, G4 제외) NumberExpression elseCnt = new CaseBuilder() .when(datasetObjEntity.targetClassCd.notIn(building, container, waste, solar)) @@ -281,7 +282,7 @@ public class DatasetRepositoryImpl implements DatasetRepositoryCustom { if (StringUtils.isNotBlank(req.getModelNo())) { if (req.getModelNo().equals(ModelType.G2.getId())) { selectedCnt = wasteCnt; - } else { + } else if (req.getModelNo().equals(ModelType.G3.getId())) { selectedCnt = elseCnt; } } @@ -523,8 +524,8 @@ public class DatasetRepositoryImpl implements DatasetRepositoryCustom { dataset.memo, new CaseBuilder() .when(datasetObjEntity.targetClassCd.eq(DetectionClassification.SOLAR.getId())) - .then(1) - .otherwise(0) + .then(1L) + .otherwise(0L) .sum())) .from(dataset) .leftJoin(datasetObjEntity)