251121_01_ENH: 최초 기능 구현(로그인)

This commit is contained in:
2025-11-21 15:37:05 +09:00
commit bff9747d52
51 changed files with 2223 additions and 0 deletions

3
.gitattributes vendored Normal file
View File

@@ -0,0 +1,3 @@
/gradlew text eol=lf
*.bat text eol=crlf
*.jar binary

37
.gitignore vendored Normal file
View File

@@ -0,0 +1,37 @@
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/

10
application-dev.yml Normal file
View File

@@ -0,0 +1,10 @@
kri:
api-url:
intranet-extension: "http://localhost:3031"
spring:
datasource:
url: jdbc:mysql://db-md87m-kr.vpc-pub-cdb.ntruss.com:3306/test_kri_contact?serverTimezone=UTC&characterEncoding=UTF-8
username: kri_contact
password: contact#51304
driver-class-name: com.mysql.cj.jdbc.Driver

25
application-local.yml Normal file
View File

@@ -0,0 +1,25 @@
kri:
api-url:
intranet-extension: "http://localhost:3031"
spring:
datasource:
url: jdbc:mysql://db-md87m-kr.vpc-pub-cdb.ntruss.com:3306/test_kri_contact?serverTimezone=UTC&characterEncoding=UTF-8
username: kri_contact
password: contact#51304
driver-class-name: com.mysql.cj.jdbc.Driver
jpa:
hibernate:
ddl-auto: none # 필요에 따라 update / validate 등으로 변경
properties:
hibernate:
dialect: org.hibernate.dialect.MySQL8Dialect
format_sql: true
show_sql: true
open-in-view: false
logging:
level:
org.hibernate.SQL: debug
org.hibernate.type.descriptor.sql.BasicBinder: trace

10
application-prod.yml Normal file
View File

@@ -0,0 +1,10 @@
kri:
api-url:
intranet-extension: "http://localhost:3031"
spring:
datasource:
url: jdbc:mysql://db-md87m-kr.vpc-pub-cdb.ntruss.com:3306/test_kri_contact?serverTimezone=UTC&characterEncoding=UTF-8
username: kri_contact
password: contact#51304
driver-class-name: com.mysql.cj.jdbc.Driver

47
application.yml Normal file
View File

