gemo 테이블 수정
This commit is contained in:
@@ -54,11 +54,13 @@ public class InferenceResultApiController {
|
||||
String title,
|
||||
@Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0")
|
||||
int page,
|
||||
@Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20")
|
||||
int size,
|
||||
@Parameter(description = "정렬 조건 (형식: 필드명,방향)", example = "name,asc")
|
||||
@RequestParam(required = false)
|
||||
String sort
|
||||
) {
|
||||
InferenceResultDto.SearchReq searchReq = new InferenceResultDto.SearchReq(statCode, title, page, 20, sort);
|
||||
InferenceResultDto.SearchReq searchReq = new InferenceResultDto.SearchReq(statCode, title, page, size, sort);
|
||||
Page<InferenceResultDto.AnalResList> analResList = inferenceResultService.getInferenceResultList(searchReq);
|
||||
return ApiResponseDto.ok(analResList);
|
||||
}
|
||||
@@ -107,12 +109,42 @@ public class InferenceResultApiController {
|
||||
public ApiResponseDto<InferenceResultDto.Detail> getInferenceDetail(
|
||||
@Parameter(description = "목록 id", example = "1")
|
||||
@RequestParam Long id) {
|
||||
// summary
|
||||
InferenceResultDto.AnalResSummary summary = inferenceResultService.getInferenceResultSummary(id);
|
||||
//dashBoard
|
||||
List<InferenceResultDto.Dashboard> dashboardList = this.getInferenceResultDashboard(id);
|
||||
|
||||
return ApiResponseDto.ok(new Detail(summary, dashboardList));
|
||||
}
|
||||
|
||||
@Operation(
|
||||
summary = "추론관리 분석결과 상세 목록",
|
||||
description =
|
||||
"추론관리 분석결과 상세 목록 geojson 데이터 조회")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
responseCode = "200",
|
||||
description = "검색 성공",
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = Page.class))),
|
||||
@ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@GetMapping("/geom")
|
||||
public ApiResponseDto<Page<InferenceResultDto.Geom>> getInferenceResultGeomList(
|
||||
@Parameter(description = "기준년도 분류", example = "0001") @RequestParam(required = false) String targetClass,
|
||||
@Parameter(description = "비교년도 분류", example = "0002") @RequestParam(required = false) String compareClass,
|
||||
@Parameter(description = "5000:1 도협번호", example = "37801011,37801012") @RequestParam(required = false) List<Long> mapSheetNum,
|
||||
@Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0") int page,
|
||||
@Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20") int size,
|
||||
@Parameter(description = "정렬 조건 (형식: 필드명,방향)", example = "name,asc") @RequestParam(required = false) String sort
|
||||
) {
|
||||
InferenceResultDto.SearchGeoReq searchGeoReq = new InferenceResultDto.SearchGeoReq(targetClass, compareClass, mapSheetNum, page, size, sort);
|
||||
Page<InferenceResultDto.Geom> geomList = inferenceResultService.getInferenceResultGeomList(searchGeoReq);
|
||||
return ApiResponseDto.ok(geomList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 분석결과 상세 대시보드 조회
|
||||
|
||||
@@ -211,6 +211,35 @@ public class InferenceResultDto {
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
public static class Geom {
|
||||
Integer compareYyyy;
|
||||
Integer targetYyyy;
|
||||
String classBeforeName;
|
||||
Double classBeforeProb;
|
||||
String classAfterName;
|
||||
Double classAfterProb;
|
||||
Long mapSheetNum;
|
||||
|
||||
public Geom(
|
||||
Integer compareYyyy,
|
||||
Integer targetYyyy,
|
||||
String classBeforeName,
|
||||
Double classBeforeProb,
|
||||
String classAfterName,
|
||||
Double classAfterProb,
|
||||
Long mapSheetNum
|
||||
) {
|
||||
this.compareYyyy = compareYyyy;
|
||||
this.targetYyyy = targetYyyy;
|
||||
this.classBeforeName = classBeforeName;
|
||||
this.classBeforeProb = classBeforeProb;
|
||||
this.classAfterName = classAfterName;
|
||||
this.classAfterProb = classAfterProb;
|
||||
this.mapSheetNum = mapSheetNum;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -241,4 +270,35 @@ public class InferenceResultDto {
|
||||
return PageRequest.of(page, size);
|
||||
}
|
||||
}
|
||||
|
||||
@Schema(name = "InferenceResultSearchReq", description = "분석결과 목록 요청 정보")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class SearchGeoReq {
|
||||
|
||||
// 기준년도
|
||||
private String targetClass;
|
||||
// 비교년도
|
||||
private String compareClass;
|
||||
//분석도엽
|
||||
private List<Long> mapSheetNum;
|
||||
|
||||
// 페이징 파라미터
|
||||
private int page = 0;
|
||||
private int size = 20;
|
||||
private String sort;
|
||||
|
||||
public Pageable toPageable() {
|
||||
if (sort != null && !sort.isEmpty()) {
|
||||
String[] sortParams = sort.split(",");
|
||||
String property = sortParams[0];
|
||||
Sort.Direction direction =
|
||||
sortParams.length > 1 ? Sort.Direction.fromString(sortParams[1]) : Sort.Direction.ASC;
|
||||
return PageRequest.of(page, size, Sort.by(direction, property));
|
||||
}
|
||||
return PageRequest.of(page, size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,14 @@ public class InferenceResultService {
|
||||
return inferenceResultCoreService.getInferenceResultDashboard(id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 분석결과 상세 목록
|
||||
* @param searchGeoReq
|
||||
* @return
|
||||
*/
|
||||
public Page<InferenceResultDto.Geom> getInferenceResultGeomList(InferenceResultDto.SearchGeoReq searchGeoReq) {
|
||||
return inferenceResultCoreService.getInferenceResultGeomList(searchGeoReq);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ 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;
|
||||
@@ -46,4 +47,13 @@ public class InferenceResultCoreService {
|
||||
.map(MapSheetAnalSttcEntity::toDto)
|
||||
.toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 분석결과 상세 목록
|
||||
* @param searchGeoReq
|
||||
* @return
|
||||
*/
|
||||
public Page<InferenceResultDto.Geom> getInferenceResultGeomList(InferenceResultDto.SearchGeoReq searchGeoReq) {
|
||||
return inferenceResultRepository.getInferenceGeomList(searchGeoReq);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,9 @@ public class CommonCodeEntity extends CommonDateEntity {
|
||||
@Column(name = "used")
|
||||
private Boolean used;
|
||||
|
||||
@Column(name = "misc_cd")
|
||||
private String miscCd;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "deleted", nullable = false)
|
||||
private Boolean deleted = false;
|
||||
|
||||
@@ -28,16 +28,14 @@ public class MapSheetAnalDataGeomEntity {
|
||||
@Column(name = "cd_prob")
|
||||
private Double cdProb;
|
||||
|
||||
@Size(max = 100)
|
||||
@Column(name = "class_before_name", length = 100)
|
||||
private String classBeforeName;
|
||||
@Column(name = "class_before_cd")
|
||||
private String classBeforeCd;
|
||||
|
||||
@Column(name = "class_before_prob")
|
||||
private Double classBeforeProb;
|
||||
|
||||
@Size(max = 100)
|
||||
@Column(name = "class_after_name", length = 100)
|
||||
private String classAfterName;
|
||||
@Column(name = "class_after_cd")
|
||||
private String classAfterCd;
|
||||
|
||||
@Column(name = "class_after_prob")
|
||||
private Double classAfterProb;
|
||||
@@ -69,13 +67,8 @@ public class MapSheetAnalDataGeomEntity {
|
||||
|
||||
@Column(name = "updated_dttm")
|
||||
private ZonedDateTime updatedDttm;
|
||||
|
||||
@Column(name = "updated_uid")
|
||||
private Long updatedUid;
|
||||
|
||||
/*
|
||||
TODO [Reverse Engineering] create field to map the 'geom' column
|
||||
Available actions: Define target Java type | Uncomment as is | Remove column mapping
|
||||
@Column(name = "geom", columnDefinition = "geometry")
|
||||
private Object geom;
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -2,6 +2,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.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;
|
||||
@@ -12,5 +13,5 @@ public interface InferenceResultRepositoryCustom {
|
||||
Page<InferenceResultDto.AnalResList> getInferenceResultList(InferenceResultDto.SearchReq searchReq);
|
||||
Optional<InferenceResultDto.AnalResSummary> getInferenceResultSummary(Long id);
|
||||
List<MapSheetAnalSttcEntity> getInferenceResultDashboard(Long id);
|
||||
|
||||
Page<InferenceResultDto.Geom> getInferenceGeomList(InferenceResultDto.SearchGeoReq searchGeoReq);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
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.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;
|
||||
@@ -30,6 +32,7 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
private final QModelMngEntity tmm = QModelMngEntity.modelMngEntity;
|
||||
private final QModelVerEntity tmv = QModelVerEntity.modelVerEntity;
|
||||
private final QMapSheetAnalSttcEntity mapSheetAnalSttc = QMapSheetAnalSttcEntity.mapSheetAnalSttcEntity;
|
||||
private final QMapSheetAnalDataGeomEntity mapSheetAnalDataGeom = QMapSheetAnalDataGeomEntity.mapSheetAnalDataGeomEntity;
|
||||
|
||||
|
||||
|
||||
@@ -145,4 +148,56 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
.where(mapSheetAnalSttc.dataUid.eq(id))
|
||||
.fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 분석결과 상세 목록
|
||||
* @param searchGeoReq
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<InferenceResultDto.Geom> getInferenceGeomList(SearchGeoReq searchGeoReq) {
|
||||
Pageable pageable = searchGeoReq.toPageable();
|
||||
BooleanBuilder builder = new BooleanBuilder();
|
||||
|
||||
// 기준년도 분류
|
||||
if(searchGeoReq.getTargetClass() != null && !searchGeoReq.getTargetClass().equals("")){
|
||||
builder.and(mapSheetAnalDataGeom.classAfterCd.eq(searchGeoReq.getTargetClass()));
|
||||
|
||||
}
|
||||
|
||||
// 비교년도 분류
|
||||
if(searchGeoReq.getCompareClass() != null && !searchGeoReq.getCompareClass().equals("")){
|
||||
builder.and(mapSheetAnalDataGeom.classBeforeCd.eq(searchGeoReq.getCompareClass()));
|
||||
}
|
||||
|
||||
// 분석도엽
|
||||
if(searchGeoReq.getMapSheetNum() != null){
|
||||
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,
|
||||
mapSheetAnalDataGeom.classBeforeProb,
|
||||
mapSheetAnalDataGeom.classAfterCd,
|
||||
mapSheetAnalDataGeom.classAfterProb,
|
||||
mapSheetAnalDataGeom.mapSheetNum))
|
||||
.from(mapSheetAnalDataGeom)
|
||||
.where(builder)
|
||||
.fetch()
|
||||
;
|
||||
|
||||
long total = queryFactory
|
||||
.select(mapSheetAnalDataGeom.id)
|
||||
.from(mapSheetAnalDataGeom)
|
||||
.where(
|
||||
builder
|
||||
)
|
||||
.fetchCount();
|
||||
|
||||
return new PageImpl<>(content, pageable, total);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user