하이퍼파라미터 기능 추가
This commit is contained in:
@@ -119,7 +119,7 @@ public class HyperParamCoreService {
|
||||
throw new CustomApiException("CONFLICT", HttpStatus.CONFLICT, "HPs_0001 버전은 삭제할수 없습니다.");
|
||||
}
|
||||
|
||||
entity.setDelYn("Y");
|
||||
entity.setDelYn(true);
|
||||
entity.setUpdatedUid(userUtil.getId());
|
||||
entity.setUpdatedDttm(ZonedDateTime.now());
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.kamco.cd.training.postgres.core;
|
||||
|
||||
import com.kamco.cd.training.common.exception.BadRequestException;
|
||||
import com.kamco.cd.training.common.exception.CustomApiException;
|
||||
import com.kamco.cd.training.common.exception.NotFoundException;
|
||||
import com.kamco.cd.training.model.dto.ModelMngDto;
|
||||
import com.kamco.cd.training.model.dto.ModelMngDto.Basic;
|
||||
@@ -10,8 +11,10 @@ import com.kamco.cd.training.postgres.repository.model.ModelDatasetMappRepositor
|
||||
import com.kamco.cd.training.postgres.repository.model.ModelMngRepository;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@@ -26,11 +29,19 @@ public class ModelMngCoreService {
|
||||
* @param searchReq 검색 조건
|
||||
* @return 페이징 처리된 모델 목록
|
||||
*/
|
||||
public Page<Basic> findByModels(ModelMngDto.SearchReq searchReq) {
|
||||
public Page<Basic> findByModelList(ModelMngDto.SearchReq searchReq) {
|
||||
Page<ModelTrainMasterEntity> entityPage = modelMngRepository.findByModels(searchReq);
|
||||
return entityPage.map(ModelTrainMasterEntity::toDto);
|
||||
}
|
||||
|
||||
public void deleteModel(UUID uuid) {
|
||||
ModelTrainMasterEntity entity =
|
||||
modelMngRepository
|
||||
.findByUuid(uuid)
|
||||
.orElseThrow(() -> new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND));
|
||||
// entity.setDelYn();
|
||||
}
|
||||
|
||||
/**
|
||||
* 모델 상세 조회
|
||||
*
|
||||
|
||||
@@ -280,9 +280,9 @@ public class ModelHyperParamEntity {
|
||||
private String memo;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("'N'")
|
||||
@ColumnDefault("false")
|
||||
@Column(name = "del_yn", nullable = false, length = 1)
|
||||
private String delYn = "N";
|
||||
private Boolean delYn = false;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("CURRENT_TIMESTAMP")
|
||||
|
||||
@@ -186,6 +186,7 @@ public class ModelTrainMasterEntity {
|
||||
this.step2Duration,
|
||||
this.step1Status,
|
||||
this.step2Status,
|
||||
this.transferStatus);
|
||||
this.transferStatus,
|
||||
this.statusCd);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class HyperParamRepositoryImpl implements HyperParamRepositoryCustom {
|
||||
queryFactory
|
||||
.select(modelHyperParamEntity)
|
||||
.from(modelHyperParamEntity)
|
||||
.where(modelHyperParamEntity.delYn.eq("N"))
|
||||
.where(modelHyperParamEntity.delYn.isFalse())
|
||||
.orderBy(modelHyperParamEntity.hyperVer.desc())
|
||||
.limit(1)
|
||||
.fetchOne());
|
||||
@@ -47,7 +47,7 @@ public class HyperParamRepositoryImpl implements HyperParamRepositoryCustom {
|
||||
queryFactory
|
||||
.select(modelHyperParamEntity)
|
||||
.from(modelHyperParamEntity)
|
||||
.where(modelHyperParamEntity.delYn.eq("N").and(modelHyperParamEntity.uuid.eq(uuid)))
|
||||
.where(modelHyperParamEntity.delYn.isFalse().and(modelHyperParamEntity.uuid.eq(uuid)))
|
||||
.fetchOne());
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class HyperParamRepositoryImpl implements HyperParamRepositoryCustom {
|
||||
Pageable pageable = req.toPageable();
|
||||
|
||||
BooleanBuilder builder = new BooleanBuilder();
|
||||
builder.and(modelHyperParamEntity.delYn.eq("N"));
|
||||
builder.and(modelHyperParamEntity.delYn.isFalse());
|
||||
|
||||
if (req.getHyperVer() != null && !req.getHyperVer().isEmpty()) {
|
||||
// 버전
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.kamco.cd.training.postgres.repository.model;
|
||||
|
||||
import com.kamco.cd.training.model.dto.ModelMngDto;
|
||||
import com.kamco.cd.training.postgres.entity.ModelTrainMasterEntity;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
public interface ModelMngRepositoryCustom {
|
||||
@@ -13,4 +15,6 @@ public interface ModelMngRepositoryCustom {
|
||||
* @return
|
||||
*/
|
||||
Page<ModelTrainMasterEntity> findByModels(ModelMngDto.SearchReq searchReq);
|
||||
|
||||
Optional<ModelTrainMasterEntity> findByUuid(UUID uuid);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package com.kamco.cd.training.postgres.repository.model;
|
||||
|
||||
import static com.kamco.cd.training.postgres.entity.QModelTrainMasterEntity.modelTrainMasterEntity;
|
||||
|
||||
import com.kamco.cd.training.model.dto.ModelMngDto;
|
||||
import com.kamco.cd.training.postgres.entity.ModelTrainMasterEntity;
|
||||
import com.kamco.cd.training.postgres.entity.QModelTrainMasterEntity;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
@@ -18,43 +20,57 @@ import org.springframework.stereotype.Repository;
|
||||
public class ModelMngRepositoryImpl implements ModelMngRepositoryCustom {
|
||||
|
||||
private final JPAQueryFactory queryFactory;
|
||||
private final QModelTrainMasterEntity modelMng = QModelTrainMasterEntity.modelTrainMasterEntity;
|
||||
|
||||
/**
|
||||
* 모델 목록 조회
|
||||
*
|
||||
* @param searchReq
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<ModelTrainMasterEntity> findByModels(ModelMngDto.SearchReq searchReq) {
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
public Page<ModelTrainMasterEntity> findByModels(ModelMngDto.SearchReq req) {
|
||||
Pageable pageable = req.toPageable();
|
||||
BooleanBuilder builder = new BooleanBuilder();
|
||||
//
|
||||
// if (StringUtils.isNotBlank(searchReq.getStatus())) {
|
||||
// builder.and(modelMng.statusCd.eq(searchReq.getStatus()));
|
||||
// }
|
||||
|
||||
// Entity 직접 조회 (Projections 사용 지양)
|
||||
if (req.getStatus() != null && !req.getStatus().isEmpty()) {
|
||||
builder.and(modelTrainMasterEntity.statusCd.eq(req.getStatus()));
|
||||
}
|
||||
|
||||
List<ModelTrainMasterEntity> content =
|
||||
queryFactory
|
||||
.selectFrom(modelMng)
|
||||
.where(builder.and(modelMng.delYn.isFalse()))
|
||||
.selectFrom(modelTrainMasterEntity)
|
||||
.where(builder)
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.orderBy(modelMng.createdDttm.desc())
|
||||
.orderBy(modelTrainMasterEntity.createdDttm.desc())
|
||||
.fetch();
|
||||
|
||||
// Count 쿼리 별도 실행 (null safe handling)
|
||||
long total =
|
||||
Optional.ofNullable(
|
||||
queryFactory
|
||||
.select(modelMng.count())
|
||||
.from(modelMng)
|
||||
.where(builder.and(modelMng.delYn.isFalse()))
|
||||
.fetchOne())
|
||||
.orElse(0L);
|
||||
Long total =
|
||||
queryFactory
|
||||
.select(modelTrainMasterEntity.count())
|
||||
.from(modelTrainMasterEntity)
|
||||
.where(builder)
|
||||
.fetchOne();
|
||||
|
||||
return new PageImpl<>(content, pageable, total);
|
||||
long totalCount = (total != null) ? total : 0L;
|
||||
|
||||
return new PageImpl<>(content, pageable, totalCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 모델 조회
|
||||
*
|
||||
* @param uuid
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Optional<ModelTrainMasterEntity> findByUuid(UUID uuid) {
|
||||
return Optional.ofNullable(
|
||||
queryFactory
|
||||
.select(modelTrainMasterEntity)
|
||||
.from(modelTrainMasterEntity)
|
||||
.where(modelTrainMasterEntity.uuid.eq(uuid))
|
||||
.fetchOne());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user