모델관리 테이블 교체하기 위한 백업본 entity 선언
This commit is contained in:
@@ -2,18 +2,19 @@ package com.kamco.cd.kamcoback.postgres.core;
|
|||||||
|
|
||||||
import com.kamco.cd.kamcoback.model.dto.ModelMngDto;
|
import com.kamco.cd.kamcoback.model.dto.ModelMngDto;
|
||||||
import com.kamco.cd.kamcoback.model.dto.ModelVerDto;
|
import com.kamco.cd.kamcoback.model.dto.ModelVerDto;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.ModelMngEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.ModelMngBakEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.ModelVerEntity;
|
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.ModelMngRepository;
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.model.ModelVerRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.model.ModelVerRepository;
|
||||||
import jakarta.persistence.EntityNotFoundException;
|
import jakarta.persistence.EntityNotFoundException;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class ModelMngCoreService {
|
public class ModelMngCoreService {
|
||||||
@@ -22,7 +23,7 @@ public class ModelMngCoreService {
|
|||||||
private final ModelVerRepository modelVerRepository;
|
private final ModelVerRepository modelVerRepository;
|
||||||
|
|
||||||
public List<ModelMngDto.Basic> findModelMngAll() {
|
public List<ModelMngDto.Basic> findModelMngAll() {
|
||||||
return modelMngRepository.findModelMngAll().stream().map(ModelMngEntity::toDto).toList();
|
return modelMngRepository.findModelMngAll().stream().map(ModelMngBakEntity::toDto).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<ModelMngDto.FinalModelDto> getFinalModelInfo() {
|
public Optional<ModelMngDto.FinalModelDto> getFinalModelInfo() {
|
||||||
@@ -30,8 +31,8 @@ public class ModelMngCoreService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ModelVerDto.Basic save(ModelMngDto.AddReq addReq) {
|
public ModelVerDto.Basic save(ModelMngDto.AddReq addReq) {
|
||||||
ModelMngEntity modelMngEntity =
|
ModelMngBakEntity modelMngBakEntity =
|
||||||
new ModelMngEntity(
|
new ModelMngBakEntity(
|
||||||
addReq.getModelNm(),
|
addReq.getModelNm(),
|
||||||
addReq.getModelCate(),
|
addReq.getModelCate(),
|
||||||
addReq.getModelPath(),
|
addReq.getModelPath(),
|
||||||
@@ -39,7 +40,7 @@ public class ModelMngCoreService {
|
|||||||
1L,
|
1L,
|
||||||
addReq.getModelCntnt()); // TODO: 로그인 기능 붙이면 Uid 넣어야 함
|
addReq.getModelCntnt()); // TODO: 로그인 기능 붙이면 Uid 넣어야 함
|
||||||
|
|
||||||
ModelMngEntity saved = modelMngRepository.save(modelMngEntity);
|
ModelMngBakEntity saved = modelMngRepository.save(modelMngBakEntity);
|
||||||
ModelVerEntity modelVerEntity =
|
ModelVerEntity modelVerEntity =
|
||||||
new ModelVerEntity(
|
new ModelVerEntity(
|
||||||
saved.getId(),
|
saved.getId(),
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.entity;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Entity
|
|
||||||
@Table(name = "tb_model_class_count")
|
|
||||||
public class ModelClassCountEntity {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
@Column(name = "count_uid")
|
|
||||||
private Integer countUid;
|
|
||||||
|
|
||||||
@Column(name = "model_uid")
|
|
||||||
private Integer modelUid;
|
|
||||||
|
|
||||||
@Column(name = "class_cd")
|
|
||||||
private String classCd;
|
|
||||||
|
|
||||||
@Column(name = "obj_cnt")
|
|
||||||
private Integer objCnt;
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.entity;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
|
||||||
import jakarta.persistence.EmbeddedId;
|
|
||||||
import jakarta.persistence.Entity;
|
|
||||||
import jakarta.persistence.Table;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Entity
|
|
||||||
@Table(name = "tb_model_dataset_mapp")
|
|
||||||
public class ModelDatasetMappEntity {
|
|
||||||
|
|
||||||
@EmbeddedId private ModelDatasetMappEntityId id;
|
|
||||||
|
|
||||||
@Column(name = "dataset_type")
|
|
||||||
private String datasetType;
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.entity;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
|
||||||
import jakarta.persistence.Embeddable;
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Objects;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.hibernate.Hibernate;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Embeddable
|
|
||||||
public class ModelDatasetMappEntityId implements Serializable {
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Column(name = "model_uid", nullable = false)
|
|
||||||
private Integer modelUid;
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Column(name = "dataset_uid", nullable = false)
|
|
||||||
private Integer datasetUid;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (this == o) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
ModelDatasetMappEntityId entity = (ModelDatasetMappEntityId) o;
|
|
||||||
return Objects.equals(this.modelUid, entity.modelUid)
|
|
||||||
&& Objects.equals(this.datasetUid, entity.datasetUid);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hash(modelUid, modelUid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.entity;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
|
||||||
import jakarta.persistence.Entity;
|
|
||||||
import jakarta.persistence.Id;
|
|
||||||
import jakarta.persistence.Table;
|
|
||||||
import java.time.ZonedDateTime;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Entity
|
|
||||||
@Table(name = "tb_model_hyper_param")
|
|
||||||
public class ModelHyperParamEntity {
|
|
||||||
@Id
|
|
||||||
@Column(name = "hyper_ver")
|
|
||||||
private String hyperVer;
|
|
||||||
|
|
||||||
@Column(name = "learning_rate")
|
|
||||||
private Double learningRate;
|
|
||||||
|
|
||||||
@Column(name = "batch_size")
|
|
||||||
private Integer batchSize;
|
|
||||||
|
|
||||||
@Column(name = "dropout_ratio")
|
|
||||||
private Double dropoutRatio;
|
|
||||||
|
|
||||||
@Column(name = "cnn_filter_cnt")
|
|
||||||
private Integer cnnFilterCnt;
|
|
||||||
|
|
||||||
@Column(name = "memo", columnDefinition = "TEXT")
|
|
||||||
private String memo;
|
|
||||||
|
|
||||||
@Column(name = "del_yn")
|
|
||||||
private Character delYn;
|
|
||||||
|
|
||||||
@Column(name = "created_dttm")
|
|
||||||
private ZonedDateTime createdDttm;
|
|
||||||
}
|
|
||||||
@@ -12,16 +12,12 @@ import org.hibernate.annotations.ColumnDefault;
|
|||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "tb_model_mng")
|
@Table(name = "tb_model_mng_bak")
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class ModelMngEntity extends CommonDateEntity {
|
public class ModelMngBakEntity extends CommonDateEntity {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tb_model_mng_id_gen")
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@SequenceGenerator(
|
|
||||||
name = "tb_model_mng_id_gen",
|
|
||||||
sequenceName = "tb_model_mng_model_uid",
|
|
||||||
allocationSize = 1)
|
|
||||||
@Column(name = "model_uid", nullable = false)
|
@Column(name = "model_uid", nullable = false)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@@ -52,7 +48,7 @@ public class ModelMngEntity extends CommonDateEntity {
|
|||||||
@Column(name = "bbone_ver")
|
@Column(name = "bbone_ver")
|
||||||
private String bboneVer;
|
private String bboneVer;
|
||||||
|
|
||||||
public ModelMngEntity(
|
public ModelMngBakEntity(
|
||||||
String modelNm,
|
String modelNm,
|
||||||
String modelCate,
|
String modelCate,
|
||||||
String modelPath,
|
String modelPath,
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.entity;
|
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.postgres.CommonDateEntity;
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.time.ZonedDateTime;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Entity
|
|
||||||
@Table(name = "tb_model_train_master")
|
|
||||||
public class ModelTrainMasterEntity extends CommonDateEntity {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
@Column(name = "model_uid", nullable = false)
|
|
||||||
private Integer modelUid;
|
|
||||||
|
|
||||||
@Column(name = "model_ver")
|
|
||||||
private String modelVer;
|
|
||||||
|
|
||||||
@Column(name = "hyper_ver")
|
|
||||||
private String hyperVer;
|
|
||||||
|
|
||||||
@Column(name = "epoch_ver")
|
|
||||||
private String epochVer;
|
|
||||||
|
|
||||||
@Column(name = "process_step")
|
|
||||||
private String processStep;
|
|
||||||
|
|
||||||
@Column(name = "status_cd")
|
|
||||||
private String statsusCd;
|
|
||||||
|
|
||||||
@Column(name = "train_start_dttm")
|
|
||||||
private ZonedDateTime trainStartDttm;
|
|
||||||
|
|
||||||
@Column(name = "epoch_cnt")
|
|
||||||
private Integer epochCnt;
|
|
||||||
|
|
||||||
@Column(name = "dataset_ratio")
|
|
||||||
private String datasetRatio;
|
|
||||||
|
|
||||||
@Column(name = "best_epoch")
|
|
||||||
private Integer bestEpoch;
|
|
||||||
|
|
||||||
@Column(name = "step1_end_dttm")
|
|
||||||
private ZonedDateTime step1EndDttm;
|
|
||||||
|
|
||||||
@Column(name = "step1_duration")
|
|
||||||
private String step1Duration;
|
|
||||||
|
|
||||||
@Column(name = "step2_end_dttm")
|
|
||||||
private ZonedDateTime step2EndDttm;
|
|
||||||
|
|
||||||
@Column(name = "step2_duration")
|
|
||||||
private String step2Duration;
|
|
||||||
|
|
||||||
@Column(name = "del_yn")
|
|
||||||
private Character delYn;
|
|
||||||
|
|
||||||
@Column(name = "created_uid")
|
|
||||||
private Long createdUid;
|
|
||||||
|
|
||||||
@Column(name = "updated_uid")
|
|
||||||
private Long updatedUid;
|
|
||||||
}
|
|
||||||
@@ -3,14 +3,7 @@ package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
|||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Dashboard;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Dashboard;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.SearchGeoReq;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.SearchGeoReq;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.*;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataGeomEntity;
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataEntity;
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataGeomEntity;
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalEntity;
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalSttcEntity;
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.QModelMngEntity;
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.QModelVerEntity;
|
|
||||||
import com.querydsl.core.BooleanBuilder;
|
import com.querydsl.core.BooleanBuilder;
|
||||||
import com.querydsl.core.types.Order;
|
import com.querydsl.core.types.Order;
|
||||||
import com.querydsl.core.types.OrderSpecifier;
|
import com.querydsl.core.types.OrderSpecifier;
|
||||||
@@ -21,9 +14,6 @@ import com.querydsl.jpa.JPAExpressions;
|
|||||||
import com.querydsl.jpa.JPQLQuery;
|
import com.querydsl.jpa.JPQLQuery;
|
||||||
import com.querydsl.jpa.impl.JPAQuery;
|
import com.querydsl.jpa.impl.JPAQuery;
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.PageImpl;
|
import org.springframework.data.domain.PageImpl;
|
||||||
@@ -31,12 +21,16 @@ import org.springframework.data.domain.Pageable;
|
|||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class InferenceResultRepositoryImpl implements InferenceResultRepositoryCustom {
|
public class InferenceResultRepositoryImpl implements InferenceResultRepositoryCustom {
|
||||||
|
|
||||||
private final JPAQueryFactory queryFactory;
|
private final JPAQueryFactory queryFactory;
|
||||||
private final QModelMngEntity tmm = QModelMngEntity.modelMngEntity;
|
private final QModelMngBakEntity tmm = QModelMngBakEntity.modelMngBakEntity;
|
||||||
private final QModelVerEntity tmv = QModelVerEntity.modelVerEntity;
|
private final QModelVerEntity tmv = QModelVerEntity.modelVerEntity;
|
||||||
private final QMapSheetAnalEntity mapSheetAnalEntity = QMapSheetAnalEntity.mapSheetAnalEntity;
|
private final QMapSheetAnalEntity mapSheetAnalEntity = QMapSheetAnalEntity.mapSheetAnalEntity;
|
||||||
private final QMapSheetAnalDataEntity mapSheetAnalDataEntity =
|
private final QMapSheetAnalDataEntity mapSheetAnalDataEntity =
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.model;
|
package com.kamco.cd.kamcoback.postgres.repository.model;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.ModelMngEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.ModelMngBakEntity;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
public interface ModelMngRepository
|
public interface ModelMngRepository
|
||||||
extends JpaRepository<ModelMngEntity, Long>, ModelMngRepositoryCustom {}
|
extends JpaRepository<ModelMngBakEntity, Long>, ModelMngRepositoryCustom {}
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.model;
|
package com.kamco.cd.kamcoback.postgres.repository.model;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.model.dto.ModelMngDto;
|
import com.kamco.cd.kamcoback.model.dto.ModelMngDto;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.ModelMngEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.ModelMngBakEntity;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
|
|
||||||
public interface ModelMngRepositoryCustom {
|
public interface ModelMngRepositoryCustom {
|
||||||
|
|
||||||
List<ModelMngEntity> findModelMngAll();
|
List<ModelMngBakEntity> findModelMngAll();
|
||||||
|
|
||||||
Optional<ModelMngDto.FinalModelDto> getFinalModelInfo();
|
Optional<ModelMngDto.FinalModelDto> getFinalModelInfo();
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.model;
|
package com.kamco.cd.kamcoback.postgres.repository.model;
|
||||||
|
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QModelDeployHstEntity.modelDeployHstEntity;
|
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QModelMngEntity.modelMngEntity;
|
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QModelVerEntity.modelVerEntity;
|
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.model.dto.ModelMngDto;
|
import com.kamco.cd.kamcoback.model.dto.ModelMngDto;
|
||||||
import com.kamco.cd.kamcoback.postgres.QuerydslOrderUtil;
|
import com.kamco.cd.kamcoback.postgres.QuerydslOrderUtil;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.ModelMngEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.ModelMngBakEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.ModelVerEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.ModelVerEntity;
|
||||||
import com.querydsl.core.types.Projections;
|
import com.querydsl.core.types.Projections;
|
||||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||||
@@ -14,16 +10,21 @@ import com.querydsl.core.types.dsl.Expressions;
|
|||||||
import com.querydsl.core.types.dsl.StringExpression;
|
import com.querydsl.core.types.dsl.StringExpression;
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
import io.micrometer.common.util.StringUtils;
|
import io.micrometer.common.util.StringUtils;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.PageImpl;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.PageImpl;
|
import static com.kamco.cd.kamcoback.postgres.entity.QModelDeployHstEntity.modelDeployHstEntity;
|
||||||
import org.springframework.data.domain.Pageable;
|
import static com.kamco.cd.kamcoback.postgres.entity.QModelMngBakEntity.modelMngBakEntity;
|
||||||
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
import static com.kamco.cd.kamcoback.postgres.entity.QModelVerEntity.modelVerEntity;
|
||||||
|
|
||||||
public class ModelMngRepositoryImpl extends QuerydslRepositorySupport
|
public class ModelMngRepositoryImpl extends QuerydslRepositorySupport
|
||||||
implements ModelMngRepositoryCustom {
|
implements ModelMngRepositoryCustom {
|
||||||
@@ -32,13 +33,13 @@ public class ModelMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
private final StringExpression NULL_STRING = Expressions.stringTemplate("cast(null as text)");
|
private final StringExpression NULL_STRING = Expressions.stringTemplate("cast(null as text)");
|
||||||
|
|
||||||
public ModelMngRepositoryImpl(JPAQueryFactory queryFactory) {
|
public ModelMngRepositoryImpl(JPAQueryFactory queryFactory) {
|
||||||
super(ModelMngEntity.class);
|
super(ModelMngBakEntity.class);
|
||||||
this.queryFactory = queryFactory;
|
this.queryFactory = queryFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ModelMngEntity> findModelMngAll() {
|
public List<ModelMngBakEntity> findModelMngAll() {
|
||||||
return queryFactory.selectFrom(modelMngEntity).orderBy(modelMngEntity.id.desc()).fetch();
|
return queryFactory.selectFrom(modelMngBakEntity).orderBy(modelMngBakEntity.id.desc()).fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -47,9 +48,9 @@ public class ModelMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
.select(
|
.select(
|
||||||
Projections.constructor(
|
Projections.constructor(
|
||||||
ModelMngDto.FinalModelDto.class,
|
ModelMngDto.FinalModelDto.class,
|
||||||
modelMngEntity.id.as("modelUid"),
|
modelMngBakEntity.id.as("modelUid"),
|
||||||
modelMngEntity.modelNm,
|
modelMngBakEntity.modelNm,
|
||||||
modelMngEntity.modelCate,
|
modelMngBakEntity.modelCate,
|
||||||
modelVerEntity.id.as("modelVerUid"),
|
modelVerEntity.id.as("modelVerUid"),
|
||||||
modelVerEntity.modelVer,
|
modelVerEntity.modelVer,
|
||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
@@ -60,9 +61,9 @@ public class ModelMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
"fn_codenm_to_misc({0}, {1})", 52, modelVerEntity.deployState), // 배포상태 한글 명칭
|
"fn_codenm_to_misc({0}, {1})", 52, modelVerEntity.deployState), // 배포상태 한글 명칭
|
||||||
modelVerEntity.modelPath))
|
modelVerEntity.modelPath))
|
||||||
.from(modelMngEntity)
|
.from(modelMngBakEntity)
|
||||||
.innerJoin(modelVerEntity)
|
.innerJoin(modelVerEntity)
|
||||||
.on(modelMngEntity.id.eq(modelVerEntity.modelUid))
|
.on(modelMngBakEntity.id.eq(modelVerEntity.modelUid))
|
||||||
.where(modelVerEntity.usedState.eq("USED")) // USED 인 것 중에
|
.where(modelVerEntity.usedState.eq("USED")) // USED 인 것 중에
|
||||||
.orderBy(modelVerEntity.modelVer.desc()) // Version 높은 것 기준
|
.orderBy(modelVerEntity.modelVer.desc()) // Version 높은 것 기준
|
||||||
.stream()
|
.stream()
|
||||||
@@ -79,8 +80,8 @@ public class ModelMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
.select(
|
.select(
|
||||||
Projections.constructor(
|
Projections.constructor(
|
||||||
ModelMngDto.ModelRegHistory.class,
|
ModelMngDto.ModelRegHistory.class,
|
||||||
modelMngEntity.modelNm,
|
modelMngBakEntity.modelNm,
|
||||||
modelMngEntity.modelCate,
|
modelMngBakEntity.modelCate,
|
||||||
modelVerEntity.modelVer,
|
modelVerEntity.modelVer,
|
||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
"to_char({0}, 'YYYY-MM-DD')", modelVerEntity.createdDate)
|
"to_char({0}, 'YYYY-MM-DD')", modelVerEntity.createdDate)
|
||||||
@@ -93,9 +94,9 @@ public class ModelMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
"to_char({0}, 'YYYY-MM-DD')", modelDeployHstEntity.deployDttm)
|
"to_char({0}, 'YYYY-MM-DD')", modelDeployHstEntity.deployDttm)
|
||||||
.as("deployDttm")))
|
.as("deployDttm")))
|
||||||
.from(modelMngEntity)
|
.from(modelMngBakEntity)
|
||||||
.innerJoin(modelVerEntity)
|
.innerJoin(modelVerEntity)
|
||||||
.on(modelMngEntity.id.eq(modelVerEntity.modelUid))
|
.on(modelMngBakEntity.id.eq(modelVerEntity.modelUid))
|
||||||
.leftJoin(modelDeployHstEntity)
|
.leftJoin(modelDeployHstEntity)
|
||||||
.on(
|
.on(
|
||||||
modelVerEntity
|
modelVerEntity
|
||||||
@@ -114,9 +115,9 @@ public class ModelMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
Long countQuery =
|
Long countQuery =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(modelVerEntity.id.count())
|
.select(modelVerEntity.id.count())
|
||||||
.from(modelMngEntity)
|
.from(modelMngBakEntity)
|
||||||
.innerJoin(modelVerEntity)
|
.innerJoin(modelVerEntity)
|
||||||
.on(modelMngEntity.id.eq(modelVerEntity.modelUid))
|
.on(modelMngBakEntity.id.eq(modelVerEntity.modelUid))
|
||||||
.where(eventEndedAtBetween(startDate, endDate), searchModelVerLike(searchVal))
|
.where(eventEndedAtBetween(startDate, endDate), searchModelVerLike(searchVal))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
@@ -129,10 +130,10 @@ public class ModelMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
}
|
}
|
||||||
LocalDateTime startDateTime = startDate.atStartOfDay();
|
LocalDateTime startDateTime = startDate.atStartOfDay();
|
||||||
LocalDateTime endDateTime = endDate.plusDays(1).atStartOfDay();
|
LocalDateTime endDateTime = endDate.plusDays(1).atStartOfDay();
|
||||||
return modelMngEntity
|
return modelMngBakEntity
|
||||||
.createdDate
|
.createdDate
|
||||||
.goe(ZonedDateTime.from(startDateTime))
|
.goe(ZonedDateTime.from(startDateTime))
|
||||||
.and(modelMngEntity.modifiedDate.lt(ZonedDateTime.from(endDateTime)));
|
.and(modelMngBakEntity.modifiedDate.lt(ZonedDateTime.from(endDateTime)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private BooleanExpression searchModelVerLike(String searchVal) {
|
private BooleanExpression searchModelVerLike(String searchVal) {
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.model;
|
package com.kamco.cd.kamcoback.postgres.repository.model;
|
||||||
|
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QModelVerEntity.modelVerEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.ModelMngBakEntity;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.ModelMngEntity;
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.ModelVerEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.ModelVerEntity;
|
||||||
import com.querydsl.core.types.dsl.Expressions;
|
import com.querydsl.core.types.dsl.Expressions;
|
||||||
import com.querydsl.core.types.dsl.StringExpression;
|
import com.querydsl.core.types.dsl.StringExpression;
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
import java.util.Optional;
|
|
||||||
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QModelVerEntity.modelVerEntity;
|
||||||
|
|
||||||
public class ModelVerRepositoryImpl extends QuerydslRepositorySupport
|
public class ModelVerRepositoryImpl extends QuerydslRepositorySupport
|
||||||
implements ModelVerRepositoryCustom {
|
implements ModelVerRepositoryCustom {
|
||||||
|
|
||||||
@@ -17,7 +18,7 @@ public class ModelVerRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
private final StringExpression NULL_STRING = Expressions.stringTemplate("cast(null as text)");
|
private final StringExpression NULL_STRING = Expressions.stringTemplate("cast(null as text)");
|
||||||
|
|
||||||
public ModelVerRepositoryImpl(JPAQueryFactory queryFactory) {
|
public ModelVerRepositoryImpl(JPAQueryFactory queryFactory) {
|
||||||
super(ModelMngEntity.class);
|
super(ModelMngBakEntity.class);
|
||||||
this.queryFactory = queryFactory;
|
this.queryFactory = queryFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user