@@ -0,0 +1,47 @@
server:
port: 4001
spring:
application:
name: KriContact
profiles:
# 아무 설정 없을 때 기본으로 쓸 프로파일
default: local
logging:
file:
path: ./logs
kri:
auth:
apikey:
enabled: true # API Key 인증 사용 여부
header-name: "X-API-Key" # API Key 헤더
key: "4B726963-436F6E74616374-53657276696365-402531213230"
security:
enabled: true
public-paths: # 인증 없이 열어둘 URL
- /v3/api-docs/**
- /swagger-ui.html
- /swagger-ui/**
- /ping
- /api/v1/auth/login
swagger:
enabled: true
title: "KRI Contact API"
description: "KRI 컨택 API"
version: "v1.0.0"
base-package: "com.kri.contact.server"
common:
web:
enabled: true # 공통 Web 구성 사용 여부 (기본 true)
webmvc:
enabled: true # 공통 Webmvc 구성 사용 여부 (기본 true)
redis:
enabled: false # RedisQueueHelper 사용 시 true
scheduling:
enabled: false # @Scheduled 사용 시 true

91
build.gradle Normal file
View File

@@ -0,0 +1,91 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.5.7'
id 'io.spring.dependency-management' version '1.1.7'
}
group = 'com.kri.contact'
version = '0.0.1-SNAPSHOT'
description = 'contact-server'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
def giteaUser = findProperty("giteaUser") ?: ""
def giteaToken = findProperty("giteaToken") ?: ""
repositories {
mavenCentral()
maven {
name = "gitea"
url = uri("https://gitea.kric.com/api/packages/KRi/maven")
//allowInsecureProtocol = true
credentials {
username = giteaUser
password = giteaToken
}
}
}
dependencies {
implementation "com.kri.common:starter:1.0.21"
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation "org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.11"
//JPA
implementation "org.springframework.boot:spring-boot-starter-data-jpa"
//MySQL
runtimeOnly "com.mysql:mysql-connector-j"
// QueryDSL JPA
implementation "com.querydsl:querydsl-jpa:5.0.0:jakarta"
// QClass 생성용 annotationProcessor
annotationProcessor "com.querydsl:querydsl-apt:5.0.0:jakarta"
annotationProcessor "jakarta.annotation:jakarta.annotation-api"
annotationProcessor "jakarta.persistence:jakarta.persistence-api"
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter-test:3.0.5'
testImplementation 'org.springframework.security:spring-security-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
// === QueryDSL Q클래스 생성 위치 설정 ===
def querydslDir = layout.buildDirectory.dir("generated/querydsl").get().asFile
sourceSets {
// Q클래스가 있는 디렉토리를 main 소스에 추가
main.java.srcDirs += [ querydslDir ]
}
tasks.withType(JavaCompile).configureEach {
options.generatedSourceOutputDirectory.set(file(querydslDir))
}
tasks.named('test') {
useJUnitPlatform()
}
tasks.named('clean') {
doLast {
delete querydslDir
}
}

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

251
gradlew vendored Normal file
View File

@@ -0,0 +1,251 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

94
gradlew.bat vendored Normal file
View File

@@ -0,0 +1,94 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

1
settings.gradle Normal file
View File

@@ -0,0 +1 @@
rootProject.name = 'server'

View File

@@ -0,0 +1,13 @@
package com.kri.contact.server;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ContactServerApplication {
public static void main(String[] args) {
SpringApplication.run(ContactServerApplication.class, args);
}
}

View File

@@ -0,0 +1,24 @@
package com.kri.contact.server.api.auth;
import com.kri.contact.server.api.auth.request.LoginRequestDto;
import com.kri.contact.server.api.auth.response.LoginResponseDto;
import com.kri.contact.server.application.AuthService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
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.RestController;
@RestController
@RequestMapping("/api/v1/auth")
@RequiredArgsConstructor
@Tag(name = "Auth", description = "인증 API")
public class AuthController {
private final AuthService authService;
@PostMapping("/login")
public LoginResponseDto tryLogin(@RequestBody LoginRequestDto request){
return authService.tryLogin(request);
}
}

View File

@@ -0,0 +1,11 @@
package com.kri.contact.server.api.auth.request;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class LoginRequestDto {
private String userId;
private String userPw;
}

View File

@@ -0,0 +1,20 @@
package com.kri.contact.server.api.auth.response;
import com.kri.common.auth.jwt.JwtUserClaimsDto;
import com.kri.contact.server.persistence.entity.TUserEntity;
import lombok.Builder;
import lombok.Getter;
@Getter
@Builder
public class LoginResponseDto {
private String accessToken;
private JwtUserClaimsDto user;
public static LoginResponseDto from(String accessToken, JwtUserClaimsDto jwtUserClaims){
return LoginResponseDto.builder()
.accessToken(accessToken)
.user(jwtUserClaims)
.build();
}
}

View File

@@ -0,0 +1,52 @@
package com.kri.contact.server.application;
import com.kri.common.auth.jwt.JwtService;
import com.kri.common.auth.jwt.JwtUserClaimsDto;
import com.kri.common.web.BusinessException;
import com.kri.contact.server.api.auth.request.LoginRequestDto;
import com.kri.contact.server.api.auth.response.LoginResponseDto;
import com.kri.contact.server.common.external.intranet.IntranetExtensionApiClient;
import com.kri.contact.server.common.external.intranet.response.SearchLoginInfoResponseDto;
import com.kri.contact.server.persistence.entity.TUserEntity;
import com.kri.contact.server.persistence.repository.UserRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class AuthService {
private final JwtService jwtService;
private final IntranetExtensionApiClient intranetExtensionApiClient;
private final UserRepository userRepository;
public LoginResponseDto tryLogin(LoginRequestDto request){
SearchLoginInfoResponseDto loginInfoResponse = intranetExtensionApiClient.searchLoginInfo(request);
JwtUserClaimsDto claims;
if(loginInfoResponse != null){
claims = JwtUserClaimsDto.builder()
.userId(loginInfoResponse.getUserId())
.userName(loginInfoResponse.getUserNm())
.userTeam(loginInfoResponse.getUserTeam())
.userRole(loginInfoResponse.getUserRole())
.build();
}
else{
TUserEntity user = userRepository.findByUserIdAndUserPw(request.getUserId(), request.getUserPw());
if(user == null){
throw BusinessException.forbidden("USER_NOT_FOUND", "사용자가 없습니다.")
.with("userId", request.getUserId());
}
claims = JwtUserClaimsDto.builder()
.userId(user.getUserId())
.userName(user.getUserNm())
.userTeam(user.getUserTeam())
.userRole(user.getUserRole())
.build();
}
String accessToken = jwtService.generateAccessToken(claims);
return LoginResponseDto.from(accessToken, claims);
}
}

View File

@@ -0,0 +1,21 @@
package com.kri.contact.server.common.enums;
import com.kri.common.enums.CodeEnum;
public enum ResultCodeType implements CodeEnum<Short> {
CONTACT((short) 0), // 컨택 결과코드
INTERVIEW((short) 1), // 면접 결과코드
SURVEY((short) 2); // 설문 결과코드
private final short code;
ResultCodeType(short code) {
this.code = code;
}
@Override
public Short getCode() {
return code;
}
}

View File

@@ -0,0 +1,53 @@
package com.kri.contact.server.common.external.intranet;
import com.kri.common.http.ExternalApiClient;
import com.kri.contact.server.api.auth.request.LoginRequestDto;
import com.kri.contact.server.api.auth.response.LoginResponseDto;
import com.kri.contact.server.common.external.intranet.response.SearchLoginInfoResponseDto;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.util.HashMap;
import java.util.Map;
import com.kri.common.http.ExternalApiResponse;
/**
* 공통 모듈로 분리하기 위한 외부(Intranet-Extension) 인증 API 클라이언트.
* 현재 프로젝트 내에 두되, 이후 common 리포지토리로 이동이 용이하도록
* contact-server 의 도메인(Service) 코드와 분리한다.
*/
@Component
@RequiredArgsConstructor
public class IntranetExtensionApiClient {
@Value("${kri.api-url.intranet-extension}")
private String intranetExtensionBaseUrl;
@Value("${kri.auth.apikey.header-name:X-API-Key}")
private String apiKeyHeaderName;
@Value("${kri.auth.apikey.key}")
private String apiKey;
// ExternalApiClient 를 직접 생성해 사용 (starter에서 Bean 미제공 시 대비)
private final ExternalApiClient externalApiClient = new ExternalApiClient();
private final ObjectMapper objectMapper = new ObjectMapper();
public SearchLoginInfoResponseDto searchLoginInfo(LoginRequestDto request) {
String url = String.format("%s/api/v1/user/search/login-info", intranetExtensionBaseUrl);
// 요구사항: ExternalApiClient.post() 사용 (시그니처: post(url, headers, body))
Map<String, String> headers = new HashMap<>();
headers.put(apiKeyHeaderName, apiKey);
try {
String body = objectMapper.writeValueAsString(request);
ExternalApiResponse response = externalApiClient.post(url, headers, body);
String test = response.getBody();
return objectMapper.readValue(response.getBody(), SearchLoginInfoResponseDto.class);
} catch (JsonProcessingException e) {
return null;
}
}
}

