유저테이블 변경
This commit is contained in:
@@ -57,6 +57,9 @@ dependencies {
|
||||
|
||||
// Apache Commons Compress for archive handling
|
||||
implementation 'org.apache.commons:commons-compress:1.26.0'
|
||||
|
||||
// crypto
|
||||
implementation 'org.springframework.security:spring-security-crypto'
|
||||
}
|
||||
|
||||
tasks.named('test') {
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.kamco.cd.kamcoback.auth;
|
||||
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/auth")
|
||||
public class AuthApiController {
|
||||
|
||||
@PostMapping("/signup")
|
||||
public void signup() {
|
||||
|
||||
}
|
||||
}
|
||||
35
src/main/java/com/kamco/cd/kamcoback/auth/dto/AuthDto.java
Normal file
35
src/main/java/com/kamco/cd/kamcoback/auth/dto/AuthDto.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package com.kamco.cd.kamcoback.auth.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
public class AuthDto {
|
||||
|
||||
@Getter
|
||||
public static class Signup {
|
||||
private String userAuth;
|
||||
private String userNm;
|
||||
private String userId;
|
||||
private String userPw;
|
||||
private String empId;
|
||||
private String userEmail;
|
||||
|
||||
public Signup(
|
||||
String userAuth,
|
||||
String userNm,
|
||||
String userId,
|
||||
String userPw,
|
||||
String empId,
|
||||
String userEmail
|
||||
) {
|
||||
this.userAuth = userAuth;
|
||||
this.userNm = userNm;
|
||||
this.userId = userId;
|
||||
this.userPw = userPw;
|
||||
this.empId = empId;
|
||||
this.userEmail = userEmail;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.kamco.cd.kamcoback.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
|
||||
@Configuration
|
||||
public class PasswordConfig {
|
||||
@Bean
|
||||
public PasswordEncoder passwordEncoder() {
|
||||
// strength 기본값 10, 필요하면 조절 가능
|
||||
return new BCryptPasswordEncoder();
|
||||
}
|
||||
}
|
||||
@@ -22,8 +22,12 @@ public class QuerydslOrderUtil {
|
||||
sort -> {
|
||||
Order order = sort.isAscending() ? Order.ASC : Order.DESC;
|
||||
// PathBuilder.get()는 컬럼명(String)을 동적 Path로 반환
|
||||
return new OrderSpecifier<>(order, entityPath.get(sort.getProperty(), String.class));
|
||||
return new OrderSpecifier<>(order, entityPath.get(sort.getProperty(), Comparable.class));
|
||||
})
|
||||
.toArray(OrderSpecifier[]::new);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,37 +1,81 @@
|
||||
package com.kamco.cd.kamcoback.postgres.entity;
|
||||
|
||||
import com.kamco.cd.kamcoback.postgres.CommonDateEntity;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.SequenceGenerator;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.ZonedDateTime;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "tb_user")
|
||||
public class UserEntity extends CommonDateEntity {
|
||||
public class UserEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "user_uid")
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tb_user_id_gen")
|
||||
@SequenceGenerator(name = "tb_user_id_gen", sequenceName = "tb_user_user_uid_seq", allocationSize = 1)
|
||||
@Column(name = "user_uid", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "user_nm")
|
||||
@Size(max = 255)
|
||||
@NotNull
|
||||
@Column(name = "user_nm", nullable = false)
|
||||
private String userNm;
|
||||
|
||||
@Column(name = "user_id")
|
||||
@Size(max = 255)
|
||||
@NotNull
|
||||
@Column(name = "user_id", nullable = false)
|
||||
private String userId;
|
||||
|
||||
@Column(name = "pswd")
|
||||
private String pswd; // TODO: 암호화
|
||||
@Size(max = 255)
|
||||
@NotNull
|
||||
@Column(name = "user_pw", nullable = false)
|
||||
private String userPw;
|
||||
|
||||
// @Enumerated(EnumType.STRING)
|
||||
private String state; // TODO: 추후 enum -> ACTIVE : 정상, LOCKED : 잠김, EXPIRED : 만료, WITHDRAWAL : 탈퇴
|
||||
@Size(max = 255)
|
||||
@NotNull
|
||||
@ColumnDefault("'ACTIVE'")
|
||||
@Column(name = "state", nullable = false)
|
||||
private String state;
|
||||
|
||||
@Column(name = "date_withdrawal")
|
||||
private ZonedDateTime dateWithdrawal;
|
||||
|
||||
private String userEmail;
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "created_dttm")
|
||||
private ZonedDateTime createdDttm;
|
||||
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "updated_dttm")
|
||||
private ZonedDateTime updatedDttm;
|
||||
|
||||
@Column(name = "created_uid")
|
||||
private Long createdUid;
|
||||
|
||||
@Column(name = "updated_uid")
|
||||
private Long updatedUid;
|
||||
|
||||
@Size(max = 255)
|
||||
@Column(name = "user_email")
|
||||
private String userEmail;
|
||||
|
||||
@Size(max = 20)
|
||||
@NotNull
|
||||
@Column(name = "user_auth", nullable = false, length = 20)
|
||||
private String userAuth;
|
||||
|
||||
@Size(max = 255)
|
||||
@NotNull
|
||||
@Column(name = "emp_id", nullable = false)
|
||||
private String empId;
|
||||
|
||||
}
|
||||
|
||||
@@ -45,7 +45,6 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
public Page<InferenceResultDto.AnalResList> getInferenceResultList(
|
||||
InferenceResultDto.SearchReq searchReq) {
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
|
||||
// "0000" 전체조회
|
||||
BooleanBuilder builder = new BooleanBuilder();
|
||||
if (searchReq.getStatCode() != null && !"0000".equals(searchReq.getStatCode())) {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
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 {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.auth;
|
||||
|
||||
import com.kamco.cd.kamcoback.auth.dto.AuthDto;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.UserEntity;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface AuthRepositoryCustom {
|
||||
Optional<UserEntity> signup(AuthDto.Signup signup);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.auth;
|
||||
|
||||
import com.kamco.cd.kamcoback.auth.dto.AuthDto;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.UserEntity;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import java.util.Optional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class AuthRepositoryImpl implements AuthRepositoryCustom {
|
||||
private final JPAQueryFactory queryFactory;
|
||||
|
||||
@Override
|
||||
public Optional<UserEntity> signup(AuthDto.Signup signup) {
|
||||
// queryFactory.insert()
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
@@ -12,18 +12,15 @@ import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
public class CommonCodeRepositoryImpl extends QuerydslRepositorySupport
|
||||
implements CommonCodeRepositoryCustom {
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class CommonCodeRepositoryImpl implements CommonCodeRepositoryCustom {
|
||||
|
||||
private final JPAQueryFactory queryFactory;
|
||||
|
||||
public CommonCodeRepositoryImpl(JPAQueryFactory queryFactory) {
|
||||
super(CommonCodeEntity.class);
|
||||
this.queryFactory = queryFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<CommonCodeEntity> findByCodeId(Long id) {
|
||||
QCommonCodeEntity child = new QCommonCodeEntity("child");
|
||||
|
||||
Reference in New Issue
Block a user