ads367
04-11
2024-04-11 최민식 공통코드/로그인 이력/ 회원정보 등록
공통코드/로그인 이력/ 회원정보 등록
@c75ceb84f994d26802cca6ebc7e25a95b1b4472f
--- src/main/java/com/takensoft/cms/mber/dao/LgnHstryDAO.java
+++ src/main/java/com/takensoft/cms/mber/dao/LgnHstryDAO.java
... | ... | @@ -1,4 +1,20 @@ |
1 | 1 |
package com.takensoft.cms.mber.dao; |
2 | 2 |
|
3 |
+import com.takensoft.cms.mber.vo.LgnHstryVO; |
|
4 |
+import org.egovframe.rte.psl.dataaccess.mapper.Mapper; |
|
5 |
+ |
|
6 |
+/** |
|
7 |
+ * @author : takensoft |
|
8 |
+ * @since : 2024.04.09 |
|
9 |
+ * |
|
10 |
+ * 로그인 이력 관련 Mapper |
|
11 |
+ */ |
|
12 |
+@Mapper("lgnHstryDAO") |
|
3 | 13 |
public interface LgnHstryDAO { |
14 |
+ /** |
|
15 |
+ * @author takensoft |
|
16 |
+ * @since 2024.04.09 |
|
17 |
+ * 로그인 이력 등록 |
|
18 |
+ */ |
|
19 |
+ int save(LgnHstryVO lgnHstryVO); |
|
4 | 20 |
} |
--- src/main/java/com/takensoft/cms/mber/service/Impl/LgnHstryServiceImpl.java
+++ src/main/java/com/takensoft/cms/mber/service/Impl/LgnHstryServiceImpl.java
... | ... | @@ -1,4 +1,39 @@ |
1 | 1 |
package com.takensoft.cms.mber.service.Impl; |
2 | 2 |
|
3 |
-public class LgnHstryServiceImpl { |
|
3 |
+ |
|
4 |
+import com.takensoft.cms.mber.dao.LgnHstryDAO; |
|
5 |
+import com.takensoft.cms.mber.service.LgnHstryService; |
|
6 |
+import com.takensoft.cms.mber.vo.LgnHstryVO; |
|
7 |
+import com.takensoft.common.util.JWTUtil; |
|
8 |
+import lombok.RequiredArgsConstructor; |
|
9 |
+import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; |
|
10 |
+import org.slf4j.Logger; |
|
11 |
+import org.slf4j.LoggerFactory; |
|
12 |
+import org.springframework.stereotype.Service; |
|
13 |
+ |
|
14 |
+/** |
|
15 |
+ * @author : takensoft |
|
16 |
+ * @since : 2024.04.09 |
|
17 |
+ * |
|
18 |
+ * 로그인 이력 정보 관련 구현체 |
|
19 |
+ * EgovAbstractServiceImpl : 전자정부 상속 |
|
20 |
+ * LgnHstryService : 로그인 이력 정보 인터페이스 상속 |
|
21 |
+ */ |
|
22 |
+@Service("lgnHstryService") |
|
23 |
+@RequiredArgsConstructor |
|
24 |
+public class LgnHstryServiceImpl extends EgovAbstractServiceImpl implements LgnHstryService { |
|
25 |
+ |
|
26 |
+ private static final Logger LOGGER = LoggerFactory.getLogger(LgnHstryServiceImpl.class); |
|
27 |
+ private final JWTUtil jwtUtil; |
|
28 |
+ private final LgnHstryDAO lgnHstryDAO; |
|
29 |
+ |
|
30 |
+ /** |
|
31 |
+ * @author takensoft |
|
32 |
+ * @since 2024.04.09 |
|
33 |
+ * 로그인 이력 등록 |
|
34 |
+ */ |
|
35 |
+ @Override |
|
36 |
+ public int LgnHstrySave(LgnHstryVO lgnHstryVO) throws Exception { |
|
37 |
+ return lgnHstryDAO.save(lgnHstryVO); |
|
38 |
+ } |
|
4 | 39 |
} |
--- src/main/java/com/takensoft/cms/mber/service/LgnHstryService.java
+++ src/main/java/com/takensoft/cms/mber/service/LgnHstryService.java
... | ... | @@ -1,4 +1,19 @@ |
1 | 1 |
package com.takensoft.cms.mber.service; |
2 | 2 |
|
3 |
+import com.takensoft.cms.mber.vo.LgnHstryVO; |
|
4 |
+ |
|
5 |
+/** |
|
6 |
+ * @author : takensoft |
|
7 |
+ * @since : 2024.04.09 |
|
8 |
+ * |
|
9 |
+ * 로그인 이력 정보 관련 인터페이스 |
|
10 |
+ */ |
|
3 | 11 |
public interface LgnHstryService { |
12 |
+ |
|
13 |
+ /** |
|
14 |
+ * @author takensoft |
|
15 |
+ * @since 2024.04.09 |
|
16 |
+ * 로그인 이력 등록 |
|
17 |
+ */ |
|
18 |
+ public int LgnHstrySave(LgnHstryVO lgnHstryVO) throws Exception; |
|
4 | 19 |
} |
--- src/main/java/com/takensoft/cms/mber/service/MberService.java
+++ src/main/java/com/takensoft/cms/mber/service/MberService.java
... | ... | @@ -26,5 +26,4 @@ |
26 | 26 |
* 회원가입 |
27 | 27 |
*/ |
28 | 28 |
public int userJoin(HttpServletRequest req, JoinDTO joinDTO) throws Exception; |
29 |
- |
|
30 | 29 |
} |
--- src/main/java/com/takensoft/cms/mber/vo/LgnHstryVO.java
+++ src/main/java/com/takensoft/cms/mber/vo/LgnHstryVO.java
... | ... | @@ -1,4 +1,47 @@ |
1 | 1 |
package com.takensoft.cms.mber.vo; |
2 | 2 |
|
3 |
+import lombok.*; |
|
4 |
+ |
|
5 |
+/** |
|
6 |
+ * @author : takensoft |
|
7 |
+ * @since : 2024.04.01 |
|
8 |
+ * |
|
9 |
+ * 로그인 이력 정보 관련 VO |
|
10 |
+ */ |
|
11 |
+@Getter |
|
12 |
+@Setter |
|
13 |
+@ToString |
|
14 |
+@Builder |
|
15 |
+@AllArgsConstructor |
|
16 |
+@NoArgsConstructor |
|
3 | 17 |
public class LgnHstryVO { |
18 |
+ |
|
19 |
+ /** |
|
20 |
+ * 로그인 아이디 |
|
21 |
+ */ |
|
22 |
+ private String lgnId; |
|
23 |
+ /** |
|
24 |
+ * 로그인 유형 |
|
25 |
+ */ |
|
26 |
+ private String lgnType; |
|
27 |
+ /** |
|
28 |
+ * 접속일 |
|
29 |
+ */ |
|
30 |
+ private String cntnDt; |
|
31 |
+ /** |
|
32 |
+ * 접속 아이피 |
|
33 |
+ */ |
|
34 |
+ private String cntnIp; |
|
35 |
+ /** |
|
36 |
+ * 접속 운영체제 |
|
37 |
+ */ |
|
38 |
+ private String cntnOperSys; |
|
39 |
+ /** |
|
40 |
+ * 디바이스명 |
|
41 |
+ */ |
|
42 |
+ private String deviceNm; |
|
43 |
+ /** |
|
44 |
+ * 브라우저명 |
|
45 |
+ */ |
|
46 |
+ private String brwsrNm; |
|
4 | 47 |
} |
--- src/main/java/com/takensoft/common/config/SecurityConfig.java
+++ src/main/java/com/takensoft/common/config/SecurityConfig.java
... | ... | @@ -1,5 +1,6 @@ |
1 | 1 |
package com.takensoft.common.config; |
2 | 2 |
|
3 |
+import com.takensoft.cms.mber.service.LgnHstryService; |
|
3 | 4 |
import com.takensoft.cms.mber.service.RefreshTokenService; |
4 | 5 |
import com.takensoft.common.filter.JWTFilter; |
5 | 6 |
import com.takensoft.common.filter.LoginFilter; |
... | ... | @@ -33,6 +34,7 @@ |
33 | 34 |
private final RefreshTokenService refreshTokenService; |
34 | 35 |
private final CustomAuthenticationEntryPoint authenticationEntryPoint; |
35 | 36 |
private final CustomAccessDenieHandler accessDenieHandler; |
37 |
+ private final LgnHstryService lgnHstryService; |
|
36 | 38 |
|
37 | 39 |
private static String FRONT_URL; // 프론트 접근 허용 URL |
38 | 40 |
private static long JWT_ACCESSTIME; // access 토큰 유지 시간 |
... | ... | @@ -40,7 +42,7 @@ |
40 | 42 |
private static int COOKIE_TIME; // 쿠키 유지 시간 |
41 | 43 |
|
42 | 44 |
public SecurityConfig(AuthenticationConfiguration authenticationConfiguration, JWTUtil jwtUtil, RefreshTokenService refreshTokenService, |
43 |
- CustomAuthenticationEntryPoint authenticationEntryPoint, CustomAccessDenieHandler accessDenieHandler, |
|
45 |
+ LgnHstryService lgnHstryService, CustomAuthenticationEntryPoint authenticationEntryPoint, CustomAccessDenieHandler accessDenieHandler, |
|
44 | 46 |
@Value("${front.url}")String fUrl,@Value("${jwt.accessTime}")long aTime, |
45 | 47 |
@Value("${jwt.refreshTime}")long rTime, @Value("${cookie.time}")int ctime) { |
46 | 48 |
this.authenticationConfiguration = authenticationConfiguration; |
... | ... | @@ -48,6 +50,7 @@ |
48 | 50 |
this.refreshTokenService = refreshTokenService; |
49 | 51 |
this.authenticationEntryPoint = authenticationEntryPoint; |
50 | 52 |
this.accessDenieHandler = accessDenieHandler; |
53 |
+ this.lgnHstryService = lgnHstryService; |
|
51 | 54 |
|
52 | 55 |
this.FRONT_URL = fUrl; |
53 | 56 |
this.JWT_ACCESSTIME = aTime; |
... | ... | @@ -112,7 +115,7 @@ |
112 | 115 |
// 토큰 검증 필터 |
113 | 116 |
http.addFilterBefore(new JWTFilter(jwtUtil), LoginFilter.class); |
114 | 117 |
// 로그인 필터 |
115 |
- http.addFilterAt(new LoginFilter(authenticationManager(authenticationConfiguration), jwtUtil, refreshTokenService, |
|
118 |
+ http.addFilterAt(new LoginFilter(authenticationManager(authenticationConfiguration), jwtUtil, refreshTokenService, lgnHstryService, |
|
116 | 119 |
JWT_ACCESSTIME, JWT_REFRESHTIME, COOKIE_TIME), UsernamePasswordAuthenticationFilter.class); |
117 | 120 |
|
118 | 121 |
return http.build(); |
--- src/main/java/com/takensoft/common/filter/LoginFilter.java
+++ src/main/java/com/takensoft/common/filter/LoginFilter.java
... | ... | @@ -3,11 +3,14 @@ |
3 | 3 |
import com.fasterxml.jackson.databind.ObjectMapper; |
4 | 4 |
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; |
5 | 5 |
import com.takensoft.cms.mber.dto.LoginDTO; |
6 |
+import com.takensoft.cms.mber.service.LgnHstryService; |
|
6 | 7 |
import com.takensoft.cms.mber.service.RefreshTokenService; |
8 |
+import com.takensoft.cms.mber.vo.LgnHstryVO; |
|
7 | 9 |
import com.takensoft.cms.mber.vo.MberVO; |
8 | 10 |
import com.takensoft.cms.mber.vo.RefreshVO; |
9 | 11 |
import com.takensoft.common.util.ErrorResponse; |
10 | 12 |
import com.takensoft.common.util.JWTUtil; |
13 |
+import com.takensoft.common.util.UserAgentUtils; |
|
11 | 14 |
import lombok.SneakyThrows; |
12 | 15 |
import org.springframework.beans.factory.annotation.Value; |
13 | 16 |
import org.springframework.http.HttpStatus; |
... | ... | @@ -32,16 +35,19 @@ |
32 | 35 |
private final AuthenticationManager authenticationManager; |
33 | 36 |
private final JWTUtil jwtUtil; |
34 | 37 |
private final RefreshTokenService refreshTokenService; |
38 |
+ private final LgnHstryService lgnHstryService; |
|
35 | 39 |
|
36 | 40 |
private static long JWT_ACCESSTIME; // access 토큰 유지 시간 |
37 | 41 |
private static long JWT_REFRESHTIME; // refresh 토큰 유지 시간 |
38 | 42 |
private static int COOKIE_TIME; // 쿠키 유지 시간 |
39 | 43 |
|
40 |
- public LoginFilter(AuthenticationManager authenticationManager, JWTUtil jwtUtil, RefreshTokenService refreshTokenService, |
|
44 |
+ public LoginFilter(AuthenticationManager authenticationManager, JWTUtil jwtUtil, RefreshTokenService refreshTokenService, LgnHstryService lgnHstryService, |
|
41 | 45 |
@Value("${jwt.accessTime}")long aTime, @Value("${jwt.refreshTime}")long rTime, @Value("${cookie.time}")int ctime) { |
42 | 46 |
this.authenticationManager = authenticationManager; |
43 | 47 |
this.jwtUtil = jwtUtil; |
44 | 48 |
this.refreshTokenService = refreshTokenService; |
49 |
+ this.lgnHstryService = lgnHstryService; |
|
50 |
+ |
|
45 | 51 |
|
46 | 52 |
this.JWT_ACCESSTIME = aTime; |
47 | 53 |
this.JWT_REFRESHTIME = rTime; |
... | ... | @@ -83,6 +89,21 @@ |
83 | 89 |
|
84 | 90 |
MberVO mber = (MberVO) authentication.getPrincipal(); |
85 | 91 |
|
92 |
+ // 로그인 이력 등록 |
|
93 |
+ LgnHstryVO lgnHstryVO = new LgnHstryVO(); |
|
94 |
+ lgnHstryVO.setLgnId(mber.getLgnId()); |
|
95 |
+ if(mber.getAuthorities().stream().anyMatch(role -> role.getAuthority().equals("ROLE_ADMIN"))) { |
|
96 |
+ lgnHstryVO.setLgnType("0"); |
|
97 |
+ } else { |
|
98 |
+ lgnHstryVO.setLgnType("1"); |
|
99 |
+ } |
|
100 |
+ lgnHstryVO.setCntnIp(req.getRemoteAddr()); |
|
101 |
+ lgnHstryVO.setCntnOperSys(UserAgentUtils.getOS(UserAgentUtils.getUserAgent(req))); |
|
102 |
+ lgnHstryVO.setDeviceNm(UserAgentUtils.getDevice(UserAgentUtils.getUserAgent(req))); |
|
103 |
+ lgnHstryVO.setBrwsrNm(UserAgentUtils.getBrowser(UserAgentUtils.getUserAgent(req))); |
|
104 |
+ lgnHstryService.LgnHstrySave(lgnHstryVO); |
|
105 |
+ |
|
106 |
+ |
|
86 | 107 |
// 토큰 생성(access, refresh) |
87 | 108 |
String accessToken = jwtUtil.createJwt("Authorization", mber.getMbrId(), mber.getLgnId(), (List) mber.getAuthorities(), JWT_ACCESSTIME); |
88 | 109 |
String refreshToken = jwtUtil.createJwt("refresh", mber.getMbrId(), mber.getLgnId(), (List) mber.getAuthorities(), JWT_REFRESHTIME); |
--- src/main/java/com/takensoft/common/idgen/context/ContextIdgen.java
+++ src/main/java/com/takensoft/common/idgen/context/ContextIdgen.java
... | ... | @@ -78,8 +78,8 @@ |
78 | 78 |
IdgenService idgenServiceImpl = new IdgenService(); |
79 | 79 |
idgenServiceImpl.setCipers(15); |
80 | 80 |
idgenServiceImpl.setFillChar('0'); |
81 |
- idgenServiceImpl.setPrefix("MBER_"); |
|
82 |
- idgenServiceImpl.setTblNm("MBER_ID"); |
|
81 |
+ idgenServiceImpl.setPrefix("MBR_"); |
|
82 |
+ idgenServiceImpl.setTblNm("MBR_ID"); |
|
83 | 83 |
return idgenServiceImpl; |
84 | 84 |
} |
85 | 85 |
|
... | ... | @@ -100,8 +100,8 @@ |
100 | 100 |
IdgenService idgenServiceImpl = new IdgenService(); |
101 | 101 |
idgenServiceImpl.setCipers(15); |
102 | 102 |
idgenServiceImpl.setFillChar('0'); |
103 |
- idgenServiceImpl.setPrefix("MENU_STSFDG_"); |
|
104 |
- idgenServiceImpl.setTblNm("MENU_STSFDG_ID"); |
|
103 |
+ idgenServiceImpl.setPrefix("MENU_DGSTFN_"); |
|
104 |
+ idgenServiceImpl.setTblNm("MENU_DGSTFN_ID"); |
|
105 | 105 |
return idgenServiceImpl; |
106 | 106 |
} |
107 | 107 |
}(파일 끝에 줄바꿈 문자 없음) |
--- src/main/java/com/takensoft/common/util/UserAgentUtils.java
+++ src/main/java/com/takensoft/common/util/UserAgentUtils.java
... | ... | @@ -1,4 +1,65 @@ |
1 | 1 |
package com.takensoft.common.util; |
2 | 2 |
|
3 |
+import javax.servlet.http.HttpServletRequest; |
|
4 |
+ |
|
5 |
+/** |
|
6 |
+ * 간단한 사용자 Agent정보 추출 |
|
7 |
+ */ |
|
3 | 8 |
public class UserAgentUtils { |
9 |
+ |
|
10 |
+ // HTTP 요청에서 User-Agent 해더 추출 |
|
11 |
+ public static String getUserAgent(HttpServletRequest req) { |
|
12 |
+ return req.getHeader("User-Agent"); |
|
13 |
+ } |
|
14 |
+ |
|
15 |
+ // 운영체제 정보 추출 |
|
16 |
+ public static String getOS(String userAgent) { |
|
17 |
+ String os = "Unknown"; |
|
18 |
+ |
|
19 |
+ // userAgent 문자열에서 운영체제 정보 추출 |
|
20 |
+ if(userAgent != null && !userAgent.isEmpty()) { |
|
21 |
+ if(userAgent.toLowerCase().contains("windows")) { |
|
22 |
+ os = "Windows"; |
|
23 |
+ } else if(userAgent.toLowerCase().contains("mac")) { |
|
24 |
+ os = "Mac"; |
|
25 |
+ } else if(userAgent.toLowerCase().contains("linux")) { |
|
26 |
+ os = "Linux"; |
|
27 |
+ } |
|
28 |
+ } |
|
29 |
+ return os; |
|
30 |
+ } |
|
31 |
+ |
|
32 |
+ // 디바이스 정보 추출 |
|
33 |
+ public static String getDevice(String userAgent) { |
|
34 |
+ String device = "Unknown"; |
|
35 |
+ // userAgent 문자열에서 디바이스 정보 추출 |
|
36 |
+ if(userAgent != null && !userAgent.isEmpty()) { |
|
37 |
+ if(userAgent.toLowerCase().contains("mobile")) { |
|
38 |
+ device = "Mobile"; |
|
39 |
+ } else { |
|
40 |
+ device = "Desktop"; |
|
41 |
+ } |
|
42 |
+ } |
|
43 |
+ return device; |
|
44 |
+ } |
|
45 |
+ |
|
46 |
+ // 브라우저 정보 추출 |
|
47 |
+ public static String getBrowser(String userAgent) { |
|
48 |
+ String browser = "Unknown"; |
|
49 |
+ // userAgent 문자열에서 브라우저저 정보추출 |
|
50 |
+ if(userAgent != null && !userAgent.isEmpty()) { |
|
51 |
+ if(userAgent.toLowerCase().contains("msie")) { |
|
52 |
+ browser = "Internet Explorer"; |
|
53 |
+ } else if(userAgent.toLowerCase().contains("firefox")) { |
|
54 |
+ browser = "Firefox"; |
|
55 |
+ } else if(userAgent.toLowerCase().contains("chrome")) { |
|
56 |
+ browser = "Chrome"; |
|
57 |
+ } else if(userAgent.toLowerCase().contains("safari")) { |
|
58 |
+ browser = "Safari"; |
|
59 |
+ } else if(userAgent.toLowerCase().contains("edge")) { |
|
60 |
+ browser = "Edge"; |
|
61 |
+ } |
|
62 |
+ } |
|
63 |
+ return browser; |
|
64 |
+ } |
|
4 | 65 |
} |
--- src/main/resources/mybatis/mapper/codeManage/codeManage-SQL.xml
+++ src/main/resources/mybatis/mapper/codeManage/codeManage-SQL.xml
... | ... | @@ -90,12 +90,7 @@ |
90 | 90 |
</choose> |
91 | 91 |
</select> |
92 | 92 |
|
93 |
- <!-- |
|
94 |
- 작성자 : takensoft |
|
95 |
- 작성일 : 2024.04.09 |
|
96 |
- 내 용 : 최상위 코드 조회 [관리자용] |
|
97 |
- --> |
|
98 |
- <select id="findTopCd" resultType="CodeManageVO"> |
|
93 |
+ <sql id="selectCd"> |
|
99 | 94 |
SELECT cd |
100 | 95 |
, up_cd |
101 | 96 |
, cd_nm |
... | ... | @@ -110,6 +105,14 @@ |
110 | 105 |
, mdfr |
111 | 106 |
, DATE_FORMAT(mdfcn_dt, '%Y-%m-%d %H:%i') AS mdfcn_dt |
112 | 107 |
FROM cd_mng |
108 |
+ </sql> |
|
109 |
+ <!-- |
|
110 |
+ 작성자 : takensoft |
|
111 |
+ 작성일 : 2024.04.09 |
|
112 |
+ 내 용 : 최상위 코드 조회 [관리자용] |
|
113 |
+ --> |
|
114 |
+ <select id="findTopCd" resultType="CodeManageVO"> |
|
115 |
+ <include refid="selectCd" /> |
|
113 | 116 |
WHERE up_cd IS NULL |
114 | 117 |
ORDER BY cd_sn |
115 | 118 |
</select> |
... | ... | @@ -120,20 +123,7 @@ |
120 | 123 |
내 용 : 하위 코드 조회 [관리자용] |
121 | 124 |
--> |
122 | 125 |
<select id="findChildCd" parameterType="String" resultType="CodeManageVO"> |
123 |
- SELECT cd |
|
124 |
- , up_cd |
|
125 |
- , cd_nm |
|
126 |
- , cd_vl |
|
127 |
- , cd_expln |
|
128 |
- , cd_grd |
|
129 |
- , cd_sn |
|
130 |
- , use_yn |
|
131 |
- , sys_pvsn_yn |
|
132 |
- , rgtr |
|
133 |
- , DATE_FORMAT(reg_dt, '%Y-%m-%d %H:%i') AS reg_dt |
|
134 |
- , mdfr |
|
135 |
- , DATE_FORMAT(mdfcn_dt, '%Y-%m-%d %H:%i') AS mdfcn_dt |
|
136 |
- FROM cd_mng |
|
126 |
+ <include refid="selectCd" /> |
|
137 | 127 |
WHERE up_cd = #{cd} |
138 | 128 |
ORDER BY cd_sn |
139 | 129 |
</select> |
... | ... | @@ -144,20 +134,7 @@ |
144 | 134 |
내 용 : 코드 상세 조회 |
145 | 135 |
--> |
146 | 136 |
<select id="findByCd" parameterType="String" resultType="CodeManageVO"> |
147 |
- SELECT cd |
|
148 |
- , up_cd |
|
149 |
- , cd_nm |
|
150 |
- , cd_vl |
|
151 |
- , cd_expln |
|
152 |
- , cd_grd |
|
153 |
- , cd_sn |
|
154 |
- , use_yn |
|
155 |
- , sys_pvsn_yn |
|
156 |
- , rgtr |
|
157 |
- , DATE_FORMAT(reg_dt, '%Y-%m-%d %H:%i') AS reg_dt |
|
158 |
- , mdfr |
|
159 |
- , DATE_FORMAT(mdfcn_dt, '%Y-%m-%d %H:%i') AS mdfcn_dt |
|
160 |
- FROM cd_mng |
|
137 |
+ <include refid="selectCd" /> |
|
161 | 138 |
WHERE cd = #{cd} |
162 | 139 |
</select> |
163 | 140 |
</mapper>(파일 끝에 줄바꿈 문자 없음) |
--- src/main/resources/mybatis/mapper/mber/lgnHstry-SQL.xml
+++ src/main/resources/mybatis/mapper/mber/lgnHstry-SQL.xml
... | ... | @@ -2,184 +2,33 @@ |
2 | 2 |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
3 | 3 |
<!-- |
4 | 4 |
작성자 : takensoft |
5 |
- 작성일 : 2024.04.03 |
|
6 |
- 내 용 : 회원정보 관련 |
|
5 |
+ 작성일 : 2024.04.09 |
|
6 |
+ 내 용 : 로그인 이력 관련 |
|
7 | 7 |
--> |
8 |
-<mapper namespace="com.takensoft.cms.mber.dao.MberDAO"> |
|
9 |
- |
|
10 |
- <!-- 회원 정보 resultMap(권한 포함) --> |
|
11 |
- <resultMap id="mberMap" type="MberVO"> |
|
12 |
- <result property="mbrId" column="mbr_id" /> |
|
13 |
- <result property="lgnId" column="lgn_id" /> |
|
14 |
- <result property="mbrNm" column="mbr_nm" /> |
|
15 |
- <result property="ncnm" column="ncnm" /> |
|
16 |
- <result property="password" column="password" /> |
|
17 |
- <result property="mblTelno" column="mbl_telno" /> |
|
18 |
- <result property="telno" column="telno" /> |
|
19 |
- <result property="eml" column="eml" /> |
|
20 |
- <result property="zip" column="zip" /> |
|
21 |
- <result property="addr" column="addr" /> |
|
22 |
- <result property="daddr" column="daddr" /> |
|
23 |
- <result property="mbrStts" column="mbr_stts" /> |
|
24 |
- <result property="useYn" column="use_yn" /> |
|
25 |
- <result property="cntrlDt" column="cntrl_dt" /> |
|
26 |
- <result property="cntrlRsn" column="cntrl_rsn" /> |
|
27 |
- <result property="smsRcptnAgreYn" column="sms_rcptn_agre_yn" /> |
|
28 |
- <result property="emlRcptnAgreYn" column="eml_rcptn_agre_yn" /> |
|
29 |
- <result property="prvcRcptnAgreYn" column="prvc_rcptn_agre_yn" /> |
|
30 |
- <result property="mbrType" column="mbr_type" /> |
|
31 |
- <result property="passwordChgDt" column="password_chg_dt" /> |
|
32 |
- <result property="frstRegIp" column="frst_reg_ip" /> |
|
33 |
- <result property="sysPvsnYn" column="sys_pvsn_yn" /> |
|
34 |
- <result property="rgtr" column="rgtr" /> |
|
35 |
- <result property="regDt" column="reg_dt" /> |
|
36 |
- <result property="mdfr" column="mdfr" /> |
|
37 |
- <result property="mdfcnDt" column="mdfcn_dt" /> |
|
38 |
- <collection property="authorList" column="{mbrId = mbr_id}" javaType="java.util.ArrayList" ofType="MberAuthorVO" select="findByMberAuthor" /> |
|
39 |
- </resultMap> |
|
40 |
- |
|
41 |
- <!-- 회원, 권한 매핑 --> |
|
42 |
- <resultMap id="authMap" type="MberAuthorVO"> |
|
43 |
- <result property="mbrId" column="mbr_id" /> |
|
44 |
- <result property="authrtCd" column="authrt_cd" /> |
|
45 |
- <result property="rgtr" column="rgtr" /> |
|
46 |
- <result property="regDt" column="reg_dt" /> |
|
47 |
- </resultMap> |
|
8 |
+<mapper namespace="com.takensoft.cms.mber.dao.LgnHstryDAO"> |
|
48 | 9 |
|
49 | 10 |
<!-- |
50 | 11 |
작성자 : takensoft |
51 |
- 작성일 : 2024.04.03 |
|
52 |
- 내 용 : 로그인 아이디 중복 확인 |
|
12 |
+ 작성일 : 2024.04.11 |
|
13 |
+ 내 용 : 로그인 이력 등록 |
|
53 | 14 |
--> |
54 |
- <select id="findByCheckLoginId" parameterType="String" resultType="boolean"> |
|
55 |
- SELECT COUNT(lgn_id) |
|
56 |
- FROM mbr_info |
|
57 |
- WHERE lgn_id = #{lgnId} |
|
58 |
- </select> |
|
59 |
- |
|
60 |
- <!-- |
|
61 |
- 작성자 : takensoft |
|
62 |
- 작성일 : 2024.04.03 |
|
63 |
- 내 용 : 회원가입 |
|
64 |
- --> |
|
65 |
- <insert id="save" parameterType="JoinDTO"> |
|
66 |
- INSERT INTO mbr_info ( |
|
67 |
- mbr_id |
|
68 |
- , lgn_id |
|
69 |
- , mbr_nm |
|
70 |
- , ncnm |
|
71 |
- , password |
|
72 |
- , mbl_telno |
|
73 |
- , telno |
|
74 |
- , eml |
|
75 |
- , zip |
|
76 |
- , addr |
|
77 |
- , daddr |
|
78 |
- , mbr_stts |
|
79 |
- , use_yn |
|
80 |
- , sms_rcptn_agre_yn |
|
81 |
- , eml_rcptn_agre_yn |
|
82 |
- , prvc_rcptn_agre_yn |
|
83 |
- , mbr_type |
|
84 |
- , password_chg_dt |
|
85 |
- , frst_reg_ip |
|
86 |
- , sys_pvsn_yn |
|
87 |
- , rgtr |
|
88 |
- , reg_dt |
|
15 |
+ <insert id="save" parameterType="LgnHstryVO"> |
|
16 |
+ INSERT INTO lgn_hstry ( |
|
17 |
+ lgn_id |
|
18 |
+ , lgn_type |
|
19 |
+ , cntn_dt |
|
20 |
+ , cntn_ip |
|
21 |
+ , cntn_oper_sys |
|
22 |
+ , device_nm |
|
23 |
+ , brwsr_nm |
|
89 | 24 |
) VALUES ( |
90 |
- #{mbrId} |
|
91 |
- , #{lgnId} |
|
92 |
- , #{mbrNm} |
|
93 |
- , #{ncnm} |
|
94 |
- , #{password} |
|
95 |
- , #{mblTelno} |
|
96 |
- , #{telno} |
|
97 |
- , #{eml} |
|
98 |
- , #{zip} |
|
99 |
- , #{addr} |
|
100 |
- , #{daddr} |
|
101 |
- , 1 |
|
102 |
- , 'Y' |
|
103 |
- , #{smsRcptnAgreYn} |
|
104 |
- , #{emlRcptnAgreYn} |
|
105 |
- , #{prvcRcptnAgreYn} |
|
106 |
- , 'S' |
|
25 |
+ #{lgnId} |
|
26 |
+ , #{lgnType} |
|
107 | 27 |
, NOW() |
108 |
- , #{frstRegIp} |
|
109 |
- , 1 |
|
110 |
- , #{rgtr} |
|
111 |
- , NOW() |
|
28 |
+ , #{cntnIp} |
|
29 |
+ , #{cntnOperSys} |
|
30 |
+ , #{deviceNm} |
|
31 |
+ , #{brwsrNm} |
|
112 | 32 |
) |
113 | 33 |
</insert> |
114 |
- |
|
115 |
- <!-- |
|
116 |
- 작성자 : takensoft |
|
117 |
- 작성일 : 2024.04.03 |
|
118 |
- 내 용 : 회원 권한 등록 |
|
119 |
- --> |
|
120 |
- <insert id="authorSave" parameterType="MberAuthorVO"> |
|
121 |
- INSERT INTO mbr_authrt_info ( |
|
122 |
- mbr_id |
|
123 |
- , authrt_cd |
|
124 |
- , rgtr |
|
125 |
- , reg_dt |
|
126 |
- ) VALUE ( |
|
127 |
- #{mbrId} |
|
128 |
- , #{authrtCd} |
|
129 |
- , #{rgtr} |
|
130 |
- , NOW() |
|
131 |
- ) |
|
132 |
- </insert> |
|
133 |
- |
|
134 |
- <!-- |
|
135 |
- 작성자 : takensoft |
|
136 |
- 작성일 : 2024.04.03 |
|
137 |
- 내 용 : 회원정보 조회 |
|
138 |
- --> |
|
139 |
- <select id="findByMber" parameterType="String" resultMap="mberMap"> |
|
140 |
- SELECT mi.mbr_id |
|
141 |
- , mi.lgn_id |
|
142 |
- , mi.mbr_nm |
|
143 |
- , mi.ncnm |
|
144 |
- , mi.password |
|
145 |
- , mi.mbl_telno |
|
146 |
- , mi.telno |
|
147 |
- , mi.eml |
|
148 |
- , mi.zip |
|
149 |
- , mi.addr |
|
150 |
- , mi.daddr |
|
151 |
- , mi.mbr_stts |
|
152 |
- , mi.use_yn |
|
153 |
- , DATE_FORMAT(mi.cntrl_dt, '%Y-%m-%d %H:%i') AS cntrl_dt |
|
154 |
- , mi.cntrl_rsn |
|
155 |
- , mi.sms_rcptn_agre_yn |
|
156 |
- , mi.eml_rcptn_agre_yn |
|
157 |
- , mi.prvc_rcptn_agre_yn |
|
158 |
- , mi.mbr_type |
|
159 |
- , DATE_FORMAT(mi.password_chg_dt, '%Y-%m-%d %H:%i') AS password_chg_dt |
|
160 |
- , mi.frst_reg_ip |
|
161 |
- , mi.sys_pvsn_yn |
|
162 |
- , mi.rgtr |
|
163 |
- , DATE_FORMAT(mi.reg_dt, '%Y-%m-%d %H:%i') AS reg_dt |
|
164 |
- , mi.mdfr |
|
165 |
- , DATE_FORMAT(mi.mdfcn_dt, '%Y-%m-%d %H:%i') AS mdfcn_dt |
|
166 |
- FROM mbr_info mi |
|
167 |
- WHERE mi.lgn_id = #{lgnId} |
|
168 |
- AND mi.use_yn = 'Y' |
|
169 |
- </select> |
|
170 |
- |
|
171 |
- <!-- |
|
172 |
- 작성자 : takensoft |
|
173 |
- 작성일 : 2024.04.03 |
|
174 |
- 내 용 : 회원 권한 정보 조회 |
|
175 |
- --> |
|
176 |
- <select id="findByMberAuthor" parameterType="MberVO" resultMap="authMap"> |
|
177 |
- SELECT mai.mbr_id |
|
178 |
- , mai.authrt_cd |
|
179 |
- , mai.rgtr |
|
180 |
- , DATE_FORMAT(mai.reg_dt, '%Y-%m-%d %H:%i') AS reg_dt |
|
181 |
- FROM mbr_authrt_info mai |
|
182 |
- WHERE mai.mbr_id = #{mbrId} |
|
183 |
- </select> |
|
184 |
- |
|
185 | 34 |
</mapper>(파일 끝에 줄바꿈 문자 없음) |
--- src/main/resources/mybatis/mapper/mber/mber-SQL.xml
+++ src/main/resources/mybatis/mapper/mber/mber-SQL.xml
... | ... | @@ -81,7 +81,7 @@ |
81 | 81 |
, eml_rcptn_agre_yn |
82 | 82 |
, prvc_rcptn_agre_yn |
83 | 83 |
, mbr_type |
84 |
- , password_change_de |
|
84 |
+ , password_chg_dt |
|
85 | 85 |
, frst_reg_ip |
86 | 86 |
, sys_pvsn_yn |
87 | 87 |
, rgtr |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?