통합검색 조건 수정.

검색어 요청 화면 추가.
master
강석 최 2023-06-19 17:24:06 +09:00
parent 7c17429bb5
commit f71dd2b273
6 changed files with 115 additions and 89 deletions

View File

@ -27,13 +27,14 @@ public class SearchEngineController {
@GetMapping("/searchPage") @GetMapping("/searchPage")
public ModelAndView organMgtPage(@AuthenticationPrincipal UserInfo loginUser, SearchParams params) { public ModelAndView organMgtPage(@AuthenticationPrincipal UserInfo loginUser, SearchParams params) {
ModelAndView mav = new ModelAndView("searchEngine/search"); ModelAndView mav = new ModelAndView("searchEngine/search");
if(Utils.isEmpty(params.getKeyword())){
mav.setViewName("common/keywordRequest");
return mav;
}
if (Utils.isEmpty(params.getActiveTab())){ if (Utils.isEmpty(params.getActiveTab())){
params.setActiveTab("all"); params.setActiveTab("all");
params.setPageIndex(1); params.setPageIndex(1);
} }
// if(Utils.isEmpty(params.getWrtOrgan())){
// params.setWrtOrgan(codeMgtService.searchValue(loginUser.getOgCd()));
// }
if(Utils.isEmpty(params.getWrtUserSeq())){ if(Utils.isEmpty(params.getWrtUserSeq())){
params.setWrtUserSeq(loginUser.getUserSeq()); params.setWrtUserSeq(loginUser.getUserSeq());
} }

View File

@ -16,4 +16,6 @@ public class SearchFileView {
private String save_path; private String save_path;
private String full_path; private String full_path;
private String file_content; private String file_content;
private String wrt_organ;
private String wrt_user_seq;
} }

View File

@ -44,9 +44,6 @@ public class SearchEngineService {
.append(params.getKeyword()) .append(params.getKeyword())
.append("' allword synonym"); .append("' allword synonym");
if(!params.getForm().equals("search_menu_view.search_menu_view")){ if(!params.getForm().equals("search_menu_view.search_menu_view")){
// builder.append(" and wrt_organ='")
// .append(params.getWrtOrgan())
// .append("'");
builder.append(" and wrt_user_seq='") builder.append(" and wrt_user_seq='")
.append(params.getWrtUserSeq()) .append(params.getWrtUserSeq())
.append("'"); .append("'");
@ -70,9 +67,8 @@ public class SearchEngineService {
.queryParam("where", where) .queryParam("where", where)
.queryParam("order by", " $relevance desc") .queryParam("order by", " $relevance desc")
.queryParam("offset", params.getOffset().toString()) .queryParam("offset", params.getOffset().toString())
.queryParam("pagelength", params.getLimit().toString())
//.queryParam("limit", params.getLimit().toString()) //.queryParam("limit", params.getLimit().toString())
// total_count 갯수가 limit로 제한걸려 조건에서 제외. 검색 결과는 정상적으로 나옴. // total_count 갯수가 limit로 제한걸려 조건에서 제외. 검색 결과는 정상적으로 나옴.
.queryParam("charset", "UTF-8") .queryParam("charset", "UTF-8")
.queryParam("hilite-keywords", params.getKeyword()) .queryParam("hilite-keywords", params.getKeyword())
.encode() .encode()

View File

@ -1,22 +1,28 @@
 
$(function () { $(function () {
$('.searchFileBtn').click(function () { $('.searchFileBtn').click(function () {
if ($(this).parent('dd').hasClass('focus')) { if ($(this).parent('dd').hasClass('focus')) {
$(this).parent('dd').removeClass('focus'); $(this).parent('dd').removeClass('focus');
$(this).parent('dd').children('.searchFileList').slideUp(); $(this).parent('dd').children('.searchFileList').slideUp();
} else { } else {
$(this).parent('dd').addClass('focus'); $(this).parent('dd').addClass('focus');
$(this).parent('dd').children('.searchFileList').slideDown(); $(this).parent('dd').children('.searchFileList').slideDown();
} }
}); });
$('.searchPageBoxBtn').click(function () { $('.searchPageBoxBtn').click(function () {
if ($('.searchPageBox').hasClass('searchDTView')) { if ($('.searchPageBox').hasClass('searchDTView')) {
$('.searchPageBox').removeClass('searchDTView'); $('.searchPageBox').removeClass('searchDTView');
} else { } else {
$('.searchPageBox').addClass('searchDTView'); $('.searchPageBox').addClass('searchDTView');
} }
}); });
$("#dateSelectorDiv").datepicker({
format: "yyyy-mm-dd",
language: "ko",
autoclose: true
});
}); });
$(document).on('click', '#searchBtn', function (){ $(document).on('click', '#searchBtn', function (){
@ -28,17 +34,19 @@ $(document).on('click', '.searchTabLink', function (){
searchPageFormSubmit(1); searchPageFormSubmit(1);
}) })
$(document).on('click', '.boardLink', function (){ $(document).on('click', '.boardLink', function (event){
let menuUrl = $(this).find(".menuUrl").val() if(!event.target.className.includes('fileLink')){
if(menuUrl === undefined){ let menuUrl = $(this).find(".menuUrl").val()
location.href= "/publicBoard/findPage?publicKey="+$(this).find(".refDocKey").val() if(menuUrl === undefined){
}else{ location.href= "/publicBoard/findPage?publicKey="+$(this).find(".refDocKey").val()
if(menuUrl.includes("?")){
menuUrl += "&refDocKey="
}else{ }else{
menuUrl += "?refDocKey=" if(menuUrl.includes("?")){
menuUrl += "&refDocKey="
}else{
menuUrl += "?refDocKey="
}
location.href = menuUrl+$(this).find(".refDocKey").val()
} }
location.href = menuUrl+$(this).find(".refDocKey").val()
} }
}) })

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{layout/layout}">
<th:block layout:fragment="script">
<script type="text/javascript">
$(function () {
alert("검색어를 입력해주세요.")
history.go(-1)
})
</script>
</th:block>
<div layout:fragment="content">
</div>

View File

@ -12,10 +12,10 @@
</th:block> </th:block>
<div layout:fragment="content"> <div layout:fragment="content">
<main> <main>
<div class="headerArea"> <form method="get" action="/search/searchPage" id="searchForm">
<header id="searchHeader"> <div class="headerArea">
<div class="searchPagetop guideBox"> <header id="searchHeader">
<form method="get" action="/search/searchPage" id="searchForm"> <div class="searchPagetop guideBox">
<div class="searchBox"> <div class="searchBox">
<input type="hidden" name="pageIndex" id="pageIndexInput" th:value="${searchParams.pageIndex}"> <input type="hidden" name="pageIndex" id="pageIndexInput" th:value="${searchParams.pageIndex}">
<input type="hidden" name="activeTab" id="activeTabInput" th:value="${searchParams.activeTab}"> <input type="hidden" name="activeTab" id="activeTabInput" th:value="${searchParams.activeTab}">
@ -43,57 +43,57 @@
</span> </span>
</div> </div>
</div> </div>
</form> </div>
</div> </header>
</header> </div>
</div> <div class="searchPageBox">
<div class="searchPageBox"> <form>
<form> <fieldset>
<fieldset> <legend class="hide">상세검색</legend>
<legend class="hide">상세검색</legend> <ul class="searchWideBox">
<ul class="searchWideBox"> <!--<li>
<!--<li> <p>정렬</p>
<p>정렬</p> <input id="btn_chk1" type="radio" checked="checked" name="radio1" value="정확도순" />
<input id="btn_chk1" type="radio" checked="checked" name="radio1" value="정확도순" /> <label for="btn_chk1">정확도순</label>
<label for="btn_chk1">정확도순</label> <input id="btn_chk2" type="radio" name="radio1" value="최신순" />
<input id="btn_chk2" type="radio" name="radio1" value="최신순" /> <label for="btn_chk2">최신순</label>
<label for="btn_chk2">최신순</label> </li>-->
</li>--> <li>
<li> <p>기간</p>
<p>기간</p> <ul>
<ul> <li class="active"><a href="#">전체</a></li>
<li class="active"><a href="#">전체</a></li> <li><a href="#">1일</a></li>
<li><a href="#">1일</a></li> <li><a href="#">1주</a></li>
<li><a href="#">1주</a></li> <li><a href="#">1개월</a></li>
<li><a href="#">1개월</a></li> <li><a href="#">3개월</a></li>
<li><a href="#">3개월</a></li> <li><a href="#">1년</a></li>
<li><a href="#">1년</a></li> </ul>
</ul> <span>
<span> <span class="tie">
<span class="tie"> <label class="hide" for="beginDay">시작일</label>
<label class="hide" for="beginDay">시작일</label> <input id="beginDay" name="beginDay" type="date" value="" maxlength="250" class="shortText" />
<input id="beginDay" name="beginDay" type="date" value="" maxlength="250" class="shortText" /> </span>
<b>~</b>
<span class="tie">
<label class="hide" for="endDay">종료일</label>
<input id="endDay" name="endDay" type="date" value="" maxlength="250" class="shortText" />
</span>
</span> </span>
<b>~</b> </li>
<span class="tie"> <!--<li>
<label class="hide" for="endDay">종료일</label> <p>영역</p>
<input id="endDay" name="endDay" type="date" value="" maxlength="250" class="shortText" /> <input id="btn_chk3" type="checkbox" checked="checked" value="제목" />
</span> <label for="btn_chk3">제목</label>
</span> <input id="btn_chk4" type="checkbox" value="내용" />
</li> <label for="btn_chk4">내용</label>
<!--<li> <input id="btn_chk5" type="checkbox" value="첨부파일" />
<p>영역</p> <label for="btn_chk5">첨부파일</label>
<input id="btn_chk3" type="checkbox" checked="checked" value="제목" /> </li>-->
<label for="btn_chk3">제목</label> </ul>
<input id="btn_chk4" type="checkbox" value="내용" /> </fieldset>
<label for="btn_chk4">내용</label> </form>
<input id="btn_chk5" type="checkbox" value="첨부파일" /> </div>
<label for="btn_chk5">첨부파일</label> </form>
</li>-->
</ul>
</fieldset>
</form>
</div>
<div class="searchContents"> <div class="searchContents">
<div class="guideBox searchDataBox" id="start_contents"> <div class="guideBox searchDataBox" id="start_contents">
<div class="searchDataList"> <div class="searchDataList">
@ -222,10 +222,12 @@
<h3>첨부파일<span th:text="|${fileResult.totalCount}건|"></span></h3> <h3>첨부파일<span th:text="|${fileResult.totalCount}건|"></span></h3>
<ul class="boardList boardFileList"> <ul class="boardList boardFileList">
<li th:each="file:${fileResult.rowList}"> <li th:each="file:${fileResult.rowList}">
<dl class="fileLink" th:data-menukey="${file.menu_key eq null?'0':file.menu_key}" th:data-mainkey="${file.main_key}" th:data-fileseq="${file.file_seq}"> <dl class="boardLink">
<input type="hidden" class="refDocKey" th:value="${file.main_key}">
<th:block th:if="${file.menu_key ne null}"> <th:block th:if="${file.menu_key ne null}">
<th:block th:each="menu:${menuList}"> <th:block th:each="menu:${menuList}">
<th:block th:if="${menu.menuKey eq file.menu_key}"> <th:block th:if="${menu.menuKey eq file.menu_key}">
<input type="hidden" class="menuUrl" th:value="${menu.menuUrl}">
[<th:block th:if="${!#strings.isEmpty(menu.cat3Cd)}"> [<th:block th:if="${!#strings.isEmpty(menu.cat3Cd)}">
<th:block th:each="code:${session.commonCode.get('CAT3')}"> <th:block th:each="code:${session.commonCode.get('CAT3')}">
<th:block th:if="${menu.cat3Cd eq code.itemCd}" th:text="${code.itemValue}"></th:block> <th:block th:if="${menu.cat3Cd eq code.itemCd}" th:text="${code.itemValue}"></th:block>
@ -244,7 +246,10 @@
</th:block> </th:block>
</th:block> </th:block>
</th:block> </th:block>
<dt><a href="#" th:text="${#strings.concat(file.orig_nm, '.', file.file_extn)}"></a><a href="#" class="downBtn">내려받기</a></dt> <dt>
<a href="#" th:text="${#strings.concat(file.orig_nm, '.', file.file_extn)}"></a>
<a href="#" class="downBtn fileLink" th:data-menukey="${file.menu_key eq null?'0':file.menu_key}" th:data-mainkey="${file.main_key}" th:data-fileseq="${file.file_seq}">내려받기</a>
</dt>
<dd th:text="${file.file_content}"></dd> <dd th:text="${file.file_content}"></dd>
</dl> </dl>
</li> </li>