2023-04-14 17:43 인터셉트 추가하여 로그남기기, IP 체크, 키검증(accessKey, mberId)을 공통으로
처리하도록 하였습니다. 추가로 API의 결과 형태를 json, plain 두가지를 지원하도록 샘플 개발 하였음
This commit is contained in:
parent
4a3b517791
commit
24d392261d
21
pom.xml
21
pom.xml
@ -66,6 +66,27 @@
|
|||||||
<artifactId>spring-restdocs-mockmvc</artifactId>
|
<artifactId>spring-restdocs-mockmvc</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 수정시 바로 재기동 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-devtools</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- DB Logback -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bgee.log4jdbc-log4j2</groupId>
|
||||||
|
<artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
|
||||||
|
<version>1.16</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- JSON Object -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.googlecode.json-simple</groupId>
|
||||||
|
<artifactId>json-simple</artifactId>
|
||||||
|
<version>1.1.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
37
src/main/java/com/itn/mjonApi/cmn/config/WebConfig.java
Normal file
37
src/main/java/com/itn/mjonApi/cmn/config/WebConfig.java
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package com.itn.mjonApi.cmn.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
import com.itn.mjonApi.cmn.interceptor.CertificationInterceptor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* packageName : com.itn.mjonApi.mjon.send.web
|
||||||
|
* fileName : SendRestController
|
||||||
|
* author : hylee
|
||||||
|
* date : 2023-02-15
|
||||||
|
* description :
|
||||||
|
* ===========================================================
|
||||||
|
* DATE AUTHOR NOTE
|
||||||
|
* -----------------------------------------------------------
|
||||||
|
* 2023-02-15 hylee 최초 생성
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class WebConfig implements WebMvcConfigurer {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public CertificationInterceptor certificationInterceptor(){
|
||||||
|
return new CertificationInterceptor();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
|
registry.addInterceptor(certificationInterceptor())
|
||||||
|
.addPathPatterns("/api/**");
|
||||||
|
//.excludePathPatterns("/css/**", "/images/**", "/js/**");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
package com.itn.mjonApi.cmn.idgen.mapper.domain;
|
||||||
|
/*
|
||||||
|
table : mj_mymsg
|
||||||
|
comment : '내문자 보관함';
|
||||||
|
*/
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class AccessKeyVO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -7865729705175845268L;
|
||||||
|
private String accessNo; //access_key 고유번호
|
||||||
|
private String mberId; //일반회원ID
|
||||||
|
private String accessKey; //access_key
|
||||||
|
private String useYn; //사용여부Y/N
|
||||||
|
private String frstRegistPnttm; //최초등록일시
|
||||||
|
private String frstRegisterId; //최초등록자ID
|
||||||
|
private String lastUpdtPnttm; //최종수정일시
|
||||||
|
private String lastUpdusrId; //최종수정자ID
|
||||||
|
|
||||||
|
//for access_token
|
||||||
|
private String accessToken; //access_token 고유번호
|
||||||
|
private String tokenObj; //access_token 고유번호
|
||||||
|
private String expirePnttm; //access_token 파기일시
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
package com.itn.mjonApi.cmn.idgen.mapper.domain;
|
||||||
|
/*
|
||||||
|
table : mj_mymsg
|
||||||
|
comment : '내문자 보관함';
|
||||||
|
*/
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class LettnLoginLogVO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -7865729705175845268L;
|
||||||
|
private String logId; //log id
|
||||||
|
private String conectId; //접속ID
|
||||||
|
private String conectIp; //접속IP
|
||||||
|
private String userAt; //사용자 여부
|
||||||
|
private String deviceType; //device type
|
||||||
|
private String progrmFileNm; //프로그램파일명
|
||||||
|
private String menuNo; //메뉴번호
|
||||||
|
private String menuNm; //메뉴명
|
||||||
|
private String url; //접속URL
|
||||||
|
private String creatDt; //생성일자
|
||||||
|
|
||||||
|
private int cnt; //count
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
package com.itn.mjonApi.cmn.idgen.mapper.domain;
|
||||||
|
/*
|
||||||
|
table : mj_mymsg
|
||||||
|
comment : '내문자 보관함';
|
||||||
|
*/
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SendMsgVO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -7865729705175845268L;
|
||||||
|
|
||||||
|
private String accessKey; //인증용 API Key O String
|
||||||
|
private String mberId; //사용자id O String
|
||||||
|
|
||||||
|
private String sender; //발신자 전화번호 (최대 16bytes) O String
|
||||||
|
private String receiver; //수신자 전화번호 - 컴마(,)분기 입력으로 최대 1천명 O String
|
||||||
|
private String msg; //메시지 내용 O String (1~2,000Byte)
|
||||||
|
private String msg_type; //SMS(단문) , LMS(장문), MMS(그림문자) 구분 X String
|
||||||
|
private String title; //문자제목(LMS,MMS만 허용) X String (1~44Byte)
|
||||||
|
private String destination; //%치환% 치환명 입력, 수신자 전화번호 수량 만큼 넣어야 한다. X String
|
||||||
|
private String rdate; //발송일 (현재일이상) X YYYYMMDD
|
||||||
|
private String rtime; //발송시간 - 현재시간기준 10분이내나 0 이면 바로 발송 X HHII
|
||||||
|
//private String image1; //첨부이미지 (image 또는 image1) X JPEG,PNG,GIF
|
||||||
|
//private String image2; //첨부이미지 X JPEG,PNG,GIF
|
||||||
|
//private String image3; //첨부이미지 X JPEG,PNG,GIF
|
||||||
|
private String testmodeYn; //연동테스트시 Y 적용 X String
|
||||||
|
|
||||||
|
//sendMsg 문자 발송 전 체크 사항
|
||||||
|
//step1.발신자 전화번호 사용 가능 여부 체크(해당 사용자의 기 등록된 번호만 발송 가능)
|
||||||
|
// 1010
|
||||||
|
|
||||||
|
//step2.수신자 전화번호 정상 여부 체크(정상 번호에 대해서만 발송 가능)
|
||||||
|
// 1020
|
||||||
|
|
||||||
|
//step3.문자 내용 정상 여부 확인 - 스미싱 문구는 발송 안됨
|
||||||
|
// 1030
|
||||||
|
|
||||||
|
//step4.치환명 정상 여부 확인
|
||||||
|
// 1040
|
||||||
|
|
||||||
|
//step5.발송일시 정상여부 확인
|
||||||
|
// 1050
|
||||||
|
|
||||||
|
//step6.문자 타입에 따른 비용 처리 가능 여부 확인
|
||||||
|
// 1060
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,179 @@
|
|||||||
|
package com.itn.mjonApi.cmn.interceptor;
|
||||||
|
|
||||||
|
//import java.sql.Date;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import com.itn.mjonApi.cmn.idgen.mapper.domain.AccessKeyVO;
|
||||||
|
import com.itn.mjonApi.cmn.idgen.mapper.domain.LettnLoginLogVO;
|
||||||
|
import com.itn.mjonApi.mjon.api.service.AccessKeyService;
|
||||||
|
import com.itn.mjonApi.mjon.log.service.LettnLoginLogService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* packageName : com.itn.mjonApi.mjon.send.web
|
||||||
|
* fileName : SendRestController
|
||||||
|
* author : hylee
|
||||||
|
* date : 2023-02-15
|
||||||
|
* description :
|
||||||
|
* ===========================================================
|
||||||
|
* DATE AUTHOR NOTE
|
||||||
|
* -----------------------------------------------------------
|
||||||
|
* 2023-02-15 hylee 최초 생성
|
||||||
|
*/
|
||||||
|
//@Component
|
||||||
|
public class CertificationInterceptor implements HandlerInterceptor{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AccessKeyService accessKeyService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LettnLoginLogService lettnLoginLogService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||||
|
throws Exception {
|
||||||
|
//HttpSession session = request.getSession();
|
||||||
|
|
||||||
|
System.out.println("=====preHandle=4=apikey==");
|
||||||
|
System.out.println("=====preHandle=4=apikey=="+request.getRequestURI());
|
||||||
|
|
||||||
|
System.out.println("=====preHandle=4=apikey=="+request.getRemoteAddr());
|
||||||
|
System.out.println("=====preHandle=4=apikey=="+request.getRemoteHost());
|
||||||
|
System.out.println("=====preHandle=4=apikey=="+request.getRemotePort());
|
||||||
|
System.out.println("=====preHandle=4=apikey=="+request.getRemoteUser());
|
||||||
|
System.out.println("=====preHandle=4=apikey=="+request.getRequestedSessionId());
|
||||||
|
System.out.println("=====preHandle=4=apikey==");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//step0-1.log 남기기
|
||||||
|
//step0-2.IP 체크
|
||||||
|
{
|
||||||
|
try{
|
||||||
|
//step0-1.log 남기기
|
||||||
|
LettnLoginLogVO lettnLoginLogVO = new LettnLoginLogVO();
|
||||||
|
|
||||||
|
//ip
|
||||||
|
HttpServletRequest req = ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest();
|
||||||
|
String ip = req.getHeader("X-FORWARDED-FOR");
|
||||||
|
if (ip == null){ ip = req.getRemoteAddr();}
|
||||||
|
|
||||||
|
lettnLoginLogVO.setConectIp(ip);
|
||||||
|
|
||||||
|
//사용자 여부
|
||||||
|
lettnLoginLogVO.setUserAt("U");
|
||||||
|
|
||||||
|
//사용자 ID
|
||||||
|
lettnLoginLogVO.setConectId(request.getParameter("mberId"));
|
||||||
|
|
||||||
|
//device type
|
||||||
|
if(isMobile(request)){
|
||||||
|
lettnLoginLogVO.setDeviceType("M");
|
||||||
|
}else{
|
||||||
|
lettnLoginLogVO.setDeviceType("P");
|
||||||
|
}
|
||||||
|
|
||||||
|
//program_nm
|
||||||
|
lettnLoginLogVO.setProgrmFileNm("API");
|
||||||
|
lettnLoginLogVO.setMenuNm("API");
|
||||||
|
lettnLoginLogVO.setMenuNo("100");
|
||||||
|
|
||||||
|
//url
|
||||||
|
lettnLoginLogVO.setUrl(request.getRequestURI());
|
||||||
|
//IP 컬럼 길이를 늘려서 비교 조건 제거함 2023-04-05
|
||||||
|
if (lettnLoginLogVO.getUrl().length()>200){ //길이문제로 오류가 발생하는 경우도 처리하도록 수정
|
||||||
|
lettnLoginLogVO.setUrl(lettnLoginLogVO.getUrl().substring(0,199));
|
||||||
|
}
|
||||||
|
|
||||||
|
lettnLoginLogService.insert(lettnLoginLogVO);
|
||||||
|
|
||||||
|
|
||||||
|
//step0-2.IP 체크
|
||||||
|
lettnLoginLogVO = lettnLoginLogService.selectIgnoreIpCnt(lettnLoginLogVO);
|
||||||
|
int i_ignoreCnt = lettnLoginLogVO.getCnt();
|
||||||
|
|
||||||
|
if (i_ignoreCnt>0) {
|
||||||
|
//제한 아이피인 경우는 화면 안나옴 처리
|
||||||
|
response.setContentType("application/json");
|
||||||
|
response.setCharacterEncoding("UTF-8");
|
||||||
|
response.getWriter().write("{\"resultCode\":\"403\",\"message\":\"Forbidden\"}");
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch(Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//step1.키 검증 - accessKey & mberId 는 검증을 위한 필수값
|
||||||
|
{
|
||||||
|
try{
|
||||||
|
AccessKeyVO accessKeyVO = new AccessKeyVO();
|
||||||
|
accessKeyVO.setAccessKey(request.getParameter("accessKey"));
|
||||||
|
accessKeyVO.setMberId(request.getParameter("mberId"));
|
||||||
|
|
||||||
|
accessKeyVO = accessKeyService.selectRKey(accessKeyVO);
|
||||||
|
|
||||||
|
if (accessKeyVO ==null) {
|
||||||
|
response.setContentType("application/json");
|
||||||
|
response.setCharacterEncoding("UTF-8");
|
||||||
|
response.getWriter().write("{\"resultCode\":\"401\",\"message\":\"Unauthorized\"}");
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch(Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
|
||||||
|
response.setContentType("application/json");
|
||||||
|
response.setCharacterEncoding("UTF-8");
|
||||||
|
response.getWriter().write("{\"resultCode\":\"401\",\"message\":\"Unauthorized\"}");
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
|
||||||
|
ModelAndView modelAndView) throws Exception {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
System.out.println("=====postHandle=4=apikey==");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
|
||||||
|
throws Exception {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
System.out.println("=====afterCompletion=4=apikey==");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*모바일접속 유무*/
|
||||||
|
private boolean isMobile(HttpServletRequest request) {
|
||||||
|
String userAgent = request.getHeader("user-agent");
|
||||||
|
boolean mobile1 = userAgent.matches(".*(iPhone|iPod|Android|Windows CE|BlackBerry|Symbian|Windows Phone|webOS|Opera Mini|Opera Mobi|POLARIS|IEMobile|lgtelecom|nokia|SonyEricsson).*");
|
||||||
|
boolean mobile2 = userAgent.matches(".*(LG|SAMSUNG|Samsung).*");
|
||||||
|
if(mobile1 || mobile2) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
57
src/main/java/com/itn/mjonApi/cmn/msg/PlainResponse.java
Normal file
57
src/main/java/com/itn/mjonApi/cmn/msg/PlainResponse.java
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
package com.itn.mjonApi.cmn.msg;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
public class PlainResponse {
|
||||||
|
|
||||||
|
//private HttpStatus status;
|
||||||
|
private int resultCode;
|
||||||
|
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
private LocalDateTime localDateTime;
|
||||||
|
|
||||||
|
private Object object;
|
||||||
|
|
||||||
|
private List<?> objectList;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 200-OK : 정상접속
|
||||||
|
* 401-Unauthorized : 인증실패
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
|
||||||
|
public PlainResponse(HttpStatus status, String message, LocalDateTime timestamp) {
|
||||||
|
this.resultCode = status.value();
|
||||||
|
checkMessage(status, message);
|
||||||
|
this.localDateTime = timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlainResponse(HttpStatus status, String message, LocalDateTime timestamp, Object object) {
|
||||||
|
this.resultCode = status.value();
|
||||||
|
checkMessage(status, message);
|
||||||
|
|
||||||
|
this.object= object;
|
||||||
|
this.localDateTime = timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlainResponse(HttpStatus status, String message, LocalDateTime timestamp, List<?> objectList) {
|
||||||
|
this.resultCode = status.value();
|
||||||
|
checkMessage(status, message);
|
||||||
|
|
||||||
|
this.objectList = objectList;
|
||||||
|
this.localDateTime = timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkMessage(HttpStatus status, String message) {
|
||||||
|
if ("".equals(message)){ this.message = status.name();
|
||||||
|
}else { this.message = message; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -11,26 +11,47 @@ import java.util.List;
|
|||||||
@Getter
|
@Getter
|
||||||
public class RestResponse {
|
public class RestResponse {
|
||||||
|
|
||||||
private HttpStatus status;
|
//private HttpStatus status;
|
||||||
|
private int resultCode;
|
||||||
|
|
||||||
private String message;
|
private String message;
|
||||||
|
|
||||||
private LocalDateTime localDateTime;
|
private LocalDateTime localDateTime;
|
||||||
|
|
||||||
|
private Object object;
|
||||||
|
|
||||||
private List<?> objectList;
|
private List<?> objectList;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 200-OK : 정상접속
|
||||||
|
* 401-Unauthorized : 인증실패
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
|
||||||
public RestResponse(HttpStatus status, String message, LocalDateTime timestamp) {
|
public RestResponse(HttpStatus status, String message, LocalDateTime timestamp) {
|
||||||
this.status = status;
|
this.resultCode = status.value();
|
||||||
this.message = message;
|
checkMessage(status, message);
|
||||||
this.localDateTime = timestamp;
|
this.localDateTime = timestamp;
|
||||||
}
|
}
|
||||||
public RestResponse(HttpStatus status, String message, List<?> objectList, LocalDateTime timestamp) {
|
|
||||||
this.status = status;
|
public RestResponse(HttpStatus status, String message, LocalDateTime timestamp, Object object) {
|
||||||
this.message = message;
|
this.resultCode = status.value();
|
||||||
|
checkMessage(status, message);
|
||||||
|
|
||||||
|
this.object= object;
|
||||||
|
this.localDateTime = timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RestResponse(HttpStatus status, String message, LocalDateTime timestamp, List<?> objectList) {
|
||||||
|
this.resultCode = status.value();
|
||||||
|
checkMessage(status, message);
|
||||||
|
|
||||||
this.objectList = objectList;
|
this.objectList = objectList;
|
||||||
this.localDateTime = timestamp;
|
this.localDateTime = timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkMessage(HttpStatus status, String message) {
|
||||||
|
if ("".equals(message)){ this.message = status.name();
|
||||||
|
}else { this.message = message; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,21 @@
|
|||||||
|
package com.itn.mjonApi.mjon.api.service;
|
||||||
|
|
||||||
|
import com.itn.mjonApi.cmn.idgen.mapper.domain.AccessKeyVO;
|
||||||
|
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||||
|
|
||||||
|
public interface AccessKeyService {
|
||||||
|
|
||||||
|
RestResponse insert(AccessKeyVO accessKeyVO);
|
||||||
|
|
||||||
|
RestResponse selectR(AccessKeyVO accessKeyVO);
|
||||||
|
|
||||||
|
RestResponse selectL(AccessKeyVO accessKeyVO);
|
||||||
|
|
||||||
|
//AccessKeyVO selectR(AccessKeyVO accessKeyVO);
|
||||||
|
|
||||||
|
AccessKeyVO selectRKey(AccessKeyVO accessKeyVO);
|
||||||
|
|
||||||
|
RestResponse update(AccessKeyVO accessKeyVO);
|
||||||
|
|
||||||
|
RestResponse delete(AccessKeyVO accessKeyVO);
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package com.itn.mjonApi.mjon.api.service;
|
||||||
|
|
||||||
|
import com.itn.mjonApi.cmn.idgen.mapper.domain.AccessKeyVO;
|
||||||
|
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||||
|
|
||||||
|
public interface AccessTokenService {
|
||||||
|
|
||||||
|
RestResponse findAll();
|
||||||
|
|
||||||
|
RestResponse insert(AccessKeyVO accessKeyVO);
|
||||||
|
|
||||||
|
RestResponse selectR(AccessKeyVO accessKeyVO);
|
||||||
|
|
||||||
|
RestResponse selectL(AccessKeyVO accessKeyVO);
|
||||||
|
|
||||||
|
//AccessKeyVO selectR(AccessKeyVO accessKeyVO);
|
||||||
|
|
||||||
|
AccessKeyVO selectRKey(AccessKeyVO accessKeyVO);
|
||||||
|
|
||||||
|
RestResponse update(AccessKeyVO accessKeyVO);
|
||||||
|
|
||||||
|
RestResponse delete(AccessKeyVO accessKeyVO);
|
||||||
|
}
|
||||||
@ -0,0 +1,69 @@
|
|||||||
|
package com.itn.mjonApi.mjon.api.service.impl;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.itn.mjonApi.cmn.idgen.mapper.domain.AccessKeyVO;
|
||||||
|
import com.itn.mjonApi.cmn.idgen.mapper.domain.IdgenVO;
|
||||||
|
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||||
|
import com.itn.mjonApi.mjon.api.service.AccessKeyService;
|
||||||
|
import com.itn.mjonApi.mjon.api.service.mapper.AccessKeyMapper;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class AccessKeyServiceImpl implements AccessKeyService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
AccessKeyMapper accessKeyMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RestResponse insert(AccessKeyVO accessKeyVO) {
|
||||||
|
int i_ret = accessKeyMapper.insert(accessKeyVO);
|
||||||
|
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RestResponse selectR(AccessKeyVO accessKeyVO) {
|
||||||
|
AccessKeyVO MyMsgListVO = accessKeyMapper.selectR(accessKeyVO);
|
||||||
|
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now(), MyMsgListVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RestResponse selectL(AccessKeyVO accessKeyVO) {
|
||||||
|
List<AccessKeyVO> MyMsgListVO = accessKeyMapper.selectL(accessKeyVO);
|
||||||
|
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now(), MyMsgListVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
@Override
|
||||||
|
public AccessKeyVO selectR(AccessKeyVO p_accessKeyVO) {
|
||||||
|
AccessKeyVO accessKeyVO = accessKeyMapper.selectR(p_accessKeyVO);
|
||||||
|
return accessKeyVO;
|
||||||
|
//return new RestResponse(HttpStatus.OK, "성공", MyMsgListVO, LocalDateTime.now());
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AccessKeyVO selectRKey(AccessKeyVO p_accessKeyVO) {
|
||||||
|
AccessKeyVO accessKeyVO = accessKeyMapper.selectRKey(p_accessKeyVO);
|
||||||
|
return accessKeyVO;
|
||||||
|
//return new RestResponse(HttpStatus.OK, "성공", MyMsgListVO, LocalDateTime.now());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RestResponse update(AccessKeyVO accessKeyVO) {
|
||||||
|
int i_ret = accessKeyMapper.update(accessKeyVO);
|
||||||
|
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RestResponse delete(AccessKeyVO accessKeyVO) {
|
||||||
|
int i_ret = accessKeyMapper.delete(accessKeyVO);
|
||||||
|
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,75 @@
|
|||||||
|
package com.itn.mjonApi.mjon.api.service.impl;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.itn.mjonApi.cmn.idgen.mapper.domain.AccessKeyVO;
|
||||||
|
import com.itn.mjonApi.cmn.idgen.mapper.domain.IdgenVO;
|
||||||
|
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||||
|
import com.itn.mjonApi.mjon.api.service.AccessTokenService;
|
||||||
|
import com.itn.mjonApi.mjon.api.service.mapper.AccessTokenMapper;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class AccessTokenServiceImpl implements AccessTokenService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
AccessTokenMapper accessTokenMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RestResponse findAll() {
|
||||||
|
List<IdgenVO> MyMsgListVO = accessTokenMapper.findAll();
|
||||||
|
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now(), MyMsgListVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RestResponse insert(AccessKeyVO accessKeyVO) {
|
||||||
|
int i_ret = accessTokenMapper.insert(accessKeyVO);
|
||||||
|
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RestResponse selectR(AccessKeyVO accessKeyVO) {
|
||||||
|
AccessKeyVO MyMsgListVO = accessTokenMapper.selectR(accessKeyVO);
|
||||||
|
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now(), MyMsgListVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RestResponse selectL(AccessKeyVO accessKeyVO) {
|
||||||
|
List<AccessKeyVO> MyMsgListVO = accessTokenMapper.selectL(accessKeyVO);
|
||||||
|
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now(), MyMsgListVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
@Override
|
||||||
|
public AccessKeyVO selectR(AccessKeyVO p_accessKeyVO) {
|
||||||
|
AccessKeyVO accessKeyVO = accessKeyMapper.selectR(p_accessKeyVO);
|
||||||
|
return accessKeyVO;
|
||||||
|
//return new RestResponse(HttpStatus.OK, "성공", MyMsgListVO, LocalDateTime.now());
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AccessKeyVO selectRKey(AccessKeyVO p_accessKeyVO) {
|
||||||
|
AccessKeyVO accessKeyVO = accessTokenMapper.selectRKey(p_accessKeyVO);
|
||||||
|
return accessKeyVO;
|
||||||
|
//return new RestResponse(HttpStatus.OK, "성공", MyMsgListVO, LocalDateTime.now());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RestResponse update(AccessKeyVO accessKeyVO) {
|
||||||
|
int i_ret = accessTokenMapper.update(accessKeyVO);
|
||||||
|
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RestResponse delete(AccessKeyVO accessKeyVO) {
|
||||||
|
int i_ret = accessTokenMapper.delete(accessKeyVO);
|
||||||
|
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
package com.itn.mjonApi.mjon.api.service.mapper;
|
||||||
|
|
||||||
|
import com.itn.mjonApi.cmn.idgen.mapper.domain.AccessKeyVO;
|
||||||
|
import com.itn.mjonApi.cmn.idgen.mapper.domain.IdgenVO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface AccessKeyMapper {
|
||||||
|
|
||||||
|
int insert(AccessKeyVO accessKeyVO);
|
||||||
|
|
||||||
|
AccessKeyVO selectR(AccessKeyVO accessKeyVO);
|
||||||
|
|
||||||
|
List<AccessKeyVO> selectL(AccessKeyVO accessKeyVO);
|
||||||
|
|
||||||
|
AccessKeyVO selectRKey(AccessKeyVO accessKeyVO);
|
||||||
|
|
||||||
|
int update(AccessKeyVO accessKeyVO);
|
||||||
|
|
||||||
|
int delete(AccessKeyVO accessKeyVO);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.itn.mjonApi.mjon.api.service.mapper;
|
||||||
|
|
||||||
|
import com.itn.mjonApi.cmn.idgen.mapper.domain.AccessKeyVO;
|
||||||
|
import com.itn.mjonApi.cmn.idgen.mapper.domain.IdgenVO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface AccessTokenMapper {
|
||||||
|
|
||||||
|
/**/
|
||||||
|
List<IdgenVO> findAll();
|
||||||
|
|
||||||
|
int insert(AccessKeyVO accessKeyVO);
|
||||||
|
|
||||||
|
AccessKeyVO selectR(AccessKeyVO accessKeyVO);
|
||||||
|
|
||||||
|
List<AccessKeyVO> selectL(AccessKeyVO accessKeyVO);
|
||||||
|
|
||||||
|
AccessKeyVO selectRKey(AccessKeyVO accessKeyVO);
|
||||||
|
|
||||||
|
int update(AccessKeyVO accessKeyVO);
|
||||||
|
|
||||||
|
int delete(AccessKeyVO accessKeyVO);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,263 @@
|
|||||||
|
package com.itn.mjonApi.mjon.api.web;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import org.json.simple.JSONObject;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.itn.mjonApi.cmn.idgen.mapper.domain.SendMsgVO;
|
||||||
|
import com.itn.mjonApi.cmn.msg.PlainResponse;
|
||||||
|
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||||
|
import com.itn.mjonApi.mjon.api.service.AccessKeyService;
|
||||||
|
import com.itn.mjonApi.mjon.api.service.AccessTokenService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author User
|
||||||
|
*
|
||||||
|
* access key( + user_id) 방식의 STEP1 api 구현
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
public class AccessKeyRestController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AccessKeyService accessKeyService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AccessTokenService accessTokenService;
|
||||||
|
|
||||||
|
//
|
||||||
|
/**
|
||||||
|
* @param p_name_1
|
||||||
|
* @param p_name_2
|
||||||
|
* @return
|
||||||
|
*
|
||||||
|
* 동일 내용을 1천명(?) 까지 보내기 가능
|
||||||
|
*
|
||||||
|
* grp_id, 결과코드, 결과msg
|
||||||
|
*
|
||||||
|
* 3가지 형태로 제공 가능
|
||||||
|
* 1.json
|
||||||
|
* 2.plain text
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@GetMapping("/api/accessKey/SendMsg")
|
||||||
|
public ResponseEntity<RestResponse> apiaccessKeysendMsg(
|
||||||
|
@ModelAttribute SendMsgVO sendMsgVO
|
||||||
|
){
|
||||||
|
//step2.api 처리
|
||||||
|
//단문 문자 발송 처리
|
||||||
|
|
||||||
|
//step3.결과 전달
|
||||||
|
System.out.println("name_1");
|
||||||
|
System.out.println(sendMsgVO.getAccessKey());
|
||||||
|
System.out.println(sendMsgVO.getMberId());
|
||||||
|
System.out.println(sendMsgVO.getSender());
|
||||||
|
System.out.println(sendMsgVO.getReceiver());
|
||||||
|
System.out.println(sendMsgVO.getMsg());
|
||||||
|
System.out.println(sendMsgVO.getMsg_type());
|
||||||
|
System.out.println(sendMsgVO.getTitle());
|
||||||
|
System.out.println(sendMsgVO.getRdate());
|
||||||
|
System.out.println(sendMsgVO.getRtime());
|
||||||
|
System.out.println(sendMsgVO.getTestmodeYn());
|
||||||
|
System.out.println("name_12");
|
||||||
|
|
||||||
|
//System.out.println(p_name_1);
|
||||||
|
//System.out.println(p_name_2);
|
||||||
|
|
||||||
|
//sendMsg 문자 발송 전 체크 사항
|
||||||
|
//step1.발신자 전화번호 사용 가능 여부 체크(해당 사용자의 기 등록된 번호만 발송 가능)
|
||||||
|
// 1010
|
||||||
|
|
||||||
|
//step2.수신자 전화번호 정상 여부 체크(정상 번호에 대해서만 발송 가능)
|
||||||
|
// 1020
|
||||||
|
|
||||||
|
//step3.문자 내용 정상 여부 확인 - 스미싱 문구는 발송 안됨
|
||||||
|
// 1030
|
||||||
|
|
||||||
|
//step4.치환명 정상 여부 확인
|
||||||
|
// 1040
|
||||||
|
|
||||||
|
//step5.발송일시 정상여부 확인
|
||||||
|
// 1050
|
||||||
|
|
||||||
|
//step6.문자 타입에 따른 비용 처리 가능 여부 확인
|
||||||
|
// 1060
|
||||||
|
|
||||||
|
return ResponseEntity.ok(
|
||||||
|
new RestResponse(
|
||||||
|
HttpStatus.OK
|
||||||
|
, ""
|
||||||
|
, LocalDateTime.now()
|
||||||
|
, "grp100"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
//AccessKeyVO
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/api/accessKey/SendMsgPlain")
|
||||||
|
public String apiaccessKeysendMsgPlain(
|
||||||
|
@ModelAttribute SendMsgVO sendMsgVO
|
||||||
|
){
|
||||||
|
//step2.api 처리
|
||||||
|
//단문 문자 발송 처리
|
||||||
|
|
||||||
|
//step3.결과 전달
|
||||||
|
System.out.println("name_1");
|
||||||
|
System.out.println(sendMsgVO.getAccessKey());
|
||||||
|
System.out.println(sendMsgVO.getMberId());
|
||||||
|
System.out.println(sendMsgVO.getSender());
|
||||||
|
System.out.println(sendMsgVO.getReceiver());
|
||||||
|
System.out.println(sendMsgVO.getMsg());
|
||||||
|
System.out.println(sendMsgVO.getMsg_type());
|
||||||
|
System.out.println(sendMsgVO.getTitle());
|
||||||
|
System.out.println(sendMsgVO.getRdate());
|
||||||
|
System.out.println(sendMsgVO.getRtime());
|
||||||
|
System.out.println(sendMsgVO.getTestmodeYn());
|
||||||
|
System.out.println("name_12");
|
||||||
|
|
||||||
|
//System.out.println(p_name_1);
|
||||||
|
//System.out.println(p_name_2);
|
||||||
|
|
||||||
|
//sendMsg 문자 발송 전 체크 사항
|
||||||
|
//step1.발신자 전화번호 사용 가능 여부 체크(해당 사용자의 기 등록된 번호만 발송 가능)
|
||||||
|
// 1010
|
||||||
|
|
||||||
|
//step2.수신자 전화번호 정상 여부 체크(정상 번호에 대해서만 발송 가능)
|
||||||
|
// 1020
|
||||||
|
|
||||||
|
//step3.문자 내용 정상 여부 확인 - 스미싱 문구는 발송 안됨
|
||||||
|
// 1030
|
||||||
|
|
||||||
|
//step4.치환명 정상 여부 확인
|
||||||
|
// 1040
|
||||||
|
|
||||||
|
//step5.발송일시 정상여부 확인
|
||||||
|
// 1050
|
||||||
|
|
||||||
|
//step6.문자 타입에 따른 비용 처리 가능 여부 확인
|
||||||
|
// 1060
|
||||||
|
|
||||||
|
return this.MakePlainResponseResult(
|
||||||
|
new PlainResponse(
|
||||||
|
HttpStatus.OK
|
||||||
|
, ""
|
||||||
|
, LocalDateTime.now()
|
||||||
|
)
|
||||||
|
, "grp100"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
/**
|
||||||
|
* @param p_name_1
|
||||||
|
* @param p_name_2
|
||||||
|
* @return
|
||||||
|
*
|
||||||
|
* 잔액 확인
|
||||||
|
* 2가지 형태로 제공 가능
|
||||||
|
* 1.json
|
||||||
|
* 2.plain text
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@GetMapping("/api/accessKey/Remain")
|
||||||
|
public ResponseEntity<RestResponse> apiaccessKeysendRemain(
|
||||||
|
@ModelAttribute SendMsgVO sendMsgVO
|
||||||
|
){
|
||||||
|
//step2.api 처리
|
||||||
|
//단문 문자 발송 처리
|
||||||
|
|
||||||
|
//step3.결과 전달
|
||||||
|
System.out.println("name_1");
|
||||||
|
System.out.println(sendMsgVO.getAccessKey());
|
||||||
|
System.out.println(sendMsgVO.getMberId());
|
||||||
|
System.out.println("name_12");
|
||||||
|
|
||||||
|
//System.out.println(p_name_1);
|
||||||
|
//System.out.println(p_name_2);
|
||||||
|
|
||||||
|
//remain 체크 사항
|
||||||
|
//step1.잔액 확인 여부 체크
|
||||||
|
// 2010
|
||||||
|
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
|
||||||
|
jsonObject.put("SMS", "50");
|
||||||
|
jsonObject.put("LMS", "30");
|
||||||
|
jsonObject.put("MMS", "20");
|
||||||
|
|
||||||
|
return ResponseEntity.ok(
|
||||||
|
new RestResponse(
|
||||||
|
HttpStatus.OK
|
||||||
|
, ""
|
||||||
|
, LocalDateTime.now()
|
||||||
|
, jsonObject
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
//AccessKeyVO
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
/**
|
||||||
|
* @param p_name_1
|
||||||
|
* @param p_name_2
|
||||||
|
* @return
|
||||||
|
*
|
||||||
|
* 잔액 확인
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@GetMapping("/api/accessKey/RemainPlain")
|
||||||
|
public String apiaccessKeysendRemainPlain(
|
||||||
|
@ModelAttribute SendMsgVO sendMsgVO
|
||||||
|
){
|
||||||
|
//step2.api 처리
|
||||||
|
//단문 문자 발송 처리
|
||||||
|
|
||||||
|
//step3.결과 전달
|
||||||
|
System.out.println("name_1");
|
||||||
|
System.out.println(sendMsgVO.getAccessKey());
|
||||||
|
System.out.println(sendMsgVO.getMberId());
|
||||||
|
System.out.println("name_12");
|
||||||
|
|
||||||
|
//System.out.println(p_name_1);
|
||||||
|
//System.out.println(p_name_2);
|
||||||
|
|
||||||
|
//remain 체크 사항
|
||||||
|
//step1.잔액 확인 여부 체크
|
||||||
|
// 2010
|
||||||
|
|
||||||
|
return this.MakePlainResponseResult(
|
||||||
|
new PlainResponse(
|
||||||
|
HttpStatus.OK
|
||||||
|
, ""
|
||||||
|
, LocalDateTime.now()
|
||||||
|
)
|
||||||
|
, "50|30|20"
|
||||||
|
);
|
||||||
|
|
||||||
|
//AccessKeyVO
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// private function
|
||||||
|
//
|
||||||
|
//
|
||||||
|
private String MakePlainResponseResult(PlainResponse plainResponse, String p_code) {
|
||||||
|
String v_ret = "";
|
||||||
|
v_ret = Integer.toString(plainResponse.getResultCode())
|
||||||
|
+ "|" + plainResponse.getMessage()
|
||||||
|
+ "|" + p_code;
|
||||||
|
|
||||||
|
return v_ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
package com.itn.mjonApi.mjon.log.service;
|
||||||
|
|
||||||
|
import com.itn.mjonApi.cmn.idgen.mapper.domain.LettnLoginLogVO;
|
||||||
|
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||||
|
|
||||||
|
public interface LettnLoginLogService {
|
||||||
|
|
||||||
|
//기본 insert 구문
|
||||||
|
RestResponse insert(LettnLoginLogVO lettnLoginLogVO);
|
||||||
|
|
||||||
|
//기본 select R 구문
|
||||||
|
RestResponse selectR(LettnLoginLogVO lettnLoginLogVO);
|
||||||
|
|
||||||
|
//기본 select LIST 구문
|
||||||
|
RestResponse selectL(LettnLoginLogVO lettnLoginLogVO);
|
||||||
|
|
||||||
|
//AccessKeyVO selectR(AccessKeyVO accessKeyVO);
|
||||||
|
|
||||||
|
//기본 select with key 구문
|
||||||
|
LettnLoginLogVO selectRKey(LettnLoginLogVO lettnLoginLogVO);
|
||||||
|
|
||||||
|
//기본 update구문
|
||||||
|
RestResponse update(LettnLoginLogVO lettnLoginLogVO);
|
||||||
|
|
||||||
|
//기본 delete 구문
|
||||||
|
RestResponse delete(LettnLoginLogVO lettnLoginLogVO);
|
||||||
|
|
||||||
|
//IP 제어 select 구문
|
||||||
|
LettnLoginLogVO selectIgnoreIpCnt(LettnLoginLogVO lettnLoginLogVO);
|
||||||
|
}
|
||||||
@ -0,0 +1,78 @@
|
|||||||
|
package com.itn.mjonApi.mjon.log.service.impl;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.itn.mjonApi.cmn.idgen.mapper.domain.AccessKeyVO;
|
||||||
|
import com.itn.mjonApi.cmn.idgen.mapper.domain.IdgenVO;
|
||||||
|
import com.itn.mjonApi.cmn.idgen.mapper.domain.LettnLoginLogVO;
|
||||||
|
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||||
|
import com.itn.mjonApi.mjon.log.service.LettnLoginLogService;
|
||||||
|
import com.itn.mjonApi.mjon.log.service.mapper.LettnLoginLogMapper;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class LettnLoginLogServiceImpl implements LettnLoginLogService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
LettnLoginLogMapper lettnLoginLogMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RestResponse insert(LettnLoginLogVO lettnLoginLogVO) {
|
||||||
|
int i_ret = lettnLoginLogMapper.insert(lettnLoginLogVO);
|
||||||
|
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RestResponse selectR(LettnLoginLogVO lettnLoginLogVO) {
|
||||||
|
LettnLoginLogVO MyMsgListVO = lettnLoginLogMapper.selectR(lettnLoginLogVO);
|
||||||
|
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now(), MyMsgListVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RestResponse selectL(LettnLoginLogVO lettnLoginLogVO) {
|
||||||
|
List<LettnLoginLogVO> MyMsgListVO = lettnLoginLogMapper.selectL(lettnLoginLogVO);
|
||||||
|
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now(), MyMsgListVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
@Override
|
||||||
|
public AccessKeyVO selectR(AccessKeyVO p_accessKeyVO) {
|
||||||
|
AccessKeyVO accessKeyVO = accessKeyMapper.selectR(p_accessKeyVO);
|
||||||
|
return accessKeyVO;
|
||||||
|
//return new RestResponse(HttpStatus.OK, "성공", MyMsgListVO, LocalDateTime.now());
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LettnLoginLogVO selectRKey(LettnLoginLogVO p_lettnLoginLogVO) {
|
||||||
|
LettnLoginLogVO lettnLoginLogVO = lettnLoginLogMapper.selectRKey(p_lettnLoginLogVO);
|
||||||
|
return lettnLoginLogVO;
|
||||||
|
//return new RestResponse(HttpStatus.OK, "성공", MyMsgListVO, LocalDateTime.now());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RestResponse update(LettnLoginLogVO lettnLoginLogVO) {
|
||||||
|
int i_ret = lettnLoginLogMapper.update(lettnLoginLogVO);
|
||||||
|
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RestResponse delete(LettnLoginLogVO lettnLoginLogVO) {
|
||||||
|
int i_ret = lettnLoginLogMapper.delete(lettnLoginLogVO);
|
||||||
|
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LettnLoginLogVO selectIgnoreIpCnt(LettnLoginLogVO p_lettnLoginLogVO) {
|
||||||
|
LettnLoginLogVO lettnLoginLogVO = lettnLoginLogMapper.selectIgnoreIpCnt(p_lettnLoginLogVO);
|
||||||
|
return lettnLoginLogVO;
|
||||||
|
//return new RestResponse(HttpStatus.OK, "성공", MyMsgListVO, LocalDateTime.now());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
package com.itn.mjonApi.mjon.log.service.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import com.itn.mjonApi.cmn.idgen.mapper.domain.LettnLoginLogVO;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface LettnLoginLogMapper {
|
||||||
|
|
||||||
|
int insert(LettnLoginLogVO lettnLoginLogVO);
|
||||||
|
|
||||||
|
LettnLoginLogVO selectR(LettnLoginLogVO lettnLoginLogVO);
|
||||||
|
|
||||||
|
List<LettnLoginLogVO> selectL(LettnLoginLogVO lettnLoginLogVO);
|
||||||
|
|
||||||
|
LettnLoginLogVO selectRKey(LettnLoginLogVO lettnLoginLogVO);
|
||||||
|
|
||||||
|
int update(LettnLoginLogVO lettnLoginLogVO);
|
||||||
|
|
||||||
|
int delete(LettnLoginLogVO lettnLoginLogVO);
|
||||||
|
|
||||||
|
LettnLoginLogVO selectIgnoreIpCnt(LettnLoginLogVO lettnLoginLogVO);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -21,12 +21,12 @@ public class MemberServiceImpl implements MemberService {
|
|||||||
@Override
|
@Override
|
||||||
public RestResponse findAll() {
|
public RestResponse findAll() {
|
||||||
List<IdgenVO> MyMsgListVO = myMsgMapper.findAll();
|
List<IdgenVO> MyMsgListVO = myMsgMapper.findAll();
|
||||||
return new RestResponse(HttpStatus.OK, "성공", MyMsgListVO, LocalDateTime.now());
|
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now(), MyMsgListVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RestResponse findAll2() {
|
public RestResponse findAll2() {
|
||||||
List<IdgenVO> MyMsgListVO = myMsgMapper.findAll_2();
|
List<IdgenVO> MyMsgListVO = myMsgMapper.findAll_2();
|
||||||
return new RestResponse(HttpStatus.OK, "성공", MyMsgListVO, LocalDateTime.now());
|
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now(), MyMsgListVO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,10 +2,14 @@
|
|||||||
|
|
||||||
# DB INFO
|
# DB INFO
|
||||||
#spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
|
#spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
|
||||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||||
spring.datasource.url=jdbc:mysql://192.168.0.125:3306/mjon?serverTimezone=Asia/Seoul
|
#spring.datasource.url=jdbc:mysql://192.168.0.125:3306/mjon?serverTimezone=Asia/Seoul
|
||||||
|
spring.datasource.driverClassName=net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||||
|
spring.datasource.url=jdbc:log4jdbc:mysql://192.168.0.125:3306/mjon?serverTimezone=Asia/Seoul
|
||||||
|
|
||||||
spring.datasource.username=mjonUr
|
spring.datasource.username=mjonUr
|
||||||
spring.datasource.password=mjon!@#$
|
spring.datasource.password=mjon!@#$
|
||||||
|
|
||||||
|
|
||||||
server.port=8088
|
server.port=8088
|
||||||
|
|
||||||
|
|||||||
@ -7,4 +7,10 @@ spring.profiles.active=dev
|
|||||||
mybatis.mapper-locations=classpath:mapper/**/*.xml
|
mybatis.mapper-locations=classpath:mapper/**/*.xml
|
||||||
# model camel case set
|
# model camel case set
|
||||||
mybatis.configuration.map-underscore-to-camel-case=true
|
mybatis.configuration.map-underscore-to-camel-case=true
|
||||||
logging.level.jdbc.sqlonly=info
|
|
||||||
|
#sql \ucd9c\ub825 log \uc124\uc815
|
||||||
|
logging.level.jdbc.sqlonly=off
|
||||||
|
logging.level.jdbc.sqltiming=info
|
||||||
|
logging.level.jdbc.audit=off
|
||||||
|
logging.level.jdbc.resultset=off
|
||||||
|
logging.level.jdbc.resultsettable=off
|
||||||
|
|||||||
2
src/main/resources/log4jdbc.log4j2.properties
Normal file
2
src/main/resources/log4jdbc.log4j2.properties
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator
|
||||||
|
log4jdbc.dump.sql.maxlinelength=0
|
||||||
129
src/main/resources/mapper/api/AccessKeyMapper.xml
Normal file
129
src/main/resources/mapper/api/AccessKeyMapper.xml
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="com.itn.mjonApi.mjon.api.service.mapper.AccessKeyMapper">
|
||||||
|
|
||||||
|
<select id="findAll" resultType="com.itn.mjonApi.cmn.idgen.mapper.domain.AccessKeyVO">
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM lettngnrlmber_access_key
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 공통 테이블 명 -->
|
||||||
|
<!-- <sql id="AccessKeyDAO.table_name"> -->
|
||||||
|
<sql id="table_name">
|
||||||
|
lettngnrlmber_access_key
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 저장용 공통 컬럼 명 -->
|
||||||
|
<!-- <sql id="AccessKeyDAO.column_name"> -->
|
||||||
|
<sql id="column_name">
|
||||||
|
access_no,
|
||||||
|
|
||||||
|
mber_id,
|
||||||
|
access_key,
|
||||||
|
use_yn,
|
||||||
|
|
||||||
|
frst_regist_pnttm,
|
||||||
|
frst_register_id,
|
||||||
|
last_updt_pnttm,
|
||||||
|
last_updusr_id
|
||||||
|
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 조회용 공통 컬럼 명 -->
|
||||||
|
<!-- <sql id="AccessKeyDAO.select_column_name"> -->
|
||||||
|
<sql id="select_column_name">
|
||||||
|
a.access_no AS accessNo,
|
||||||
|
|
||||||
|
a.mber_id AS mberId,
|
||||||
|
a.access_key AS accessKey,
|
||||||
|
a.use_yn AS useYn,
|
||||||
|
|
||||||
|
DATE_FORMAT(a.frst_regist_pnttm,'%Y-%m-%d') AS frstRegistPnttm,
|
||||||
|
a.frst_register_id AS frstRegisterId,
|
||||||
|
DATE_FORMAT(a.last_updt_pnttm,'%Y-%m-%d') AS lastUpdtPnttm,
|
||||||
|
a.last_updusr_id AS lastUpdusrId
|
||||||
|
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- access_key 정보 등록 C -->
|
||||||
|
<insert id="insert">
|
||||||
|
<!-- INSERT INTO <include refid="AccessKeyDAO.table_name"/> ( -->
|
||||||
|
<!-- <include refid="AccessKeyDAO.column_name"/> -->
|
||||||
|
INSERT INTO <include refid="table_name"/> (
|
||||||
|
<include refid="column_name"/>
|
||||||
|
)VALUES(
|
||||||
|
#{accessNo},
|
||||||
|
|
||||||
|
#{mberId},
|
||||||
|
#{accessKey},
|
||||||
|
#{useYn},
|
||||||
|
|
||||||
|
NOW(),
|
||||||
|
#{frstRegisterId},
|
||||||
|
NOW(),
|
||||||
|
#{lastUpdusrId}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!-- access_key 정보 R -->
|
||||||
|
<!-- <include refid="AccessKeyDAO.select_column_name"/> -->
|
||||||
|
<!-- <include refid="AccessKeyDAO.table_name"/> a -->
|
||||||
|
<select id="selectR" resultType="com.itn.mjonApi.cmn.idgen.mapper.domain.AccessKeyVO">
|
||||||
|
SELECT
|
||||||
|
<include refid="select_column_name"/>
|
||||||
|
FROM
|
||||||
|
<include refid="table_name"/> a
|
||||||
|
WHERE
|
||||||
|
a.ACCESS_NO = #{accessNo}
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectRKey" resultType="com.itn.mjonApi.cmn.idgen.mapper.domain.AccessKeyVO">
|
||||||
|
SELECT
|
||||||
|
<include refid="select_column_name"/>
|
||||||
|
FROM
|
||||||
|
<include refid="table_name"/> a
|
||||||
|
WHERE
|
||||||
|
1=1
|
||||||
|
AND a.ACCESS_KEY = #{accessKey}
|
||||||
|
AND a.MBER_ID = #{mberId}
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- access_key 정보 U -->
|
||||||
|
<update id="update">
|
||||||
|
UPDATE
|
||||||
|
<include refid="table_name"/>
|
||||||
|
SET
|
||||||
|
|
||||||
|
LAST_UPDT_PNTTM = NOW()
|
||||||
|
,LAST_UPDUSR_ID = #lastUpdusrId#
|
||||||
|
|
||||||
|
<if test="mberId ne null">
|
||||||
|
,mber_id=#{mberId}
|
||||||
|
|
||||||
|
</if><if test="accessKey ne null">
|
||||||
|
,access_key=#{accessKey}
|
||||||
|
|
||||||
|
</if><if test="useYn ne null">
|
||||||
|
,use_yn=#{useYn}
|
||||||
|
|
||||||
|
</if>
|
||||||
|
WHERE
|
||||||
|
ACCESS_NO = #{accessNo}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!-- access_key 정보 U -->
|
||||||
|
<delete id="delete">
|
||||||
|
DELETE FROM
|
||||||
|
<include refid="table_name"/>
|
||||||
|
WHERE
|
||||||
|
ACCESS_NO = #{accessNo}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
130
src/main/resources/mapper/api/AccessTokenMapper.xml
Normal file
130
src/main/resources/mapper/api/AccessTokenMapper.xml
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="com.itn.mjonApi.mjon.api.service.mapper.AccessTokenMapper">
|
||||||
|
|
||||||
|
<select id="findAll" resultType="com.itn.mjonApi.cmn.idgen.mapper.domain.AccessKeyVO">
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM lettngnrlmber_access_token
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 공통 테이블 명 -->
|
||||||
|
<!-- <sql id="AccessKeyDAO.table_name"> -->
|
||||||
|
<sql id="table_name">
|
||||||
|
lettngnrlmber_access_token
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 저장용 공통 컬럼 명 -->
|
||||||
|
<!-- <sql id="AccessKeyDAO.column_name"> -->
|
||||||
|
<sql id="column_name">
|
||||||
|
access_no,
|
||||||
|
access_token,
|
||||||
|
|
||||||
|
token_obj,
|
||||||
|
expire_pnttm,
|
||||||
|
|
||||||
|
frst_regist_pnttm,
|
||||||
|
frst_register_id,
|
||||||
|
last_updt_pnttm,
|
||||||
|
last_updusr_id
|
||||||
|
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 조회용 공통 컬럼 명 -->
|
||||||
|
<!-- <sql id="AccessKeyDAO.select_column_name"> -->
|
||||||
|
<sql id="select_column_name">
|
||||||
|
a.access_no AS accessNo,
|
||||||
|
a.access_token AS accessToken,
|
||||||
|
|
||||||
|
a.token_obj AS tokenObj,
|
||||||
|
a.expire_pnttm AS expirePnttm,
|
||||||
|
|
||||||
|
DATE_FORMAT(a.frst_regist_pnttm,'%Y-%m-%d') AS frstRegistPnttm,
|
||||||
|
a.frst_register_id AS frstRegisterId,
|
||||||
|
DATE_FORMAT(a.last_updt_pnttm,'%Y-%m-%d') AS lastUpdtPnttm,
|
||||||
|
a.last_updusr_id AS lastUpdusrId
|
||||||
|
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- access_key 정보 등록 C -->
|
||||||
|
<insert id="insert">
|
||||||
|
<!-- INSERT INTO <include refid="AccessKeyDAO.table_name"/> ( -->
|
||||||
|
<!-- <include refid="AccessKeyDAO.column_name"/> -->
|
||||||
|
INSERT INTO <include refid="table_name"/> (
|
||||||
|
<include refid="column_name"/>
|
||||||
|
)VALUES(
|
||||||
|
#{accessNo},
|
||||||
|
#{accessToken},
|
||||||
|
|
||||||
|
#{tokenObj},
|
||||||
|
#{expirePnttm},
|
||||||
|
|
||||||
|
NOW(),
|
||||||
|
#{frstRegisterId},
|
||||||
|
NOW(),
|
||||||
|
#{lastUpdusrId}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!-- access_key 정보 R -->
|
||||||
|
<!-- <include refid="AccessKeyDAO.select_column_name"/> -->
|
||||||
|
<!-- <include refid="AccessKeyDAO.table_name"/> a -->
|
||||||
|
<select id="selectR" resultType="com.itn.mjonApi.cmn.idgen.mapper.domain.AccessKeyVO">
|
||||||
|
SELECT
|
||||||
|
<include refid="select_column_name"/>
|
||||||
|
FROM
|
||||||
|
<include refid="table_name"/> a
|
||||||
|
WHERE
|
||||||
|
a.ACCESS_NO = #{accessNo}
|
||||||
|
AND a.ACCESS_TOKEN = #{accessToken}
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectRToken" resultType="com.itn.mjonApi.cmn.idgen.mapper.domain.AccessKeyVO">
|
||||||
|
SELECT
|
||||||
|
<include refid="select_column_name"/>
|
||||||
|
FROM
|
||||||
|
<include refid="table_name"/> a
|
||||||
|
WHERE
|
||||||
|
a.ACCESS_TOKEN = #{accessToken}
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- access_key 정보 U -->
|
||||||
|
<update id="update">
|
||||||
|
UPDATE
|
||||||
|
<include refid="table_name"/>
|
||||||
|
SET
|
||||||
|
|
||||||
|
LAST_UPDT_PNTTM = NOW()
|
||||||
|
,LAST_UPDUSR_ID = #lastUpdusrId#
|
||||||
|
|
||||||
|
<if test="mberId ne null">
|
||||||
|
,mber_id=#{mberId}
|
||||||
|
|
||||||
|
</if><if test="accessKey ne null">
|
||||||
|
,access_key=#{accessKey}
|
||||||
|
|
||||||
|
</if><if test="useYn ne null">
|
||||||
|
,use_yn=#{useYn}
|
||||||
|
|
||||||
|
</if>
|
||||||
|
WHERE
|
||||||
|
ACCESS_NO = #{accessNo}
|
||||||
|
AND ACCESS_TOKEN = #{accessToken}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!-- access_key 정보 U -->
|
||||||
|
<delete id="delete">
|
||||||
|
DELETE FROM
|
||||||
|
<include refid="table_name"/>
|
||||||
|
WHERE
|
||||||
|
ACCESS_NO = #{accessNo}
|
||||||
|
AND ACCESS_TOKEN = #{accessToken}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
127
src/main/resources/mapper/log/LettnLoginLog.xml
Normal file
127
src/main/resources/mapper/log/LettnLoginLog.xml
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="com.itn.mjonApi.mjon.log.service.mapper.LettnLoginLogMapper">
|
||||||
|
|
||||||
|
<!-- 공통 테이블 명 -->
|
||||||
|
<sql id="table_name">
|
||||||
|
lettnLoginLog
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 저장용 공통 컬럼 명 -->
|
||||||
|
<sql id="column_name">
|
||||||
|
|
||||||
|
LOG_ID
|
||||||
|
, CONECT_ID
|
||||||
|
, CONECT_IP
|
||||||
|
, USER_AT
|
||||||
|
, DEVICE_TYPE /**인터넷,모바일 */
|
||||||
|
, PROGRM_FILE_NM
|
||||||
|
, MENU_NO
|
||||||
|
, MENU_NM
|
||||||
|
, URL
|
||||||
|
, CREAT_DT
|
||||||
|
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 조회용 공통 컬럼 명 -->
|
||||||
|
<sql id="select_column_name">
|
||||||
|
a.LOG_ID AS logId
|
||||||
|
, a.CONECT_ID AS conectId
|
||||||
|
, a.CONECT_IP AS conectIp
|
||||||
|
, a.USER_AT AS userAt
|
||||||
|
, a.DEVICE_TYPE AS deviceType /**인터넷,모바일 */
|
||||||
|
, a.PROGRM_FILE_NM AS progrmFileNm
|
||||||
|
, a.MENU_NO AS menuNo
|
||||||
|
, a.MENU_NM AS menuNm
|
||||||
|
, a.URL AS url
|
||||||
|
, a.CREAT_DT AS creatDt
|
||||||
|
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- access_key 정보 등록 C -->
|
||||||
|
<insert id="insert">
|
||||||
|
INSERT INTO <include refid="table_name"/> (
|
||||||
|
<include refid="column_name"/>
|
||||||
|
)
|
||||||
|
SELECT concat('API_',lpad(ifnull(replace(MAX(log_id),'API_',''),0)+1,16,'0'))
|
||||||
|
, #{conectId}
|
||||||
|
, #{conectIp}
|
||||||
|
, #{userAt} /**A:관리자, U:홈페이지 */
|
||||||
|
, #{deviceType}
|
||||||
|
, #{progrmFileNm}
|
||||||
|
, #{menuNo}
|
||||||
|
, #{menuNm}
|
||||||
|
, #{url}
|
||||||
|
, now()
|
||||||
|
|
||||||
|
FROM LETTNLOGINLOG
|
||||||
|
WHERE log_id LIKE 'API_%'
|
||||||
|
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!-- access_key 정보 R -->
|
||||||
|
<select id="selectR" resultType="com.itn.mjonApi.cmn.idgen.mapper.domain.LettnLoginLogVO">
|
||||||
|
SELECT
|
||||||
|
<include refid="select_column_name"/>
|
||||||
|
FROM
|
||||||
|
<include refid="table_name"/> a
|
||||||
|
WHERE
|
||||||
|
a.LOG_ID = #{logId}
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectRKey" resultType="com.itn.mjonApi.cmn.idgen.mapper.domain.LettnLoginLogVO">
|
||||||
|
SELECT
|
||||||
|
<include refid="select_column_name"/>
|
||||||
|
FROM
|
||||||
|
<include refid="table_name"/> a
|
||||||
|
WHERE
|
||||||
|
1=1
|
||||||
|
AND a.LOG_ID = #{logId}
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- access_key 정보 U -->
|
||||||
|
<update id="update">
|
||||||
|
UPDATE
|
||||||
|
<include refid="table_name"/>
|
||||||
|
SET
|
||||||
|
|
||||||
|
LAST_UPDT_PNTTM = NOW()
|
||||||
|
,LAST_UPDUSR_ID = #{lastUpdusrId}
|
||||||
|
|
||||||
|
<if test="mberId ne null">
|
||||||
|
,mber_id=#{mberId}
|
||||||
|
|
||||||
|
</if><if test="accessKey ne null">
|
||||||
|
,access_key=#{accessKey}
|
||||||
|
|
||||||
|
</if><if test="useYn ne null">
|
||||||
|
,use_yn=#{useYn}
|
||||||
|
|
||||||
|
</if>
|
||||||
|
WHERE
|
||||||
|
LOG_ID = #{logId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!-- access_key 정보 U -->
|
||||||
|
<delete id="delete">
|
||||||
|
DELETE FROM
|
||||||
|
<include refid="table_name"/>
|
||||||
|
WHERE
|
||||||
|
LOG_ID = #{logId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<select id="selectIgnoreIpCnt" resultType="com.itn.mjonApi.cmn.idgen.mapper.domain.LettnLoginLogVO">
|
||||||
|
SELECT
|
||||||
|
COUNT(A.IGNORE_NO) AS CNT
|
||||||
|
FROM mj_ignore_ip A
|
||||||
|
WHERE 1=1
|
||||||
|
AND A.IGNORE_IP = #{conectIp}
|
||||||
|
LIMIT 1
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue
Block a user