[KC-108] 분석도엽 ai api호출 테스트중

This commit is contained in:
2026-01-12 17:57:25 +09:00
parent 78d0ccf6e2
commit f74f8557d7
5 changed files with 159 additions and 115 deletions

View File

@@ -242,6 +242,10 @@ public class MapSheetMngCoreService {
return mapSheetMngRepository.findByHstMapSheetTargetList(mngYyyy);
}
public List<MngListDto> getHstMapSheetList(int mngYyyy, List<String> mapIds) {
return mapSheetMngRepository.findByHstMapSheetTargetList(mngYyyy, mapIds);
}
public List<MngListCompareDto> getByHstMapSheetCompareList(int mngYyyy, List<String> mapId) {
return mapSheetMngRepository.findByHstMapSheetCompareList(mngYyyy, mapId);
}

View File

@@ -63,6 +63,8 @@ public interface MapSheetMngRepositoryCustom {
List<MngListDto> findByHstMapSheetTargetList(int mngYyyy);
List<MngListDto> findByHstMapSheetTargetList(int mngYyyy, List<String> mapIds);
List<MngListCompareDto> findByHstMapSheetCompareList(int mngYyyy, List<String> mapId);
MapSheetMngDto.MngFilesDto findByFileUidMapSheetFile(Long fileUid);

View File

@@ -498,25 +498,46 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
.fetch();
}
@Override
public List<MngListDto> findByHstMapSheetTargetList(int mngYyyy, List<String> mapIds) {
BooleanBuilder whereBuilder = new BooleanBuilder();
whereBuilder.and(mapSheetMngHstEntity.mngYyyy.eq(mngYyyy));
whereBuilder.and(mapSheetMngHstEntity.mapSheetNum.in(mapIds));
whereBuilder.and(mapSheetMngHstEntity.dataState.eq("DONE"));
whereBuilder.and(mapSheetMngHstEntity.syncState.eq("DONE"));
whereBuilder.and(mapSheetMngHstEntity.useInference.eq("USE"));
return queryFactory
.select(
Projections.constructor(
MngListDto.class,
mapSheetMngHstEntity.mngYyyy,
mapSheetMngHstEntity.mapSheetNum,
mapSheetMngHstEntity.mapSheetName))
.from(mapSheetMngHstEntity)
.where(whereBuilder)
.fetch();
}
@Override
public List<MngListCompareDto> findByHstMapSheetCompareList(int mngYyyy, List<String> mapIds) {
String sql =
"""
SELECT
t.map_sheet_num,
t.map_years,
COALESCE(s.target_year, 0) AS before_year
FROM public.tb_map_sheet_years_map t
LEFT JOIN LATERAL (
SELECT x::int AS target_year
FROM unnest(string_to_array(t.map_years, '>')) AS x
WHERE x::int <= :mngYyyy
ORDER BY x::int DESC
LIMIT 1
) s ON true
WHERE t.map_sheet_num = ANY(:mapIds)
""";
SELECT
t.map_sheet_num,
t.map_years,
COALESCE(s.target_year, 0) AS before_year
FROM public.tb_map_sheet_years_map t
LEFT JOIN LATERAL (
SELECT x::int AS target_year
FROM unnest(string_to_array(t.map_years, '>')) AS x
WHERE x::int <= :mngYyyy
ORDER BY x::int DESC
LIMIT 1
) s ON true
WHERE t.map_sheet_num = ANY(:mapIds)
""";
@SuppressWarnings("unchecked")
List<Object[]> rows =