View File

@@ -0,0 +1,26 @@
package com.kri.contact.server.common.external.intranet.response;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
@Getter
@Builder
@NoArgsConstructor // Jackson이 빈 객체를 생성할 수 있도록 추가
@AllArgsConstructor // Builder 패턴 사용 시 필요
@Schema(description = "인트라넷 사용자 검색 응답 DTO")
public class SearchLoginInfoResponseDto {
@Schema(description = "사용자 ID (p_user_mail)")
private String userId; // final 제거
@Schema(description = "사용자 이름 (p_name)")
private String userNm; // final 제거
@Schema(description = "사용자 팀 (p_depart_now + p_team_now)")
private String userTeam; // final 제거
@Schema(description = "사용자 역할")
private int userRole; // final 제거
}

View File

@@ -0,0 +1,14 @@
package com.kri.contact.server.common.jpa;
import com.kri.common.jpa.AbstractCodeEnumConverter;
import com.kri.contact.server.common.enums.ResultCodeType;
import jakarta.persistence.Converter;
@Converter(autoApply = false)
public class ResultCodeTypeConverter
extends AbstractCodeEnumConverter<ResultCodeType, Short> {
public ResultCodeTypeConverter() {
super(ResultCodeType.class);
}
}

View File

@@ -0,0 +1,19 @@
package com.kri.contact.server.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import lombok.RequiredArgsConstructor;
import jakarta.persistence.EntityManager;
import com.querydsl.jpa.impl.JPAQueryFactory;
@Configuration
@RequiredArgsConstructor
public class QueryDSLConfig {
private final EntityManager entityManager;
@Bean
public JPAQueryFactory jpaQueryFactory() {
return new JPAQueryFactory(entityManager);
}
}

View File

@@ -0,0 +1,26 @@
package com.kri.contact.server.persistence.entity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@Entity
@Table(name = "t_event_ty_dic")
public class TEventTyDicEntity {
@Id
@Column(name = "event_ty", nullable = false)
private Short eventTy;
@Size(max = 64)
@NotNull
@Column(name = "event_ty_nm", nullable = false, length = 64)
private String eventTyNm;
}

View File

@@ -0,0 +1,43 @@
package com.kri.contact.server.persistence.entity;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
@Getter
@Setter
@Entity
@Table(name = "t_func")
public class TFuncEntity {
@Id
@NotNull
@Column(name = "func_cd")
private Integer funcCd;
@Size(max = 32)
@NotNull
@Column(name = "func_nm", nullable = false, length = 32)
private String funcNm;
@NotNull
@ColumnDefault("1")
@Column(name = "is_menu", nullable = false)
private Boolean isMenu = false;
@NotNull
@Column(name = "depth", nullable = false)
private Integer depth;
@NotNull
@Column(name = "parent", nullable = false)
private Integer parent;
@NotNull
@Lob
@Column(name = "func_memo", nullable = false)
private String funcMemo;
}

View File

@@ -0,0 +1,52 @@
package com.kri.contact.server.persistence.entity;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import java.time.Instant;
@Getter
@Setter
@Entity
@Table(name = "t_list_assign")
public class TListAssignEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "list_assign_idx", nullable = false)
private Long listAssignIdx;
@Column(name = "prjct_idx", columnDefinition = "int UNSIGNED not null")
private Long prjctIdx;
@NotNull
@Column(name = "sid", nullable = false)
private Integer sid;
@NotNull
@Column(name = "assign_ty", nullable = false)
private Short assignTy;
@Size(max = 32)
@Column(name = "user_id", length = 32)
private String userId;
@Size(max = 32)
@Column(name = "reg_user", length = 32)
private String regUser;
@ColumnDefault("CURRENT_TIMESTAMP")
@Column(name = "reg_dt")
private Instant regDt;
@Size(max = 32)
@Column(name = "exc_user", length = 32)
private String excUser;
@Column(name = "exc_dt")
private Instant excDt;
}

View File

