파일생성 추가
This commit is contained in:
@@ -16,15 +16,12 @@ public class InferenceResultShpCoreService {
|
||||
|
||||
private final InferenceResultRepository inferenceResultRepository;
|
||||
|
||||
public record ShpKey(Integer stage, Long mapId, Integer input1, Integer input2) {
|
||||
public record ShpKey(Integer stage, Long mapId, Integer input1, Integer input2) {}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* DB를 스트리밍하면서 그룹이 완성될 때마다 handler로 넘김 handler: (key, groupRows)
|
||||
*/
|
||||
/** DB를 스트리밍하면서 그룹이 완성될 때마다 handler로 넘김 handler: (key, groupRows) */
|
||||
@Transactional(readOnly = true)
|
||||
public void streamGrouped(int fetchSize, BiConsumer<ShpKey, List<InferenceResultEntity>> handler) {
|
||||
public void streamGrouped(
|
||||
int fetchSize, BiConsumer<ShpKey, List<InferenceResultEntity>> handler) {
|
||||
|
||||
ScrollableResults cursor = inferenceResultRepository.scrollAllOrdered(fetchSize);
|
||||
|
||||
|
||||
@@ -135,16 +135,12 @@ public class MapSheetAnalDataInferenceGeomEntity {
|
||||
@Column(name = "file_created_yn")
|
||||
private Boolean fileCreatedYn;
|
||||
|
||||
|
||||
@Column(name = "geom", columnDefinition = "geometry")
|
||||
private Geometry geom;
|
||||
|
||||
|
||||
@Column(name = "geom_center", columnDefinition = "geometry")
|
||||
private Geometry geomCenter;
|
||||
|
||||
|
||||
@Column(name = "before_geom", columnDefinition = "geometry")
|
||||
private Geometry beforeGeom;
|
||||
|
||||
}
|
||||
|
||||
@@ -5,5 +5,4 @@ import org.hibernate.ScrollableResults;
|
||||
public interface InferenceResultRepositoryCustom {
|
||||
|
||||
ScrollableResults scrollAllOrdered(int fetchSize);
|
||||
|
||||
}
|
||||
|
||||
@@ -20,22 +20,16 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
QInferenceResultEntity e = QInferenceResultEntity.inferenceResultEntity;
|
||||
|
||||
JPAQuery<InferenceResultEntity> q =
|
||||
queryFactory
|
||||
.selectFrom(e)
|
||||
.orderBy(
|
||||
e.stage.asc(),
|
||||
e.mapId.asc(),
|
||||
e.input1.asc(),
|
||||
e.input2.asc(),
|
||||
e.id.asc()
|
||||
);
|
||||
queryFactory
|
||||
.selectFrom(e)
|
||||
.orderBy(e.stage.asc(), e.mapId.asc(), e.input1.asc(), e.input2.asc(), e.id.asc());
|
||||
|
||||
// QueryDSL -> Hibernate Query로 unwrap 해서 커서 스트리밍
|
||||
Query<?> hQuery = q.createQuery().unwrap(Query.class);
|
||||
|
||||
return hQuery
|
||||
.setReadOnly(true)
|
||||
.setFetchSize(fetchSize) // PostgreSQL 커서/스트리밍에 영향
|
||||
.scroll(ScrollMode.FORWARD_ONLY);
|
||||
.setReadOnly(true)
|
||||
.setFetchSize(fetchSize) // PostgreSQL 커서/스트리밍에 영향
|
||||
.scroll(ScrollMode.FORWARD_ONLY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,4 @@ import org.springframework.stereotype.Repository;
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class MapSheetAnalDataInferenceGeomRepositoryImpl
|
||||
implements MapSheetAnalDataInferenceGeomRepositoryCustom {
|
||||
|
||||
}
|
||||
implements MapSheetAnalDataInferenceGeomRepositoryCustom {}
|
||||
|
||||
@@ -4,7 +4,5 @@ import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface MapSheetAnalDataInferenceRepository
|
||||
extends JpaRepository<MapSheetAnalDataInferenceEntity, Long>,
|
||||
MapSheetAnalDataInferenceRepositoryCustom {
|
||||
|
||||
}
|
||||
extends JpaRepository<MapSheetAnalDataInferenceEntity, Long>,
|
||||
MapSheetAnalDataInferenceRepositoryCustom {}
|
||||
|
||||
@@ -661,13 +661,17 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
}
|
||||
|
||||
@Override
|
||||
public int findByYearFileNameFileCount(int mngYyyy, String fileName){
|
||||
Long execCount = queryFactory
|
||||
.select(mapSheetMngFileEntity.count())
|
||||
.from(mapSheetMngFileEntity)
|
||||
.where(mapSheetMngFileEntity.mngYyyy.eq(mngYyyy)
|
||||
.and(mapSheetMngFileEntity.fileName.eq(fileName)))
|
||||
.fetchOne();
|
||||
public int findByYearFileNameFileCount(int mngYyyy, String fileName) {
|
||||
Long execCount =
|
||||
queryFactory
|
||||
.select(mapSheetMngFileEntity.count())
|
||||
.from(mapSheetMngFileEntity)
|
||||
.where(
|
||||
mapSheetMngFileEntity
|
||||
.mngYyyy
|
||||
.eq(mngYyyy)
|
||||
.and(mapSheetMngFileEntity.fileName.eq(fileName)))
|
||||
.fetchOne();
|
||||
|
||||
return Math.toIntExact(execCount);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user