통합검색 요청사항 반영 작업중.

master
강석 최 2023-08-17 18:47:22 +09:00
parent 17e6613bd7
commit 574ab57567
9 changed files with 94 additions and 58 deletions

View File

@ -149,7 +149,7 @@ public class BaseController {
public void setSession(@AuthenticationPrincipal UserInfo loginUser, HttpSession session){
loginUser.setDownOrganCdList(organConfigService.selectDownOrganList(loginUser.getOgCd()));
loginUser.setUpOrganCdList(organConfigService.selectUpOrganList(loginUser.getOgCd()));
session.setAttribute("menuList", menuMgtService.selectAccessMenuListWhereUserSeq(loginUser.getUserSeq()));
session.setAttribute("menuList", menuMgtService.selectSortedAccessMenuList(loginUser.getUserSeq()));
Map<String, List<CodeMgt>> codeMap = codeMgtService.getCommonCode();
session.setAttribute("commonCode", codeMap);
session.setAttribute("userSeq", loginUser.getUserSeq());

View File

@ -100,7 +100,11 @@ public class MenuMgtService {
return menuList;
}
public List<MenuMgt> selectAccessMenuListWhereUserSeq(Integer userSeq) {
public List<MenuMgt> selectAccessMenuList(Integer userSeq) {
return menuMgtMapper.selectAccessMenuListWhereUserSeq(userSeq);
}
public List<MenuMgt> selectSortedAccessMenuList(Integer userSeq) {
List<MenuMgt> accessMenuList =menuMgtMapper.selectAccessMenuListWhereUserSeq(userSeq);
Set<String> cat1Set = new HashSet<>();
Set<String> cat2Set = new HashSet<>();
@ -114,23 +118,17 @@ public class MenuMgtService {
}
List<MenuMgt> firstMenuList = new ArrayList<>();
Iterator<String> cat1Itr = cat1Set.iterator();
while(cat1Itr.hasNext()){
String cat1Cd = cat1Itr.next();
for (String cat1Cd : cat1Set) {
MenuMgt firstMenu = new MenuMgt();
List<MenuMgt> secondMenuList = new ArrayList<>();
firstMenu.setCat1Cd(cat1Cd);
Iterator<String> cat2Itr = cat2Set.iterator();
while(cat2Itr.hasNext()){
String cat2Cd = cat2Itr.next();
for (String cat2Cd : cat2Set) {
if (cat2Cd.contains(cat1Cd)) {
MenuMgt secondMenu = new MenuMgt();
List<MenuMgt> thirdMenuList = new ArrayList<>();
secondMenu.setCat1Cd(cat1Cd);
secondMenu.setCat2Cd(cat2Cd.replace(cat1Cd, ""));
Iterator<String> cat3Itr = cat3Set.iterator();
while(cat3Itr.hasNext()){
String cat3Cd = cat3Itr.next();
for (String cat3Cd : cat3Set) {
if (cat3Cd.contains(cat2Cd)) {
MenuMgt thirdMenu = new MenuMgt();
thirdMenu.setCat2Cd(secondMenu.getCat2Cd());

View File

@ -14,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import java.util.List;
@RestController
@RequiredArgsConstructor
@ -26,6 +28,8 @@ public class SearchEngineController {
@GetMapping("/searchPage")
public ModelAndView searchPage(@AuthenticationPrincipal UserInfo loginUser, SearchParams params) {
ModelAndView mav = new ModelAndView("searchEngine/searchPage");
mav.addObject("accessMenuList", menuMgtService.selectAccessMenuList(loginUser.getUserSeq()));
mav.addObject("downOrganList", loginUser.getDownOrganCdList());
if(Utils.isEmpty(params.getKeyword())){
mav.setViewName("common/keywordRequest");
return mav;
@ -34,9 +38,6 @@ public class SearchEngineController {
params.setActiveTab("all");
params.setPageIndex(1);
}
if(Utils.isEmpty(params.getWrtUserSeq())){
params.setWrtUserSeq(loginUser.getUserSeq());
}
int totalCnt = 0;
SearchResult result = null;
switch (params.getActiveTab()){

View File

@ -38,5 +38,6 @@ public class SearchBoardView {
private String wrt_user_nm;
@JsonFormat(pattern = "yyyyMMddHHmmss")
private LocalDateTime wrt_dt;
private String organ_cd;
private String readableuser;
}

View File

@ -119,9 +119,6 @@ public class SearchEngineService {
.append(params.getKeyword())
.append("' allword synonym");
if(!params.getForm().equals("search_menu_view.search_menu_view")){
builder.append(" and wrt_user_seq='")
.append(params.getWrtUserSeq())
.append("'");
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
if(!Utils.isEmpty(params.getStartDate())){
builder.append(" and wrt_dt >= ")
@ -149,7 +146,6 @@ public class SearchEngineService {
.encode()
.build()
.toUri();
System.out.println("uri: " + uri);
ResponseEntity<String> response = requestRestTemplateExchange(uri);
JSONObject jsonObj = null;
try {
@ -183,7 +179,6 @@ public class SearchEngineService {
e.printStackTrace();
}
result.setRowList(convertList);
System.out.println("rowSize: "+result.getRowList().size());
return result;
}

View File

@ -56,7 +56,8 @@
ab.cat2_cd,
ab.cat3_cd,
ab.order_str,
ab.menu_url
ab.menu_url,
aa.access_auth
from access_config aa
inner join menu_mgt ab on aa.menu_key = ab.menu_key
where aa.user_seq = #{userSeq}

View File

@ -90,12 +90,15 @@ input::-moz-placeholder { color: #aaa; }
.menuList ol li{display:inline-block; margin-right:3px; font-size:17px; line-height:30px;}
.menuList ol li:before{content:' 〉'; color:#aaa;}
.menuList ol li:first-of-type:before{content:'';}
.menuLink > a:before{content:' · '; }
.menuList a{display:inline-block; margin-right:3px; font-size:17px; line-height:30px;}
/*메뉴*/
.boardList li{margin-bottom:30px;}
.boardList li dt{margin-bottom:15px;}
.boardList li dt{margin-bottom:5px;}
.boardList li dt a{font-size:17px; font-weight:bold; line-height:24px;}
.boardList li dt .titleDate{color:#aaa; margin-left:8px; font-size:12px; line-height:24px; line-height:none;}
.boardList li dd:first-of-type{ margin-bottom:12px; font-size:15px; text-overflow:ellipsis; overflow:hidden; white-space:nowrap; word-wrap:normal; color:#444;}
.boardList li dt .titleDate{color:#aaa; margin-left:8px; font-size:12px; line-height:24px; float:right;}
.boardList li dd:first-of-type{ margin-bottom:12px; font-size:12px; text-overflow:ellipsis; overflow:hidden; white-space:nowrap; word-wrap:normal; color:#444;}
.boardList li dd:nth-of-type(1){color:#999; margin-bottom:5px; font-size:15px; }
.boardList li dd:nth-of-type(2){color:#999; margin-bottom:5px; font-size:15px; }
.boardList li dd:nth-of-type(2):before{color:#999; content:' ㄴ ';}
.boardList li dd:nth-of-type(3) > b{display:inline-block; color:#999; padding-right:24px; margin-bottom:5px; font-size:14px; line-height:26px; cursor:pointer;}

View File

@ -66,10 +66,19 @@ $(document).on('click', '.searchTabLink', function (){
$("#activeTabInput").val($(this).attr('data-activetab'))
searchPageFormSubmit(1);
})
$(document).on('click', '.menuLink', function (){
const menuUrlEl = $(this).find(".menuUrl");
if(menuUrlEl.length !== 0){
location.href = menuUrlEl.val()
}else{
alert("메뉴 접근 권한이 없습니다.")
}
})
$(document).on('click', '.boardLink', function (event){
if(!event.target.className.includes('fileLink')){
let menuUrl = $(this).find(".menuUrl").val()
const menuUrlEl = $(this).find(".menuUrl");
if(menuUrlEl.length !== 0){
let menuUrl = menuUrlEl.val()
if(menuUrl === undefined){
location.href = "/publicBoard/findPage?publicKey="+$(this).find(".refDocKey").val()
}else{
@ -80,6 +89,9 @@ $(document).on('click', '.boardLink', function (event){
}
location.href = menuUrl+$(this).find(".refDocKey").val()
}
}else{
alert("메뉴 접근 권한이 없습니다.")
}
}
})

View File

@ -100,11 +100,21 @@
<section class="searchDataListBox" th:if="${searchParams.activeTab eq 'all' or searchParams.activeTab eq 'menu'}">
<h3>메뉴검색<span th:text="|${menuResult.totalCount}건|"></span></h3>
<ul class="menuList">
<li th:each="menu:${menuResult.rowList}">
<ol>
<li><a th:href="${menu.menu_url}" th:text="${menu.menu_nm}"></a></li>
</ol>
<th:block th:each="menu:${menuResult.rowList}">
<li class="menuLink">
<a href="#" th:text="${menu.menu_nm}"></a>
<th:block th:if="${menu.menu_key eq 0}">
<input type="hidden" class="menuUrl" th:value="${menu.menu_url}">
</th:block>
<th:block th:if="${menu.menu_key ne 0}">
<th:block th:each="accessMenu:${accessMenuList}">
<th:block th:if="${menu.menu_key eq accessMenu.menuKey and !#strings.isEmpty(accessMenu.accessAuth)}">
<input type="hidden" class="menuUrl" th:value="${menu.menu_url}">
</th:block>
</th:block>
</th:block>
</li>
</th:block>
</ul>
<div class="optionView" th:if="${searchParams.activeTab eq 'all'}">
<a href="#" class="plusView searchTabLink" data-activetab="menu">더보기 +</a>
@ -142,12 +152,16 @@
<ul class="boardList">
<li th:each="board:${boardResult.rowList}">
<dl class="boardLink">
<input type="hidden" class="refDocKey" th:value="${board.main_key}">
<dt>
<th:block th:if="${board.menu_key ne 0}">
[<th:block th:each="menu:${menuList}">
<th:block th:if="${menu.menuKey eq board.menu_key}">
<th:block th:each="accessMenu:${accessMenuList}">
<th:block th:if="${board.menu_key eq accessMenu.menuKey and !#strings.isEmpty(accessMenu.accessAuth)}">
<input type="hidden" class="refDocKey" th:value="${board.main_key}">
<input type="hidden" class="menuUrl" th:value="${menu.menuUrl}">
</th:block>
</th:block>
<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>
@ -167,14 +181,25 @@
</th:block>]
</th:block>
<a href="#" th:text="${board.title1}"></a>
<span class="titleDate" th:text="${#temporals.format(board.wrt_dt, 'yyyy-MM-dd HH:mm')}"></span>
<span class="titleDate">
<th:block th:if="${!#strings.isEmpty(board.wrt_organ)}" th:text="${board.wrt_organ}"></th:block>
<th:block th:if="${!#strings.isEmpty(board.wrt_part)}" th:text="${board.wrt_part}"></th:block>
<th:block th:if="${!#strings.isEmpty(board.wrt_user_grd)}" th:text="${board.wrt_user_grd}"></th:block>
<th:block th:if="${!#strings.isEmpty(board.wrt_user_nm)}" th:text="${board.wrt_user_nm}"></th:block>
<th:block th:text="${#temporals.format(board.wrt_dt, 'yyyy-MM-dd HH:mm')}"></th:block>
</span>
</dt>
<dt th:if="${!#strings.isEmpty(board.title2)}"><a href="#" th:text="${board.title2}"></a></dt>
<!--<dd th:if="${!#strings.isEmpty(board.content1)}" th:utext="${board.content1}"></dd>
<!--<dt th:if="${!#strings.isEmpty(board.title2)}"><a href="#" th:text="${board.title2}"></a></dt>-->
<th:block th:if="${!#strings.isEmpty(board.hash_tag)}">
<dd th:utext="|해시태그: ${board.hash_tag}|"></dd>
</th:block>
<!--
<dd th:if="${!#strings.isEmpty(board.content1)}" th:utext="${board.content1}"></dd>
<dd th:if="${!#strings.isEmpty(board.content2)}" th:utext="${board.content2}"></dd>
<dd th:if="${!#strings.isEmpty(board.content3)}" th:utext="${board.content3}"></dd>
<dd th:if="${!#strings.isEmpty(board.content4)}" th:utext="${board.content4}"></dd>
<dd th:if="${!#strings.isEmpty(board.content5)}" th:utext="${board.content5}"></dd>-->
<dd th:if="${!#strings.isEmpty(board.content5)}" th:utext="${board.content5}"></dd>
-->
</dl>
</li>
</ul>