주소록그룹 성능개선
@47f4edf866fa6468b03c0c5ad275761212031c98
--- src/main/java/itn/let/mjo/addr/service/AddrGroupService.java
+++ src/main/java/itn/let/mjo/addr/service/AddrGroupService.java
... | ... | @@ -22,6 +22,9 @@ |
| 22 | 22 |
|
| 23 | 23 |
public AddrGroupVO selectAddrGroupDetail(AddrGroupVO addrGroupVO) throws Exception; |
| 24 | 24 |
|
| 25 |
+ // 주소록 그룹 카운트 조회 |
|
| 26 |
+ public AddrGroupVO selectAddrGroupCnt(AddrGroupVO addrGroupVO) throws Exception; |
|
| 27 |
+ |
|
| 25 | 28 |
public String insertAddrGroup(AddrGroupVO addrGroupVO) throws Exception; |
| 26 | 29 |
|
| 27 | 30 |
public int updateAddrGroup(AddrGroupVO addrGroupVO) throws Exception; |
--- src/main/java/itn/let/mjo/addr/service/AddrGroupVO.java
+++ src/main/java/itn/let/mjo/addr/service/AddrGroupVO.java
... | ... | @@ -18,6 +18,28 @@ |
| 18 | 18 |
private String grpCount; // 그룹에 소속된 주소록 갯수 |
| 19 | 19 |
private String mergeGrps; // 합치기 그룹 id |
| 20 | 20 |
|
| 21 |
+ private int bookmarkCnt; |
|
| 22 |
+ private int nogrpCnt; |
|
| 23 |
+ private int addrTotCnt; |
|
| 24 |
+ |
|
| 25 |
+ public int getBookmarkCnt() {
|
|
| 26 |
+ return bookmarkCnt; |
|
| 27 |
+ } |
|
| 28 |
+ public void setBookmarkCnt(int bookmarkCnt) {
|
|
| 29 |
+ this.bookmarkCnt = bookmarkCnt; |
|
| 30 |
+ } |
|
| 31 |
+ public int getNogrpCnt() {
|
|
| 32 |
+ return nogrpCnt; |
|
| 33 |
+ } |
|
| 34 |
+ public void setNogrpCnt(int nogrpCnt) {
|
|
| 35 |
+ this.nogrpCnt = nogrpCnt; |
|
| 36 |
+ } |
|
| 37 |
+ public int getAddrTotCnt() {
|
|
| 38 |
+ return addrTotCnt; |
|
| 39 |
+ } |
|
| 40 |
+ public void setAddrTotCnt(int addrTotCnt) {
|
|
| 41 |
+ this.addrTotCnt = addrTotCnt; |
|
| 42 |
+ } |
|
| 21 | 43 |
public int getTotcnt() {
|
| 22 | 44 |
return totcnt; |
| 23 | 45 |
} |
--- src/main/java/itn/let/mjo/addr/service/impl/AddrGroupDAO.java
+++ src/main/java/itn/let/mjo/addr/service/impl/AddrGroupDAO.java
... | ... | @@ -44,7 +44,16 @@ |
| 44 | 44 |
public AddrGroupVO selectAddrGroupDetail(AddrGroupVO addrGroupVO) throws Exception {
|
| 45 | 45 |
return (AddrGroupVO) select("AddrGroupDAO.selectAddrGroupDetail", addrGroupVO);
|
| 46 | 46 |
} |
| 47 |
- |
|
| 47 |
+ |
|
| 48 |
+ /** |
|
| 49 |
+ * 주소록 그룹 카운트 조회 |
|
| 50 |
+ * @param addrGroupVO |
|
| 51 |
+ * @return |
|
| 52 |
+ * @throws Exception |
|
| 53 |
+ */ |
|
| 54 |
+ public AddrGroupVO selectAddrGroupCnt(AddrGroupVO addrGroupVO) throws Exception {
|
|
| 55 |
+ return (AddrGroupVO) select("AddrGroupDAO.selectAddrGroupCnt", addrGroupVO);
|
|
| 56 |
+ } |
|
| 48 | 57 |
|
| 49 | 58 |
/** |
| 50 | 59 |
* 주소록 그룹 등록 |
--- src/main/java/itn/let/mjo/addr/service/impl/AddrGroupServiceImpl.java
+++ src/main/java/itn/let/mjo/addr/service/impl/AddrGroupServiceImpl.java
... | ... | @@ -46,6 +46,11 @@ |
| 46 | 46 |
return addrGroupDAO.selectAddrGroupDetail(addrGroupVO); |
| 47 | 47 |
} |
| 48 | 48 |
|
| 49 |
+ // 주소록 그룹 카운트 조회 |
|
| 50 |
+ public AddrGroupVO selectAddrGroupCnt(AddrGroupVO addrGroupVO) throws Exception {
|
|
| 51 |
+ return addrGroupDAO.selectAddrGroupCnt(addrGroupVO); |
|
| 52 |
+ } |
|
| 53 |
+ |
|
| 49 | 54 |
public String insertAddrGroup(AddrGroupVO addrGroupVO) throws Exception {
|
| 50 | 55 |
int orderNum = addrGroupDAO.selectMaxOrderNumber(addrGroupVO); |
| 51 | 56 |
addrGroupVO.setGrpOrder(orderNum); |
--- src/main/java/itn/let/mjo/addr/web/AddrGroupController.java
+++ src/main/java/itn/let/mjo/addr/web/AddrGroupController.java
... | ... | @@ -181,10 +181,12 @@ |
| 181 | 181 |
addrGroupVO.setSearchSortCnd("grpOrder");
|
| 182 | 182 |
addrGroupVO.setSearchSortOrd("desc");
|
| 183 | 183 |
} |
| 184 |
- |
|
| 184 |
+ |
|
| 185 | 185 |
addrGroupVO.setSiteId("web");
|
| 186 | 186 |
List<AddrGroupVO> addrGroupList = addrGroupService.selectAddrGroupList(addrGroupVO); |
| 187 |
- |
|
| 187 |
+ |
|
| 188 |
+ /* |
|
| 189 |
+ * JSPark 2023.08.30 => Ajax 로 변경 |
|
| 188 | 190 |
//회원별 주소록 전체 갯수 조회 |
| 189 | 191 |
int addrTotalCount = addrService.selectAddrTotalCount(addrVO); |
| 190 | 192 |
|
... | ... | @@ -194,12 +196,12 @@ |
| 194 | 196 |
addrVO.setType("noGrp");
|
| 195 | 197 |
List<AddrVO> addrNoGrpList = addrService.selectAddrBasicGrpList(addrVO); |
| 196 | 198 |
|
| 197 |
- |
|
| 198 |
- |
|
| 199 | 199 |
model.addAttribute("addrTotalCount", addrTotalCount);
|
| 200 |
- model.addAttribute("addrGroupList", addrGroupList);
|
|
| 201 | 200 |
model.addAttribute("addrBookmarkList", addrBookmarkList);
|
| 202 | 201 |
model.addAttribute("addrNoGrpList", addrNoGrpList);
|
| 202 |
+ */ |
|
| 203 |
+ |
|
| 204 |
+ model.addAttribute("addrGroupList", addrGroupList);
|
|
| 203 | 205 |
model.addAttribute("userId", userId);
|
| 204 | 206 |
|
| 205 | 207 |
return "/web/addr/AddrGroupListAjax"; |
... | ... | @@ -427,6 +429,54 @@ |
| 427 | 429 |
return "/web/addr/AddrGroupSelectAjax"; |
| 428 | 430 |
} |
| 429 | 431 |
|
| 432 |
+ /** |
|
| 433 |
+ * 주소록 그룹 카운트 조회 Ajax |
|
| 434 |
+ * |
|
| 435 |
+ * @param request |
|
| 436 |
+ * @param addrGroupVO |
|
| 437 |
+ * @param redirectAttributes |
|
| 438 |
+ * @param model |
|
| 439 |
+ * @return |
|
| 440 |
+ * @throws Exception |
|
| 441 |
+ */ |
|
| 442 |
+ @RequestMapping("/web/addr/selectAddrGroupCntAjax.do")
|
|
| 443 |
+ public ModelAndView selectAddrGroupCntAjax(HttpServletRequest request, |
|
| 444 |
+ @ModelAttribute("searchVO") AddrGroupVO addrGroupVO
|
|
| 445 |
+ , Model model) throws Exception {
|
|
| 446 |
+ |
|
| 447 |
+ ModelAndView modelAndView = new ModelAndView(); |
|
| 448 |
+ modelAndView.setViewName("jsonView");
|
|
| 449 |
+ |
|
| 450 |
+ boolean isSuccess = true; |
|
| 451 |
+ String msg = ""; |
|
| 452 |
+ int bookmarkCnt = 0; |
|
| 453 |
+ int nogrpCnt = 0; |
|
| 454 |
+ int addrTotCnt = 0; |
|
| 455 |
+ |
|
| 456 |
+ try{
|
|
| 457 |
+ LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); |
|
| 458 |
+ addrGroupVO.setMberId(user.getId()); |
|
| 459 |
+ |
|
| 460 |
+ addrGroupVO = addrGroupService.selectAddrGroupCnt(addrGroupVO); |
|
| 461 |
+ if (addrGroupVO != null) {
|
|
| 462 |
+ bookmarkCnt = addrGroupVO.getBookmarkCnt(); |
|
| 463 |
+ nogrpCnt = addrGroupVO.getNogrpCnt(); |
|
| 464 |
+ addrTotCnt = addrGroupVO.getAddrTotCnt(); |
|
| 465 |
+ } |
|
| 466 |
+ } |
|
| 467 |
+ catch(Exception e) {
|
|
| 468 |
+ isSuccess = false; |
|
| 469 |
+ msg = e.getMessage(); |
|
| 470 |
+ } |
|
| 471 |
+ |
|
| 472 |
+ modelAndView.addObject("isSuccess", isSuccess);
|
|
| 473 |
+ modelAndView.addObject("msg", msg);
|
|
| 474 |
+ modelAndView.addObject("addrTotCnt", addrTotCnt);
|
|
| 475 |
+ modelAndView.addObject("nogrpCnt", nogrpCnt);
|
|
| 476 |
+ modelAndView.addObject("bookmarkCnt", bookmarkCnt);
|
|
| 477 |
+ |
|
| 478 |
+ return modelAndView; |
|
| 479 |
+ } |
|
| 430 | 480 |
|
| 431 | 481 |
/** |
| 432 | 482 |
* 주소록 그룹 수정 로직 |
--- src/main/resources/egovframework/sqlmap/let/mjo/addr/AddrGroup_SQL_Mysql.xml
+++ src/main/resources/egovframework/sqlmap/let/mjo/addr/AddrGroup_SQL_Mysql.xml
... | ... | @@ -69,7 +69,38 @@ |
| 69 | 69 |
WHERE 1=1 |
| 70 | 70 |
AND a.ADDR_GRP_ID = #addrGrpId# |
| 71 | 71 |
</select> |
| 72 |
- |
|
| 72 |
+ |
|
| 73 |
+ <!-- 주소록 그룹 카운트 조회 --> |
|
| 74 |
+ <select id="AddrGroupDAO.selectAddrGroupCnt" parameterClass="addrGroupVO" resultClass="addrGroupVO"> |
|
| 75 |
+ SELECT |
|
| 76 |
+ ( |
|
| 77 |
+ SELECT |
|
| 78 |
+ COUNT(0) |
|
| 79 |
+ FROM MJ_ADDR A |
|
| 80 |
+ WHERE A.MBER_ID = #mberId# |
|
| 81 |
+ AND A.BOOKMARK = 'Y' |
|
| 82 |
+ AND A.DELETE_YN = 'N' |
|
| 83 |
+ ) bookmarkCnt |
|
| 84 |
+ , ( |
|
| 85 |
+ SELECT |
|
| 86 |
+ COUNT(0) |
|
| 87 |
+ FROM MJ_ADDR A |
|
| 88 |
+ WHERE A.MBER_ID = #mberId# |
|
| 89 |
+ AND A.ADDR_GRP_ID = '0' |
|
| 90 |
+ AND A.BOOKMARK = 'N' |
|
| 91 |
+ AND A.DELETE_YN = 'N' |
|
| 92 |
+ ) nogrpCnt |
|
| 93 |
+ , ( |
|
| 94 |
+ SELECT |
|
| 95 |
+ COUNT(0) |
|
| 96 |
+ FROM MJ_ADDR A |
|
| 97 |
+ WHERE A.MBER_ID = #mberId# |
|
| 98 |
+ AND (A.RECV_STATUS = 'Y' OR A.RECV_STATUS = 'S' OR A.RECV_STATUS IS NULL) |
|
| 99 |
+ AND A.DELETE_YN = 'N' |
|
| 100 |
+ ) addrTotCnt |
|
| 101 |
+ FROM DUAL |
|
| 102 |
+ </select> |
|
| 103 |
+ |
|
| 73 | 104 |
<!-- 주소록 그룹 등록 --> |
| 74 | 105 |
<insert id="AddrGroupDAO.insertAddrGroup" parameterClass="addrGroupVO"> |
| 75 | 106 |
INSERT INTO MJ_ADDR_GRP ( |
--- src/main/webapp/WEB-INF/jsp/web/addr/AddrGroupListAjax.jsp
+++ src/main/webapp/WEB-INF/jsp/web/addr/AddrGroupListAjax.jsp
... | ... | @@ -6,8 +6,38 @@ |
| 6 | 6 |
|
| 7 | 7 |
<script src="/publish/js/content.js"></script> |
| 8 | 8 |
<script type="text/javascript"> |
| 9 |
- |
|
| 10 | 9 |
var successHtml=""; |
| 10 |
+ |
|
| 11 |
+$(document).ready(function(){
|
|
| 12 |
+ |
|
| 13 |
+ // 주소록 그룹 카운트 |
|
| 14 |
+ getAddrGroupCnt(); |
|
| 15 |
+ |
|
| 16 |
+}); |
|
| 17 |
+ |
|
| 18 |
+// 주소록 그룹 카운트 |
|
| 19 |
+function getAddrGroupCnt() {
|
|
| 20 |
+ $.ajax({
|
|
| 21 |
+ type: "POST", |
|
| 22 |
+ url: "/web/addr/selectAddrGroupCntAjax.do", |
|
| 23 |
+ data: {},
|
|
| 24 |
+ dataType:'json', |
|
| 25 |
+ async: true, |
|
| 26 |
+ success: function (data) {
|
|
| 27 |
+ if (data.isSuccess) {
|
|
| 28 |
+ $("#addrTotCnt").html(numberWithCommas(data.addrTotCnt));
|
|
| 29 |
+ $("#nogrpCnt").html(data.nogrpCnt);
|
|
| 30 |
+ $("#bookmarkCnt").html(data.bookmarkCnt);
|
|
| 31 |
+ } |
|
| 32 |
+ else {
|
|
| 33 |
+ //alert("Msg : " + data.msg);
|
|
| 34 |
+ } |
|
| 35 |
+ }, |
|
| 36 |
+ error: function (e) {
|
|
| 37 |
+ //alert("ERROR : " + JSON.stringify(e));
|
|
| 38 |
+ } |
|
| 39 |
+ }); |
|
| 40 |
+} |
|
| 11 | 41 |
|
| 12 | 42 |
// 주소록 그룹 리스트 띄우기 |
| 13 | 43 |
function listAddrGroupAjax() {
|
... | ... | @@ -599,7 +629,7 @@ |
| 599 | 629 |
<label for="groupAll" class="label">전체 선택</label> |
| 600 | 630 |
<input type="checkbox" name="groupAll" id="groupAll" value="1" onClick="fnCheckAll();"> |
| 601 | 631 |
</div> |
| 602 |
- <p class="open" onclick="openThisGroup('');"><img src="/publish/images/content/open_folder.png" alt="폴더 열림">전체[<span class="c_002c9a fwMd"><fmt:formatNumber value="${addrTotalCount}" pattern="#,###"/></span>/최대 100,000]</p>
|
|
| 632 |
+ <p class="open" onclick="openThisGroup('');"><img src="/publish/images/content/open_folder.png" alt="폴더 열림">전체[<span class="c_002c9a fwMd" id="addrTotCnt"></span>/최대 100,000]</p>
|
|
| 603 | 633 |
</div> |
| 604 | 634 |
<div class="adr1_btnWrap"> |
| 605 | 635 |
<div> |
... | ... | @@ -615,18 +645,16 @@ |
| 615 | 645 |
</div> |
| 616 | 646 |
<div class="adr1_list"> |
| 617 | 647 |
<!-- 고정그룹 : 그룹미지정 --> |
| 618 |
- <c:set var="noGrpSize" value="${fn:length(addrNoGrpList)}" />
|
|
| 619 | 648 |
<div class="adr_cb_wrap list_fixed"> |
| 620 | 649 |
<label for="group1" class="label"></label> |
| 621 | 650 |
<input type="checkbox" id="group1" disabled="disabled"> |
| 622 |
- <p onclick="openThisGroup('noGrp');"><img src="/publish/images/content/close_folder2.png" alt="폴더 닫힘">그룹미지정[<span><fmt:formatNumber value="${noGrpSize}" pattern="#,###"/></span>명]</p>
|
|
| 651 |
+ <p onclick="openThisGroup('noGrp');"><img src="/publish/images/content/close_folder2.png" alt="폴더 닫힘">그룹미지정[<span id="nogrpCnt"></span>명]</p>
|
|
| 623 | 652 |
</div> |
| 624 | 653 |
<!-- 고정그룹 : 자주보내는번호 --> |
| 625 |
- <c:set var="bookmarkSize" value="${fn:length(addrBookmarkList)}" />
|
|
| 626 | 654 |
<div class="adr_cb_wrap list_fixed"> |
| 627 | 655 |
<label for="group2" class="label"></label> |
| 628 | 656 |
<input type="checkbox" id="group2" disabled="disabled"> |
| 629 |
- <p onclick="openThisGroup('bookmark');"><img src="/publish/images/content/close_folder2.png" alt="폴더 닫힘">자주보내는 번호[<span><fmt:formatNumber value="${bookmarkSize}" pattern="#,###"/></span>명]
|
|
| 657 |
+ <p onclick="openThisGroup('bookmark');"><img src="/publish/images/content/close_folder2.png" alt="폴더 닫힘">자주보내는 번호[<span id="bookmarkCnt"></span>명]
|
|
| 630 | 658 |
</div> |
| 631 | 659 |
<c:forEach var="addrGroupList" items="${addrGroupList}" varStatus="status">
|
| 632 | 660 |
<div class="adr_cb_wrap list_switch"> |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?