./gradlew :spotlessApply 실행
This commit is contained in:
@@ -8,20 +8,22 @@ import org.springframework.data.domain.Pageable;
|
||||
public class QuerydslOrderUtil {
|
||||
/**
|
||||
* Pageable의 Sort 정보를 QueryDSL OrderSpecifier 배열로 변환
|
||||
*
|
||||
* @param pageable Spring Pageable
|
||||
* @param entityClass 엔티티 클래스 (예: User.class)
|
||||
* @param alias Q 엔티티 alias (예: "user")
|
||||
*/
|
||||
public static <T> OrderSpecifier<?>[] getOrderSpecifiers(Pageable pageable, Class<T> entityClass, String alias) {
|
||||
public static <T> OrderSpecifier<?>[] getOrderSpecifiers(
|
||||
Pageable pageable, Class<T> entityClass, String alias) {
|
||||
PathBuilder<T> entityPath = new PathBuilder<>(entityClass, alias);
|
||||
|
||||
return pageable.getSort()
|
||||
.stream()
|
||||
.map(sort -> {
|
||||
Order order = sort.isAscending() ? Order.ASC : Order.DESC;
|
||||
// PathBuilder.get()는 컬럼명(String)을 동적 Path로 반환
|
||||
return new OrderSpecifier<>(order, entityPath.get(sort.getProperty(), String.class));
|
||||
})
|
||||
.toArray(OrderSpecifier[]::new);
|
||||
return pageable.getSort().stream()
|
||||
.map(
|
||||
sort -> {
|
||||
Order order = sort.isAscending() ? Order.ASC : Order.DESC;
|
||||
// PathBuilder.get()는 컬럼명(String)을 동적 Path로 반환
|
||||
return new OrderSpecifier<>(order, entityPath.get(sort.getProperty(), String.class));
|
||||
})
|
||||
.toArray(OrderSpecifier[]::new);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
package com.kamco.cd.kamcoback.postgres.core;
|
||||
|
||||
|
||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataGeomEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.changedetection.ChangeDetectionRepository;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
import org.locationtech.jts.geom.Point;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ChangeDetectionCoreService {
|
||||
@@ -21,18 +19,15 @@ public class ChangeDetectionCoreService {
|
||||
public List<ChangeDetectionDto> getPolygonToPoint() {
|
||||
List<MapSheetAnalDataGeomEntity> list = changeDetectionRepository.findAll();
|
||||
|
||||
return list.stream().map(p -> {
|
||||
Geometry polygon = p.getGeom();
|
||||
// 중심 좌표 계산
|
||||
Point centroid = polygon.getCentroid();
|
||||
return list.stream()
|
||||
.map(
|
||||
p -> {
|
||||
Geometry polygon = p.getGeom();
|
||||
// 중심 좌표 계산
|
||||
Point centroid = polygon.getCentroid();
|
||||
|
||||
return new ChangeDetectionDto(
|
||||
p.getId(),
|
||||
polygon,
|
||||
centroid.getX(),
|
||||
centroid.getY()
|
||||
);
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
return new ChangeDetectionDto(p.getId(), polygon, centroid.getX(), centroid.getY());
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@ public class CommonCodeCoreService
|
||||
|
||||
/**
|
||||
* 공통코드 이름 조회
|
||||
*
|
||||
* @param parentCodeCd
|
||||
* @param childCodeCd
|
||||
* @return
|
||||
|
||||
@@ -6,7 +6,6 @@ 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;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -19,41 +18,49 @@ public class InferenceResultCoreService {
|
||||
|
||||
/**
|
||||
* 추론관리 > 분석결과 목록 조회
|
||||
*
|
||||
* @param searchReq
|
||||
* @return
|
||||
*/
|
||||
public Page<InferenceResultDto.AnalResList> getInferenceResultList(InferenceResultDto.SearchReq searchReq) {
|
||||
public Page<InferenceResultDto.AnalResList> getInferenceResultList(
|
||||
InferenceResultDto.SearchReq searchReq) {
|
||||
return inferenceResultRepository.getInferenceResultList(searchReq);
|
||||
}
|
||||
|
||||
/**
|
||||
* 분석결과 요약정보
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public InferenceResultDto.AnalResSummary getInferenceResultSummary(Long id) {
|
||||
InferenceResultDto.AnalResSummary summary = inferenceResultRepository.getInferenceResultSummary(id).orElseThrow(() -> new EntityNotFoundException("요약정보를 찾을 수 없습니다. " + id));
|
||||
InferenceResultDto.AnalResSummary summary =
|
||||
inferenceResultRepository
|
||||
.getInferenceResultSummary(id)
|
||||
.orElseThrow(() -> new EntityNotFoundException("요약정보를 찾을 수 없습니다. " + id));
|
||||
return summary;
|
||||
}
|
||||
|
||||
/**
|
||||
* 분석결과 대시보드 조회
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public List<Dashboard> getInferenceResultDashboard(Long id) {
|
||||
return inferenceResultRepository.getInferenceResultDashboard(id)
|
||||
.stream()
|
||||
.map(MapSheetAnalSttcEntity::toDto)
|
||||
.toList();
|
||||
return inferenceResultRepository.getInferenceResultDashboard(id).stream()
|
||||
.map(MapSheetAnalSttcEntity::toDto)
|
||||
.toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 분석결과 상세 목록
|
||||
*
|
||||
* @param searchGeoReq
|
||||
* @return
|
||||
*/
|
||||
public Page<InferenceResultDto.Geom> getInferenceResultGeomList(InferenceResultDto.SearchGeoReq searchGeoReq) {
|
||||
public Page<InferenceResultDto.Geom> getInferenceResultGeomList(
|
||||
InferenceResultDto.SearchGeoReq searchGeoReq) {
|
||||
return inferenceResultRepository.getInferenceGeomList(searchGeoReq);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,13 +7,12 @@ import com.kamco.cd.kamcoback.postgres.entity.ModelVerEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.model.ModelMngRepository;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.model.ModelVerRepository;
|
||||
import jakarta.persistence.EntityNotFoundException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@@ -26,37 +25,57 @@ public class ModelMngCoreService {
|
||||
return modelMngRepository.findModelMngAll().stream().map(ModelMngEntity::toDto).toList();
|
||||
}
|
||||
|
||||
public Optional<ModelMngDto.FinalModelDto> getFinalModelInfo(){
|
||||
public Optional<ModelMngDto.FinalModelDto> getFinalModelInfo() {
|
||||
return modelMngRepository.getFinalModelInfo();
|
||||
}
|
||||
|
||||
public ModelVerDto.Basic save(ModelMngDto.AddReq addReq) {
|
||||
ModelMngEntity modelMngEntity = new ModelMngEntity(addReq.getModelNm(), addReq.getModelCate(), addReq.getModelPath(),
|
||||
1L, 1L, addReq.getModelCntnt()); //TODO: 로그인 기능 붙이면 Uid 넣어야 함
|
||||
ModelMngEntity modelMngEntity =
|
||||
new ModelMngEntity(
|
||||
addReq.getModelNm(),
|
||||
addReq.getModelCate(),
|
||||
addReq.getModelPath(),
|
||||
1L,
|
||||
1L,
|
||||
addReq.getModelCntnt()); // TODO: 로그인 기능 붙이면 Uid 넣어야 함
|
||||
|
||||
ModelMngEntity saved = modelMngRepository.save(modelMngEntity);
|
||||
ModelVerEntity modelVerEntity = new ModelVerEntity(saved.getId(), addReq.getModelCate(), addReq.getModelVer(), "NONE", "NONE",
|
||||
0.0, "NONE", addReq.getModelPath(), 1L, 1L);
|
||||
ModelVerEntity modelVerEntity =
|
||||
new ModelVerEntity(
|
||||
saved.getId(),
|
||||
addReq.getModelCate(),
|
||||
addReq.getModelVer(),
|
||||
"NONE",
|
||||
"NONE",
|
||||
0.0,
|
||||
"NONE",
|
||||
addReq.getModelPath(),
|
||||
1L,
|
||||
1L);
|
||||
return modelVerRepository.save(modelVerEntity).toDto();
|
||||
}
|
||||
|
||||
public Long update(Long id, ModelMngDto.AddReq addReq) {
|
||||
//조회
|
||||
ModelVerEntity existData = modelVerRepository.findModelVerById(id)
|
||||
.orElseThrow(EntityNotFoundException::new); //데이터 없는 경우 exception
|
||||
// 조회
|
||||
ModelVerEntity existData =
|
||||
modelVerRepository
|
||||
.findModelVerById(id)
|
||||
.orElseThrow(EntityNotFoundException::new); // 데이터 없는 경우 exception
|
||||
existData.update(addReq);
|
||||
//TODO: 추후 수정 단계에서 도커파일 업로드하면 버전 업데이트 하는 로직 필요
|
||||
// TODO: 추후 수정 단계에서 도커파일 업로드하면 버전 업데이트 하는 로직 필요
|
||||
return existData.getId();
|
||||
}
|
||||
|
||||
public Long delete(Long id) {
|
||||
//조회
|
||||
ModelVerEntity verEntity = modelVerRepository.findModelVerById(id)
|
||||
.orElseThrow(() -> new EntityNotFoundException("버전 id 에 대한 정보를 찾을 수 없습니다. id : " + id));
|
||||
// 조회
|
||||
ModelVerEntity verEntity =
|
||||
modelVerRepository
|
||||
.findModelVerById(id)
|
||||
.orElseThrow(() -> new EntityNotFoundException("버전 id 에 대한 정보를 찾을 수 없습니다. id : " + id));
|
||||
|
||||
//usedState가 USED 이거나 이미 삭제된 상태이면 삭제 불가
|
||||
// usedState가 USED 이거나 이미 삭제된 상태이면 삭제 불가
|
||||
if (verEntity.getUsedState().equals("USED") || verEntity.isDeleted().equals(true)) {
|
||||
throw new IllegalStateException("해당 모델이 사용중이라 삭제 불가"); //TODO: 추후 규칙 정의되면 수정 필요
|
||||
throw new IllegalStateException("해당 모델이 사용중이라 삭제 불가"); // TODO: 추후 규칙 정의되면 수정 필요
|
||||
}
|
||||
|
||||
// id 코드 deleted = true 업데이트
|
||||
@@ -64,7 +83,8 @@ public class ModelMngCoreService {
|
||||
return verEntity.getId();
|
||||
}
|
||||
|
||||
public Page<ModelMngDto.ModelRegHistory> getRegHistoryList(ModelMngDto.searchReq searchReq, LocalDate startDate, LocalDate endDate, String searchVal) {
|
||||
public Page<ModelMngDto.ModelRegHistory> getRegHistoryList(
|
||||
ModelMngDto.searchReq searchReq, LocalDate startDate, LocalDate endDate, String searchVal) {
|
||||
return modelMngRepository.getRegHistoryList(searchReq, startDate, endDate, searchVal);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@ import jakarta.persistence.Id;
|
||||
import jakarta.persistence.SequenceGenerator;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalTime;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Map;
|
||||
import lombok.Getter;
|
||||
@@ -26,7 +24,10 @@ public class MapSheetAnalDataEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tb_map_sheet_anal_data_id_gen")
|
||||
@SequenceGenerator(name = "tb_map_sheet_anal_data_id_gen", sequenceName = "tb_map_sheet_learn_data_data_uid", allocationSize = 1)
|
||||
@SequenceGenerator(
|
||||
name = "tb_map_sheet_anal_data_id_gen",
|
||||
sequenceName = "tb_map_sheet_learn_data_data_uid",
|
||||
allocationSize = 1)
|
||||
@Column(name = "data_uid", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@@ -103,5 +104,4 @@ public class MapSheetAnalDataEntity {
|
||||
|
||||
@Column(name = "detecting_cnt")
|
||||
private Long detectingCnt;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,12 +2,11 @@ package com.kamco.cd.kamcoback.postgres.entity;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.ZonedDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@@ -15,8 +14,13 @@ import java.time.ZonedDateTime;
|
||||
public class MapSheetAnalDataGeomEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tb_map_sheet_anal_data_geom_id_gen")
|
||||
@SequenceGenerator(name = "tb_map_sheet_anal_data_geom_id_gen", sequenceName = "tb_map_sheet_learn_data_geom_geom_uid", allocationSize = 1)
|
||||
@GeneratedValue(
|
||||
strategy = GenerationType.SEQUENCE,
|
||||
generator = "tb_map_sheet_anal_data_geom_id_gen")
|
||||
@SequenceGenerator(
|
||||
name = "tb_map_sheet_anal_data_geom_id_gen",
|
||||
sequenceName = "tb_map_sheet_learn_data_geom_geom_uid",
|
||||
allocationSize = 1)
|
||||
@Column(name = "geo_uid", nullable = false)
|
||||
private Long id;
|
||||
|
||||
|
||||
@@ -2,16 +2,12 @@ package com.kamco.cd.kamcoback.postgres.entity;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.SequenceGenerator;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.Instant;
|
||||
import java.time.ZonedDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -25,7 +21,10 @@ public class MapSheetAnalEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tb_map_sheet_anal_id_gen")
|
||||
@SequenceGenerator(name = "tb_map_sheet_anal_id_gen", sequenceName = "tb_map_sheet_anal_anal_uid", allocationSize = 1)
|
||||
@SequenceGenerator(
|
||||
name = "tb_map_sheet_anal_id_gen",
|
||||
sequenceName = "tb_map_sheet_anal_anal_uid",
|
||||
allocationSize = 1)
|
||||
@Column(name = "anal_uid", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@@ -92,5 +91,4 @@ public class MapSheetAnalEntity {
|
||||
|
||||
@Column(name = "detecting_cnt")
|
||||
private Long detectingCnt;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package com.kamco.cd.kamcoback.postgres.entity;
|
||||
|
||||
import com.kamco.cd.kamcoback.code.dto.CommonCodeDto;
|
||||
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.OffsetDateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -19,8 +17,7 @@ import org.hibernate.annotations.ColumnDefault;
|
||||
@Table(name = "tb_map_sheet_anal_sttc")
|
||||
public class MapSheetAnalSttcEntity {
|
||||
|
||||
@EmbeddedId
|
||||
private MapSheetAnalSttcEntityId id;
|
||||
@EmbeddedId private MapSheetAnalSttcEntityId id;
|
||||
|
||||
@Column(name = "class_before_cnt")
|
||||
private Long classBeforeCnt;
|
||||
@@ -52,19 +49,18 @@ public class MapSheetAnalSttcEntity {
|
||||
|
||||
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
|
||||
);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.hibernate.Hibernate;
|
||||
public class MapSheetAnalSttcEntityId implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -8630519290255405042L;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "compare_yyyy", nullable = false)
|
||||
private Integer compareYyyy;
|
||||
@@ -47,16 +48,15 @@ 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.classBeforeName, entity.classBeforeName)
|
||||
&& Objects.equals(this.classAfterName, entity.classAfterName)
|
||||
&& Objects.equals(this.compareYyyy, entity.compareYyyy)
|
||||
&& Objects.equals(this.mapSheetNum, entity.mapSheetNum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(targetYyyy, classBeforeName, classAfterName, compareYyyy, mapSheetNum);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,8 +5,6 @@ import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.LocalTime;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Map;
|
||||
import lombok.Getter;
|
||||
@@ -104,5 +102,4 @@ public class MapSheetLearnDataEntity {
|
||||
|
||||
@Column(name = "updated_uid")
|
||||
private Long updatedUid;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,18 +2,12 @@ package com.kamco.cd.kamcoback.postgres.entity;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.OnDelete;
|
||||
import org.hibernate.annotations.OnDeleteAction;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
|
||||
@Getter
|
||||
@@ -75,5 +69,4 @@ public class MapSheetLearnDataGeomEntity {
|
||||
|
||||
@Column(name = "updated_uid")
|
||||
private Long updatedUid;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,11 +2,10 @@ package com.kamco.cd.kamcoback.postgres.entity;
|
||||
|
||||
import com.kamco.cd.kamcoback.postgres.CommonDateEntity;
|
||||
import jakarta.persistence.*;
|
||||
import java.time.ZonedDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@@ -14,7 +13,10 @@ import java.time.ZonedDateTime;
|
||||
public class ModelDeployHstEntity extends CommonDateEntity {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tb_model_deploy_hst_id_gen")
|
||||
@SequenceGenerator(name = "tb_model_deploy_hst_id_gen", sequenceName = "tb_model_deploy_hst_deploy_uid", allocationSize = 1)
|
||||
@SequenceGenerator(
|
||||
name = "tb_model_deploy_hst_id_gen",
|
||||
sequenceName = "tb_model_deploy_hst_deploy_uid",
|
||||
allocationSize = 1)
|
||||
@Column(name = "deploy_uid", nullable = false)
|
||||
private Long id;
|
||||
|
||||
|
||||
@@ -8,8 +8,6 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@@ -18,7 +16,10 @@ public class ModelMngEntity extends CommonDateEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tb_model_mng_id_gen")
|
||||
@SequenceGenerator(name = "tb_model_mng_id_gen", sequenceName = "tb_model_mng_model_uid", allocationSize = 1)
|
||||
@SequenceGenerator(
|
||||
name = "tb_model_mng_id_gen",
|
||||
sequenceName = "tb_model_mng_model_uid",
|
||||
allocationSize = 1)
|
||||
@Column(name = "model_uid", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@@ -46,8 +47,13 @@ public class ModelMngEntity extends CommonDateEntity {
|
||||
@Column(name = "model_cntnt", columnDefinition = "TEXT")
|
||||
private String modelCntnt;
|
||||
|
||||
public ModelMngEntity(String modelNm, String modelCate, String modelPath,
|
||||
Long createdUid, Long updatedUid, String modelCntnt) {
|
||||
public ModelMngEntity(
|
||||
String modelNm,
|
||||
String modelCate,
|
||||
String modelPath,
|
||||
Long createdUid,
|
||||
Long updatedUid,
|
||||
String modelCntnt) {
|
||||
this.modelNm = modelNm;
|
||||
this.modelCate = modelCate;
|
||||
this.modelPath = modelPath;
|
||||
@@ -59,14 +65,14 @@ public class ModelMngEntity extends CommonDateEntity {
|
||||
|
||||
public ModelMngDto.Basic toDto() {
|
||||
return new ModelMngDto.Basic(
|
||||
this.id,
|
||||
this.modelNm,
|
||||
this.modelCate,
|
||||
this.modelPath,
|
||||
super.getCreatedDate(),
|
||||
this.createdUid,
|
||||
super.getModifiedDate(),
|
||||
this.updatedUid,
|
||||
this.modelCntnt);
|
||||
this.id,
|
||||
this.modelNm,
|
||||
this.modelCate,
|
||||
this.modelPath,
|
||||
super.getCreatedDate(),
|
||||
this.createdUid,
|
||||
super.getModifiedDate(),
|
||||
this.updatedUid,
|
||||
this.modelCntnt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,10 @@ public class ModelVerEntity extends CommonDateEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tb_model_ver_id_gen")
|
||||
@SequenceGenerator(name = "tb_model_ver_id_gen", sequenceName = "tb_model_ver_model_ver_uid", allocationSize = 1)
|
||||
@SequenceGenerator(
|
||||
name = "tb_model_ver_id_gen",
|
||||
sequenceName = "tb_model_ver_model_ver_uid",
|
||||
allocationSize = 1)
|
||||
@Column(name = "model_ver_uid", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@@ -62,8 +65,19 @@ public class ModelVerEntity extends CommonDateEntity {
|
||||
|
||||
private Boolean deleted = false;
|
||||
|
||||
public ModelVerEntity(Long id, Long modelUid, String modelCate, String modelVer, String usedState, String modelState,
|
||||
Double qualityProb, String deployState, String modelPath, Long createdUid, Long updatedUid, Boolean deleted) {
|
||||
public ModelVerEntity(
|
||||
Long id,
|
||||
Long modelUid,
|
||||
String modelCate,
|
||||
String modelVer,
|
||||
String usedState,
|
||||
String modelState,
|
||||
Double qualityProb,
|
||||
String deployState,
|
||||
String modelPath,
|
||||
Long createdUid,
|
||||
Long updatedUid,
|
||||
Boolean deleted) {
|
||||
this.id = id;
|
||||
this.modelUid = modelUid;
|
||||
this.modelCate = modelCate;
|
||||
@@ -78,8 +92,17 @@ public class ModelVerEntity extends CommonDateEntity {
|
||||
this.deleted = deleted;
|
||||
}
|
||||
|
||||
public ModelVerEntity(Long modelUid, String modelCate, String modelVer, String usedState, String modelState,
|
||||
Double qualityProb, String deployState, String modelPath, Long createdUid, Long updatedUid) {
|
||||
public ModelVerEntity(
|
||||
Long modelUid,
|
||||
String modelCate,
|
||||
String modelVer,
|
||||
String usedState,
|
||||
String modelState,
|
||||
Double qualityProb,
|
||||
String deployState,
|
||||
String modelPath,
|
||||
Long createdUid,
|
||||
Long updatedUid) {
|
||||
this.modelUid = modelUid;
|
||||
this.modelCate = modelCate;
|
||||
this.modelVer = modelVer;
|
||||
@@ -94,19 +117,19 @@ public class ModelVerEntity extends CommonDateEntity {
|
||||
|
||||
public ModelVerDto.Basic toDto() {
|
||||
return new ModelVerDto.Basic(
|
||||
this.id,
|
||||
this.modelUid,
|
||||
this.modelCate,
|
||||
this.modelVer,
|
||||
this.usedState,
|
||||
this.modelState,
|
||||
this.qualityProb,
|
||||
this.deployState,
|
||||
this.modelPath,
|
||||
super.getCreatedDate(),
|
||||
this.createdUid,
|
||||
super.getModifiedDate(),
|
||||
this.updatedUid);
|
||||
this.id,
|
||||
this.modelUid,
|
||||
this.modelCate,
|
||||
this.modelVer,
|
||||
this.usedState,
|
||||
this.modelState,
|
||||
this.qualityProb,
|
||||
this.deployState,
|
||||
this.modelPath,
|
||||
super.getCreatedDate(),
|
||||
this.createdUid,
|
||||
super.getModifiedDate(),
|
||||
this.updatedUid);
|
||||
}
|
||||
|
||||
public void update(ModelMngDto.AddReq addReq) {
|
||||
@@ -119,7 +142,7 @@ public class ModelVerEntity extends CommonDateEntity {
|
||||
return deleted;
|
||||
}
|
||||
|
||||
public void deleted(){
|
||||
public void deleted() {
|
||||
this.deleted = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,5 @@ package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface InferenceResultRepository extends JpaRepository<MapSheetAnalEntity, Long>, InferenceResultRepositoryCustom {
|
||||
|
||||
}
|
||||
public interface InferenceResultRepository
|
||||
extends JpaRepository<MapSheetAnalEntity, Long>, InferenceResultRepositoryCustom {}
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
||||
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Dashboard;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataGeomEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalSttcEntity;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
public interface InferenceResultRepositoryCustom {
|
||||
Page<InferenceResultDto.AnalResList> getInferenceResultList(InferenceResultDto.SearchReq searchReq);
|
||||
Page<InferenceResultDto.AnalResList> getInferenceResultList(
|
||||
InferenceResultDto.SearchReq searchReq);
|
||||
|
||||
Optional<InferenceResultDto.AnalResSummary> getInferenceResultSummary(Long id);
|
||||
List<MapSheetAnalSttcEntity> getInferenceResultDashboard(Long id);
|
||||
|
||||
List<MapSheetAnalSttcEntity> getInferenceResultDashboard(Long id);
|
||||
|
||||
Page<InferenceResultDto.Geom> getInferenceGeomList(InferenceResultDto.SearchGeoReq searchGeoReq);
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@ 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.MapSheetAnalDataGeomEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalSttcEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataGeomEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalSttcEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QModelMngEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QModelVerEntity;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import com.querydsl.core.types.Projections;
|
||||
import com.querydsl.core.types.dsl.Expressions;
|
||||
import com.querydsl.jpa.JPAExpressions;
|
||||
@@ -21,7 +21,6 @@ import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
@@ -31,18 +30,20 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
private final QMapSheetAnalEntity mapSheetAnal = QMapSheetAnalEntity.mapSheetAnalEntity;
|
||||
private final QModelMngEntity tmm = QModelMngEntity.modelMngEntity;
|
||||
private final QModelVerEntity tmv = QModelVerEntity.modelVerEntity;
|
||||
private final QMapSheetAnalSttcEntity mapSheetAnalSttc = QMapSheetAnalSttcEntity.mapSheetAnalSttcEntity;
|
||||
private final QMapSheetAnalDataGeomEntity mapSheetAnalDataGeom = QMapSheetAnalDataGeomEntity.mapSheetAnalDataGeomEntity;
|
||||
|
||||
|
||||
private final QMapSheetAnalSttcEntity mapSheetAnalSttc =
|
||||
QMapSheetAnalSttcEntity.mapSheetAnalSttcEntity;
|
||||
private final QMapSheetAnalDataGeomEntity mapSheetAnalDataGeom =
|
||||
QMapSheetAnalDataGeomEntity.mapSheetAnalDataGeomEntity;
|
||||
|
||||
/**
|
||||
* 분석결과 목록 조회
|
||||
*
|
||||
* @param searchReq
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<InferenceResultDto.AnalResList> getInferenceResultList(InferenceResultDto.SearchReq searchReq) {
|
||||
public Page<InferenceResultDto.AnalResList> getInferenceResultList(
|
||||
InferenceResultDto.SearchReq searchReq) {
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
|
||||
// "0000" 전체조회
|
||||
@@ -56,101 +57,98 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
builder.and(mapSheetAnal.analTitle.like("%" + searchReq.getTitle() + "%"));
|
||||
}
|
||||
|
||||
List<InferenceResultDto.AnalResList> content = queryFactory
|
||||
.select(Projections.constructor(InferenceResultDto.AnalResList.class,
|
||||
mapSheetAnal.id,
|
||||
mapSheetAnal.analTitle,
|
||||
mapSheetAnal.analMapSheet,
|
||||
mapSheetAnal.detectingCnt,
|
||||
mapSheetAnal.analStrtDttm,
|
||||
mapSheetAnal.analEndDttm,
|
||||
mapSheetAnal.analSec,
|
||||
mapSheetAnal.analPredSec,
|
||||
mapSheetAnal.analState,
|
||||
Expressions.stringTemplate("fn_code_name({0}, {1})", "0002", mapSheetAnal.analState),
|
||||
mapSheetAnal.gukyuinUsed
|
||||
))
|
||||
.from(mapSheetAnal)
|
||||
.where(
|
||||
builder
|
||||
)
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.orderBy(mapSheetAnal.createdDttm.desc())
|
||||
.fetch();
|
||||
List<InferenceResultDto.AnalResList> content =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceResultDto.AnalResList.class,
|
||||
mapSheetAnal.id,
|
||||
mapSheetAnal.analTitle,
|
||||
mapSheetAnal.analMapSheet,
|
||||
mapSheetAnal.detectingCnt,
|
||||
mapSheetAnal.analStrtDttm,
|
||||
mapSheetAnal.analEndDttm,
|
||||
mapSheetAnal.analSec,
|
||||
mapSheetAnal.analPredSec,
|
||||
mapSheetAnal.analState,
|
||||
Expressions.stringTemplate(
|
||||
"fn_code_name({0}, {1})", "0002", mapSheetAnal.analState),
|
||||
mapSheetAnal.gukyuinUsed))
|
||||
.from(mapSheetAnal)
|
||||
.where(builder)
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.orderBy(mapSheetAnal.createdDttm.desc())
|
||||
.fetch();
|
||||
|
||||
long total = queryFactory
|
||||
.select(mapSheetAnal.id)
|
||||
.from(mapSheetAnal)
|
||||
.where(
|
||||
builder
|
||||
)
|
||||
.fetchCount();
|
||||
long total =
|
||||
queryFactory.select(mapSheetAnal.id).from(mapSheetAnal).where(builder).fetchCount();
|
||||
|
||||
return new PageImpl<>(content, pageable, total);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 분석결과 요약정보
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Optional<InferenceResultDto.AnalResSummary> getInferenceResultSummary(Long id) {
|
||||
|
||||
// 1. 최신 버전 UID를 가져오는 서브쿼리
|
||||
JPQLQuery<Long> latestVerUidSub = JPAExpressions
|
||||
.select(tmv.id.max())
|
||||
.from(tmv)
|
||||
.where(tmv.modelUid.eq(tmm.id));
|
||||
// 1. 최신 버전 UID를 가져오는 서브쿼리
|
||||
JPQLQuery<Long> latestVerUidSub =
|
||||
JPAExpressions.select(tmv.id.max()).from(tmv).where(tmv.modelUid.eq(tmm.id));
|
||||
|
||||
Optional<InferenceResultDto.AnalResSummary> content = Optional.ofNullable(queryFactory
|
||||
.select(Projections.constructor(InferenceResultDto.AnalResSummary.class,
|
||||
mapSheetAnal.id,
|
||||
tmm.modelNm.concat(" ").concat(tmv.modelVer).as("modelInfo"),
|
||||
mapSheetAnal.targetYyyy,
|
||||
mapSheetAnal.compareYyyy,
|
||||
mapSheetAnal.analMapSheet,
|
||||
mapSheetAnal.analStrtDttm,
|
||||
mapSheetAnal.analEndDttm,
|
||||
mapSheetAnal.analSec,
|
||||
mapSheetAnal.analPredSec,
|
||||
mapSheetAnal.resultUrl,
|
||||
mapSheetAnal.detectingCnt,
|
||||
mapSheetAnal.accuracy,
|
||||
mapSheetAnal.analState,
|
||||
Expressions.stringTemplate("fn_code_name({0}, {1})", "0002", mapSheetAnal.analState)
|
||||
))
|
||||
.from(mapSheetAnal)
|
||||
.leftJoin(tmm).on(mapSheetAnal.modelUid.eq(tmm.id))
|
||||
.leftJoin(tmv).on(
|
||||
tmv.modelUid.eq(tmm.id)
|
||||
.and(tmv.id.eq(latestVerUidSub))
|
||||
)
|
||||
.where(mapSheetAnal.id.eq(id))
|
||||
.fetchOne()
|
||||
);
|
||||
Optional<InferenceResultDto.AnalResSummary> content =
|
||||
Optional.ofNullable(
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceResultDto.AnalResSummary.class,
|
||||
mapSheetAnal.id,
|
||||
tmm.modelNm.concat(" ").concat(tmv.modelVer).as("modelInfo"),
|
||||
mapSheetAnal.targetYyyy,
|
||||
mapSheetAnal.compareYyyy,
|
||||
mapSheetAnal.analMapSheet,
|
||||
mapSheetAnal.analStrtDttm,
|
||||
mapSheetAnal.analEndDttm,
|
||||
mapSheetAnal.analSec,
|
||||
mapSheetAnal.analPredSec,
|
||||
mapSheetAnal.resultUrl,
|
||||
mapSheetAnal.detectingCnt,
|
||||
mapSheetAnal.accuracy,
|
||||
mapSheetAnal.analState,
|
||||
Expressions.stringTemplate(
|
||||
"fn_code_name({0}, {1})", "0002", mapSheetAnal.analState)))
|
||||
.from(mapSheetAnal)
|
||||
.leftJoin(tmm)
|
||||
.on(mapSheetAnal.modelUid.eq(tmm.id))
|
||||
.leftJoin(tmv)
|
||||
.on(tmv.modelUid.eq(tmm.id).and(tmv.id.eq(latestVerUidSub)))
|
||||
.where(mapSheetAnal.id.eq(id))
|
||||
.fetchOne());
|
||||
return content;
|
||||
}
|
||||
|
||||
/**
|
||||
* 분석결과 상세 대시보드 조회
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<MapSheetAnalSttcEntity> getInferenceResultDashboard(Long id) {
|
||||
return queryFactory
|
||||
.select(mapSheetAnalSttc)
|
||||
.from(mapSheetAnalSttc)
|
||||
.where(mapSheetAnalSttc.dataUid.eq(id))
|
||||
.fetch();
|
||||
.select(mapSheetAnalSttc)
|
||||
.from(mapSheetAnalSttc)
|
||||
.where(mapSheetAnalSttc.dataUid.eq(id))
|
||||
.fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 분석결과 상세 목록
|
||||
*
|
||||
* @param searchGeoReq
|
||||
* @return
|
||||
*/
|
||||
@@ -160,45 +158,47 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
BooleanBuilder builder = new BooleanBuilder();
|
||||
|
||||
// 기준년도 분류
|
||||
if(searchGeoReq.getTargetClass() != null && !searchGeoReq.getTargetClass().equals("")){
|
||||
if (searchGeoReq.getTargetClass() != null && !searchGeoReq.getTargetClass().equals("")) {
|
||||
builder.and(mapSheetAnalDataGeom.classAfterCd.eq(searchGeoReq.getTargetClass()));
|
||||
|
||||
}
|
||||
|
||||
// 비교년도 분류
|
||||
if(searchGeoReq.getCompareClass() != null && !searchGeoReq.getCompareClass().equals("")){
|
||||
if (searchGeoReq.getCompareClass() != null && !searchGeoReq.getCompareClass().equals("")) {
|
||||
builder.and(mapSheetAnalDataGeom.classBeforeCd.eq(searchGeoReq.getCompareClass()));
|
||||
}
|
||||
|
||||
// 분석도엽
|
||||
if(searchGeoReq.getMapSheetNum() != null && !searchGeoReq.getMapSheetNum().isEmpty()){
|
||||
if (searchGeoReq.getMapSheetNum() != null && !searchGeoReq.getMapSheetNum().isEmpty()) {
|
||||
List<Long> mapSheetNum = searchGeoReq.getMapSheetNum();
|
||||
builder.and(mapSheetAnalDataGeom.mapSheetNum.in(mapSheetNum));
|
||||
}
|
||||
|
||||
List<InferenceResultDto.Geom> content = queryFactory
|
||||
.select(Projections.constructor(InferenceResultDto.Geom.class,
|
||||
mapSheetAnalDataGeom.compareYyyy,
|
||||
mapSheetAnalDataGeom.targetYyyy,
|
||||
mapSheetAnalDataGeom.classBeforeCd,
|
||||
Expressions.stringTemplate("fn_code_name({0}, {1})", "0000", mapSheetAnalDataGeom.classBeforeCd),
|
||||
mapSheetAnalDataGeom.classBeforeProb,
|
||||
mapSheetAnalDataGeom.classAfterCd,
|
||||
Expressions.stringTemplate("fn_code_name({0}, {1})", "0000", mapSheetAnalDataGeom.classAfterCd),
|
||||
mapSheetAnalDataGeom.classAfterProb,
|
||||
mapSheetAnalDataGeom.mapSheetNum))
|
||||
.from(mapSheetAnalDataGeom)
|
||||
.where(builder)
|
||||
.fetch()
|
||||
;
|
||||
List<InferenceResultDto.Geom> content =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceResultDto.Geom.class,
|
||||
mapSheetAnalDataGeom.compareYyyy,
|
||||
mapSheetAnalDataGeom.targetYyyy,
|
||||
mapSheetAnalDataGeom.classBeforeCd,
|
||||
Expressions.stringTemplate(
|
||||
"fn_code_name({0}, {1})", "0000", mapSheetAnalDataGeom.classBeforeCd),
|
||||
mapSheetAnalDataGeom.classBeforeProb,
|
||||
mapSheetAnalDataGeom.classAfterCd,
|
||||
Expressions.stringTemplate(
|
||||
"fn_code_name({0}, {1})", "0000", mapSheetAnalDataGeom.classAfterCd),
|
||||
mapSheetAnalDataGeom.classAfterProb,
|
||||
mapSheetAnalDataGeom.mapSheetNum))
|
||||
.from(mapSheetAnalDataGeom)
|
||||
.where(builder)
|
||||
.fetch();
|
||||
|
||||
long total = queryFactory
|
||||
.select(mapSheetAnalDataGeom.id)
|
||||
.from(mapSheetAnalDataGeom)
|
||||
.where(
|
||||
builder
|
||||
)
|
||||
.fetchCount();
|
||||
long total =
|
||||
queryFactory
|
||||
.select(mapSheetAnalDataGeom.id)
|
||||
.from(mapSheetAnalDataGeom)
|
||||
.where(builder)
|
||||
.fetchCount();
|
||||
|
||||
return new PageImpl<>(content, pageable, total);
|
||||
}
|
||||
|
||||
@@ -1,36 +1,27 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository;
|
||||
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetLearnDataGeomEntity;
|
||||
import java.util.List;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface MapSheetLearnDataGeomRepository extends JpaRepository<MapSheetLearnDataGeomEntity, Long> {
|
||||
|
||||
/**
|
||||
* 데이터 UID로 지오메트리 정보 조회
|
||||
*/
|
||||
public interface MapSheetLearnDataGeomRepository
|
||||
extends JpaRepository<MapSheetLearnDataGeomEntity, Long> {
|
||||
|
||||
/** 데이터 UID로 지오메트리 정보 조회 */
|
||||
List<MapSheetLearnDataGeomEntity> findByDataUid(Long dataUid);
|
||||
|
||||
/**
|
||||
* 도엽 번호로 지오메트리 정보 조회
|
||||
*/
|
||||
|
||||
/** 도엽 번호로 지오메트리 정보 조회 */
|
||||
List<MapSheetLearnDataGeomEntity> findByMapSheetNum(Long mapSheetNum);
|
||||
|
||||
/**
|
||||
* 연도 범위로 지오메트리 정보 조회
|
||||
*/
|
||||
List<MapSheetLearnDataGeomEntity> findByBeforeYyyyAndAfterYyyy(Integer beforeYyyy, Integer afterYyyy);
|
||||
|
||||
/**
|
||||
* 지오메트리 타입별 조회
|
||||
*/
|
||||
|
||||
/** 연도 범위로 지오메트리 정보 조회 */
|
||||
List<MapSheetLearnDataGeomEntity> findByBeforeYyyyAndAfterYyyy(
|
||||
Integer beforeYyyy, Integer afterYyyy);
|
||||
|
||||
/** 지오메트리 타입별 조회 */
|
||||
List<MapSheetLearnDataGeomEntity> findByGeoType(String geoType);
|
||||
|
||||
/**
|
||||
* 데이터 UID로 기존 지오메트리 데이터 삭제 (재생성 전에 사용)
|
||||
*/
|
||||
|
||||
/** 데이터 UID로 기존 지오메트리 데이터 삭제 (재생성 전에 사용) */
|
||||
void deleteByDataUid(Long dataUid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,47 +1,32 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository;
|
||||
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetLearnDataEntity;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
public interface MapSheetLearnDataRepository extends JpaRepository<MapSheetLearnDataEntity, Long> {
|
||||
|
||||
/**
|
||||
* 데이터 이름으로 조회
|
||||
*/
|
||||
|
||||
/** 데이터 이름으로 조회 */
|
||||
Optional<MapSheetLearnDataEntity> findByDataName(String dataName);
|
||||
|
||||
/**
|
||||
* 데이터 경로로 조회
|
||||
*/
|
||||
|
||||
/** 데이터 경로로 조회 */
|
||||
Optional<MapSheetLearnDataEntity> findByDataPath(String dataPath);
|
||||
|
||||
/**
|
||||
* 처리 상태별 조회
|
||||
*/
|
||||
|
||||
/** 처리 상태별 조회 */
|
||||
List<MapSheetLearnDataEntity> findByDataState(String dataState);
|
||||
|
||||
/**
|
||||
* 데이터 타입별 조회
|
||||
*/
|
||||
|
||||
/** 데이터 타입별 조회 */
|
||||
List<MapSheetLearnDataEntity> findByDataType(String dataType);
|
||||
|
||||
/**
|
||||
* 분석 상태별 조회
|
||||
*/
|
||||
|
||||
/** 분석 상태별 조회 */
|
||||
List<MapSheetLearnDataEntity> findByAnalState(String analState);
|
||||
|
||||
/**
|
||||
* 분석 상태별 개수 조회
|
||||
*/
|
||||
|
||||
/** 분석 상태별 개수 조회 */
|
||||
long countByAnalState(String analState);
|
||||
|
||||
/**
|
||||
* 처리되지 않은 데이터 조회 (data_state가 'PENDING' 또는 null인 것들)
|
||||
*/
|
||||
|
||||
/** 처리되지 않은 데이터 조회 (data_state가 'PENDING' 또는 null인 것들) */
|
||||
List<MapSheetLearnDataEntity> findByDataStateIsNullOrDataState(String dataState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,5 @@ package com.kamco.cd.kamcoback.postgres.repository.changedetection;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataGeomEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface ChangeDetectionRepository extends JpaRepository<MapSheetAnalDataGeomEntity, Long>, ChangeDetectionRepositoryCustom {}
|
||||
public interface ChangeDetectionRepository
|
||||
extends JpaRepository<MapSheetAnalDataGeomEntity, Long>, ChangeDetectionRepositoryCustom {}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.changedetection;
|
||||
|
||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||
|
||||
public interface ChangeDetectionRepositoryCustom {
|
||||
|
||||
String getPolygonToPoint();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.changedetection;
|
||||
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataGeomEntity;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataGeomEntity.mapSheetAnalDataGeomEntity;
|
||||
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataGeomEntity;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import java.util.List;
|
||||
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
||||
|
||||
public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
||||
implements ChangeDetectionRepositoryCustom {
|
||||
implements ChangeDetectionRepositoryCustom {
|
||||
|
||||
private final JPAQueryFactory queryFactory;
|
||||
|
||||
@@ -26,8 +25,8 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
||||
|
||||
public List<MapSheetAnalDataGeomEntity> findAll() {
|
||||
return queryFactory
|
||||
.selectFrom(mapSheetAnalDataGeomEntity)
|
||||
.orderBy(mapSheetAnalDataGeomEntity.id.desc())
|
||||
.fetch();
|
||||
.selectFrom(mapSheetAnalDataGeomEntity)
|
||||
.orderBy(mapSheetAnalDataGeomEntity.id.desc())
|
||||
.fetch();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,13 +88,13 @@ public class CommonCodeRepositoryImpl extends QuerydslRepositorySupport
|
||||
QCommonCodeEntity parent = QCommonCodeEntity.commonCodeEntity;
|
||||
QCommonCodeEntity child = new QCommonCodeEntity("child");
|
||||
|
||||
String result = queryFactory
|
||||
.select(child.name)
|
||||
.from(child)
|
||||
.join(child.parent, parent)
|
||||
.where(parent.code.eq(parentCodeCd)
|
||||
.and(child.code.eq(childCodeCd)))
|
||||
.fetchFirst(); // 단일 결과만
|
||||
String result =
|
||||
queryFactory
|
||||
.select(child.name)
|
||||
.from(child)
|
||||
.join(child.parent, parent)
|
||||
.where(parent.code.eq(parentCodeCd).and(child.code.eq(childCodeCd)))
|
||||
.fetchFirst(); // 단일 결과만
|
||||
|
||||
return Optional.ofNullable(result);
|
||||
}
|
||||
|
||||
@@ -18,8 +18,7 @@ public interface AuditLogRepositoryCustom {
|
||||
Page<AuditLogDto.DailyDetail> findLogByDailyResult(
|
||||
AuditLogDto.searchReq searchReq, LocalDate logDate);
|
||||
|
||||
Page<AuditLogDto.MenuDetail> findLogByMenuResult(
|
||||
AuditLogDto.searchReq searchReq, String menuId);
|
||||
Page<AuditLogDto.MenuDetail> findLogByMenuResult(AuditLogDto.searchReq searchReq, String menuId);
|
||||
|
||||
Page<AuditLogDto.UserDetail> findLogByAccountResult(
|
||||
AuditLogDto.searchReq searchReq, Long accountId);
|
||||
|
||||
@@ -39,7 +39,7 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
public Page<AuditLogDto.DailyAuditList> findLogByDaily(
|
||||
AuditLogDto.searchReq searchReq, LocalDate startDate, LocalDate endDate) {
|
||||
StringExpression groupDateTime =
|
||||
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')", auditLogEntity.createdDate);
|
||||
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')", auditLogEntity.createdDate);
|
||||
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
List<AuditLogDto.DailyAuditList> foundContent =
|
||||
@@ -52,9 +52,7 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
printCount().as("printCount"),
|
||||
downloadCount().as("downloadCount"),
|
||||
auditLogEntity.count().as("totalCount"),
|
||||
groupDateTime.as("baseDate")
|
||||
)
|
||||
)
|
||||
groupDateTime.as("baseDate")))
|
||||
.from(auditLogEntity)
|
||||
.where(eventEndedAtBetween(startDate, endDate))
|
||||
.groupBy(groupDateTime)
|
||||
@@ -242,7 +240,9 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
Projections.constructor(
|
||||
AuditLogDto.MenuDetail.class,
|
||||
auditLogEntity.id.as("logId"),
|
||||
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')", auditLogEntity.createdDate).as("logDateTime"), //??
|
||||
Expressions.stringTemplate(
|
||||
"to_char({0}, 'YYYY-MM-DD')", auditLogEntity.createdDate)
|
||||
.as("logDateTime"), // ??
|
||||
userEntity.userNm.as("userName"),
|
||||
userEntity.userId.as("loginId"),
|
||||
auditLogEntity.eventType.as("eventType"),
|
||||
@@ -307,7 +307,9 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
Projections.constructor(
|
||||
AuditLogDto.UserDetail.class,
|
||||
auditLogEntity.id.as("logId"),
|
||||
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')", auditLogEntity.createdDate).as("logDateTime"),
|
||||
Expressions.stringTemplate(
|
||||
"to_char({0}, 'YYYY-MM-DD')", auditLogEntity.createdDate)
|
||||
.as("logDateTime"),
|
||||
menuEntity.menuNm.as("menuName"),
|
||||
auditLogEntity.eventType.as("eventType"),
|
||||
Projections.constructor(
|
||||
@@ -392,7 +394,7 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
|
||||
private BooleanExpression eventEndedAtEqDate(LocalDate logDate) {
|
||||
StringExpression eventEndedDate =
|
||||
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')", auditLogEntity.createdDate);
|
||||
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')", auditLogEntity.createdDate);
|
||||
LocalDateTime comparisonDate = logDate.atStartOfDay();
|
||||
|
||||
return eventEndedDate.eq(comparisonDate.toString());
|
||||
|
||||
@@ -3,4 +3,5 @@ package com.kamco.cd.kamcoback.postgres.repository.model;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.ModelMngEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface ModelMngRepository extends JpaRepository<ModelMngEntity, Long>, ModelMngRepositoryCustom {}
|
||||
public interface ModelMngRepository
|
||||
extends JpaRepository<ModelMngEntity, Long>, ModelMngRepositoryCustom {}
|
||||
|
||||
@@ -2,11 +2,10 @@ package com.kamco.cd.kamcoback.postgres.repository.model;
|
||||
|
||||
import com.kamco.cd.kamcoback.model.dto.ModelMngDto;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.ModelMngEntity;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
public interface ModelMngRepositoryCustom {
|
||||
|
||||
@@ -14,5 +13,6 @@ public interface ModelMngRepositoryCustom {
|
||||
|
||||
Optional<ModelMngDto.FinalModelDto> getFinalModelInfo();
|
||||
|
||||
Page<ModelMngDto.ModelRegHistory> getRegHistoryList(ModelMngDto.searchReq searchReq, LocalDate startDate, LocalDate endDate, String searchVal);
|
||||
Page<ModelMngDto.ModelRegHistory> getRegHistoryList(
|
||||
ModelMngDto.searchReq searchReq, LocalDate startDate, LocalDate endDate, String searchVal);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.model;
|
||||
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QModelDeployHstEntity.modelDeployHstEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QModelMngEntity.modelMngEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QModelVerEntity.modelVerEntity;
|
||||
|
||||
import com.kamco.cd.kamcoback.model.dto.ModelMngDto;
|
||||
import com.kamco.cd.kamcoback.postgres.QuerydslOrderUtil;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.ModelMngEntity;
|
||||
@@ -10,24 +14,19 @@ import com.querydsl.core.types.dsl.Expressions;
|
||||
import com.querydsl.core.types.dsl.StringExpression;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import io.micrometer.common.util.StringUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QModelDeployHstEntity.modelDeployHstEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QModelMngEntity.modelMngEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QModelVerEntity.modelVerEntity;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
||||
|
||||
public class ModelMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
implements ModelMngRepositoryCustom {
|
||||
implements ModelMngRepositoryCustom {
|
||||
|
||||
private final JPAQueryFactory queryFactory;
|
||||
private final StringExpression NULL_STRING = Expressions.stringTemplate("cast(null as text)");
|
||||
@@ -39,85 +38,81 @@ public class ModelMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
|
||||
@Override
|
||||
public List<ModelMngEntity> findModelMngAll() {
|
||||
return queryFactory
|
||||
.selectFrom(modelMngEntity)
|
||||
.orderBy(modelMngEntity.id.desc())
|
||||
.fetch();
|
||||
return queryFactory.selectFrom(modelMngEntity).orderBy(modelMngEntity.id.desc()).fetch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<ModelMngDto.FinalModelDto> getFinalModelInfo(){
|
||||
public Optional<ModelMngDto.FinalModelDto> getFinalModelInfo() {
|
||||
return queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
ModelMngDto.FinalModelDto.class,
|
||||
modelMngEntity.id.as("modelUid"),
|
||||
modelMngEntity.modelNm,
|
||||
modelMngEntity.modelCate,
|
||||
modelVerEntity.id.as("modelVerUid"),
|
||||
modelVerEntity.modelVer,
|
||||
modelVerEntity.usedState,
|
||||
modelVerEntity.modelState,
|
||||
modelVerEntity.qualityProb,
|
||||
modelVerEntity.deployState,
|
||||
modelVerEntity.modelPath
|
||||
)
|
||||
)
|
||||
Projections.constructor(
|
||||
ModelMngDto.FinalModelDto.class,
|
||||
modelMngEntity.id.as("modelUid"),
|
||||
modelMngEntity.modelNm,
|
||||
modelMngEntity.modelCate,
|
||||
modelVerEntity.id.as("modelVerUid"),
|
||||
modelVerEntity.modelVer,
|
||||
modelVerEntity.usedState,
|
||||
modelVerEntity.modelState,
|
||||
modelVerEntity.qualityProb,
|
||||
modelVerEntity.deployState,
|
||||
modelVerEntity.modelPath))
|
||||
.from(modelMngEntity)
|
||||
.innerJoin(modelVerEntity)
|
||||
.on(modelMngEntity.id.eq(modelVerEntity.modelUid))
|
||||
.where(modelVerEntity.usedState.eq("USED")) //USED 인 것 중에
|
||||
.orderBy(modelVerEntity.modelVer.desc()) //Version 높은 것 기준
|
||||
.where(modelVerEntity.usedState.eq("USED")) // USED 인 것 중에
|
||||
.orderBy(modelVerEntity.modelVer.desc()) // Version 높은 것 기준
|
||||
.stream()
|
||||
.findFirst();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ModelMngDto.ModelRegHistory> getRegHistoryList(ModelMngDto.searchReq searchReq, LocalDate startDate, LocalDate endDate, String searchVal) {
|
||||
public Page<ModelMngDto.ModelRegHistory> getRegHistoryList(
|
||||
ModelMngDto.searchReq searchReq, LocalDate startDate, LocalDate endDate, String searchVal) {
|
||||
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
List<ModelMngDto.ModelRegHistory> foundContent =
|
||||
queryFactory
|
||||
List<ModelMngDto.ModelRegHistory> foundContent =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
ModelMngDto.ModelRegHistory.class,
|
||||
modelMngEntity.modelNm,
|
||||
modelMngEntity.modelCate,
|
||||
modelVerEntity.modelVer,
|
||||
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')", modelVerEntity.createdDate).as("createdDttm"),
|
||||
modelVerEntity.usedState,
|
||||
modelVerEntity.deployState,
|
||||
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')", modelDeployHstEntity.deployDttm).as("deployDttm")
|
||||
)
|
||||
)
|
||||
Projections.constructor(
|
||||
ModelMngDto.ModelRegHistory.class,
|
||||
modelMngEntity.modelNm,
|
||||
modelMngEntity.modelCate,
|
||||
modelVerEntity.modelVer,
|
||||
Expressions.stringTemplate(
|
||||
"to_char({0}, 'YYYY-MM-DD')", modelVerEntity.createdDate)
|
||||
.as("createdDttm"),
|
||||
modelVerEntity.usedState,
|
||||
modelVerEntity.deployState,
|
||||
Expressions.stringTemplate(
|
||||
"to_char({0}, 'YYYY-MM-DD')", modelDeployHstEntity.deployDttm)
|
||||
.as("deployDttm")))
|
||||
.from(modelMngEntity)
|
||||
.innerJoin(modelVerEntity)
|
||||
.on(modelMngEntity.id.eq(modelVerEntity.modelUid))
|
||||
.leftJoin(modelDeployHstEntity)
|
||||
.on(
|
||||
modelVerEntity.id.eq(modelDeployHstEntity.modelVerUid)
|
||||
.and(modelDeployHstEntity.serverId.eq(1L)) //1건만 조회해야 하기에 1번 서버만 조회하기
|
||||
)
|
||||
.where(
|
||||
eventEndedAtBetween(startDate, endDate),
|
||||
searchModelVerLike(searchVal)
|
||||
)
|
||||
modelVerEntity
|
||||
.id
|
||||
.eq(modelDeployHstEntity.modelVerUid)
|
||||
.and(modelDeployHstEntity.serverId.eq(1L)) // 1건만 조회해야 하기에 1번 서버만 조회하기
|
||||
)
|
||||
.where(eventEndedAtBetween(startDate, endDate), searchModelVerLike(searchVal))
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.orderBy(QuerydslOrderUtil.getOrderSpecifiers(pageable, ModelVerEntity.class, "modelVerEntity"))
|
||||
.orderBy(
|
||||
QuerydslOrderUtil.getOrderSpecifiers(
|
||||
pageable, ModelVerEntity.class, "modelVerEntity"))
|
||||
.fetch();
|
||||
|
||||
Long countQuery =
|
||||
queryFactory
|
||||
.select(modelVerEntity.id.count())
|
||||
.from(modelMngEntity)
|
||||
.innerJoin(modelVerEntity)
|
||||
.on(modelMngEntity.id.eq(modelVerEntity.modelUid))
|
||||
.where(
|
||||
eventEndedAtBetween(startDate, endDate),
|
||||
searchModelVerLike(searchVal)
|
||||
)
|
||||
.fetchOne();
|
||||
queryFactory
|
||||
.select(modelVerEntity.id.count())
|
||||
.from(modelMngEntity)
|
||||
.innerJoin(modelVerEntity)
|
||||
.on(modelMngEntity.id.eq(modelVerEntity.modelUid))
|
||||
.where(eventEndedAtBetween(startDate, endDate), searchModelVerLike(searchVal))
|
||||
.fetchOne();
|
||||
|
||||
return new PageImpl<>(foundContent, pageable, countQuery);
|
||||
}
|
||||
@@ -128,11 +123,13 @@ public class ModelMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
}
|
||||
LocalDateTime startDateTime = startDate.atStartOfDay();
|
||||
LocalDateTime endDateTime = endDate.plusDays(1).atStartOfDay();
|
||||
return modelMngEntity.createdDate.goe(ZonedDateTime.from(startDateTime))
|
||||
.and(modelMngEntity.modifiedDate.lt(ZonedDateTime.from(endDateTime)));
|
||||
return modelMngEntity
|
||||
.createdDate
|
||||
.goe(ZonedDateTime.from(startDateTime))
|
||||
.and(modelMngEntity.modifiedDate.lt(ZonedDateTime.from(endDateTime)));
|
||||
}
|
||||
|
||||
private BooleanExpression searchModelVerLike(String searchVal){
|
||||
private BooleanExpression searchModelVerLike(String searchVal) {
|
||||
if (StringUtils.isBlank(searchVal)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.model;
|
||||
|
||||
import com.kamco.cd.kamcoback.postgres.entity.ModelMngEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.ModelVerEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface ModelVerRepository extends JpaRepository<ModelVerEntity, Long>, ModelVerRepositoryCustom {}
|
||||
public interface ModelVerRepository
|
||||
extends JpaRepository<ModelVerEntity, Long>, ModelVerRepositoryCustom {}
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.model;
|
||||
|
||||
import com.kamco.cd.kamcoback.model.dto.ModelMngDto;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.ModelMngEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.ModelVerEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface ModelVerRepositoryCustom {
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.model;
|
||||
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QModelVerEntity.modelVerEntity;
|
||||
|
||||
import com.kamco.cd.kamcoback.postgres.entity.ModelMngEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.ModelVerEntity;
|
||||
import com.querydsl.core.types.dsl.Expressions;
|
||||
import com.querydsl.core.types.dsl.StringExpression;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import java.util.Optional;
|
||||
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QModelVerEntity.modelVerEntity;
|
||||
|
||||
public class ModelVerRepositoryImpl extends QuerydslRepositorySupport
|
||||
implements ModelVerRepositoryCustom {
|
||||
implements ModelVerRepositoryCustom {
|
||||
|
||||
private final JPAQueryFactory queryFactory;
|
||||
private final StringExpression NULL_STRING = Expressions.stringTemplate("cast(null as text)");
|
||||
@@ -24,10 +23,10 @@ public class ModelVerRepositoryImpl extends QuerydslRepositorySupport
|
||||
|
||||
@Override
|
||||
public Optional<ModelVerEntity> findModelVerById(Long id) {
|
||||
return Optional.ofNullable(queryFactory
|
||||
.selectFrom(modelVerEntity)
|
||||
.where(modelVerEntity.id.eq(id)) //model_ver_uid
|
||||
.fetchOne()
|
||||
);
|
||||
return Optional.ofNullable(
|
||||
queryFactory
|
||||
.selectFrom(modelVerEntity)
|
||||
.where(modelVerEntity.id.eq(id)) // model_ver_uid
|
||||
.fetchOne());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user