추론관리 분석결과 목록조회 추가
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
package com.kamco.cd.kamcoback.postgres.core;
|
||||
|
||||
import com.kamco.cd.kamcoback.common.service.BaseCoreService;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Basic;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.Inference.InferenceResultRepository;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -17,4 +20,25 @@ public class InferenceResultCoreService {
|
||||
|
||||
private final InferenceResultRepository inferenceResultRepository;
|
||||
|
||||
public Page<Basic> getInferenceResultList(InferenceResultDto.SearchReq searchReq) {
|
||||
Page<MapSheetAnalDataEntity> list = inferenceResultRepository.getInferenceResultList(searchReq);
|
||||
List<Basic> result =
|
||||
list.getContent().stream()
|
||||
.map(infList ->toDto(infList))
|
||||
.collect(Collectors.toList());
|
||||
return new PageImpl<>(result, list.getPageable(), list.getTotalElements());
|
||||
}
|
||||
|
||||
private Basic toDto(MapSheetAnalDataEntity entity) {
|
||||
return new Basic(
|
||||
entity.getId(),
|
||||
entity.getDataName(),
|
||||
entity.getMapSheepNum(),
|
||||
entity.getDetectingCnt(),
|
||||
entity.getAnalStrtDttm(),
|
||||
entity.getAnalEndDttm(),
|
||||
entity.getAnalSec(),
|
||||
entity.getAnalState()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ 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;
|
||||
import lombok.Setter;
|
||||
@@ -51,14 +52,14 @@ public class MapSheetAnalDataEntity {
|
||||
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "created_dttm")
|
||||
private Instant createdDttm;
|
||||
private ZonedDateTime createdDttm;
|
||||
|
||||
@Column(name = "created_uid")
|
||||
private Long createdUid;
|
||||
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "updated_dttm")
|
||||
private Instant updatedDttm;
|
||||
private ZonedDateTime updatedDttm;
|
||||
|
||||
@Column(name = "updated_uid")
|
||||
private Long updatedUid;
|
||||
@@ -79,13 +80,13 @@ public class MapSheetAnalDataEntity {
|
||||
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "data_state_dttm")
|
||||
private Instant dataStateDttm;
|
||||
private ZonedDateTime dataStateDttm;
|
||||
|
||||
@Column(name = "anal_strt_dttm")
|
||||
private Instant analStrtDttm;
|
||||
private ZonedDateTime analStrtDttm;
|
||||
|
||||
@Column(name = "anal_end_dttm")
|
||||
private LocalTime analEndDttm;
|
||||
private ZonedDateTime analEndDttm;
|
||||
|
||||
@Column(name = "anal_sec")
|
||||
private Long analSec;
|
||||
@@ -100,4 +101,7 @@ public class MapSheetAnalDataEntity {
|
||||
@Column(name = "map_sheep_num")
|
||||
private Long mapSheepNum;
|
||||
|
||||
@Column(name = "detecting_cnt")
|
||||
private Long detectingCnt;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
||||
|
||||
public interface InferenceResultRepositoryCustom {
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataEntity;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
public interface InferenceResultRepositoryCustom {
|
||||
Page<MapSheetAnalDataEntity> getInferenceResultList(InferenceResultDto.SearchReq searchReq);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
||||
|
||||
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnDataEntity;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataEntity;
|
||||
import com.querydsl.jpa.impl.JPAQuery;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
@@ -11,7 +18,24 @@ import org.springframework.stereotype.Repository;
|
||||
public class InferenceResultRepositoryImpl implements InferenceResultRepositoryCustom {
|
||||
|
||||
private final JPAQueryFactory queryFactory;
|
||||
private final QMapSheetLearnDataEntity qSheetLearnData = QMapSheetLearnDataEntity.mapSheetLearnDataEntity;
|
||||
private final QMapSheetAnalDataEntity mapSheetAnalData = QMapSheetAnalDataEntity.mapSheetAnalDataEntity;
|
||||
|
||||
|
||||
@Override
|
||||
public Page<MapSheetAnalDataEntity> getInferenceResultList(InferenceResultDto.SearchReq searchReq) {
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
JPAQuery<MapSheetAnalDataEntity> query =
|
||||
queryFactory.selectFrom(mapSheetAnalData)
|
||||
;
|
||||
|
||||
long total = query.fetchCount();
|
||||
|
||||
List<MapSheetAnalDataEntity> content =
|
||||
query
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.orderBy(mapSheetAnalData.createdDttm.desc())
|
||||
.fetch();
|
||||
return new PageImpl<>(content, pageable, total);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user