@@ -0,0 +1,57 @@
package com.kri.contact.server.persistence.entity;
import jakarta.persistence.Column;
import jakarta.persistence.EmbeddedId;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import java.time.Instant;
@Getter
@Setter
@Entity
@Table(name = "t_list")
public class TListEntity {
@EmbeddedId
private TListEntityId id;
@NotNull
@Column(name = "is_use", nullable = false)
private Short isUse;
@Size(max = 2048)
@Column(name = "memo", length = 2048)
private String memo;
@Size(max = 32)
@NotNull
@Column(name = "reg_user", nullable = false, length = 32)
private String regUser;
@NotNull
@ColumnDefault("CURRENT_TIMESTAMP")
@Column(name = "reg_dt", nullable = false)
private Instant regDt;
@Size(max = 32)
@NotNull
@Column(name = "mod_user", nullable = false, length = 32)
private String modUser;
@NotNull
@Column(name = "mod_dt", nullable = false)
private Instant modDt;
public Long getPrjctIdx(){
return id.getPrjctIdx();
}
public Integer getSid(){
return id.getSid();
}
}

View File

@@ -0,0 +1,39 @@
package com.kri.contact.server.persistence.entity;
import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.Hibernate;
import java.io.Serializable;
import java.util.Objects;
@Getter
@Setter
@Embeddable
public class TListEntityId implements Serializable {
private static final long serialVersionUID = 7012247084434778447L;
@Column(name = "prjct_idx", columnDefinition = "int UNSIGNED not null")
private Long prjctIdx;
@NotNull
@Column(name = "sid", nullable = false)
private Integer sid;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
TListEntityId entity = (TListEntityId) o;
return Objects.equals(this.prjctIdx, entity.prjctIdx) &&
Objects.equals(this.sid, entity.sid);
}
@Override
public int hashCode() {
return Objects.hash(prjctIdx, sid);
}
}

View File

@@ -0,0 +1,48 @@
package com.kri.contact.server.persistence.entity;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import java.time.Instant;
@Getter
@Setter
@Entity
@Table(name = "t_list_event_hist")
public class TListEventHistEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "list_event_hist_idx", nullable = false)
private Long listEventHistIdx;
@Column(name = "prjct_idx", columnDefinition = "int UNSIGNED not null")
private Long prjctIdx;
@NotNull
@Column(name = "sid", nullable = false)
private Integer sid;
@NotNull
@Column(name = "result_cd", nullable = false)
private Integer resultCd;
@NotNull
@Lob
@Column(name = "contact_memo", nullable = false)
private String contactMemo;
@Size(max = 32)
@NotNull
@Column(name = "reg_user", nullable = false, length = 32)
private String regUser;
@NotNull
@ColumnDefault("CURRENT_TIMESTAMP")
@Column(name = "reg_dt", nullable = false)
private Instant regDt;
}

View File

@@ -0,0 +1,78 @@
package com.kri.contact.server.persistence.entity;
import jakarta.persistence.Column;
import jakarta.persistence.EmbeddedId;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import java.time.Instant;
@Getter
@Setter
@Entity
@Table(name = "t_list_header")
public class TListHeaderEntity {
@EmbeddedId
private TListHeaderEntityId id;
@NotNull
@Column(name = "list_hder_grad", nullable = false)
private Short listHderGrad;
@Size(max = 32)
@NotNull
@Column(name = "list_hder_nm", nullable = false, length = 32)
private String listHderNm;
@NotNull
@Column(name = "list_hder_ty", nullable = false)
private Short listHderTy;
@NotNull
@Column(name = "use_filter", nullable = false)
private Boolean useFilter = false;
@NotNull
@Column(name = "use_view", nullable = false)
private Boolean useView = false;
@NotNull
@Column(name = "use_intrvwer_view", nullable = false)
private Boolean useIntrvwerView = false;
@NotNull
@Column(name = "use_intrvwer_edit", nullable = false)
private Boolean useIntrvwerEdit = false;
@Size(max = 32)
@NotNull
@Column(name = "reg_user", nullable = false, length = 32)
private String regUser;
@NotNull
@ColumnDefault("CURRENT_TIMESTAMP")
@Column(name = "reg_dt", nullable = false)
private Instant regDt;
@Size(max = 32)
@NotNull
@Column(name = "mod_user", nullable = false, length = 32)
private String modUser;
@NotNull
@Column(name = "mod_dt", nullable = false)
private Instant modDt;
public Long getPrjctIdx(){
return id.getPrjctIdx();
}
public Integer getListHderId(){
return id.getListHderId();
}
}

View File

@@ -0,0 +1,39 @@
package com.kri.contact.server.persistence.entity;
import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.Hibernate;
import java.io.Serializable;
import java.util.Objects;
@Getter
@Setter
@Embeddable
public class TListHeaderEntityId implements Serializable {
private static final long serialVersionUID = -1296812261527497087L;
@Column(name = "prjct_idx", columnDefinition = "int UNSIGNED not null")
private Long prjctIdx;
@NotNull
@Column(name = "list_hder_id", nullable = false)
private Integer listHderId;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
TListHeaderEntityId entity = (TListHeaderEntityId) o;
return Objects.equals(this.prjctIdx, entity.prjctIdx) &&
Objects.equals(this.listHderId, entity.listHderId);
}
@Override
public int hashCode() {
return Objects.hash(prjctIdx, listHderId);
}
}

View File

