guntaek
08-07
Merge branch 'master' of http://210.180.118.83/sjbang/lms_back
@e052c2a887bdf451e87feed9dacfe6aa8b4d5254
+++ src/main/java/com/takensoft/ai_lms/common/confing/RedisConfig.java
... | ... | @@ -0,0 +1,26 @@ |
1 | +package com.takensoft.ai_lms.common.confing; | |
2 | + | |
3 | +import org.springframework.context.annotation.Bean; | |
4 | +import org.springframework.context.annotation.Configuration; | |
5 | +import org.springframework.data.redis.connection.RedisConnectionFactory; | |
6 | +import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; | |
7 | +import org.springframework.data.redis.core.RedisTemplate; | |
8 | +import org.springframework.data.redis.serializer.StringRedisSerializer; | |
9 | + | |
10 | +@Configuration | |
11 | +public class RedisConfig { | |
12 | + | |
13 | + @Bean | |
14 | + public RedisConnectionFactory redisConnectionFactory() { | |
15 | + return new LettuceConnectionFactory(); | |
16 | + } | |
17 | + | |
18 | + @Bean | |
19 | + public RedisTemplate<String, String> redisTemplate(RedisConnectionFactory connectionFactory) { | |
20 | + RedisTemplate<String, String> redisTemplate = new RedisTemplate<>(); | |
21 | + redisTemplate.setConnectionFactory(connectionFactory); | |
22 | + redisTemplate.setKeySerializer(new StringRedisSerializer()); | |
23 | + redisTemplate.setValueSerializer(new StringRedisSerializer()); | |
24 | + return redisTemplate; | |
25 | + } | |
26 | +} |
--- src/main/java/com/takensoft/ai_lms/common/confing/SecurityConfig.java
+++ src/main/java/com/takensoft/ai_lms/common/confing/SecurityConfig.java
... | ... | @@ -6,6 +6,7 @@ |
6 | 6 |
import org.springframework.beans.factory.annotation.Value; |
7 | 7 |
import org.springframework.context.annotation.Bean; |
8 | 8 |
import org.springframework.context.annotation.Configuration; |
9 |
+import org.springframework.data.redis.core.RedisTemplate; |
|
9 | 10 |
import org.springframework.security.authentication.AuthenticationManager; |
10 | 11 |
import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration; |
11 | 12 |
import org.springframework.security.config.annotation.web.builders.HttpSecurity; |
... | ... | @@ -29,16 +30,20 @@ |
29 | 30 |
private final JwtUtil jwtUtil; |
30 | 31 |
private final CommonConfig commonConfig; |
31 | 32 |
|
33 |
+ private final RedisTemplate<String, String> redisTemplate; |
|
34 |
+ |
|
32 | 35 |
private static String FRONT_URL; // 프론트 경로 |
33 | 36 |
private static long JWT_ACCESSTIME; // access 토큰 유지 시간 |
34 | 37 |
private static int COOKIE_TIME; // 쿠키 유지 시간 |
35 | 38 |
|
39 |
+ |
|
36 | 40 |
public SecurityConfig(AuthenticationConfiguration authenticationConfiguration, JwtUtil jwtUtil, CommonConfig commonConfig, |
37 |
- @Value("${frontUrl}") String fUrl, @Value("${spring.jwt.accessTime}") long aTime, @Value("${spring.jwt.refreshTime}") long rTime, @Value("${cookie.time}") int ctime |
|
41 |
+ RedisTemplate<String, String> redisTemplate, @Value("${frontUrl}") String fUrl, @Value("${spring.jwt.accessTime}") long aTime, @Value("${spring.jwt.refreshTime}") long rTime, @Value("${cookie.time}") int ctime |
|
38 | 42 |
) { |
39 | 43 |
this.authenticationConfiguration = authenticationConfiguration; |
40 | 44 |
this.jwtUtil = jwtUtil; |
41 | 45 |
this.commonConfig = commonConfig; |
46 |
+ this.redisTemplate = redisTemplate; |
|
42 | 47 |
|
43 | 48 |
this.FRONT_URL = fUrl; |
44 | 49 |
this.JWT_ACCESSTIME = aTime; |
... | ... | @@ -90,7 +95,7 @@ |
90 | 95 |
.anyRequest().authenticated()); // 나머지 경로는 인증 필요 |
91 | 96 |
|
92 | 97 |
// jwt 필터 처리 적용 |
93 |
- http.addFilterBefore(new JwtFilter(jwtUtil, commonConfig), LoginFilter.class); // 토큰 검증 필터 |
|
98 |
+ http.addFilterBefore(new JwtFilter(jwtUtil, commonConfig, redisTemplate), LoginFilter.class); // 토큰 검증 필터 |
|
94 | 99 |
http.addFilterAt(new LoginFilter(authenticationManager(authenticationConfiguration), jwtUtil, commonConfig, JWT_ACCESSTIME), UsernamePasswordAuthenticationFilter.class); |
95 | 100 |
|
96 | 101 |
return http.build(); |
--- src/main/java/com/takensoft/ai_lms/common/filter/JwtFilter.java
+++ src/main/java/com/takensoft/ai_lms/common/filter/JwtFilter.java
... | ... | @@ -11,6 +11,7 @@ |
11 | 11 |
import jakarta.servlet.http.HttpServletRequest; |
12 | 12 |
import jakarta.servlet.http.HttpServletResponse; |
13 | 13 |
import lombok.RequiredArgsConstructor; |
14 |
+import org.springframework.data.redis.core.RedisTemplate; |
|
14 | 15 |
import org.springframework.http.HttpStatus; |
15 | 16 |
import org.springframework.http.MediaType; |
16 | 17 |
import org.springframework.security.authentication.InsufficientAuthenticationException; |
... | ... | @@ -30,6 +31,7 @@ |
30 | 31 |
|
31 | 32 |
private final JwtUtil jwtUtil; |
32 | 33 |
private final CommonConfig commonConfig; |
34 |
+ private final RedisTemplate<String, String> redisTemplate; |
|
33 | 35 |
|
34 | 36 |
@Override |
35 | 37 |
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws jakarta.servlet.ServletException, IOException { |
... | ... | @@ -45,6 +47,12 @@ |
45 | 47 |
if (jwtUtil.isExpired(accessToken)) { |
46 | 48 |
throw new JwtException("Token expired"); |
47 | 49 |
} |
50 |
+ |
|
51 |
+ // Redis에서 토큰이 존재하는지 확인 (로그아웃된 토큰인지 확인) |
|
52 |
+ if (redisTemplate.hasKey(accessToken)) { |
|
53 |
+ throw new JwtException("Invalid token"); |
|
54 |
+ } |
|
55 |
+ |
|
48 | 56 |
// 토큰에서 페이로드 확인[ 발급시 명시 ] |
49 | 57 |
String category = jwtUtil.getCategory(accessToken); |
50 | 58 |
if (!category.equals("Authorization")) { |
--- src/main/java/com/takensoft/ai_lms/lms/auth/service/AuthService.java
+++ src/main/java/com/takensoft/ai_lms/lms/auth/service/AuthService.java
... | ... | @@ -1,5 +1,6 @@ |
1 | 1 |
package com.takensoft.ai_lms.lms.auth.service; |
2 | 2 |
|
3 |
+import com.takensoft.ai_lms.lms.auth.dto.LoginDTO; |
|
3 | 4 |
import com.takensoft.ai_lms.lms.auth.vo.UserVO; |
4 | 5 |
|
5 | 6 |
/** |
... | ... | @@ -10,4 +11,8 @@ |
10 | 11 |
*/ |
11 | 12 |
public interface AuthService { |
12 | 13 |
int insertUser(UserVO userVO) throws Exception; |
14 |
+ |
|
15 |
+ String login(LoginDTO loginDTO) throws Exception; |
|
16 |
+ |
|
17 |
+ void logout(String token) throws Exception; |
|
13 | 18 |
} |
--- src/main/java/com/takensoft/ai_lms/lms/auth/service/Impl/AuthServiceImpl.java
+++ src/main/java/com/takensoft/ai_lms/lms/auth/service/Impl/AuthServiceImpl.java
... | ... | @@ -3,10 +3,14 @@ |
3 | 3 |
import com.takensoft.ai_lms.common.idgen.service.IdgenService; |
4 | 4 |
import com.takensoft.ai_lms.common.util.JwtUtil; |
5 | 5 |
import com.takensoft.ai_lms.lms.auth.dao.AuthDAO; |
6 |
+import com.takensoft.ai_lms.lms.auth.dto.LoginDTO; |
|
6 | 7 |
import com.takensoft.ai_lms.lms.auth.service.AuthService; |
7 | 8 |
import com.takensoft.ai_lms.lms.auth.vo.UserVO; |
8 | 9 |
import lombok.RequiredArgsConstructor; |
9 | 10 |
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; |
11 |
+import org.springframework.beans.factory.annotation.Value; |
|
12 |
+import org.springframework.data.redis.core.RedisTemplate; |
|
13 |
+import org.springframework.security.core.GrantedAuthority; |
|
10 | 14 |
import org.springframework.security.core.userdetails.UserDetails; |
11 | 15 |
import org.springframework.security.core.userdetails.UserDetailsService; |
12 | 16 |
import org.springframework.security.core.userdetails.UsernameNotFoundException; |
... | ... | @@ -16,6 +20,8 @@ |
16 | 20 |
|
17 | 21 |
import java.util.HashMap; |
18 | 22 |
import java.util.Map; |
23 |
+import java.util.concurrent.TimeUnit; |
|
24 |
+import java.util.stream.Collectors; |
|
19 | 25 |
|
20 | 26 |
/** |
21 | 27 |
* @author : 방선주 |
... | ... | @@ -31,6 +37,10 @@ |
31 | 37 |
private final AuthDAO authDAO; |
32 | 38 |
private final BCryptPasswordEncoder bCryptPasswordEncoder; |
33 | 39 |
private final JwtUtil jwtUtil; |
40 |
+ @Value("${spring.jwt.accessTime}") |
|
41 |
+ private long jwtAccessTime; |
|
42 |
+ |
|
43 |
+ private final RedisTemplate<String, String> redisTemplate; |
|
34 | 44 |
|
35 | 45 |
private final IdgenService userIdgn; |
36 | 46 |
|
... | ... | @@ -72,6 +82,46 @@ |
72 | 82 |
return result; |
73 | 83 |
} |
74 | 84 |
|
85 |
+ /** |
|
86 |
+ * @author : 박민혁 |
|
87 |
+ * @since : 2024.08.02 |
|
88 |
+ * 로그인 기능 |
|
89 |
+ */ |
|
90 |
+ @Override |
|
91 |
+ public String login(LoginDTO loginDTO) throws Exception{ |
|
92 |
+ try { |
|
93 |
+ UserDetails userDetails = loadUserByUsername(loginDTO.getLoginId()); |
|
94 |
+ if (userDetails != null && bCryptPasswordEncoder.matches(loginDTO.getPassword(), userDetails.getPassword())) { |
|
95 |
+ UserVO userVO = (UserVO) userDetails; |
|
96 |
+ return jwtUtil.createJwt( |
|
97 |
+ "access", |
|
98 |
+ userVO.getUsid(), |
|
99 |
+ userVO.getLoginId(), |
|
100 |
+ userVO.getUserNm(), |
|
101 |
+ userVO.getAuthorities().stream().map(GrantedAuthority::getAuthority).collect(Collectors.toList()), |
|
102 |
+ jwtAccessTime // 액세스 토큰 유효 시간 |
|
103 |
+ ); |
|
104 |
+ } else { |
|
105 |
+ throw new UsernameNotFoundException("유효하지 않은 사용자 이름 또는 비밀번호"); |
|
106 |
+ } |
|
107 |
+ } catch (UsernameNotFoundException e) { |
|
108 |
+ throw new Exception("유효하지 않은 사용자 이름 또는 비밀번호", e); |
|
109 |
+ } |
|
110 |
+ } |
|
111 |
+ |
|
112 |
+ @Override |
|
113 |
+ public void logout(String token) throws Exception { |
|
114 |
+ try { |
|
115 |
+ // 토큰에서 사용자 ID 추출 |
|
116 |
+ String userId = jwtUtil.getUsid(token); |
|
117 |
+ |
|
118 |
+ // Redis에 토큰을 저장하여 무효화 시킴 |
|
119 |
+ redisTemplate.opsForValue().set(token, userId, jwtAccessTime, TimeUnit.MILLISECONDS); |
|
120 |
+ } catch (Exception e) { |
|
121 |
+ System.err.println("로그아웃 오류: " + e.getMessage()); |
|
122 |
+ throw new Exception("로그아웃 중 오류가 발생했습니다.", e); |
|
123 |
+ } |
|
124 |
+ } |
|
75 | 125 |
|
76 | 126 |
} |
77 | 127 |
|
--- src/main/java/com/takensoft/ai_lms/lms/auth/web/AuthController.java
+++ src/main/java/com/takensoft/ai_lms/lms/auth/web/AuthController.java
... | ... | @@ -2,15 +2,13 @@ |
2 | 2 |
|
3 | 3 |
import com.google.gson.Gson; |
4 | 4 |
import com.google.gson.JsonObject; |
5 |
+import com.takensoft.ai_lms.lms.auth.dto.LoginDTO; |
|
5 | 6 |
import com.takensoft.ai_lms.lms.auth.service.AuthService; |
6 | 7 |
import com.takensoft.ai_lms.lms.auth.vo.UserVO; |
7 | 8 |
import io.swagger.v3.oas.annotations.Operation; |
8 | 9 |
import lombok.RequiredArgsConstructor; |
9 | 10 |
import lombok.extern.slf4j.Slf4j; |
10 |
-import org.springframework.web.bind.annotation.PostMapping; |
|
11 |
-import org.springframework.web.bind.annotation.RequestBody; |
|
12 |
-import org.springframework.web.bind.annotation.RequestMapping; |
|
13 |
-import org.springframework.web.bind.annotation.RestController; |
|
11 |
+import org.springframework.web.bind.annotation.*; |
|
14 | 12 |
|
15 | 13 |
/** |
16 | 14 |
* @author : 방선주 |
... | ... | @@ -62,5 +60,46 @@ |
62 | 60 |
|
63 | 61 |
} |
64 | 62 |
|
63 |
+ /** |
|
64 |
+ * @author : 박민혁 |
|
65 |
+ * @since : 2024.08.02 |
|
66 |
+ * 로그인 기능 |
|
67 |
+ */ |
|
68 |
+ @PostMapping("/login.json") |
|
69 |
+ @Operation(summary = "사용자 로그인") |
|
70 |
+ public String login(@RequestBody LoginDTO loginDTO) { |
|
71 |
+ Gson gson = new Gson(); |
|
72 |
+ JsonObject response = new JsonObject(); |
|
73 |
+ |
|
74 |
+ try { |
|
75 |
+ String token = authService.login(loginDTO); |
|
76 |
+ response.addProperty("status", "success"); |
|
77 |
+ response.addProperty("token", token); |
|
78 |
+ return gson.toJson(response); |
|
79 |
+ } catch (Exception e) { |
|
80 |
+ response.addProperty("status", "error"); |
|
81 |
+ response.addProperty("message", e.getMessage()); |
|
82 |
+ return gson.toJson(response); |
|
83 |
+ } |
|
84 |
+ } |
|
85 |
+ |
|
86 |
+ @PostMapping("/logout.json") |
|
87 |
+ @Operation(summary = "사용자 로그아웃") |
|
88 |
+ public String logout(@RequestHeader("Authorization") String token) { |
|
89 |
+ Gson gson = new Gson(); |
|
90 |
+ JsonObject response = new JsonObject(); |
|
91 |
+ |
|
92 |
+ try { |
|
93 |
+ authService.logout(token); |
|
94 |
+ |
|
95 |
+ response.addProperty("status", "success"); |
|
96 |
+ response.addProperty("message", "성공적으로 로그아웃되었습니다."); |
|
97 |
+ return gson.toJson(response); |
|
98 |
+ } catch (Exception e) { |
|
99 |
+ response.addProperty("status", "error"); |
|
100 |
+ response.addProperty("message", e.getMessage()); |
|
101 |
+ return gson.toJson(response); |
|
102 |
+ } |
|
103 |
+ } |
|
65 | 104 |
|
66 | 105 |
} |
--- src/main/java/com/takensoft/ai_lms/lms/board/dao/BoardDAO.java
+++ src/main/java/com/takensoft/ai_lms/lms/board/dao/BoardDAO.java
... | ... | @@ -1,6 +1,7 @@ |
1 | 1 |
package com.takensoft.ai_lms.lms.board.dao; |
2 | 2 |
|
3 | 3 |
|
4 |
+import com.takensoft.ai_lms.lms.board.vo.BoardStudentVO; |
|
4 | 5 |
import com.takensoft.ai_lms.lms.board.vo.BoardVO; |
5 | 6 |
import org.egovframe.rte.psl.dataaccess.mapper.Mapper; |
6 | 7 |
|
... | ... | @@ -38,6 +39,29 @@ |
38 | 39 |
// 게시글 검색 |
39 | 40 |
List<HashMap<String, Object>> searchBoard(HashMap<String, Object> params) throws Exception; |
40 | 41 |
|
42 |
+ // 학생 게시판 등록 |
|
43 |
+ int insertBoardStudent(BoardStudentVO boardStudentVO) throws Exception; |
|
44 |
+ |
|
45 |
+ // 학생 게시판 삭세 |
|
46 |
+ int deleteBoardStudent(String bbsId) throws Exception; |
|
47 |
+ |
|
48 |
+ // 학생 게시판 조회 |
|
49 |
+ List<BoardStudentVO> boardStudentList(HashMap<String, Object> params) throws Exception; |
|
50 |
+ |
|
51 |
+ // 학생 게시판 수 조회 |
|
52 |
+ int boardStudentCount(HashMap<String, Object> params) throws Exception; |
|
53 |
+ |
|
54 |
+ // 학생 게시판 조회 여부 체크 |
|
55 |
+ int updateBoardCheck(HashMap<String, Object> params) throws Exception; |
|
56 |
+ |
|
57 |
+ // 학생 게시판 조회 여부 일괄 갱신 |
|
58 |
+ int updateAllBoardCheck(HashMap<String, Object> params) throws Exception; |
|
59 |
+ |
|
60 |
+ // 학생 게시판 조회 안한 게시물 수 조회 |
|
61 |
+ int checkCount(HashMap<String, Object> params) throws Exception; |
|
62 |
+ |
|
63 |
+ |
|
64 |
+ |
|
41 | 65 |
|
42 | 66 |
|
43 | 67 |
} |
--- src/main/java/com/takensoft/ai_lms/lms/board/service/BoardService.java
+++ src/main/java/com/takensoft/ai_lms/lms/board/service/BoardService.java
... | ... | @@ -1,5 +1,6 @@ |
1 | 1 |
package com.takensoft.ai_lms.lms.board.service; |
2 | 2 |
|
3 |
+import com.takensoft.ai_lms.lms.board.vo.BoardStudentVO; |
|
3 | 4 |
import com.takensoft.ai_lms.lms.board.vo.BoardVO; |
4 | 5 |
|
5 | 6 |
import java.util.HashMap; |
... | ... | @@ -34,4 +35,25 @@ |
34 | 35 |
|
35 | 36 |
// 게시글 검색 |
36 | 37 |
List<HashMap<String, Object>> searchBoard(HashMap<String, Object> params) throws Exception; |
38 |
+ |
|
39 |
+ // 학생 게시판 등록 |
|
40 |
+ int insertBoardStudent(BoardStudentVO boardStudentVO) throws Exception; |
|
41 |
+ |
|
42 |
+ // 학생 게시판 삭세 |
|
43 |
+ int deleteBoardStudent(String bbsId) throws Exception; |
|
44 |
+ |
|
45 |
+ // 학생 게시판 전체 조회 |
|
46 |
+ List<BoardStudentVO> boardStudentList(HashMap<String, Object> params) throws Exception; |
|
47 |
+ |
|
48 |
+ // 학생 게시판 수 조회 |
|
49 |
+ int boardStudentCount(HashMap<String, Object> params) throws Exception; |
|
50 |
+ |
|
51 |
+ // 학생 게시판 조회 여부 체크 |
|
52 |
+ int updateBoardCheck(HashMap<String, Object> params) throws Exception; |
|
53 |
+ |
|
54 |
+ // 학생 게시판 조회 여부 일괄 갱신 |
|
55 |
+ int updateAllBoardCheck(HashMap<String, Object> params) throws Exception; |
|
56 |
+ |
|
57 |
+ // 학생 게시판 조회 안한 게시물 수 조회 |
|
58 |
+ int checkCount(HashMap<String, Object> params) throws Exception; |
|
37 | 59 |
} |
--- src/main/java/com/takensoft/ai_lms/lms/board/service/impl/BoardServiceImpl.java
+++ src/main/java/com/takensoft/ai_lms/lms/board/service/impl/BoardServiceImpl.java
... | ... | @@ -3,6 +3,7 @@ |
3 | 3 |
import com.takensoft.ai_lms.common.idgen.service.IdgenService; |
4 | 4 |
import com.takensoft.ai_lms.lms.board.dao.BoardDAO; |
5 | 5 |
import com.takensoft.ai_lms.lms.board.service.BoardService; |
6 |
+import com.takensoft.ai_lms.lms.board.vo.BoardStudentVO; |
|
6 | 7 |
import com.takensoft.ai_lms.lms.board.vo.BoardVO; |
7 | 8 |
import lombok.RequiredArgsConstructor; |
8 | 9 |
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; |
... | ... | @@ -24,7 +25,15 @@ |
24 | 25 |
public int insertBoard(BoardVO boardVO) throws Exception { |
25 | 26 |
String boardId = boardIdgn.getNextStringId(); |
26 | 27 |
boardVO.setBbsId(boardId); |
27 |
- return boardDAO.insertBoard(boardVO); |
|
28 |
+ int result = boardDAO.insertBoard(boardVO); |
|
29 |
+ |
|
30 |
+ if(result > 0) { |
|
31 |
+ BoardStudentVO boardStudentVO = new BoardStudentVO(); |
|
32 |
+ boardStudentVO.setBbsId(boardId); |
|
33 |
+ boardDAO.insertBoardStudent(boardStudentVO); |
|
34 |
+ } |
|
35 |
+ |
|
36 |
+ return result; |
|
28 | 37 |
} |
29 | 38 |
// 게시글 전체 조회 |
30 | 39 |
@Override |
... | ... | @@ -62,7 +71,13 @@ |
62 | 71 |
// 게시글 삭제 |
63 | 72 |
@Override |
64 | 73 |
public int deleteBoard(String bbsId) throws Exception{ |
65 |
- return boardDAO.deleteBoard(bbsId); |
|
74 |
+ int result = boardDAO.deleteBoard(bbsId); |
|
75 |
+ |
|
76 |
+ if(result > 0) { |
|
77 |
+ boardDAO.deleteBoardStudent(bbsId); |
|
78 |
+ } |
|
79 |
+ |
|
80 |
+ return result; |
|
66 | 81 |
} |
67 | 82 |
|
68 | 83 |
// 게시글 검색 |
... | ... | @@ -72,6 +87,57 @@ |
72 | 87 |
} |
73 | 88 |
|
74 | 89 |
|
90 |
+ // 학생 게시판 등록 |
|
91 |
+ @Override |
|
92 |
+ public int insertBoardStudent(BoardStudentVO boardStudentVO) throws Exception { |
|
93 |
+ return boardDAO.insertBoardStudent(boardStudentVO); |
|
94 |
+ } |
|
95 |
+ |
|
96 |
+ // 학생 게시판 삭세 |
|
97 |
+ @Override |
|
98 |
+ public int deleteBoardStudent(String bbsId) throws Exception { |
|
99 |
+ return boardDAO.deleteBoardStudent(bbsId); |
|
100 |
+ } |
|
101 |
+ |
|
102 |
+ |
|
103 |
+ // 학생 게시판 조회 |
|
104 |
+ @Override |
|
105 |
+ public List<BoardStudentVO> boardStudentList(HashMap<String, Object> params) throws Exception{ |
|
106 |
+ int page = Integer.parseInt(params.get("page").toString()); |
|
107 |
+ int pageSize = Integer.parseInt(params.get("pageSize").toString()); |
|
108 |
+ |
|
109 |
+ // 조회를 위한 startIndex 계산 |
|
110 |
+ int startIndex = (page - 1) * pageSize; |
|
111 |
+ params.put("startIndex", startIndex); |
|
112 |
+ params.put("pageSize", pageSize); |
|
113 |
+ System.out.println(startIndex); |
|
114 |
+ return boardDAO.boardStudentList(params); |
|
115 |
+ } |
|
116 |
+ |
|
117 |
+ // 학생 게시판 수 조회 |
|
118 |
+ @Override |
|
119 |
+ public int boardStudentCount(HashMap<String, Object> params) throws Exception { |
|
120 |
+ return boardDAO.boardStudentCount(params); |
|
121 |
+ } |
|
122 |
+ |
|
123 |
+ // 학생 게시판 조회 여부 체크 |
|
124 |
+ @Override |
|
125 |
+ public int updateBoardCheck(HashMap<String, Object> params) throws Exception{ |
|
126 |
+ return boardDAO.updateBoardCheck(params); |
|
127 |
+ } |
|
128 |
+ |
|
129 |
+ // 학생 게시판 조회 여부 일괄 갱신 |
|
130 |
+ @Override |
|
131 |
+ public int updateAllBoardCheck(HashMap<String, Object> params) throws Exception{ |
|
132 |
+ return boardDAO.updateAllBoardCheck(params); |
|
133 |
+ } |
|
134 |
+ |
|
135 |
+ // 학생 게시판 조회 안한 게시물 수 조회 |
|
136 |
+ @Override |
|
137 |
+ public int checkCount(HashMap<String, Object> params) throws Exception{ |
|
138 |
+ return boardDAO.checkCount(params); |
|
139 |
+ } |
|
140 |
+ |
|
75 | 141 |
|
76 | 142 |
|
77 | 143 |
} |
+++ src/main/java/com/takensoft/ai_lms/lms/board/vo/BoardStudentVO.java
... | ... | @@ -0,0 +1,30 @@ |
1 | +package com.takensoft.ai_lms.lms.board.vo; | |
2 | + | |
3 | + | |
4 | +import lombok.AllArgsConstructor; | |
5 | +import lombok.Getter; | |
6 | +import lombok.NoArgsConstructor; | |
7 | +import lombok.Setter; | |
8 | + | |
9 | +/** | |
10 | + * @author : 박세훈 | |
11 | + * since : 2024.08.06 | |
12 | + * | |
13 | + * 학생 게시판 정보 관련 VO | |
14 | + */ | |
15 | + | |
16 | +@Getter | |
17 | +@Setter | |
18 | +@NoArgsConstructor | |
19 | +@AllArgsConstructor | |
20 | +public class BoardStudentVO { | |
21 | + | |
22 | + // 학생 아이디 | |
23 | + private String stdId; | |
24 | + | |
25 | + // 게시판 아이디 | |
26 | + private String bbsId; | |
27 | + | |
28 | + // 공지 조회 여부 | |
29 | + private String checkYn; | |
30 | +} |
--- src/main/java/com/takensoft/ai_lms/lms/board/web/BoardController.java
+++ src/main/java/com/takensoft/ai_lms/lms/board/web/BoardController.java
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 |
|
3 | 3 |
|
4 | 4 |
import com.takensoft.ai_lms.lms.board.service.BoardService; |
5 |
+import com.takensoft.ai_lms.lms.board.vo.BoardStudentVO; |
|
5 | 6 |
import com.takensoft.ai_lms.lms.board.vo.BoardVO; |
6 | 7 |
import com.takensoft.ai_lms.lms.file.service.FileService; |
7 | 8 |
import lombok.RequiredArgsConstructor; |
... | ... | @@ -141,5 +142,52 @@ |
141 | 142 |
} |
142 | 143 |
|
143 | 144 |
|
145 |
+ /** |
|
146 |
+ * @author 박세훈 |
|
147 |
+ * @since 2024.08.06 |
|
148 |
+ * |
|
149 |
+ * 학생 게시판 조회 |
|
150 |
+ */ |
|
151 |
+ @PostMapping("/boardStudentList.json") |
|
152 |
+ public ResponseEntity<?> boardStudentList(@RequestBody HashMap<String, Object> params) throws Exception{ |
|
153 |
+ HashMap<String, Object> result = new HashMap<>(); |
|
154 |
+ |
|
155 |
+ // 전체 게시물 수 조회 및 추가 |
|
156 |
+ result.put("totalBoard", boardService.boardStudentCount(params)); |
|
157 |
+ result.put("result", boardService.boardStudentList(params)); |
|
158 |
+ result.put("unCheck", boardService.checkCount(params)); |
|
159 |
+ |
|
160 |
+ return new ResponseEntity<>(result, HttpStatus.OK); |
|
161 |
+ } |
|
162 |
+ |
|
163 |
+ |
|
164 |
+ /** |
|
165 |
+ * @author 박세훈 |
|
166 |
+ * @since 2024.08.06 |
|
167 |
+ * |
|
168 |
+ * 학생 게시판 조회 여부 체크 |
|
169 |
+ */ |
|
170 |
+ @PostMapping("/boardStudentCheck.json") |
|
171 |
+ public int updateBoardCheck(@RequestBody HashMap<String, Object> params) throws Exception { |
|
172 |
+ return boardService.updateBoardCheck(params); |
|
173 |
+ } |
|
174 |
+ |
|
175 |
+ |
|
176 |
+ /** |
|
177 |
+ * @author 박세훈 |
|
178 |
+ * @since 2024.08.06 |
|
179 |
+ * |
|
180 |
+ * 학생 게시판 조회 여부 일괄 갱신 |
|
181 |
+ */ |
|
182 |
+ @PostMapping("/allBoardStudentCheck.json") |
|
183 |
+ public int updateAllBoardCheck(@RequestBody HashMap<String, Object> params) throws Exception { |
|
184 |
+ return boardService.updateAllBoardCheck(params); |
|
185 |
+ } |
|
186 |
+ |
|
187 |
+ |
|
188 |
+ |
|
189 |
+ |
|
190 |
+ |
|
191 |
+ |
|
144 | 192 |
|
145 | 193 |
} |
--- src/main/java/com/takensoft/ai_lms/lms/problem/vo/ProblemVO.java
+++ src/main/java/com/takensoft/ai_lms/lms/problem/vo/ProblemVO.java
... | ... | @@ -32,4 +32,16 @@ |
32 | 32 |
private String bookId; |
33 | 33 |
// 단원 아이디 |
34 | 34 |
private String unitId; |
35 |
+ // 문제 지표 1 |
|
36 |
+ private String prblmMtr1; |
|
37 |
+ // 문제 지표 2 |
|
38 |
+ private String prblmMtr2; |
|
39 |
+ // 문제 지표 3 |
|
40 |
+ private String prblmMtr3; |
|
41 |
+ // 문제 지표 4 |
|
42 |
+ private String prblmMtr4; |
|
43 |
+ // 문제 지표 5 |
|
44 |
+ private String prblmMtr5; |
|
45 |
+ // 문제 지표 6 |
|
46 |
+ private String prblmMtr6; |
|
35 | 47 |
} |
--- src/main/java/com/takensoft/ai_lms/lms/text/web/TextController.java
+++ src/main/java/com/takensoft/ai_lms/lms/text/web/TextController.java
... | ... | @@ -90,6 +90,7 @@ |
90 | 90 |
*/ |
91 | 91 |
@PostMapping(value = "/textUpdate.json") |
92 | 92 |
@Operation(summary = "지문 수정") |
93 |
+ |
|
93 | 94 |
public String textUpdate(@RequestBody TextVO textVO) throws Exception { |
94 | 95 |
Gson gson = new Gson(); |
95 | 96 |
JsonObject response = new JsonObject(); |
--- src/main/java/com/takensoft/ai_lms/lms/word_book/dao/WordBookDAO.java
+++ src/main/java/com/takensoft/ai_lms/lms/word_book/dao/WordBookDAO.java
... | ... | @@ -3,6 +3,7 @@ |
3 | 3 |
import com.takensoft.ai_lms.lms.word_book.vo.WordBookVO; |
4 | 4 |
import org.egovframe.rte.psl.dataaccess.mapper.Mapper; |
5 | 5 |
|
6 |
+import java.util.HashMap; |
|
6 | 7 |
import java.util.List; |
7 | 8 |
|
8 | 9 |
/** |
... | ... | @@ -16,10 +17,12 @@ |
16 | 17 |
public interface WordBookDAO { |
17 | 18 |
|
18 | 19 |
// 임시: 단어장 전체 목록 조회 |
19 |
- List<WordBookVO> getAllWordBooks(); |
|
20 |
+ List<WordBookVO> getAllWordBooks(HashMap<String, Object> params) throws Exception; |
|
21 |
+ int getWordBooksCount() throws Exception; |
|
20 | 22 |
|
21 | 23 |
// 책에 소속된 단어장 목록 조회 |
22 |
- List<WordBookVO> getWordBooksByBookId(String bookId); |
|
24 |
+ List<WordBookVO> getWordBooksByBookId(HashMap<String, Object> params) throws Exception; |
|
25 |
+ int getWordBooksByBookIdCount(String bookId) throws Exception; |
|
23 | 26 |
|
24 | 27 |
// 아이디에 해당하는 단어장 조회 |
25 | 28 |
WordBookVO getWordBookById(String wdBookId); |
... | ... | @@ -34,9 +37,11 @@ |
34 | 37 |
int deleteWordBook(String wdBookId); |
35 | 38 |
|
36 | 39 |
// 단어장 검색(지문 이름으로 검색) |
37 |
- List<WordBookVO> getWordBooksByTextTitle(String textTitle); |
|
40 |
+ List<WordBookVO> getWordBooksByTextTitle(HashMap<String, Object> params) throws Exception; |
|
41 |
+ int getWordBooksByTextTitleCount(String textTitle) throws Exception; |
|
38 | 42 |
|
39 | 43 |
// 단어장 검색(단어로 검색) |
40 |
- List<WordBookVO> getWordBooksByWord(String word); |
|
44 |
+ List<WordBookVO> getWordBooksByWord(HashMap<String, Object> params) throws Exception; |
|
45 |
+ int getWordBooksByWordCount(String word) throws Exception; |
|
41 | 46 |
|
42 | 47 |
} |
--- src/main/java/com/takensoft/ai_lms/lms/word_book/service/Impl/WordBookServiceImpl.java
+++ src/main/java/com/takensoft/ai_lms/lms/word_book/service/Impl/WordBookServiceImpl.java
... | ... | @@ -7,6 +7,7 @@ |
7 | 7 |
import lombok.RequiredArgsConstructor; |
8 | 8 |
import org.springframework.stereotype.Service; |
9 | 9 |
|
10 |
+import java.util.HashMap; |
|
10 | 11 |
import java.util.List; |
11 | 12 |
|
12 | 13 |
/** |
... | ... | @@ -25,13 +26,32 @@ |
25 | 26 |
private final IdgenService wordBookIdgn; |
26 | 27 |
|
27 | 28 |
@Override |
28 |
- public List<WordBookVO> getAllWordBooks() { |
|
29 |
- return wordBookDAO.getAllWordBooks(); |
|
29 |
+ public List<WordBookVO> getAllWordBooks(int page, int pageSize) throws Exception { |
|
30 |
+ int startIndex = (page - 1) * pageSize; |
|
31 |
+ HashMap<String, Object> params = new HashMap<>(); |
|
32 |
+ params.put("startIndex", startIndex); |
|
33 |
+ params.put("pageSize", pageSize); |
|
34 |
+ return wordBookDAO.getAllWordBooks(params); |
|
30 | 35 |
} |
31 | 36 |
|
32 | 37 |
@Override |
33 |
- public List<WordBookVO> getWordBooksByBookId(String bookId) { |
|
34 |
- return wordBookDAO.getWordBooksByBookId(bookId); |
|
38 |
+ public int getWordBooksCount() throws Exception { |
|
39 |
+ return wordBookDAO.getWordBooksCount(); |
|
40 |
+ } |
|
41 |
+ |
|
42 |
+ @Override |
|
43 |
+ public List<WordBookVO> getWordBooksByBookId(String bookId, int page, int pageSize) throws Exception { |
|
44 |
+ int startIndex = (page - 1) * pageSize; |
|
45 |
+ HashMap<String, Object> params = new HashMap<>(); |
|
46 |
+ params.put("bookId", bookId); |
|
47 |
+ params.put("startIndex", startIndex); |
|
48 |
+ params.put("pageSize", pageSize); |
|
49 |
+ return wordBookDAO.getWordBooksByBookId(params); |
|
50 |
+ } |
|
51 |
+ |
|
52 |
+ @Override |
|
53 |
+ public int getWordBooksByBookIdCount(String bookId) throws Exception { |
|
54 |
+ return wordBookDAO.getWordBooksByBookIdCount(bookId); |
|
35 | 55 |
} |
36 | 56 |
|
37 | 57 |
@Override |
... | ... | @@ -57,13 +77,33 @@ |
57 | 77 |
} |
58 | 78 |
|
59 | 79 |
@Override |
60 |
- public List<WordBookVO> getWordBooksByTextTitle(String textTitle) { |
|
61 |
- return wordBookDAO.getWordBooksByTextTitle(textTitle); |
|
80 |
+ public List<WordBookVO> getWordBooksByTextTitle(String textTitle, int page, int pageSize) throws Exception { |
|
81 |
+ int startIndex = (page - 1) * pageSize; |
|
82 |
+ HashMap<String, Object> params = new HashMap<>(); |
|
83 |
+ params.put("textTitle", "%" + textTitle + "%"); |
|
84 |
+ params.put("startIndex", startIndex); |
|
85 |
+ params.put("pageSize", pageSize); |
|
86 |
+ return wordBookDAO.getWordBooksByTextTitle(params); |
|
62 | 87 |
} |
63 | 88 |
|
64 | 89 |
@Override |
65 |
- public List<WordBookVO> getWordBooksByWord(String word) { |
|
66 |
- return wordBookDAO.getWordBooksByWord(word); |
|
90 |
+ public int getWordBooksByTextTitleCount(String textTitle) throws Exception { |
|
91 |
+ return wordBookDAO.getWordBooksByTextTitleCount(textTitle); |
|
92 |
+ } |
|
93 |
+ |
|
94 |
+ @Override |
|
95 |
+ public List<WordBookVO> getWordBooksByWord(String word, int page, int pageSize) throws Exception { |
|
96 |
+ int startIndex = (page - 1) * pageSize; |
|
97 |
+ HashMap<String, Object> params = new HashMap<>(); |
|
98 |
+ params.put("word", word); |
|
99 |
+ params.put("startIndex", startIndex); |
|
100 |
+ params.put("pageSize", pageSize); |
|
101 |
+ return wordBookDAO.getWordBooksByWord(params); |
|
102 |
+ } |
|
103 |
+ |
|
104 |
+ @Override |
|
105 |
+ public int getWordBooksByWordCount(String word) throws Exception { |
|
106 |
+ return wordBookDAO.getWordBooksByWordCount(word); |
|
67 | 107 |
} |
68 | 108 |
|
69 | 109 |
} |
--- src/main/java/com/takensoft/ai_lms/lms/word_book/service/WordBookService.java
+++ src/main/java/com/takensoft/ai_lms/lms/word_book/service/WordBookService.java
... | ... | @@ -14,10 +14,12 @@ |
14 | 14 |
public interface WordBookService { |
15 | 15 |
|
16 | 16 |
// 임시: 단어장 전체 목록 조회 |
17 |
- List<WordBookVO> getAllWordBooks(); |
|
17 |
+ List<WordBookVO> getAllWordBooks(int page, int pageSize) throws Exception; |
|
18 |
+ int getWordBooksCount() throws Exception; |
|
18 | 19 |
|
19 | 20 |
// 책에 소속된 단어장 목록 조회 |
20 |
- List<WordBookVO> getWordBooksByBookId(String bookId); |
|
21 |
+ List<WordBookVO> getWordBooksByBookId(String bookId, int page, int pageSize) throws Exception; |
|
22 |
+ int getWordBooksByBookIdCount(String bookId) throws Exception; |
|
21 | 23 |
|
22 | 24 |
// 아이디에 해당하는 단어장 조회 |
23 | 25 |
WordBookVO getWordBookById(String wdBookId); |
... | ... | @@ -32,10 +34,12 @@ |
32 | 34 |
void deleteWordBook(String wdBookId); |
33 | 35 |
|
34 | 36 |
// 단어장 검색(지문 이름으로 검색) |
35 |
- List<WordBookVO> getWordBooksByTextTitle(String textTitle); |
|
37 |
+ List<WordBookVO> getWordBooksByTextTitle(String textTitle, int page, int pageSize) throws Exception; |
|
38 |
+ int getWordBooksByTextTitleCount(String textTitle) throws Exception; |
|
36 | 39 |
|
37 | 40 |
// 단어장 검색(단어로 검색) |
38 |
- List<WordBookVO> getWordBooksByWord(String word); |
|
41 |
+ List<WordBookVO> getWordBooksByWord(String word, int page, int pageSize) throws Exception; |
|
42 |
+ int getWordBooksByWordCount(String word) throws Exception; |
|
39 | 43 |
|
40 | 44 |
|
41 | 45 |
} |
--- src/main/java/com/takensoft/ai_lms/lms/word_book/web/WordBookController.java
+++ src/main/java/com/takensoft/ai_lms/lms/word_book/web/WordBookController.java
... | ... | @@ -6,6 +6,7 @@ |
6 | 6 |
import lombok.extern.slf4j.Slf4j; |
7 | 7 |
import org.springframework.web.bind.annotation.*; |
8 | 8 |
|
9 |
+import java.util.HashMap; |
|
9 | 10 |
import java.util.List; |
10 | 11 |
import java.util.Map; |
11 | 12 |
|
... | ... | @@ -26,15 +27,35 @@ |
26 | 27 |
|
27 | 28 |
// 단어장 전체 목록 조회 |
28 | 29 |
@PostMapping("/findAll.json") |
29 |
- public List<WordBookVO> getAllWordBooks() { |
|
30 |
- return wordBookService.getAllWordBooks(); |
|
30 |
+ public HashMap<String, Object> getAllWordBooks(@RequestBody HashMap<String, Object> params) throws Exception { |
|
31 |
+ int page = (int) params.get("page"); |
|
32 |
+ int pageSize = (int) params.get("pageSize"); |
|
33 |
+ |
|
34 |
+ List<WordBookVO> wordBooks = wordBookService.getAllWordBooks(page, pageSize); |
|
35 |
+ int totalWordBooks = wordBookService.getWordBooksCount(); |
|
36 |
+ |
|
37 |
+ HashMap<String, Object> result = new HashMap<>(); |
|
38 |
+ result.put("wordBooks", wordBooks); |
|
39 |
+ result.put("totalWordBooks", totalWordBooks); |
|
40 |
+ |
|
41 |
+ return result; |
|
31 | 42 |
} |
32 | 43 |
|
33 | 44 |
// 책에 소속된 단어장 목록 조회 |
34 | 45 |
@PostMapping("/findByBookId.json") |
35 |
- public List<WordBookVO> getWordBooksByBookId(@RequestBody Map<String, String> request) { |
|
36 |
- String bookId = request.get("bookId"); |
|
37 |
- return wordBookService.getWordBooksByBookId(bookId); |
|
46 |
+ public HashMap<String, Object> getWordBooksByBookId(@RequestBody HashMap<String, Object> params) throws Exception { |
|
47 |
+ String bookId = (String) params.get("bookId"); |
|
48 |
+ int page = (int) params.get("page"); |
|
49 |
+ int pageSize = (int) params.get("pageSize"); |
|
50 |
+ |
|
51 |
+ List<WordBookVO> wordBooks = wordBookService.getWordBooksByBookId(bookId, page, pageSize); |
|
52 |
+ int totalWordBooks = wordBookService.getWordBooksByBookIdCount(bookId); |
|
53 |
+ |
|
54 |
+ HashMap<String, Object> result = new HashMap<>(); |
|
55 |
+ result.put("wordBooks", wordBooks); |
|
56 |
+ result.put("totalWordBooks", totalWordBooks); |
|
57 |
+ |
|
58 |
+ return result; |
|
38 | 59 |
} |
39 | 60 |
|
40 | 61 |
// 아이디에 해당하는 단어장 조회 |
... | ... | @@ -68,15 +89,36 @@ |
68 | 89 |
|
69 | 90 |
// 단어장 검색(지문 이름으로 검색) |
70 | 91 |
@PostMapping("/findByTextTitle.json") |
71 |
- public List<WordBookVO> getWordBooksByTextTitle(@RequestBody Map<String, String> request) { |
|
72 |
- String textTitle = "%" + request.get("textTitle") + "%"; // 부분 검색 허용 |
|
73 |
- return wordBookService.getWordBooksByTextTitle(textTitle); |
|
92 |
+ public HashMap<String, Object> getWordBooksByTextTitle(@RequestBody HashMap<String, Object> params) throws Exception { |
|
93 |
+ String textTitle = (String) params.get("textTitle"); |
|
94 |
+ int page = (int) params.get("page"); |
|
95 |
+ int pageSize = (int) params.get("pageSize"); |
|
96 |
+ |
|
97 |
+ List<WordBookVO> wordBooks = wordBookService.getWordBooksByTextTitle(textTitle, page, pageSize); |
|
98 |
+ int totalWordBooks = wordBookService.getWordBooksByTextTitleCount(textTitle); |
|
99 |
+ |
|
100 |
+ HashMap<String, Object> result = new HashMap<>(); |
|
101 |
+ result.put("wordBooks", wordBooks); |
|
102 |
+ result.put("totalWordBooks", totalWordBooks); |
|
103 |
+ |
|
104 |
+ return result; |
|
74 | 105 |
} |
75 | 106 |
|
76 | 107 |
// 단어장 검색(단어로 검색) |
77 | 108 |
@PostMapping("/findByWord.json") |
78 |
- public List<WordBookVO> getWordBooksByWord(@RequestBody Map<String, String> request) { |
|
79 |
- return wordBookService.getWordBooksByWord(request.get("word")); |
|
109 |
+ public HashMap<String, Object> getWordBooksByWord(@RequestBody HashMap<String, Object> params) throws Exception { |
|
110 |
+ String word = (String) params.get("word"); |
|
111 |
+ int page = (int) params.get("page"); |
|
112 |
+ int pageSize = (int) params.get("pageSize"); |
|
113 |
+ |
|
114 |
+ List<WordBookVO> wordBooks = wordBookService.getWordBooksByWord(word, page, pageSize); |
|
115 |
+ int totalWordBooks = wordBookService.getWordBooksByWordCount(word); |
|
116 |
+ |
|
117 |
+ HashMap<String, Object> result = new HashMap<>(); |
|
118 |
+ result.put("wordBooks", wordBooks); |
|
119 |
+ result.put("totalWordBooks", totalWordBooks); |
|
120 |
+ |
|
121 |
+ return result; |
|
80 | 122 |
} |
81 | 123 |
|
82 | 124 |
} |
--- src/main/resources/application.yml
+++ src/main/resources/application.yml
... | ... | @@ -47,6 +47,11 @@ |
47 | 47 |
secret: 42b08045ac84dbcdf50e946bf8ad34d35af707979b3230cfb84fb8fe34236d2f |
48 | 48 |
accessTime: 600000 # 10분 600000 |
49 | 49 |
refreshTime: 86400000 # 24시간 86400000 |
50 |
+ data: |
|
51 |
+ redis: |
|
52 |
+ host: localhost |
|
53 |
+ port: 6379 |
|
54 |
+ timeout: 60000 |
|
50 | 55 |
cookie: |
51 | 56 |
time: 86400 |
52 | 57 |
|
--- src/main/resources/mybatis/mapper/lms/board-SQL.xml
+++ src/main/resources/mybatis/mapper/lms/board-SQL.xml
... | ... | @@ -63,6 +63,12 @@ |
63 | 63 |
</collection> |
64 | 64 |
</resultMap> |
65 | 65 |
|
66 |
+ <resultMap id="boardStudentResultMap" type="BoardStudentVO"> |
|
67 |
+ <result property="stdId" column="std_id" /> |
|
68 |
+ <result property="bbsId" column="bbs_id" /> |
|
69 |
+ <result property="checkYn" column="check_yn" /> |
|
70 |
+ </resultMap> |
|
71 |
+ |
|
66 | 72 |
<!-- |
67 | 73 |
작성자 : 박세훈 |
68 | 74 |
작성일 : 2024.07.25 |
... | ... | @@ -102,16 +108,7 @@ |
102 | 108 |
내 용 : 게시글 전체 조회 |
103 | 109 |
--> |
104 | 110 |
<select id="findAllBoard" resultMap="boardResultMap"> |
105 |
- SELECT b.bbs_id, |
|
106 |
- b.bbs_ttl, |
|
107 |
- b.bbs_cls, |
|
108 |
- b.bbs_cnt, |
|
109 |
- b.bbs_tm, |
|
110 |
- b.file_mng_id, |
|
111 |
- c.scls_id, |
|
112 |
- c.scls_nm, |
|
113 |
- u.user_id, |
|
114 |
- u.user_nm |
|
111 |
+ SELECT * |
|
115 | 112 |
FROM board b |
116 | 113 |
LEFT JOIN class c ON b.scls_id = c.scls_id |
117 | 114 |
LEFT JOIN users u ON c.user_id = u.user_id |
... | ... | @@ -141,16 +138,7 @@ |
141 | 138 |
내 용 : 게시글 검색 |
142 | 139 |
--> |
143 | 140 |
<select id="searchBoard" resultMap="boardResultMap"> |
144 |
- SELECT b.bbs_id, |
|
145 |
- b.bbs_ttl, |
|
146 |
- b.bbs_cls, |
|
147 |
- b.bbs_cnt, |
|
148 |
- b.bbs_tm, |
|
149 |
- b.file_mng_id, |
|
150 |
- c.scls_id, |
|
151 |
- c.scls_nm, |
|
152 |
- u.user_id, |
|
153 |
- u.user_nm |
|
141 |
+ SELECT * |
|
154 | 142 |
FROM board b |
155 | 143 |
LEFT JOIN class c ON b.scls_id = c.scls_id |
156 | 144 |
LEFT JOIN users u ON c.user_id = u.user_id |
... | ... | @@ -196,5 +184,97 @@ |
196 | 184 |
DELETE FROM board WHERE bbs_id = #{bbsId} |
197 | 185 |
</delete> |
198 | 186 |
|
187 |
+ |
|
188 |
+ <!-- |
|
189 |
+ 작성자 : 박세훈 |
|
190 |
+ 작성일 : 2024.08.06 |
|
191 |
+ 내 용 : 학생 게시판 등록 |
|
192 |
+ --> |
|
193 |
+ <insert id="insertBoardStudent" parameterType="BoardStudentVO"> |
|
194 |
+ INSERT INTO user_board (std_id, |
|
195 |
+ bbs_id, |
|
196 |
+ check_yn) |
|
197 |
+ SELECT u.std_id, b.bbs_id, 'F' |
|
198 |
+ FROM user_class u |
|
199 |
+ JOIN board b ON u.scls_id = b.scls_id |
|
200 |
+ ON CONFLICT (std_id, bbs_id) |
|
201 |
+ DO NOTHING; |
|
202 |
+ </insert> |
|
203 |
+ |
|
204 |
+ <!-- |
|
205 |
+ 작성자 : 박세훈 |
|
206 |
+ 작성일 : 2024.08.06 |
|
207 |
+ 내 용 : 학생 게시판 삭제 |
|
208 |
+ --> |
|
209 |
+ <delete id="deleteBoardStudent" parameterType="String"> |
|
210 |
+ DELETE FROM user_board |
|
211 |
+ WHERE bbs_id = #{bbsId} |
|
212 |
+ </delete> |
|
213 |
+ |
|
214 |
+ <!-- |
|
215 |
+ 작성자 : 박세훈 |
|
216 |
+ 작성일 : 2024.08.06 |
|
217 |
+ 내 용 : 학생 게시판 조회 |
|
218 |
+ --> |
|
219 |
+ <select id="boardStudentList" resultMap="boardResultMap" > |
|
220 |
+ SELECT * |
|
221 |
+ FROM user_class uc |
|
222 |
+ JOIN board b ON uc.scls_id = b.scls_id |
|
223 |
+ LEFT JOIN class c ON b.scls_id = c.scls_id |
|
224 |
+ LEFT JOIN users u ON c.user_id = u.user_id |
|
225 |
+ WHERE uc.std_id = #{stdId} |
|
226 |
+ ORDER BY b.bbs_id DESC |
|
227 |
+ LIMIT #{pageSize} OFFSET #{startIndex} |
|
228 |
+ </select> |
|
229 |
+ |
|
230 |
+ <!-- |
|
231 |
+ 작성자 : 박세훈 |
|
232 |
+ 작성일 : 2024.08.06 |
|
233 |
+ 내 용 : 학생 게시판 조회 여부 갱신 |
|
234 |
+ --> |
|
235 |
+ <update id="updateBoardCheck" parameterType="BoardStudentVO"> |
|
236 |
+ UPDATE user_board |
|
237 |
+ set check_yn = 'T' |
|
238 |
+ WHERE bbs_id = #{bbsId} |
|
239 |
+ AND std_id = #{stdId} |
|
240 |
+ AND check_yn = 'F' |
|
241 |
+ </update> |
|
242 |
+ |
|
243 |
+ <!-- |
|
244 |
+ 작성자 : 박세훈 |
|
245 |
+ 작성일 : 2024.08.06 |
|
246 |
+ 내 용 : 학생 게시판 조회 여부 일괄 갱신 |
|
247 |
+ --> |
|
248 |
+ <update id="updateAllBoardCheck" parameterType="BoardStudentVO"> |
|
249 |
+ UPDATE user_board |
|
250 |
+ set check_yn = 'T' |
|
251 |
+ WHERE std_id = #{stdId} |
|
252 |
+ AND check_yn = 'F' |
|
253 |
+ </update> |
|
254 |
+ |
|
255 |
+ <!-- |
|
256 |
+ 작성자 : 박세훈 |
|
257 |
+ 작성일 : 2024.08.06 |
|
258 |
+ 내 용 : 학생 게시판 게시물 수 확인 |
|
259 |
+ --> |
|
260 |
+ <select id="boardStudentCount" resultType="Integer"> |
|
261 |
+ SELECT COUNT(*) |
|
262 |
+ FROM user_board |
|
263 |
+ WHERE std_id = #{stdId} |
|
264 |
+ </select> |
|
265 |
+ |
|
266 |
+ |
|
267 |
+ <!-- |
|
268 |
+ 작성자 : 박세훈 |
|
269 |
+ 작성일 : 2024.08.06 |
|
270 |
+ 내 용 : 학생 게시판 미조회 게시물 수 확인 |
|
271 |
+ --> |
|
272 |
+ <select id="checkCount" resultType="Integer"> |
|
273 |
+ SELECT COUNT(*) |
|
274 |
+ FROM user_board |
|
275 |
+ WHERE check_yn = 'F' AND std_id = #{stdId} |
|
276 |
+ </select> |
|
277 |
+ |
|
278 |
+ |
|
199 | 279 |
</mapper> |
200 | 280 |
|
--- src/main/resources/mybatis/mapper/lms/problem-SQL.xml
+++ src/main/resources/mybatis/mapper/lms/problem-SQL.xml
... | ... | @@ -19,7 +19,13 @@ |
19 | 19 |
prblm_ctgry_id, |
20 | 20 |
user_id, |
21 | 21 |
book_id, |
22 |
- unit_id |
|
22 |
+ unit_id, |
|
23 |
+ prblm_mtr1, |
|
24 |
+ prblm_mtr2, |
|
25 |
+ prblm_mtr3, |
|
26 |
+ prblm_mtr4, |
|
27 |
+ prblm_mtr5, |
|
28 |
+ prblm_mtr6 |
|
23 | 29 |
FROM problem |
24 | 30 |
WHERE prblm_id = #{prblmId} |
25 | 31 |
</select> |
... | ... | @@ -57,7 +63,13 @@ |
57 | 63 |
prblm_ctgry_id, |
58 | 64 |
user_id, |
59 | 65 |
book_id, |
60 |
- unit_id |
|
66 |
+ unit_id, |
|
67 |
+ prblm_mtr1, |
|
68 |
+ prblm_mtr2, |
|
69 |
+ prblm_mtr3, |
|
70 |
+ prblm_mtr4, |
|
71 |
+ prblm_mtr5, |
|
72 |
+ prblm_mtr6 |
|
61 | 73 |
) VALUES ( |
62 | 74 |
#{prblmId}, |
63 | 75 |
#{prblmExpln}, |
... | ... | @@ -69,7 +81,13 @@ |
69 | 81 |
#{prblmCtgryId}, |
70 | 82 |
#{userId}, |
71 | 83 |
#{bookId}, |
72 |
- #{unitId} |
|
84 |
+ #{unitId}, |
|
85 |
+ #{prblmMtr1}, |
|
86 |
+ #{prblmMtr2}, |
|
87 |
+ #{prblmMtr3}, |
|
88 |
+ #{prblmMtr4}, |
|
89 |
+ #{prblmMtr5}, |
|
90 |
+ #{prblmMtr6} |
|
73 | 91 |
) |
74 | 92 |
</insert> |
75 | 93 |
|
... | ... | @@ -111,7 +129,13 @@ |
111 | 129 |
prblm_ctgry_id = #{prblmCtgryId}, |
112 | 130 |
user_id = #{userId}, |
113 | 131 |
book_id = #{bookId}, |
114 |
- unit_id = #{unitId} |
|
132 |
+ unit_id = #{unitId}, |
|
133 |
+ prblm_mtr1 = #{prblmMtr1}, |
|
134 |
+ prblm_mtr2 = #{prblmMtr2}, |
|
135 |
+ prblm_mtr3 = #{prblmMtr3}, |
|
136 |
+ prblm_mtr4 = #{prblmMtr4}, |
|
137 |
+ prblm_mtr5 = #{prblmMtr5}, |
|
138 |
+ prblm_mtr6 = #{prblmMtr6} |
|
115 | 139 |
WHERE prblm_id = #{prblmId} |
116 | 140 |
</update> |
117 | 141 |
|
... | ... | @@ -156,7 +180,13 @@ |
156 | 180 |
prblm_ctgry_id, |
157 | 181 |
user_id, |
158 | 182 |
book_id, |
159 |
- unit_id |
|
183 |
+ unit_id, |
|
184 |
+ prblm_mtr1, |
|
185 |
+ prblm_mtr2, |
|
186 |
+ prblm_mtr3, |
|
187 |
+ prblm_mtr4, |
|
188 |
+ prblm_mtr5, |
|
189 |
+ prblm_mtr6 |
|
160 | 190 |
FROM problem |
161 | 191 |
WHERE 1 = 1 |
162 | 192 |
<if test="option != null and keyword != null"> |
... | ... | @@ -198,7 +228,13 @@ |
198 | 228 |
p.prblm_ctgry_id AS prblmCtgryId, |
199 | 229 |
p.user_id AS userId, |
200 | 230 |
p.book_id AS bookId, |
201 |
- p.unit_id AS unitId |
|
231 |
+ p.unit_id AS unitId, |
|
232 |
+ p.prblm_mtr1 AS prblmMtr1, |
|
233 |
+ p.prblm_mtr2 AS prblmMtr2, |
|
234 |
+ p.prblm_mtr3 AS prblmMtr3, |
|
235 |
+ p.prblm_mtr4 AS prblmMtr4, |
|
236 |
+ p.prblm_mtr5 AS prblmMtr5, |
|
237 |
+ p.prblm_mtr6 AS prblmMtr6 |
|
202 | 238 |
FROM |
203 | 239 |
eval_problem ep |
204 | 240 |
JOIN |
--- src/main/resources/mybatis/mapper/lms/schedule-SQL.xml
+++ src/main/resources/mybatis/mapper/lms/schedule-SQL.xml
... | ... | @@ -44,6 +44,7 @@ |
44 | 44 |
|
45 | 45 |
FROM schedule |
46 | 46 |
WHERE std_id = #{stdId} |
47 |
+ AND schdl_dt::date = CURRENT_DATE |
|
47 | 48 |
ORDER BY schdl_dt DESC |
48 | 49 |
</select> |
49 | 50 |
|
--- src/main/resources/mybatis/mapper/lms/word_book-SQL.xml
+++ src/main/resources/mybatis/mapper/lms/word_book-SQL.xml
... | ... | @@ -16,6 +16,31 @@ |
16 | 16 |
<result property="bookId" column="book_id"/> |
17 | 17 |
</resultMap> |
18 | 18 |
|
19 |
+ <select id="getWordBooksCount" resultType="int"> |
|
20 |
+ SELECT COUNT(*) |
|
21 |
+ FROM ai_lms.wordbook |
|
22 |
+ </select> |
|
23 |
+ |
|
24 |
+ <select id="getWordBooksByBookIdCount" resultType="int"> |
|
25 |
+ SELECT COUNT(*) |
|
26 |
+ FROM wordbook |
|
27 |
+ WHERE book_id = #{bookId} |
|
28 |
+ </select> |
|
29 |
+ |
|
30 |
+ <select id="getWordBooksByTextTitleCount" resultType="int"> |
|
31 |
+ SELECT COUNT(*) |
|
32 |
+ FROM wordbook wb |
|
33 |
+ JOIN text t ON wb.text_id = t.text_id |
|
34 |
+ WHERE t.text_ttl LIKE #{textTitle} |
|
35 |
+ </select> |
|
36 |
+ |
|
37 |
+ <select id="getWordBooksByWordCount" resultType="int"> |
|
38 |
+ SELECT COUNT(DISTINCT wb.wd_book_id) |
|
39 |
+ FROM wordbook wb |
|
40 |
+ JOIN word w ON wb.wd_book_id = w.wd_book_id |
|
41 |
+ WHERE w.wd_nm LIKE #{word} |
|
42 |
+ </select> |
|
43 |
+ |
|
19 | 44 |
<select id="getAllWordBooks" resultMap="WordBookResultMap"> |
20 | 45 |
SELECT |
21 | 46 |
wd_book_id, |
... | ... | @@ -24,9 +49,11 @@ |
24 | 49 |
user_id, |
25 | 50 |
book_id |
26 | 51 |
FROM ai_lms.wordbook |
52 |
+ ORDER BY wd_book_id DESC |
|
53 |
+ LIMIT #{pageSize} OFFSET #{startIndex} |
|
27 | 54 |
</select> |
28 | 55 |
|
29 |
- <select id="getWordBooksByBookId" resultMap="WordBookResultMap"> <!-- 수정됨 --> |
|
56 |
+ <select id="getWordBooksByBookId" resultMap="WordBookResultMap"> |
|
30 | 57 |
SELECT |
31 | 58 |
wd_book_id, |
32 | 59 |
wd_book_type_id, |
... | ... | @@ -35,6 +62,8 @@ |
35 | 62 |
book_id |
36 | 63 |
FROM wordbook |
37 | 64 |
WHERE book_id = #{bookId} |
65 |
+ ORDER BY wd_book_id DESC |
|
66 |
+ LIMIT #{pageSize} OFFSET #{startIndex} |
|
38 | 67 |
</select> |
39 | 68 |
|
40 | 69 |
<select id="getWordBookById" parameterType="string" resultMap="WordBookResultMap"> |
... | ... | @@ -81,6 +110,8 @@ |
81 | 110 |
FROM wordbook wb |
82 | 111 |
JOIN text t ON wb.text_id = t.text_id |
83 | 112 |
WHERE t.text_ttl LIKE #{textTitle} |
113 |
+ ORDER BY wd_book_id DESC |
|
114 |
+ LIMIT #{pageSize} OFFSET #{startIndex} |
|
84 | 115 |
</select> |
85 | 116 |
|
86 | 117 |
<select id="getWordBooksByWord" resultType="WordBookVO"> |
... | ... | @@ -88,6 +119,8 @@ |
88 | 119 |
FROM wordbook wb |
89 | 120 |
JOIN word w ON wb.wd_book_id = w.wd_book_id |
90 | 121 |
WHERE w.wd_nm LIKE #{word} |
122 |
+ ORDER BY wd_book_id DESC |
|
123 |
+ LIMIT #{pageSize} OFFSET #{startIndex} |
|
91 | 124 |
</select> |
92 | 125 |
|
93 | 126 |
</mapper>(파일 끝에 줄바꿈 문자 없음) |
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?