사용자등록 추가, 추론결과 dashboard 수정
This commit is contained in:
@@ -1,15 +1,55 @@
|
|||||||
package com.kamco.cd.kamcoback.auth;
|
package com.kamco.cd.kamcoback.auth;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.auth.dto.AuthDto;
|
||||||
|
import com.kamco.cd.kamcoback.auth.service.AuthService;
|
||||||
|
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
|
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@Tag(name = "사용자 관리", description = "사용자 관리 API")
|
||||||
@RestController
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
@RequestMapping("/api/auth")
|
@RequestMapping("/api/auth")
|
||||||
public class AuthApiController {
|
public class AuthApiController {
|
||||||
|
|
||||||
@PostMapping("/signup")
|
private final AuthService authService;
|
||||||
public void signup() {
|
|
||||||
|
|
||||||
|
@Operation(summary = "사용자 등록", description = "사용자를 등록 합니다.")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "201",
|
||||||
|
description = "사용자 등록 성공",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = Long.class))),
|
||||||
|
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
@PostMapping("/signup")
|
||||||
|
public ApiResponseDto<Long> signup(
|
||||||
|
@io.swagger.v3.oas.annotations.parameters.RequestBody(
|
||||||
|
description = "사용자 정보",
|
||||||
|
required = true,
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = AuthDto.Signup.class)))
|
||||||
|
@RequestBody
|
||||||
|
@Valid
|
||||||
|
AuthDto.Signup signup) {
|
||||||
|
return ApiResponseDto.createOK(authService.signup(signup));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,29 +1,69 @@
|
|||||||
package com.kamco.cd.kamcoback.auth.dto;
|
package com.kamco.cd.kamcoback.auth.dto;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class AuthDto {
|
public class AuthDto {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public static class Signup {
|
@Setter
|
||||||
|
public static class Basic {
|
||||||
|
|
||||||
private String userAuth;
|
private String userAuth;
|
||||||
private String userNm;
|
private String userNm;
|
||||||
private String userId;
|
private String userId;
|
||||||
private String userPw;
|
|
||||||
private String empId;
|
private String empId;
|
||||||
private String userEmail;
|
private String userEmail;
|
||||||
|
|
||||||
|
public Basic(String userAuth, String userNm, String userId, String empId, String userEmail) {
|
||||||
|
this.userAuth = userAuth;
|
||||||
|
this.userNm = userNm;
|
||||||
|
this.userId = userId;
|
||||||
|
this.empId = empId;
|
||||||
|
this.userEmail = userEmail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Schema(name = "Signup", description = "사용자 등록 정보")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public static class Signup {
|
||||||
|
|
||||||
|
@Schema(description = "구분", example = "관리자/라벨러/검수자 중 하나")
|
||||||
|
@NotBlank
|
||||||
|
private String userAuth;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
@Schema(description = "이름", example = "홍길동")
|
||||||
|
private String userNm;
|
||||||
|
|
||||||
|
@Schema(description = "ID", example = "gildong")
|
||||||
|
@NotBlank
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@Schema(description = "PW", example = "password")
|
||||||
|
@NotBlank
|
||||||
|
private String userPw;
|
||||||
|
|
||||||
|
@Schema(description = "사번", example = "사번")
|
||||||
|
@NotBlank
|
||||||
|
private String empId;
|
||||||
|
|
||||||
|
@Schema(description = "이메일", example = "gildong@naver.com")
|
||||||
|
@NotBlank
|
||||||
|
private String userEmail;
|
||||||
|
|
||||||
public Signup(
|
public Signup(
|
||||||
String userAuth,
|
String userAuth,
|
||||||
String userNm,
|
String userNm,
|
||||||
String userId,
|
String userId,
|
||||||
String userPw,
|
String userPw,
|
||||||
String empId,
|
String empId,
|
||||||
String userEmail
|
String userEmail) {
|
||||||
) {
|
|
||||||
this.userAuth = userAuth;
|
this.userAuth = userAuth;
|
||||||
this.userNm = userNm;
|
this.userNm = userNm;
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
@@ -32,4 +72,10 @@ public class AuthDto {
|
|||||||
this.userEmail = userEmail;
|
this.userEmail = userEmail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public static class User {
|
||||||
|
String userId;
|
||||||
|
String userPw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.kamco.cd.kamcoback.auth.service;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.auth.dto.AuthDto;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.core.AuthCoreService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AuthService {
|
||||||
|
private final AuthCoreService authCoreService;
|
||||||
|
private final PasswordEncoder passwordEncoder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 사용자 등록
|
||||||
|
*
|
||||||
|
* @param signup
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
public Long signup(AuthDto.Signup signup) {
|
||||||
|
signup.setUserPw(passwordEncoder.encode(signup.getUserPw()));
|
||||||
|
return authCoreService.signup(signup);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -290,9 +290,9 @@ public class GlobalExceptionHandler {
|
|||||||
|
|
||||||
String stackTraceStr =
|
String stackTraceStr =
|
||||||
Arrays.stream(stackTrace)
|
Arrays.stream(stackTrace)
|
||||||
.map(StackTraceElement::toString)
|
.map(StackTraceElement::toString)
|
||||||
.collect(Collectors.joining("\n"))
|
.collect(Collectors.joining("\n"))
|
||||||
.substring(0, Math.min(stackTrace.length, 255));
|
.substring(0, Math.min(stackTrace.length, 255));
|
||||||
|
|
||||||
ErrorLogEntity errorLogEntity =
|
ErrorLogEntity errorLogEntity =
|
||||||
new ErrorLogEntity(
|
new ErrorLogEntity(
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ package com.kamco.cd.kamcoback.inference;
|
|||||||
|
|
||||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||||
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.Detail;
|
|
||||||
import com.kamco.cd.kamcoback.inference.service.InferenceResultService;
|
import com.kamco.cd.kamcoback.inference.service.InferenceResultService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
@@ -96,12 +94,7 @@ public class InferenceResultApiController {
|
|||||||
@GetMapping("/detail")
|
@GetMapping("/detail")
|
||||||
public ApiResponseDto<InferenceResultDto.Detail> getInferenceDetail(
|
public ApiResponseDto<InferenceResultDto.Detail> getInferenceDetail(
|
||||||
@Parameter(description = "목록 id", example = "1") @RequestParam Long id) {
|
@Parameter(description = "목록 id", example = "1") @RequestParam Long id) {
|
||||||
// summary
|
return ApiResponseDto.ok(inferenceResultService.getDetail(id));
|
||||||
InferenceResultDto.AnalResSummary summary =
|
|
||||||
inferenceResultService.getInferenceResultSummary(id);
|
|
||||||
// dashBoard
|
|
||||||
List<InferenceResultDto.Dashboard> dashboardList = this.getInferenceResultDashboard(id);
|
|
||||||
return ApiResponseDto.ok(new Detail(summary, dashboardList));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "추론관리 분석결과 상세 목록", description = "추론관리 분석결과 상세 목록 geojson 데이터 조회")
|
@Operation(summary = "추론관리 분석결과 상세 목록", description = "추론관리 분석결과 상세 목록 geojson 데이터 조회")
|
||||||
@@ -139,14 +132,4 @@ public class InferenceResultApiController {
|
|||||||
inferenceResultService.getInferenceResultGeomList(searchGeoReq);
|
inferenceResultService.getInferenceResultGeomList(searchGeoReq);
|
||||||
return ApiResponseDto.ok(geomList);
|
return ApiResponseDto.ok(geomList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 분석결과 상세 대시보드 조회
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private List<Dashboard> getInferenceResultDashboard(Long id) {
|
|
||||||
return inferenceResultService.getInferenceResultBasic(id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -188,10 +188,12 @@ public class InferenceResultDto {
|
|||||||
public static class Detail {
|
public static class Detail {
|
||||||
AnalResSummary summary;
|
AnalResSummary summary;
|
||||||
List<Dashboard> dashboard;
|
List<Dashboard> dashboard;
|
||||||
|
Long totalCnt;
|
||||||
|
|
||||||
public Detail(AnalResSummary summary, List<Dashboard> dashboard) {
|
public Detail(AnalResSummary summary, List<Dashboard> dashboard, Long totalCnt) {
|
||||||
this.summary = summary;
|
this.summary = summary;
|
||||||
this.dashboard = dashboard;
|
this.dashboard = dashboard;
|
||||||
|
this.totalCnt = totalCnt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.kamco.cd.kamcoback.inference.service;
|
|||||||
|
|
||||||
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.Detail;
|
||||||
import com.kamco.cd.kamcoback.postgres.core.InferenceResultCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.InferenceResultCoreService;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -57,4 +58,21 @@ public class InferenceResultService {
|
|||||||
InferenceResultDto.SearchGeoReq searchGeoReq) {
|
InferenceResultDto.SearchGeoReq searchGeoReq) {
|
||||||
return inferenceResultCoreService.getInferenceResultGeomList(searchGeoReq);
|
return inferenceResultCoreService.getInferenceResultGeomList(searchGeoReq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 분석결과 상제 정보 Summary, DashBoard
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Detail getDetail(Long id) {
|
||||||
|
// summary
|
||||||
|
InferenceResultDto.AnalResSummary summary = this.getInferenceResultSummary(id);
|
||||||
|
// 탐지건수 dashBoard
|
||||||
|
List<InferenceResultDto.Dashboard> dashboardList = this.getInferenceResultBasic(id);
|
||||||
|
// 전체 탐지건수
|
||||||
|
Long totalCnt = dashboardList.stream().mapToLong(Dashboard::getClassAfterCnt).sum();
|
||||||
|
|
||||||
|
return new Detail(summary, dashboardList, totalCnt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,12 +22,9 @@ public class QuerydslOrderUtil {
|
|||||||
sort -> {
|
sort -> {
|
||||||
Order order = sort.isAscending() ? Order.ASC : Order.DESC;
|
Order order = sort.isAscending() ? Order.ASC : Order.DESC;
|
||||||
// PathBuilder.get()는 컬럼명(String)을 동적 Path로 반환
|
// 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);
|
.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.log.dto.EventType;
|
||||||
import com.kamco.cd.kamcoback.postgres.CommonCreateEntity;
|
import com.kamco.cd.kamcoback.postgres.CommonCreateEntity;
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import java.time.ZonedDateTime;
|
|
||||||
|
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|||||||
@@ -6,14 +6,13 @@ import com.kamco.cd.kamcoback.postgres.CommonDateEntity;
|
|||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
|
import java.util.Map;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.hibernate.annotations.JdbcTypeCode;
|
import org.hibernate.annotations.JdbcTypeCode;
|
||||||
import org.hibernate.type.SqlTypes;
|
import org.hibernate.type.SqlTypes;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@Entity
|
@Entity
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import jakarta.persistence.GenerationType;
|
|||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
||||||
import jakarta.persistence.SequenceGenerator;
|
import jakarta.persistence.SequenceGenerator;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
|
import jakarta.persistence.UniqueConstraint;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
@@ -17,12 +18,17 @@ import org.hibernate.annotations.ColumnDefault;
|
|||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "tb_user")
|
@Table(
|
||||||
|
name = "tb_user",
|
||||||
|
uniqueConstraints = {@UniqueConstraint(name = "ux_tb_user_user_id", columnNames = "user_id")})
|
||||||
public class UserEntity {
|
public class UserEntity {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tb_user_id_gen")
|
@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)
|
@Column(name = "user_uid", nullable = false)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@@ -77,5 +83,4 @@ public class UserEntity {
|
|||||||
@NotNull
|
@NotNull
|
||||||
@Column(name = "emp_id", nullable = false)
|
@Column(name = "emp_id", nullable = false)
|
||||||
private String empId;
|
private String empId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Page<InferenceResultDto.AnalResList> getInferenceResultList(
|
public Page<InferenceResultDto.AnalResList> getInferenceResultList(
|
||||||
InferenceResultDto.SearchReq searchReq) {
|
InferenceResultDto.SearchReq searchReq) {
|
||||||
Pageable pageable = searchReq.toPageable();
|
Pageable pageable = searchReq.toPageable();
|
||||||
// "0000" 전체조회
|
// "0000" 전체조회
|
||||||
BooleanBuilder builder = new BooleanBuilder();
|
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 com.kamco.cd.kamcoback.postgres.entity.UserEntity;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
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;
|
import java.util.Optional;
|
||||||
|
|
||||||
public interface AuthRepositoryCustom {
|
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;
|
package com.kamco.cd.kamcoback.postgres.repository.auth;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.auth.dto.AuthDto;
|
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.kamco.cd.kamcoback.postgres.entity.UserEntity;
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@@ -11,10 +12,44 @@ import org.springframework.stereotype.Repository;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class AuthRepositoryImpl implements AuthRepositoryCustom {
|
public class AuthRepositoryImpl implements AuthRepositoryCustom {
|
||||||
private final JPAQueryFactory queryFactory;
|
private final JPAQueryFactory queryFactory;
|
||||||
|
private final QUserEntity userEntity = QUserEntity.userEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 사용자 등록
|
||||||
|
*
|
||||||
|
* @param signup
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Optional<UserEntity> signup(AuthDto.Signup signup) {
|
public Long signup(AuthDto.Signup signup) {
|
||||||
// queryFactory.insert()
|
return queryFactory
|
||||||
return Optional.empty();
|
.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,
|
modelMngEntity.modelCate,
|
||||||
modelVerEntity.id.as("modelVerUid"),
|
modelVerEntity.id.as("modelVerUid"),
|
||||||
modelVerEntity.modelVer,
|
modelVerEntity.modelVer,
|
||||||
Expressions.stringTemplate("fn_codenm_to_misc({0}, {1})", 51, modelVerEntity.usedState), //사용여부 한글 명칭
|
Expressions.stringTemplate(
|
||||||
Expressions.stringTemplate("fn_codenm_to_misc({0}, {1})", 51, modelVerEntity.modelState), //모델상태 한글 명칭
|
"fn_codenm_to_misc({0}, {1})", 51, modelVerEntity.usedState), // 사용여부 한글 명칭
|
||||||
|
Expressions.stringTemplate(
|
||||||
|
"fn_codenm_to_misc({0}, {1})", 51, modelVerEntity.modelState), // 모델상태 한글 명칭
|
||||||
modelVerEntity.qualityProb,
|
modelVerEntity.qualityProb,
|
||||||
Expressions.stringTemplate("fn_codenm_to_misc({0}, {1})", 52, modelVerEntity.deployState), //배포상태 한글 명칭
|
Expressions.stringTemplate(
|
||||||
modelVerEntity.modelPath))
|
"fn_codenm_to_misc({0}, {1})", 52, modelVerEntity.deployState), // 배포상태 한글 명칭
|
||||||
|
modelVerEntity.modelPath))
|
||||||
.from(modelMngEntity)
|
.from(modelMngEntity)
|
||||||
.innerJoin(modelVerEntity)
|
.innerJoin(modelVerEntity)
|
||||||
.on(modelMngEntity.id.eq(modelVerEntity.modelUid))
|
.on(modelMngEntity.id.eq(modelVerEntity.modelUid))
|
||||||
@@ -82,9 +85,12 @@ public class ModelMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
"to_char({0}, 'YYYY-MM-DD')", modelVerEntity.createdDate)
|
"to_char({0}, 'YYYY-MM-DD')", modelVerEntity.createdDate)
|
||||||
.as("createdDttm"),
|
.as("createdDttm"),
|
||||||
Expressions.stringTemplate("fn_codenm_to_misc({0}, {1})", 51, modelVerEntity.usedState), //사용여부 한글 명칭
|
Expressions.stringTemplate(
|
||||||
Expressions.stringTemplate("fn_codenm_to_misc({0}, {1})", 52, modelVerEntity.deployState), //배포상태 한글 명칭
|
"fn_codenm_to_misc({0}, {1})", 51, modelVerEntity.usedState), // 사용여부 한글 명칭
|
||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
|
"fn_codenm_to_misc({0}, {1})",
|
||||||
|
52, modelVerEntity.deployState), // 배포상태 한글 명칭
|
||||||
|
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(modelMngEntity)
|
||||||
|
|||||||
Reference in New Issue
Block a user