@@ -0,0 +1,55 @@
package com.kri.contact.server.persistence.entity;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import java.time.Instant;
@Getter
@Setter
@Entity
@Table(name = "t_list_item")
public class TListItemEntity {
@EmbeddedId
private TListItemEntityId id;
@NotNull
@Lob
@Column(name = "list_item_val", nullable = false)
private String listItemVal;
@Size(max = 32)
@NotNull
@Column(name = "reg_user", nullable = false, length = 32)
private String regUser;
@NotNull
@ColumnDefault("CURRENT_TIMESTAMP")
@Column(name = "reg_dt", nullable = false)
private Instant regDt;
@Size(max = 32)
@NotNull
@Column(name = "mod_user", nullable = false, length = 32)
private String modUser;
@NotNull
@Column(name = "mod_dt", nullable = false)
private Instant modDt;
public Long getPrjctIdx(){
return id.getPrjctIdx();
}
public Integer getSid(){
return id.getSid();
}
public Integer getListHderId(){
return id.getListHderId();
}
}

View File

@@ -0,0 +1,44 @@
package com.kri.contact.server.persistence.entity;
import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.Hibernate;
import java.io.Serializable;
import java.util.Objects;
@Getter
@Setter
@Embeddable
public class TListItemEntityId implements Serializable {
private static final long serialVersionUID = -3478285652359764540L;
@Column(name = "prjct_idx", columnDefinition = "int UNSIGNED not null")
private Long prjctIdx;
@NotNull
@Column(name = "sid", nullable = false)
private Integer sid;
@NotNull
@Column(name = "list_hder_id", nullable = false)
private Integer listHderId;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
TListItemEntityId entity = (TListItemEntityId) o;
return Objects.equals(this.prjctIdx, entity.prjctIdx) &&
Objects.equals(this.listHderId, entity.listHderId) &&
Objects.equals(this.sid, entity.sid);
}
@Override
public int hashCode() {
return Objects.hash(prjctIdx, listHderId, sid);
}
}

View File

@@ -0,0 +1,64 @@
package com.kri.contact.server.persistence.entity;
import jakarta.persistence.Column;
import jakarta.persistence.EmbeddedId;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import java.time.Instant;
@Getter
@Setter
@Entity
@Table(name = "t_list_item_upload")
public class TListItemUploadEntity {
@EmbeddedId
private TListItemUploadEntityId id;
@Size(max = 128)
@Column(name = "file_nm", length = 128)
private String fileNm;
@Column(name = "file_size")
private Integer fileSize;
@Size(max = 128)
@Column(name = "file_path", length = 128)
private String filePath;
@Size(max = 32)
@NotNull
@Column(name = "reg_user", nullable = false, length = 32)
private String regUser;
@NotNull
@ColumnDefault("CURRENT_TIMESTAMP")
@Column(name = "reg_dt", nullable = false)
private Instant regDt;
@Size(max = 32)
@NotNull
@Column(name = "mod_user", nullable = false, length = 32)
private String modUser;
@NotNull
@Column(name = "mod_dt", nullable = false)
private Instant modDt;
public Long getPrjctIdx(){
return id.getPrjctIdx();
}
public Integer getSid(){
return id.getSid();
}
public Integer getListHderId(){
return id.getListHderId();
}
}

View File

@@ -0,0 +1,44 @@
package com.kri.contact.server.persistence.entity;
import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.Hibernate;
import java.io.Serializable;
import java.util.Objects;
@Getter
@Setter
@Embeddable
public class TListItemUploadEntityId implements Serializable {
private static final long serialVersionUID = -8073832649114843758L;
@Column(name = "prjct_idx", columnDefinition = "int UNSIGNED not null")
private Long prjctIdx;
@NotNull
@Column(name = "sid", nullable = false)
private Integer sid;
@NotNull
@Column(name = "list_hder_id", nullable = false)
private Integer listHderId;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
TListItemUploadEntityId entity = (TListItemUploadEntityId) o;
return Objects.equals(this.prjctIdx, entity.prjctIdx) &&
Objects.equals(this.listHderId, entity.listHderId) &&
Objects.equals(this.sid, entity.sid);
}
@Override
public int hashCode() {
return Objects.hash(prjctIdx, listHderId, sid);
}
}

View File

@@ -0,0 +1,61 @@
package com.kri.contact.server.persistence.entity;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.type.SqlTypes;
import java.time.Instant;
import java.util.Map;
@Getter
@Setter
@Entity
@Table(name = "t_list_reset_log")
public class TListResetLogEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "list_reset_log_idx", columnDefinition = "int UNSIGNED not null")
private Long listResetLogIdx;
@Column(name = "prjct_idx", columnDefinition = "int UNSIGNED not null")
private Long prjctIdx;
@NotNull
@Column(name = "mode", nullable = false)
private Short mode;
@NotNull
@Column(name = "list_cnt", nullable = false)
private Integer listCnt;
@NotNull
@Column(name = "sid", nullable = false)
@JdbcTypeCode(SqlTypes.JSON)
private Map<String, Object> sid;
@Size(max = 128)
@NotNull
@Column(name = "backup_file_path", nullable = false, length = 128)
private String backupFilePath;
@Size(max = 128)
@NotNull
@Column(name = "backup_file_nm", nullable = false, length = 128)
private String backupFileNm;
@Size(max = 32)
@NotNull
@Column(name = "reg_user", nullable = false, length = 32)
private String regUser;
@NotNull
@ColumnDefault("CURRENT_TIMESTAMP")
@Column(name = "reg_dt", nullable = false)
private Instant regDt;
}

