통합검색 조건 수정.

검색어 요청 화면 추가.
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

@ -17,6 +17,12 @@ $(function () {
$('.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,7 +34,8 @@ $(document).on('click', '.searchTabLink', function (){
searchPageFormSubmit(1); searchPageFormSubmit(1);
}) })
$(document).on('click', '.boardLink', function (){ $(document).on('click', '.boardLink', function (event){
if(!event.target.className.includes('fileLink')){
let menuUrl = $(this).find(".menuUrl").val() let menuUrl = $(this).find(".menuUrl").val()
if(menuUrl === undefined){ if(menuUrl === undefined){
location.href= "/publicBoard/findPage?publicKey="+$(this).find(".refDocKey").val() location.href= "/publicBoard/findPage?publicKey="+$(this).find(".refDocKey").val()
@ -40,6 +47,7 @@ $(document).on('click', '.boardLink', function (){
} }
location.href = menuUrl+$(this).find(".refDocKey").val() location.href = menuUrl+$(this).find(".refDocKey").val()
} }
}
}) })
$(document).on('click', '.fileLink', function (){ $(document).on('click', '.fileLink', function (){

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>
<form method="get" action="/search/searchPage" id="searchForm">
<div class="headerArea"> <div class="headerArea">
<header id="searchHeader"> <header id="searchHeader">
<div class="searchPagetop guideBox"> <div class="searchPagetop guideBox">
<form method="get" action="/search/searchPage" id="searchForm">
<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,7 +43,6 @@
</span> </span>
</div> </div>
</div> </div>
</form>
</div> </div>
</header> </header>
</div> </div>
@ -94,6 +93,7 @@
</fieldset> </fieldset>
</form> </form>
</div> </div>
</form>
<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>