통합검색 조건 수정.

검색어 요청 화면 추가.
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")
public ModelAndView organMgtPage(@AuthenticationPrincipal UserInfo loginUser, SearchParams params) {
ModelAndView mav = new ModelAndView("searchEngine/search");
if(Utils.isEmpty(params.getKeyword())){
mav.setViewName("common/keywordRequest");
return mav;
}
if (Utils.isEmpty(params.getActiveTab())){
params.setActiveTab("all");
params.setPageIndex(1);
}
// if(Utils.isEmpty(params.getWrtOrgan())){
// params.setWrtOrgan(codeMgtService.searchValue(loginUser.getOgCd()));
// }
if(Utils.isEmpty(params.getWrtUserSeq())){
params.setWrtUserSeq(loginUser.getUserSeq());
}

View File

@ -16,4 +16,6 @@ public class SearchFileView {
private String save_path;
private String full_path;
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("' allword synonym");
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='")
.append(params.getWrtUserSeq())
.append("'");
@ -70,9 +67,8 @@ public class SearchEngineService {
.queryParam("where", where)
.queryParam("order by", " $relevance desc")
.queryParam("offset", params.getOffset().toString())
.queryParam("pagelength", params.getLimit().toString())
//.queryParam("limit", params.getLimit().toString())
// total_count 갯수가 limit로 제한걸려 조건에서 제외. 검색 결과는 정상적으로 나옴.
// total_count 갯수가 limit로 제한걸려 조건에서 제외. 검색 결과는 정상적으로 나옴.
.queryParam("charset", "UTF-8")
.queryParam("hilite-keywords", params.getKeyword())
.encode()

View File

@ -1,22 +1,28 @@

$(function () {
$('.searchFileBtn').click(function () {
if ($(this).parent('dd').hasClass('focus')) {
$(this).parent('dd').removeClass('focus');
$(this).parent('dd').children('.searchFileList').slideUp();
} else {
$(this).parent('dd').addClass('focus');
$(this).parent('dd').children('.searchFileList').slideDown();
}
});
$('.searchPageBoxBtn').click(function () {
if ($('.searchPageBox').hasClass('searchDTView')) {
$('.searchPageBox').removeClass('searchDTView');
} else {
$('.searchPageBox').addClass('searchDTView');
}
});
$('.searchFileBtn').click(function () {
if ($(this).parent('dd').hasClass('focus')) {
$(this).parent('dd').removeClass('focus');
$(this).parent('dd').children('.searchFileList').slideUp();
} else {
$(this).parent('dd').addClass('focus');
$(this).parent('dd').children('.searchFileList').slideDown();
}
});
$('.searchPageBoxBtn').click(function () {
if ($('.searchPageBox').hasClass('searchDTView')) {
$('.searchPageBox').removeClass('searchDTView');
} else {
$('.searchPageBox').addClass('searchDTView');
}
});
$("#dateSelectorDiv").datepicker({
format: "yyyy-mm-dd",
language: "ko",
autoclose: true
});
});
$(document).on('click', '#searchBtn', function (){
@ -28,17 +34,19 @@ $(document).on('click', '.searchTabLink', function (){
searchPageFormSubmit(1);
})
$(document).on('click', '.boardLink', function (){
let menuUrl = $(this).find(".menuUrl").val()
if(menuUrl === undefined){
location.href= "/publicBoard/findPage?publicKey="+$(this).find(".refDocKey").val()
}else{
if(menuUrl.includes("?")){
menuUrl += "&refDocKey="
$(document).on('click', '.boardLink', function (event){
if(!event.target.className.includes('fileLink')){
let menuUrl = $(this).find(".menuUrl").val()
if(menuUrl === undefined){
location.href= "/publicBoard/findPage?publicKey="+$(this).find(".refDocKey").val()
}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>
<div layout:fragment="content">
<main>
<div class="headerArea">
<header id="searchHeader">
<div class="searchPagetop guideBox">
<form method="get" action="/search/searchPage" id="searchForm">
<form method="get" action="/search/searchPage" id="searchForm">
<div class="headerArea">
<header id="searchHeader">
<div class="searchPagetop guideBox">
<div class="searchBox">
<input type="hidden" name="pageIndex" id="pageIndexInput" th:value="${searchParams.pageIndex}">
<input type="hidden" name="activeTab" id="activeTabInput" th:value="${searchParams.activeTab}">
@ -43,57 +43,57 @@
</span>
</div>
</div>
</form>
</div>
</header>
</div>
<div class="searchPageBox">
<form>
<fieldset>
<legend class="hide">상세검색</legend>
<ul class="searchWideBox">
<!--<li>
<p>정렬</p>
<input id="btn_chk1" type="radio" checked="checked" name="radio1" value="정확도순" />
<label for="btn_chk1">정확도순</label>
<input id="btn_chk2" type="radio" name="radio1" value="최신순" />
<label for="btn_chk2">최신순</label>
</li>-->
<li>
<p>기간</p>
<ul>
<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="#">3개월</a></li>
<li><a href="#">1년</a></li>
</ul>
<span>
<span class="tie">
<label class="hide" for="beginDay">시작일</label>
<input id="beginDay" name="beginDay" type="date" value="" maxlength="250" class="shortText" />
</div>
</header>
</div>
<div class="searchPageBox">
<form>
<fieldset>
<legend class="hide">상세검색</legend>
<ul class="searchWideBox">
<!--<li>
<p>정렬</p>
<input id="btn_chk1" type="radio" checked="checked" name="radio1" value="정확도순" />
<label for="btn_chk1">정확도순</label>
<input id="btn_chk2" type="radio" name="radio1" value="최신순" />
<label for="btn_chk2">최신순</label>
</li>-->
<li>
<p>기간</p>
<ul>
<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="#">3개월</a></li>
<li><a href="#">1년</a></li>
</ul>
<span>
<span class="tie">
<label class="hide" for="beginDay">시작일</label>
<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>
<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>
</li>
<!--<li>
<p>영역</p>
<input id="btn_chk3" type="checkbox" checked="checked" value="제목" />
<label for="btn_chk3">제목</label>
<input id="btn_chk4" type="checkbox" value="내용" />
<label for="btn_chk4">내용</label>
<input id="btn_chk5" type="checkbox" value="첨부파일" />
<label for="btn_chk5">첨부파일</label>
</li>-->
</ul>
</fieldset>
</form>
</div>
</li>
<!--<li>
<p>영역</p>
<input id="btn_chk3" type="checkbox" checked="checked" value="제목" />
<label for="btn_chk3">제목</label>
<input id="btn_chk4" type="checkbox" value="내용" />
<label for="btn_chk4">내용</label>
<input id="btn_chk5" type="checkbox" value="첨부파일" />
<label for="btn_chk5">첨부파일</label>
</li>-->
</ul>
</fieldset>
</form>
</div>
</form>
<div class="searchContents">
<div class="guideBox searchDataBox" id="start_contents">
<div class="searchDataList">
@ -222,10 +222,12 @@
<h3>첨부파일<span th:text="|${fileResult.totalCount}건|"></span></h3>
<ul class="boardList boardFileList">
<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:each="menu:${menuList}">
<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:each="code:${session.commonCode.get('CAT3')}">
<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>
<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>
</dl>
</li>