View File

@@ -0,0 +1,58 @@
package com.kri.contact.server.persistence.entity;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import java.time.Instant;
@Getter
@Setter
@Entity
@Table(name = "t_list_resve")
public class TListResveEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "list_resve_idx", columnDefinition = "int UNSIGNED not null")
private Long listResveIdx;
@Column(name = "prjct_idx", columnDefinition = "int UNSIGNED not null")
private Long prjctIdx;
@NotNull
@Column(name = "sid", nullable = false)
private Integer sid;
@Size(max = 2048)
@NotNull
@Column(name = "memo", nullable = false, length = 2048)
private String memo;
@NotNull
@ColumnDefault("0")
@Column(name = "is_cnfirm", nullable = false)
private Boolean isCnfirm = false;
@NotNull
@Column(name = "resve_dt", nullable = false)
private Instant resveDt;
@Size(max = 32)
@NotNull
@Column(name = "resve_user", nullable = false, length = 32)
private String resveUser;
@Size(max = 32)
@NotNull
@Column(name = "reg_user", nullable = false, length = 32)
private String regUser;
@NotNull
@ColumnDefault("CURRENT_TIMESTAMP")
@Column(name = "reg_dt", nullable = false)
private Instant regDt;
}

View File

@@ -0,0 +1,53 @@
package com.kri.contact.server.persistence.entity;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import java.time.Instant;
@Getter
@Setter
@Entity
@Table(name = "t_list_update_hist")
public class TListUpdateHistEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "list_update_hist_idx", nullable = false)
private Long listUpdateHistIdx;
@Column(name = "prjct_idx", columnDefinition = "int UNSIGNED not null")
private Long prjctIdx;
@NotNull
@Column(name = "sid", nullable = false)
private Integer sid;
@NotNull
@Column(name = "list_hder_id", nullable = false)
private Integer listHderId;
@NotNull
@Lob
@Column(name = "before_val", nullable = false)
private String beforeVal;
@NotNull
@Lob
@Column(name = "after_val", nullable = false)
private String afterVal;
@Size(max = 32)
@NotNull
@Column(name = "reg_user", nullable = false, length = 32)
private String regUser;
@NotNull
@ColumnDefault("CURRENT_TIMESTAMP")
@Column(name = "reg_dt", nullable = false)
private Instant regDt;
}

View File

@@ -0,0 +1,61 @@
package com.kri.contact.server.persistence.entity;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import java.time.Instant;
@Getter
@Setter
@Entity
@Table(name = "t_list_upload_log")
public class TListUploadLogEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "list_upload_log_idx", nullable = false)
private Long listUploadLogIdx;
@Column(name = "prjct_idx", columnDefinition = "int UNSIGNED not null")
private Long prjctIdx;
@NotNull
@Column(name = "wave", nullable = false)
private Integer wave;
@Size(max = 128)
@NotNull
@Column(name = "file_nm", nullable = false, length = 128)
private String fileNm;
@NotNull
@Column(name = "list_cnt", nullable = false)
private Integer listCnt;
@NotNull
@Column(name = "mode", nullable = false)
private Short mode;
@Size(max = 64)
@NotNull
@Column(name = "optn", nullable = false, length = 64)
private String optn;
@NotNull
@Column(name = "is_success", nullable = false)
private Boolean isSuccess = false;
@Size(max = 32)
@NotNull
@Column(name = "reg_user", nullable = false, length = 32)
private String regUser;
@NotNull
@ColumnDefault("CURRENT_TIMESTAMP")
@Column(name = "reg_dt", nullable = false)
private Instant regDt;
}

View File

@@ -0,0 +1,40 @@
package com.kri.contact.server.persistence.entity;
import jakarta.persistence.Column;
import jakarta.persistence.EmbeddedId;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import java.time.Instant;
@Getter
@Setter
@Entity
@Table(name = "t_prjct_assign")
public class TPrjctAssignEntity {
@EmbeddedId
private TPrjctAssignEntityId id;
@Size(max = 32)
@NotNull
@Column(name = "reg_user", nullable = false, length = 32)
private String regUser;
@NotNull
@ColumnDefault("CURRENT_TIMESTAMP")
@Column(name = "reg_dt", nullable = false)
private Instant regDt;
public Long getPrjctIdx(){
return id.getPrjctIdx();
}
public String getUserId(){
return id.getUserId();
}
}

View File

@@ -0,0 +1,41 @@
package com.kri.contact.server.persistence.entity;
import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.Hibernate;
import java.io.Serializable;
import java.util.Objects;
@Getter
@Setter
@Embeddable
public class TPrjctAssignEntityId implements Serializable {
private static final long serialVersionUID = -263674621497298216L;
@Column(name = "prjct_idx", columnDefinition = "int UNSIGNED not null")
private Long prjctIdx;
@Size(max = 32)
@NotNull
@Column(name = "user_id", nullable = false, length = 32)
private String userId;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
TPrjctAssignEntityId entity = (TPrjctAssignEntityId) o;
return Objects.equals(this.prjctIdx, entity.prjctIdx) &&
Objects.equals(this.userId, entity.userId);
}
@Override
public int hashCode() {
return Objects.hash(prjctIdx, userId);
}
}

View File

