PsHooN7979
08-07
240807 박세훈 게시판 수정
@f3a8e67abccc6061cc3855c76233dc303b7098dd
--- src/main/java/com/takensoft/ai_lms/lms/board/vo/BoardVO.java
+++ src/main/java/com/takensoft/ai_lms/lms/board/vo/BoardVO.java
... | ... | @@ -46,6 +46,8 @@ |
46 | 46 |
// 파일 테이블 연결 |
47 | 47 |
private List<BoardFileVO> files; |
48 | 48 |
|
49 |
+ private List<BoardStudentVO> boardStudent; |
|
50 |
+ |
|
49 | 51 |
|
50 | 52 |
|
51 | 53 |
} |
--- src/main/resources/mybatis/mapper/lms/board-SQL.xml
+++ src/main/resources/mybatis/mapper/lms/board-SQL.xml
... | ... | @@ -63,11 +63,28 @@ |
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" /> |
|
66 |
+ <resultMap id="boardStudentResultMap" type="BoardUserVO"> |
|
67 |
+ <id property="userId" column="user_id" /> |
|
68 |
+ <result property="userNm" column="user_nm" /> |
|
69 |
+ <collection property="boardClass" ofType="BoardClassVO"> |
|
70 |
+ <id property="sclsId" column="scls_id" /> |
|
71 |
+ <result property="sclsNm" column="scls_nm" /> |
|
72 |
+ <collection property="board" ofType="BoardVO" > |
|
73 |
+ <id property="bbsId" column="bbs_id"/> |
|
74 |
+ <result property="bbsTtl" column="bbs_ttl"/> |
|
75 |
+ <result property="bbsCls" column="bbs_cls"/> |
|
76 |
+ <result property="bbsCnt" column="bbs_cnt"/> |
|
77 |
+ <result property="bbsTm" column="bbs_tm"/> |
|
78 |
+ <result property="sclsId" column="scls_id"/> |
|
79 |
+ <result property="fileMngId" column="file_mng_id"/> |
|
80 |
+ <collection property="boardStudent" ofType="BoardStudentVO"> |
|
81 |
+ <id property="stdId" column="std_id" /> |
|
82 |
+ <result property="checkYn" column="check_yn" /> |
|
83 |
+ </collection> |
|
84 |
+ </collection> |
|
85 |
+ </collection> |
|
70 | 86 |
</resultMap> |
87 |
+ |
|
71 | 88 |
|
72 | 89 |
<!-- |
73 | 90 |
작성자 : 박세훈 |
... | ... | @@ -216,13 +233,13 @@ |
216 | 233 |
작성일 : 2024.08.06 |
217 | 234 |
내 용 : 학생 게시판 조회 |
218 | 235 |
--> |
219 |
- <select id="boardStudentList" resultMap="boardResultMap" > |
|
236 |
+ <select id="boardStudentList" resultMap="boardStudentResultMap" > |
|
220 | 237 |
SELECT * |
221 | 238 |
FROM user_class uc |
222 | 239 |
JOIN board b ON uc.scls_id = b.scls_id |
223 | 240 |
LEFT JOIN class c ON b.scls_id = c.scls_id |
224 | 241 |
LEFT JOIN users u ON c.user_id = u.user_id |
225 |
- WHERE uc.std_id = #{stdId} |
|
242 |
+ WHERE uc.user_id = #{userId} |
|
226 | 243 |
ORDER BY b.bbs_id DESC |
227 | 244 |
LIMIT #{pageSize} OFFSET #{startIndex} |
228 | 245 |
</select> |
... | ... | @@ -233,7 +250,7 @@ |
233 | 250 |
내 용 : 학생 게시판 조회 여부 갱신 |
234 | 251 |
--> |
235 | 252 |
<update id="updateBoardCheck" parameterType="BoardStudentVO"> |
236 |
- UPDATE user_board |
|
253 |
+ UPDATE user_board ub |
|
237 | 254 |
set check_yn = 'T' |
238 | 255 |
WHERE bbs_id = #{bbsId} |
239 | 256 |
AND std_id = #{stdId} |
... | ... | @@ -247,9 +264,9 @@ |
247 | 264 |
--> |
248 | 265 |
<update id="updateAllBoardCheck" parameterType="BoardStudentVO"> |
249 | 266 |
UPDATE user_board |
250 |
- set check_yn = 'T' |
|
267 |
+ set check_yn = 'F' |
|
251 | 268 |
WHERE std_id = #{stdId} |
252 |
- AND check_yn = 'F' |
|
269 |
+ AND check_yn = 'T' |
|
253 | 270 |
</update> |
254 | 271 |
|
255 | 272 |
<!-- |
... | ... | @@ -259,8 +276,9 @@ |
259 | 276 |
--> |
260 | 277 |
<select id="boardStudentCount" resultType="Integer"> |
261 | 278 |
SELECT COUNT(*) |
262 |
- FROM user_board |
|
263 |
- WHERE std_id = #{stdId} |
|
279 |
+ FROM user_board ub |
|
280 |
+ JOIN user_class uc ON uc.std_id = ub.std_id |
|
281 |
+ WHERE user_id = #{userId} |
|
264 | 282 |
</select> |
265 | 283 |
|
266 | 284 |
|
... | ... | @@ -271,8 +289,9 @@ |
271 | 289 |
--> |
272 | 290 |
<select id="checkCount" resultType="Integer"> |
273 | 291 |
SELECT COUNT(*) |
274 |
- FROM user_board |
|
275 |
- WHERE check_yn = 'F' AND std_id = #{stdId} |
|
292 |
+ FROM user_board ub |
|
293 |
+ JOIN user_class uc ON uc.std_id = ub.std_id |
|
294 |
+ WHERE ub.check_yn = 'F' AND uc.user_id = #{userId} |
|
276 | 295 |
</select> |
277 | 296 |
|
278 | 297 |
|
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?