shp 파일 생성 수정

This commit is contained in:
2025-12-29 14:10:22 +09:00
parent 6343a5a781
commit f48c444f6c
4 changed files with 34 additions and 0 deletions

View File

@@ -71,6 +71,9 @@ public class InferenceResultShpDto {
@NoArgsConstructor
public static class InferenceCntDto {
@Schema(description = "추론 결과(inference_results)를 기준으로 신규 목록 저장 터이터 건수", example = "120")
int sheetAnalDataCnt;
@Schema(description = "추론 결과(inference_results)를 기준으로 신규 저장 데이터 건수", example = "120")
int inferenceCnt;

View File

@@ -20,10 +20,12 @@ public class InferenceResultShpCoreService {
*/
@Transactional
public InferenceResultShpDto.InferenceCntDto buildInferenceData() {
int sheetAnalDataCnt = repo.upsertGroupsFromMapSheetAnal();
int inferenceCnt = repo.upsertGroupsFromInferenceResults();
int inferenceGeomCnt = repo.upsertGeomsFromInferenceResults();
InferenceResultShpDto.InferenceCntDto cntDto = new InferenceResultShpDto.InferenceCntDto();
cntDto.setSheetAnalDataCnt(sheetAnalDataCnt);
cntDto.setInferenceCnt(inferenceCnt);
cntDto.setInferenceGeomCnt(inferenceGeomCnt);

View File

@@ -5,6 +5,8 @@ import java.util.List;
public interface InferenceResultRepositoryCustom {
int upsertGroupsFromMapSheetAnal();
int upsertGroupsFromInferenceResults();
int upsertGeomsFromInferenceResults();

View File

@@ -31,6 +31,33 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
// Upsert (Native only)
// ===============================
@Override
public int upsertGroupsFromMapSheetAnal() {
String sql =
"""
INSERT INTO tb_map_sheet_anal_inference (
compare_yyyy,
target_yyyy,
anal_map_sheet,
stage,
anal_title
)
SELECT
r.input1 AS compare_yyyy,
r.input2 AS target_yyyy,
r.map_id AS anal_map_sheet,
r.stage,
CONCAT(r.stage ,'_', r.input1 ,'_', r.input2 ,'_', r.map_id) as anal_title
FROM inference_results r
GROUP BY r.stage, r.input1, r.input2, r.map_id
ON CONFLICT (compare_yyyy, target_yyyy, anal_map_sheet, stage)
DO UPDATE SET
updated_dttm = now()
""";
return em.createNativeQuery(sql).executeUpdate();
}
/**
* inference_results 테이블을 기준으로 분석 데이터 단위(stage, compare_yyyy, target_yyyy, map_sheet_num)를
* 생성/갱신한다.