@@ -0,0 +1,105 @@
package com.kri.contact.server.persistence.entity;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import java.time.Instant;
@Getter
@Setter
@Entity
@Table(name = "t_prjct")
public class TPrjctEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "prjct_idx", columnDefinition = "int UNSIGNED not null")
private Long prjctIdx;
@Size(max = 32)
@NotNull
@Column(name = "prjct_cd", nullable = false, length = 32)
private String prjctCd;
@Size(max = 64)
@NotNull
@Column(name = "prjct_nm", nullable = false, length = 64)
private String prjctNm;
@Size(max = 32)
@NotNull
@Column(name = "itrnt_prjct_cd", nullable = false, length = 32)
private String itrntPrjctCd;
@Size(max = 32)
@NotNull
@Column(name = "owner_dept", nullable = false, length = 32)
private String ownerDept;
@Size(max = 16)
@NotNull
@Column(name = "owner_fw", nullable = false, length = 16)
private String ownerFw;
@NotNull
@ColumnDefault("0")
@Column(name = "survey_ty", nullable = false)
private Short surveyTy;
@Size(max = 32)
@Column(name = "survey_prjct_cd", length = 32)
private String surveyPrjctCd;
@Size(max = 128)
@Column(name = "survey_url", length = 128)
private String surveyUrl;
@NotNull
@ColumnDefault("0")
@Column(name = "is_ff", nullable = false)
private Boolean isFf = false;
@NotNull
@ColumnDefault("0")
@Column(name = "is_use_contact_senario", nullable = false)
private Boolean isUseContactSenario = false;
@Lob
@Column(name = "contact_senario")
private String contactSenario;
@Size(max = 32)
@NotNull
@Column(name = "reg_user", nullable = false, length = 32)
private String regUser;
@NotNull
@ColumnDefault("CURRENT_TIMESTAMP")
@Column(name = "reg_dt", nullable = false)
private Instant regDt;
@Size(max = 32)
@NotNull
@Column(name = "mod_user", nullable = false, length = 32)
private String modUser;
@NotNull
@Column(name = "mod_dt", nullable = false)
private Instant modDt;
@NotNull
@ColumnDefault("0")
@Column(name = "is_del", nullable = false)
private Boolean isDel = false;
@Size(max = 32)
@Column(name = "del_user", length = 32)
private String delUser;
@Column(name = "del_dt")
private Instant delDt;
}

View File

@@ -0,0 +1,57 @@
package com.kri.contact.server.persistence.entity;
import com.kri.contact.server.common.enums.ResultCodeType;
import jakarta.persistence.Column;
import jakarta.persistence.EmbeddedId;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import java.time.Instant;
@Getter
@Setter
@Entity
@Table(name = "t_result_code")
public class TResultCodeEntity {
@EmbeddedId
private TResultCodeEntityId id;
@Size(max = 32)
@NotNull
@Column(name = "result_cd_lbl", nullable = false, length = 32)
private String resultCdLbl;
@Size(max = 32)
@NotNull
@Column(name = "reg_user", nullable = false, length = 32)
private String regUser;
@NotNull
@Column(name = "reg_dt", nullable = false)
private Instant regDt;
@Size(max = 32)
@NotNull
@Column(name = "mod_user", nullable = false, length = 32)
private String modUser;
@NotNull
@Column(name = "mod_dt", nullable = false)
private Instant modDt;
public Long getPrjctIdx(){
return id.getPrjctIdx();
}
public Short getResultCdTy(){
return id.getResultCdTy();
}
public ResultCodeType getResultCd(){
return id.getResultCd();
}
}

View File

@@ -0,0 +1,48 @@
package com.kri.contact.server.persistence.entity;
import com.kri.contact.server.common.jpa.ResultCodeTypeConverter;
import com.kri.contact.server.common.enums.ResultCodeType;
import jakarta.persistence.Column;
import jakarta.persistence.Convert;
import jakarta.persistence.Embeddable;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.Hibernate;
import java.io.Serializable;
import java.util.Objects;
@Getter
@Setter
@Embeddable
public class TResultCodeEntityId implements Serializable {
private static final long serialVersionUID = -1984612223940078355L;
@Column(name = "prjct_idx", columnDefinition = "int UNSIGNED not null")
private Long prjctIdx;
@NotNull
@Column(name = "result_cd_ty", nullable = false)
private Short resultCdTy;
@NotNull
@Column(name = "result_cd", nullable = false)
@Convert(converter = ResultCodeTypeConverter.class)
private ResultCodeType resultCd;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
TResultCodeEntityId entity = (TResultCodeEntityId) o;
return Objects.equals(this.prjctIdx, entity.prjctIdx) &&
Objects.equals(this.resultCdTy, entity.resultCdTy) &&
Objects.equals(this.resultCd, entity.resultCd);
}
@Override
public int hashCode() {
return Objects.hash(prjctIdx, resultCdTy, resultCd);
}
}

View File

