sttc 엔티티 수정
This commit is contained in:
@@ -2,7 +2,6 @@ package com.kamco.cd.kamcoback.postgres.core;
|
||||
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Dashboard;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalSttcEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.Inference.InferenceResultRepository;
|
||||
import jakarta.persistence.EntityNotFoundException;
|
||||
import java.util.List;
|
||||
@@ -48,9 +47,10 @@ public class InferenceResultCoreService {
|
||||
* @return
|
||||
*/
|
||||
public List<Dashboard> getInferenceResultDashboard(Long id) {
|
||||
return inferenceResultRepository.getInferenceResultDashboard(id).stream()
|
||||
.map(MapSheetAnalSttcEntity::toDto)
|
||||
.toList();
|
||||
return null;
|
||||
// inferenceResultRepository.getInferenceResultDashboard(id).stream()
|
||||
// .map(MapSheetAnalSttcEntity::toDto)
|
||||
// .toList();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,4 +63,9 @@ public class InferenceResultCoreService {
|
||||
InferenceResultDto.SearchGeoReq searchGeoReq) {
|
||||
return inferenceResultRepository.getInferenceGeomList(searchGeoReq);
|
||||
}
|
||||
//
|
||||
// public List<Long> getSheets(
|
||||
// return inferenceResultRepository.get
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.kamco.cd.kamcoback.postgres.entity;
|
||||
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.EmbeddedId;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.ZonedDateTime;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.OffsetDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
@@ -17,26 +17,29 @@ import org.hibernate.annotations.ColumnDefault;
|
||||
@Table(name = "tb_map_sheet_anal_sttc")
|
||||
public class MapSheetAnalSttcEntity {
|
||||
|
||||
@EmbeddedId private MapSheetAnalSttcEntityId id;
|
||||
@EmbeddedId
|
||||
private MapSheetAnalSttcEntityId id;
|
||||
|
||||
@ColumnDefault("0")
|
||||
@Column(name = "class_before_cnt")
|
||||
private Long classBeforeCnt;
|
||||
|
||||
@ColumnDefault("0")
|
||||
@Column(name = "class_after_cnt")
|
||||
private Long classAfterCnt;
|
||||
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "created_dttm")
|
||||
private ZonedDateTime createdDttm;
|
||||
private OffsetDateTime createdDttm;
|
||||
|
||||
@Column(name = "created_uid")
|
||||
private Long createdUid;
|
||||
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "updated_dttm")
|
||||
private ZonedDateTime updatedDttm;
|
||||
private OffsetDateTime updatedDttm;
|
||||
|
||||
@Column(name = "updated_uid", length = Integer.MAX_VALUE)
|
||||
@Column(name = "updated_uid")
|
||||
private Long updatedUid;
|
||||
|
||||
@NotNull
|
||||
@@ -47,26 +50,12 @@ public class MapSheetAnalSttcEntity {
|
||||
@Column(name = "data_uid", nullable = false)
|
||||
private Long dataUid;
|
||||
|
||||
@Column(name = "class_before_cd")
|
||||
@Size(max = 30)
|
||||
@Column(name = "class_before_cd", length = 30)
|
||||
private String classBeforeCd;
|
||||
|
||||
@Column(name = "class_after_cd")
|
||||
@Size(max = 30)
|
||||
@Column(name = "class_after_cd", length = 30)
|
||||
private String classAfterCd;
|
||||
|
||||
public InferenceResultDto.Dashboard toDto() {
|
||||
return new InferenceResultDto.Dashboard(
|
||||
id.getCompareYyyy(),
|
||||
id.getTargetYyyy(),
|
||||
id.getMapSheetNum(),
|
||||
id.getClassBeforeName(),
|
||||
id.getClassAfterName(),
|
||||
this.classBeforeCnt,
|
||||
this.classAfterCnt,
|
||||
this.createdDttm,
|
||||
this.createdUid,
|
||||
this.updatedDttm,
|
||||
this.updatedUid,
|
||||
this.refMapSheetNum,
|
||||
this.dataUid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.kamco.cd.kamcoback.postgres.entity;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Embeddable;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
import lombok.Getter;
|
||||
@@ -15,8 +14,7 @@ import org.hibernate.Hibernate;
|
||||
@Embeddable
|
||||
public class MapSheetAnalSttcEntityId implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -8630519290255405042L;
|
||||
|
||||
private static final long serialVersionUID = 2285491656408229553L;
|
||||
@NotNull
|
||||
@Column(name = "compare_yyyy", nullable = false)
|
||||
private Integer compareYyyy;
|
||||
@@ -29,16 +27,6 @@ public class MapSheetAnalSttcEntityId implements Serializable {
|
||||
@Column(name = "map_sheet_num", nullable = false)
|
||||
private Long mapSheetNum;
|
||||
|
||||
@Size(max = 64)
|
||||
@NotNull
|
||||
@Column(name = "class_before_name", nullable = false, length = 64)
|
||||
private String classBeforeName;
|
||||
|
||||
@Size(max = 64)
|
||||
@NotNull
|
||||
@Column(name = "class_after_name", nullable = false, length = 64)
|
||||
private String classAfterName;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
@@ -48,15 +36,14 @@ public class MapSheetAnalSttcEntityId implements Serializable {
|
||||
return false;
|
||||
}
|
||||
MapSheetAnalSttcEntityId entity = (MapSheetAnalSttcEntityId) o;
|
||||
return Objects.equals(this.targetYyyy, entity.targetYyyy)
|
||||
&& Objects.equals(this.classBeforeName, entity.classBeforeName)
|
||||
&& Objects.equals(this.classAfterName, entity.classAfterName)
|
||||
&& Objects.equals(this.compareYyyy, entity.compareYyyy)
|
||||
&& Objects.equals(this.mapSheetNum, entity.mapSheetNum);
|
||||
return Objects.equals(this.targetYyyy, entity.targetYyyy) &&
|
||||
Objects.equals(this.compareYyyy, entity.compareYyyy) &&
|
||||
Objects.equals(this.mapSheetNum, entity.mapSheetNum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(targetYyyy, classBeforeName, classAfterName, compareYyyy, mapSheetNum);
|
||||
return Objects.hash(targetYyyy, compareYyyy, mapSheetNum);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.Optional;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
public interface InferenceResultRepositoryCustom {
|
||||
|
||||
Page<InferenceResultDto.AnalResList> getInferenceResultList(
|
||||
InferenceResultDto.SearchReq searchReq);
|
||||
|
||||
@@ -15,4 +16,6 @@ public interface InferenceResultRepositoryCustom {
|
||||
List<MapSheetAnalSttcEntity> getInferenceResultDashboard(Long id);
|
||||
|
||||
Page<InferenceResultDto.Geom> getInferenceGeomList(InferenceResultDto.SearchGeoReq searchGeoReq);
|
||||
|
||||
List<Long> getSheets(Long id);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.SearchGeoReq;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalSttcEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataGeomEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalSttcEntity;
|
||||
@@ -27,9 +28,10 @@ import org.springframework.stereotype.Repository;
|
||||
public class InferenceResultRepositoryImpl implements InferenceResultRepositoryCustom {
|
||||
|
||||
private final JPAQueryFactory queryFactory;
|
||||
private final QMapSheetAnalEntity mapSheetAnal = QMapSheetAnalEntity.mapSheetAnalEntity;
|
||||
private final QModelMngEntity tmm = QModelMngEntity.modelMngEntity;
|
||||
private final QModelVerEntity tmv = QModelVerEntity.modelVerEntity;
|
||||
private final QMapSheetAnalEntity mapSheetAnal = QMapSheetAnalEntity.mapSheetAnalEntity;
|
||||
private final QMapSheetAnalDataEntity mapSheetAnalEntity = QMapSheetAnalDataEntity.mapSheetAnalDataEntity;
|
||||
private final QMapSheetAnalSttcEntity mapSheetAnalSttc =
|
||||
QMapSheetAnalSttcEntity.mapSheetAnalSttcEntity;
|
||||
private final QMapSheetAnalDataGeomEntity mapSheetAnalDataGeom =
|
||||
@@ -202,4 +204,22 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
|
||||
return new PageImpl<>(content, pageable, total);
|
||||
}
|
||||
|
||||
/**
|
||||
* 추론된 5000:1 도엽 목록
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Long> getSheets(Long id) {
|
||||
return queryFactory
|
||||
.select(mapSheetAnalDataGeom.mapSheetNum)
|
||||
.from(mapSheetAnal)
|
||||
.join(mapSheetAnalEntity).on(mapSheetAnalEntity.analUid.eq(mapSheetAnal.id))
|
||||
.join(mapSheetAnalDataGeom).on(mapSheetAnalDataGeom.dataUid.eq(mapSheetAnalEntity.id))
|
||||
.where(mapSheetAnal.id.eq(id))
|
||||
.groupBy(mapSheetAnalDataGeom.mapSheetNum)
|
||||
.fetch();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
||||
Projections.constructor(
|
||||
ChangeDetectionDto.CountDto.class,
|
||||
mapSheetAnalSttcEntity.classAfterCd.toUpperCase(),
|
||||
mapSheetAnalSttcEntity.id.classAfterName,
|
||||
null, // TOOD classAfterName 삭제해서 수정 필요
|
||||
mapSheetAnalSttcEntity.classAfterCnt.sum()))
|
||||
.from(mapSheetAnalEntity)
|
||||
.innerJoin(mapSheetAnalDataEntity)
|
||||
@@ -57,7 +57,7 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
||||
.innerJoin(mapSheetAnalSttcEntity)
|
||||
.on(mapSheetAnalSttcEntity.dataUid.eq(mapSheetAnalDataEntity.id))
|
||||
.where(mapSheetAnalEntity.id.eq(id))
|
||||
.groupBy(mapSheetAnalSttcEntity.classAfterCd, mapSheetAnalSttcEntity.id.classAfterName)
|
||||
.groupBy(mapSheetAnalSttcEntity.classAfterCd)
|
||||
.fetch();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user