모델 수정 진행중

This commit is contained in:
2025-11-24 17:39:11 +09:00
parent ef84638fc0
commit c56de2bf0c
7 changed files with 51 additions and 42 deletions

View File

@@ -6,16 +6,15 @@ import com.kamco.cd.kamcoback.postgres.entity.ModelMngEntity;
import com.kamco.cd.kamcoback.postgres.entity.ModelVerEntity;
import com.kamco.cd.kamcoback.postgres.repository.model.ModelMngRepository;
import com.kamco.cd.kamcoback.postgres.repository.model.ModelVerRepository;
import jakarta.persistence.EntityNotFoundException;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Optional;
@Service
@RequiredArgsConstructor
@Transactional(readOnly = true)
public class ModelMngCoreService {
private final ModelMngRepository modelMngRepository;
@@ -38,4 +37,14 @@ public class ModelMngCoreService {
0.0, "NONE", addReq.getModelPath(), 1L, 1L);
return modelVerRepository.save(modelVerEntity).toDto();
}
public Long update(Long id, ModelMngDto.AddReq addReq) {
//조회
return null;
// ModelVerEntity existData = modelVerRepository.findModelVerById(id)
// .orElseThrow(() -> new EntityNotFoundException("버전 id 에 대한 정보를 찾을 수 없습니다. id : " + id));
//
// ModelVerEntity modelVerEntity = new ModelVerEntity(saved.getId(), addReq.getModelCate(), addReq.getModelVer(), "NONE", "NONE",
// 0.0, "NONE", addReq.getModelPath(), 1L, 1L);
}
}

View File

@@ -61,6 +61,21 @@ public class ModelVerEntity extends CommonDateEntity {
@Column(name = "updated_uid")
private Long updatedUid;
public ModelVerEntity(Long id, Long modelUid, String modelCate, String modelVer, String usedState, String modelState,
Double qualityProb, String deployState, String modelPath, Long createdUid, Long updatedUid) {
this.id = id;
this.modelUid = modelUid;
this.modelCate = modelCate;
this.modelVer = modelVer;
this.usedState = usedState;
this.modelState = modelState;
this.qualityProb = qualityProb;
this.deployState = deployState;
this.modelPath = modelPath;
this.createdUid = createdUid;
this.updatedUid = updatedUid;
}
public ModelVerEntity(Long modelUid, String modelCate, String modelVer, String usedState, String modelState,
Double qualityProb, String deployState, String modelPath, Long createdUid, Long updatedUid) {
this.modelUid = modelUid;

View File

@@ -2,13 +2,12 @@ package com.kamco.cd.kamcoback.postgres.repository.model;
import com.kamco.cd.kamcoback.model.dto.ModelMngDto;
import com.kamco.cd.kamcoback.postgres.entity.ModelMngEntity;
import com.kamco.cd.kamcoback.postgres.entity.ModelVerEntity;
import java.util.List;
import java.util.Optional;
public interface ModelVerRepositoryCustom {
List<ModelMngEntity> findModelMngAll();
Optional<ModelMngDto.FinalModelDto> getFinalModelInfo();
Optional<ModelVerEntity> findModelVerById(Long id);
}

View File

@@ -2,6 +2,7 @@ package com.kamco.cd.kamcoback.postgres.repository.model;
import com.kamco.cd.kamcoback.model.dto.ModelMngDto;
import com.kamco.cd.kamcoback.postgres.entity.ModelMngEntity;
import com.kamco.cd.kamcoback.postgres.entity.ModelVerEntity;
import com.querydsl.core.types.Projections;
import com.querydsl.core.types.dsl.Expressions;
import com.querydsl.core.types.dsl.StringExpression;
@@ -26,37 +27,11 @@ public class ModelVerRepositoryImpl extends QuerydslRepositorySupport
}
@Override
public List<ModelMngEntity> findModelMngAll() {
return queryFactory
.selectFrom(modelMngEntity)
.orderBy(modelMngEntity.id.desc())
.fetch();
}
@Override
public Optional<ModelMngDto.FinalModelDto> getFinalModelInfo(){
return Optional.ofNullable(
queryFactory
.select(
Projections.constructor(
ModelMngDto.FinalModelDto.class,
modelMngEntity.id.as("modelUid"),
modelMngEntity.modelNm,
modelMngEntity.modelCate,
modelVerEntity.id.as("modelVerUid"),
modelVerEntity.modelVer,
modelVerEntity.usedState,
modelVerEntity.modelState,
modelVerEntity.qualityProb,
modelVerEntity.deployState,
modelVerEntity.modelPath
)
)
.from(modelMngEntity)
.innerJoin(modelVerEntity)
.on(modelMngEntity.id.eq(modelVerEntity.modelUid))
.where(modelVerEntity.usedState.eq("USED"))
public Optional<ModelVerEntity> findModelVerById(Long id) {
return Optional.ofNullable(queryFactory
.selectFrom(modelVerEntity)
.where(modelVerEntity.id.eq(id)) //model_ver_uid
.fetchOne()
);
);
}
}