사용자등록 추가, 추론결과 dashboard 수정
This commit is contained in:
@@ -22,12 +22,9 @@ public class QuerydslOrderUtil {
|
||||
sort -> {
|
||||
Order order = sort.isAscending() ? Order.ASC : Order.DESC;
|
||||
// PathBuilder.get()는 컬럼명(String)을 동적 Path로 반환
|
||||
return new OrderSpecifier<>(order, entityPath.get(sort.getProperty(), Comparable.class));
|
||||
return new OrderSpecifier<>(
|
||||
order, entityPath.get(sort.getProperty(), Comparable.class));
|
||||
})
|
||||
.toArray(OrderSpecifier[]::new);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.kamco.cd.kamcoback.postgres.core;
|
||||
|
||||
import com.kamco.cd.kamcoback.auth.dto.AuthDto;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.auth.AuthRepository;
|
||||
import jakarta.persistence.EntityNotFoundException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AuthCoreService {
|
||||
private final AuthRepository authRepository;
|
||||
|
||||
/**
|
||||
* 사용자 등록
|
||||
*
|
||||
* @param signup
|
||||
* @return
|
||||
*/
|
||||
public Long signup(AuthDto.Signup signup) {
|
||||
if (authRepository.findByUserId(signup.getUserId()).isPresent()) {
|
||||
new EntityNotFoundException("중복된 아이디가 있습니다. " + signup.getUserId());
|
||||
}
|
||||
return authRepository.signup(signup);
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,8 @@ import com.kamco.cd.kamcoback.log.dto.ErrorLogDto;
|
||||
import com.kamco.cd.kamcoback.log.dto.EventType;
|
||||
import com.kamco.cd.kamcoback.postgres.CommonCreateEntity;
|
||||
import jakarta.persistence.*;
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.ZonedDateTime;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@@ -6,14 +6,13 @@ import com.kamco.cd.kamcoback.postgres.CommonDateEntity;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.util.Map;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.JdbcTypeCode;
|
||||
import org.hibernate.type.SqlTypes;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
|
||||
@@ -7,6 +7,7 @@ import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.SequenceGenerator;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.persistence.UniqueConstraint;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.ZonedDateTime;
|
||||
@@ -17,12 +18,17 @@ import org.hibernate.annotations.ColumnDefault;
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "tb_user")
|
||||
@Table(
|
||||
name = "tb_user",
|
||||
uniqueConstraints = {@UniqueConstraint(name = "ux_tb_user_user_id", columnNames = "user_id")})
|
||||
public class UserEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tb_user_id_gen")
|
||||
@SequenceGenerator(name = "tb_user_id_gen", sequenceName = "tb_user_user_uid_seq", allocationSize = 1)
|
||||
@SequenceGenerator(
|
||||
name = "tb_user_id_gen",
|
||||
sequenceName = "tb_user_user_uid_seq",
|
||||
allocationSize = 1)
|
||||
@Column(name = "user_uid", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@@ -77,5 +83,4 @@ public class UserEntity {
|
||||
@NotNull
|
||||
@Column(name = "emp_id", nullable = false)
|
||||
private String empId;
|
||||
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
*/
|
||||
@Override
|
||||
public Page<InferenceResultDto.AnalResList> getInferenceResultList(
|
||||
InferenceResultDto.SearchReq searchReq) {
|
||||
InferenceResultDto.SearchReq searchReq) {
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
// "0000" 전체조회
|
||||
BooleanBuilder builder = new BooleanBuilder();
|
||||
|
||||
@@ -3,6 +3,4 @@ package com.kamco.cd.kamcoback.postgres.repository.auth;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.UserEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface AuthRepository extends JpaRepository<UserEntity, Long>, AuthRepositoryCustom {
|
||||
|
||||
}
|
||||
public interface AuthRepository extends JpaRepository<UserEntity, Long>, AuthRepositoryCustom {}
|
||||
|
||||
@@ -5,5 +5,7 @@ import com.kamco.cd.kamcoback.postgres.entity.UserEntity;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface AuthRepositoryCustom {
|
||||
Optional<UserEntity> signup(AuthDto.Signup signup);
|
||||
Long signup(AuthDto.Signup signup);
|
||||
|
||||
Optional<UserEntity> findByUserId(String userId);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.auth;
|
||||
|
||||
import com.kamco.cd.kamcoback.auth.dto.AuthDto;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QUserEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.UserEntity;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import java.util.Optional;
|
||||
@@ -11,10 +12,44 @@ import org.springframework.stereotype.Repository;
|
||||
@RequiredArgsConstructor
|
||||
public class AuthRepositoryImpl implements AuthRepositoryCustom {
|
||||
private final JPAQueryFactory queryFactory;
|
||||
private final QUserEntity userEntity = QUserEntity.userEntity;
|
||||
|
||||
/**
|
||||
* 사용자 등록
|
||||
*
|
||||
* @param signup
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Optional<UserEntity> signup(AuthDto.Signup signup) {
|
||||
// queryFactory.insert()
|
||||
return Optional.empty();
|
||||
public Long signup(AuthDto.Signup signup) {
|
||||
return queryFactory
|
||||
.insert(userEntity)
|
||||
.columns(
|
||||
userEntity.userAuth,
|
||||
userEntity.userId,
|
||||
userEntity.userNm,
|
||||
userEntity.userPw,
|
||||
userEntity.userEmail,
|
||||
userEntity.empId)
|
||||
.values(
|
||||
signup.getUserAuth(),
|
||||
signup.getUserId(),
|
||||
signup.getUserNm(),
|
||||
signup.getUserPw(),
|
||||
signup.getUserEmail(),
|
||||
signup.getEmpId())
|
||||
.execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* 유저 아이디 조회
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Optional<UserEntity> findByUserId(String userId) {
|
||||
return Optional.ofNullable(
|
||||
queryFactory.selectFrom(userEntity).where(userEntity.userId.eq(userId)).fetchOne());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,11 +52,14 @@ public class ModelMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
modelMngEntity.modelCate,
|
||||
modelVerEntity.id.as("modelVerUid"),
|
||||
modelVerEntity.modelVer,
|
||||
Expressions.stringTemplate("fn_codenm_to_misc({0}, {1})", 51, modelVerEntity.usedState), //사용여부 한글 명칭
|
||||
Expressions.stringTemplate("fn_codenm_to_misc({0}, {1})", 51, modelVerEntity.modelState), //모델상태 한글 명칭
|
||||
Expressions.stringTemplate(
|
||||
"fn_codenm_to_misc({0}, {1})", 51, modelVerEntity.usedState), // 사용여부 한글 명칭
|
||||
Expressions.stringTemplate(
|
||||
"fn_codenm_to_misc({0}, {1})", 51, modelVerEntity.modelState), // 모델상태 한글 명칭
|
||||
modelVerEntity.qualityProb,
|
||||
Expressions.stringTemplate("fn_codenm_to_misc({0}, {1})", 52, modelVerEntity.deployState), //배포상태 한글 명칭
|
||||
modelVerEntity.modelPath))
|
||||
Expressions.stringTemplate(
|
||||
"fn_codenm_to_misc({0}, {1})", 52, modelVerEntity.deployState), // 배포상태 한글 명칭
|
||||
modelVerEntity.modelPath))
|
||||
.from(modelMngEntity)
|
||||
.innerJoin(modelVerEntity)
|
||||
.on(modelMngEntity.id.eq(modelVerEntity.modelUid))
|
||||
@@ -82,9 +85,12 @@ public class ModelMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
Expressions.stringTemplate(
|
||||
"to_char({0}, 'YYYY-MM-DD')", modelVerEntity.createdDate)
|
||||
.as("createdDttm"),
|
||||
Expressions.stringTemplate("fn_codenm_to_misc({0}, {1})", 51, modelVerEntity.usedState), //사용여부 한글 명칭
|
||||
Expressions.stringTemplate("fn_codenm_to_misc({0}, {1})", 52, modelVerEntity.deployState), //배포상태 한글 명칭
|
||||
Expressions.stringTemplate(
|
||||
Expressions.stringTemplate(
|
||||
"fn_codenm_to_misc({0}, {1})", 51, modelVerEntity.usedState), // 사용여부 한글 명칭
|
||||
Expressions.stringTemplate(
|
||||
"fn_codenm_to_misc({0}, {1})",
|
||||
52, modelVerEntity.deployState), // 배포상태 한글 명칭
|
||||
Expressions.stringTemplate(
|
||||
"to_char({0}, 'YYYY-MM-DD')", modelDeployHstEntity.deployDttm)
|
||||
.as("deployDttm")))
|
||||
.from(modelMngEntity)
|
||||
|
||||
Reference in New Issue
Block a user