@@ -0,0 +1,50 @@
package com.kri.contact.server.persistence.entity;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import java.time.Instant;
@Getter
@Setter
@Entity
@Table(name = "t_role")
public class TRoleEntity {
@Id
@Column(name = "role_cd", nullable = false)
private Integer roleCd;
@Size(max = 16)
@NotNull
@Column(name = "role_nm", nullable = false, length = 16)
private String roleNm;
@NotNull
@Lob
@Column(name = "memo", nullable = false)
private String memo;
@Size(max = 32)
@NotNull
@Column(name = "reg_user", nullable = false, length = 32)
private String regUser;
@NotNull
@ColumnDefault("CURRENT_TIMESTAMP")
@Column(name = "reg_dt", nullable = false)
private Instant regDt;
@Size(max = 32)
@NotNull
@Column(name = "mod_user", nullable = false, length = 32)
private String modUser;
@NotNull
@Column(name = "mod_dt", nullable = false)
private Instant modDt;
}

View File

@@ -0,0 +1,40 @@
package com.kri.contact.server.persistence.entity;
import jakarta.persistence.Column;
import jakarta.persistence.EmbeddedId;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import java.time.Instant;
@Getter
@Setter
@Entity
@Table(name = "t_role_func_map")
public class TRoleFuncMapEntity {
@EmbeddedId
private TRoleFuncMapEntityId id;
@Size(max = 32)
@NotNull
@Column(name = "reg_user", nullable = false, length = 32)
private String regUser;
@NotNull
@ColumnDefault("CURRENT_TIMESTAMP")
@Column(name = "reg_dt", nullable = false)
private Instant regDt;
public Integer getRoleCd(){
return id.getRoleCd();
}
public Long getFuncCd(){
return id.getFuncCd();
}
}

View File

@@ -0,0 +1,40 @@
package com.kri.contact.server.persistence.entity;
import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.Hibernate;
import java.io.Serializable;
import java.util.Objects;
@Getter
@Setter
@Embeddable
public class TRoleFuncMapEntityId implements Serializable {
private static final long serialVersionUID = 5430666726716009453L;
@NotNull
@Column(name = "role_cd", nullable = false)
private Integer roleCd;
@NotNull
@Column(name = "func_cd", nullable = false)
private Long funcCd;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
TRoleFuncMapEntityId entity = (TRoleFuncMapEntityId) o;
return Objects.equals(this.roleCd, entity.roleCd) &&
Objects.equals(this.funcCd, entity.funcCd);
}
@Override
public int hashCode() {
return Objects.hash(roleCd, funcCd);
}
}

View File

@@ -0,0 +1,57 @@
package com.kri.contact.server.persistence.entity;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.type.SqlTypes;
import java.time.Instant;
import java.util.Map;
@Getter
@Setter
@Entity
@Table(name = "t_sys_event_log")
public class TSysEventLogEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "sys_event_log_idx", nullable = false)
private Long sysEventLogIdx;
@NotNull
@Column(name = "event_ty", nullable = false)
private Short eventTy;
@Size(max = 128)
@NotNull
@Column(name = "log_title", nullable = false, length = 128)
private String logTitle;
@NotNull
@Column(name = "log_content", nullable = false)
@JdbcTypeCode(SqlTypes.JSON)
private Map<String, Object> logContent;
@Column(name = "prjct_idx", columnDefinition = "int UNSIGNED")
private Long prjctIdx;
@Size(max = 16)
@NotNull
@Column(name = "ip", nullable = false, length = 16)
private String ip;
@Size(max = 16)
@NotNull
@Column(name = "reg_user", nullable = false, length = 16)
private String regUser;
@NotNull
@ColumnDefault("CURRENT_TIMESTAMP")
@Column(name = "reg_dt", nullable = false)
private Instant regDt;
}

View File

@@ -0,0 +1,71 @@
package com.kri.contact.server.persistence.entity;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import java.time.Instant;
@Getter
@Setter
@Entity
@Table(name = "t_user")
public class TUserEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "user_idx", columnDefinition = "int UNSIGNED not null")
private Long userIdx;
@Size(max = 32)
@NotNull
@Column(name = "user_id", nullable = false, length = 32)
private String userId;
@Size(max = 128)
@NotNull
@Column(name = "user_pw", nullable = false, length = 128)
private String userPw;
@Size(max = 32)
@NotNull
@Column(name = "user_nm", nullable = false, length = 32)
private String userNm;
@Size(max = 32)
@NotNull
@ColumnDefault("'S101'")
@Column(name = "user_team", nullable = false, length = 32)
private String userTeam;
@NotNull
@Column(name = "user_role", nullable = false)
private Integer userRole;
@NotNull
@Lob
@Column(name = "memo", nullable = false)
private String memo;
@Size(max = 32)
@NotNull
@Column(name = "reg_user", nullable = false, length = 32)
private String regUser;
@NotNull
@ColumnDefault("CURRENT_TIMESTAMP")
@Column(name = "reg_dt", nullable = false)
private Instant regDt;
@Size(max = 32)
@NotNull
@Column(name = "mod_user", length = 32)
private String modUser;
@NotNull
@Column(name = "mod_dt")
private Instant modDt;
}

View File

@@ -0,0 +1,9 @@
package com.kri.contact.server.persistence.repository;
import com.kri.contact.server.persistence.entity.TUserEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
public interface UserRepository extends JpaRepository<TUserEntity, Long>, JpaSpecificationExecutor<TUserEntity> {
TUserEntity findByUserIdAndUserPw(String userId, String userPw);
}

View File

@@ -0,0 +1 @@
spring.application.name=contact-server

View File

@@ -0,0 +1,13 @@
package com.kri.contact.server;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class ContactServerApplicationTests {
@Test
void contextLoads() {
}
}