메인페이지 게시물 획득 쿼리 수정.

master
강석 최 2022-03-28 11:15:31 +09:00
parent db70792bf3
commit 20df991f64
3 changed files with 31 additions and 34 deletions

View File

@ -72,9 +72,6 @@ public class BoardSearchVO extends BaseSearchVO {
* @param id . * @param id .
*/ */
public void setCategory(String category) { public void setCategory(String category) {
if (category == null || category.equals("")) {
category = " ";
}
this.category = category; this.category = category;
} }

View File

@ -91,6 +91,7 @@ public class CommonController {
if (EgovUserDetailsHelper.isAuthenticated()) { if (EgovUserDetailsHelper.isAuthenticated()) {
BoardSearchVO searchVO = new BoardSearchVO(); BoardSearchVO searchVO = new BoardSearchVO();
searchVO.setRecordCountPerPage(5); searchVO.setRecordCountPerPage(5);
searchVO.setCategory(null);
/* 내실적 조회 리스트 */ /* 내실적 조회 리스트 */
LoginUserVO loginUserVO = UserUtil.getMemberInfo(); LoginUserVO loginUserVO = UserUtil.getMemberInfo();
@ -115,25 +116,25 @@ public class CommonController {
List<ReportVO> reportList = judgeService.selectMyList(reportSearchVO); List<ReportVO> reportList = judgeService.selectMyList(reportSearchVO);
model.addAttribute("reportList", reportList); model.addAttribute("reportList", reportList);
/* 공지사항 리스트 */ /* 공지사항 리스트 */
searchVO.setId("notice"); searchVO.setId("notice");
List<BoardVO> noticeList = boardService.selectList(searchVO); List<BoardVO> noticeList = boardService.selectList(searchVO);
model.addAttribute("noticeList", noticeList); model.addAttribute("noticeList", noticeList);
/* 게시판 리스트 */ /* 게시판 리스트 */
searchVO.setId("bbs"); searchVO.setId("bbs");
List<BoardVO> bbsList = boardService.selectList(searchVO); List<BoardVO> bbsList = boardService.selectList(searchVO);
model.addAttribute("bbsList", bbsList); model.addAttribute("bbsList", bbsList);
/* 자료실 리스트 */ /* 자료실 리스트 */
searchVO.setId("data"); searchVO.setId("data");
List<BoardVO> dataList = boardService.selectList(searchVO); List<BoardVO> dataList = boardService.selectList(searchVO);
model.addAttribute("dataList", dataList); model.addAttribute("dataList", dataList);
return "main.tiles"; return "main.tiles";
} else { } else {
return "common/login"; return "common/login";
} }
} }
/** /**

View File

@ -19,28 +19,27 @@
SELECT SELECT
* *
FROM H3_BD_${id}_LIST BBS FROM H3_BD_${id}_LIST BBS
WHERE 1 = 1 <where>
<choose> <if test='category != null'>
<when test='category == " " and id == "stat_bbs"'>
</when>
<otherwise>
AND BD_CATEGORY = #{category} AND BD_CATEGORY = #{category}
</otherwise> </if>
</choose> <!--<if test='id != "stat_bbs"'>
AND BD_CATEGORY = #{category}
<if test="searchKeyword != null and searchKeyword != ''"> </if>-->
<choose> <if test="searchKeyword != null and searchKeyword != ''">
<when test="searchCondition == 0"> <choose>
AND BD_DATA1 LIKE '%' || #{searchKeyword} || '%' <when test="searchCondition == 0">
</when> AND BD_DATA1 LIKE '%' || #{searchKeyword} || '%'
<when test="searchCondition == 1"> </when>
AND BD_NAME LIKE '%' || #{searchKeyword} || '%' <when test="searchCondition == 1">
</when> AND BD_NAME LIKE '%' || #{searchKeyword} || '%'
<when test="searchCondition == 2"> </when>
AND BD_SUBJECT LIKE '%' || #{searchKeyword} || '%' <when test="searchCondition == 2">
</when> AND BD_SUBJECT LIKE '%' || #{searchKeyword} || '%'
</choose> </when>
</if> </choose>
</if>
</where>
ORDER BY ORDER BY
BBS.BD_NOTICE DESC, BBS.BD_NOTICE DESC,
BBS.BD_GROUP_SEQ DESC, BBS.BD_GROUP_SEQ DESC,