모델관리 수정
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
package com.kamco.cd.kamcoback.postgres.core;
|
||||
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QModelMngEntity.modelMngEntity;
|
||||
|
||||
import com.kamco.cd.kamcoback.model.dto.ModelMngDto;
|
||||
import com.kamco.cd.kamcoback.model.dto.ModelMngDto.ModelMetricAddReq;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.ModelMngEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.ModelResultMetricEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.model.ModelMngRepository;
|
||||
import java.time.LocalDate;
|
||||
import java.util.UUID;
|
||||
@@ -37,11 +42,47 @@ public class ModelMngCoreService {
|
||||
modelMngRepository.deleteByModelUuid(uuid);
|
||||
}
|
||||
|
||||
public void insertModel(ModelMngDto.AddReq addReq) {
|
||||
public Long insertModel(ModelMngDto.AddReq addReq) {
|
||||
|
||||
// ModelMngEntity addEntity = new ModelMngEntity();
|
||||
// addEntity.setModelType(addReq.getModelType());
|
||||
ModelMngEntity addEntity = new ModelMngEntity();
|
||||
addEntity.setModelVer(addReq.getModelVer());
|
||||
addEntity.setModelType(addReq.getModelType());
|
||||
addEntity.setFilePath(addReq.getFilePath());
|
||||
addEntity.setFileName(addReq.getFileName());
|
||||
addEntity.setMemo(addReq.getMemo());
|
||||
addEntity.setUuid(addReq.getUuid());
|
||||
|
||||
modelMngRepository.insertModel(addReq);
|
||||
addEntity.setCdModelPath(addReq.getCdModelPath());
|
||||
addEntity.setCdModelFileName(addReq.getCdModelFileName());
|
||||
addEntity.setCdModelConfigPath(addReq.getCdModelConfigPath());
|
||||
addEntity.setCdModelConfigFileName(addReq.getCdModelConfigFileName());
|
||||
addEntity.setClsModelPath(addReq.getClsModelPath());
|
||||
addEntity.setClsModelFileName(addReq.getClsModelFileName());
|
||||
addEntity.setDeleted(false);
|
||||
|
||||
//modelMngRepository.insertModel(addReq);
|
||||
ModelMngEntity entity = modelMngRepository.save(addEntity);
|
||||
return entity.getModelUid();
|
||||
}
|
||||
|
||||
public void insertModelResultMetric(ModelMngDto.ModelMetricAddReq addReq) {
|
||||
|
||||
/*
|
||||
ModelResultMetricEntity addEntity = new ModelResultMetricEntity();
|
||||
addEntity.setModelUid(addReq.getModelUid());
|
||||
addEntity.setModelVerUid(addReq.getModelVerUid());
|
||||
addEntity.setF1Score(addReq.getF1Score());
|
||||
addEntity.setPrecision(addReq.getPrecision());
|
||||
addEntity.setRecall(addReq.getRecall());
|
||||
addEntity.setLoss(addReq.getLoss());
|
||||
addEntity.setIou(addReq.getIou());
|
||||
*/
|
||||
|
||||
|
||||
modelMngRepository.insertModelResultMetric(addReq);
|
||||
//ModelMngEntity entity = modelMngRepository.save(addEntity);
|
||||
//return entity.getMetricUid();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
@@ -56,6 +57,32 @@ public class ModelMngEntity extends CommonDateEntity {
|
||||
@Column(name = "uuid")
|
||||
private UUID uuid;
|
||||
|
||||
@Size(max = 155)
|
||||
@Column(name = "cd_model_path", length = 155)
|
||||
private String cdModelPath;
|
||||
|
||||
@Size(max = 155)
|
||||
@Column(name = "cd_model_file_name", length = 155)
|
||||
private String cdModelFileName;
|
||||
|
||||
@Size(max = 155)
|
||||
@Column(name = "cd_model_config_path", length = 155)
|
||||
private String cdModelConfigPath;
|
||||
|
||||
@Size(max = 155)
|
||||
@Column(name = "cd_model_config_file_name", length = 155)
|
||||
private String cdModelConfigFileName;
|
||||
|
||||
@Size(max = 155)
|
||||
@Column(name = "cls_model_path", length = 155)
|
||||
private String clsModelPath;
|
||||
|
||||
@Size(max = 155)
|
||||
@Column(name = "cls_model_file_name", length = 155)
|
||||
private String clsModelFileName;
|
||||
|
||||
|
||||
|
||||
public void deleted() {
|
||||
this.deleted = true;
|
||||
}
|
||||
|
||||
@@ -7,21 +7,21 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.JdbcTypeCode;
|
||||
import org.hibernate.type.SqlTypes;
|
||||
|
||||
@Entity
|
||||
|
||||
@Table(name = "tb_model_result_metric")
|
||||
@Getter
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Setter
|
||||
@Entity
|
||||
public class ModelResultMetricEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "metric_uid")
|
||||
private Long id;
|
||||
private Long metricUid;
|
||||
|
||||
@Column(name = "model_uid")
|
||||
private Long modelUid;
|
||||
|
||||
@@ -23,4 +23,8 @@ public interface ModelMngRepositoryCustom {
|
||||
void insertModel(ModelMngDto.AddReq addReq);
|
||||
|
||||
void deleteByModelUuid(UUID uuid);
|
||||
|
||||
void insertModelResultMetric(ModelMngDto.ModelMetricAddReq addReq);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -197,4 +197,31 @@ public class ModelMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
.where(modelMngEntity.uuid.eq(uuid))
|
||||
.execute();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void insertModelResultMetric(@Valid ModelMngDto.ModelMetricAddReq addReq) {
|
||||
long execCount =
|
||||
queryFactory
|
||||
.insert(modelResultMetricEntity)
|
||||
.columns(
|
||||
modelResultMetricEntity.modelUid,
|
||||
modelResultMetricEntity.modelVerUid,
|
||||
modelResultMetricEntity.f1Score,
|
||||
modelResultMetricEntity.precision,
|
||||
modelResultMetricEntity.recall,
|
||||
modelResultMetricEntity.loss,
|
||||
modelResultMetricEntity.iou)
|
||||
.values(
|
||||
addReq.getModelUid(),
|
||||
addReq.getModelVerUid(),
|
||||
addReq.getF1Score(),
|
||||
addReq.getPrecision(),
|
||||
addReq.getRecall(),
|
||||
addReq.getLoss(),
|
||||
addReq.getIou())
|
||||
.execute();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user