2024-08-21 14:59 주소록 관리 성능 향상을 위한 쿼리 변경
This commit is contained in:
parent
3cb8e2178a
commit
2d8ef11cab
@ -22,6 +22,8 @@ public interface AddrService {
|
|||||||
|
|
||||||
List<AddrVO> selectAddrList(AddrVO addrVO) throws Exception;
|
List<AddrVO> selectAddrList(AddrVO addrVO) throws Exception;
|
||||||
|
|
||||||
|
int selectAddrListCount(AddrVO addrVO) throws Exception;
|
||||||
|
|
||||||
List<AddrVO> selectAddrNewList(AddrVO addrVO) throws Exception;
|
List<AddrVO> selectAddrNewList(AddrVO addrVO) throws Exception;
|
||||||
|
|
||||||
AddrVO selectAddrDetail(AddrVO addrVO) throws Exception;
|
AddrVO selectAddrDetail(AddrVO addrVO) throws Exception;
|
||||||
|
|||||||
@ -35,6 +35,10 @@ public class AddrDAO extends EgovAbstractDAO {
|
|||||||
return (List<AddrVO>) list("AddrDAO.selectAddrList", addrVO);
|
return (List<AddrVO>) list("AddrDAO.selectAddrList", addrVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int selectAddrListCount(AddrVO addrVO) throws Exception{
|
||||||
|
return (int)select("AddrDAO.selectAddrListCount", addrVO);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 주소록 목록(속도개선)
|
* 주소록 목록(속도개선)
|
||||||
* @param addrVO
|
* @param addrVO
|
||||||
|
|||||||
@ -74,6 +74,11 @@ public class AddrServiceImpl extends EgovAbstractServiceImpl implements AddrSer
|
|||||||
return addrDAO.selectAddrList(addrVO);
|
return addrDAO.selectAddrList(addrVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int selectAddrListCount(AddrVO addrVO) throws Exception {
|
||||||
|
return addrDAO.selectAddrListCount(addrVO);
|
||||||
|
}
|
||||||
|
|
||||||
public List<AddrVO> selectAddrNewList(AddrVO addrVO) throws Exception {
|
public List<AddrVO> selectAddrNewList(AddrVO addrVO) throws Exception {
|
||||||
return addrDAO.selectAddrNewList(addrVO);
|
return addrDAO.selectAddrNewList(addrVO);
|
||||||
}
|
}
|
||||||
@ -402,7 +407,7 @@ public class AddrServiceImpl extends EgovAbstractServiceImpl implements AddrSer
|
|||||||
if(addrListVO.size() > MAX_SINGLE_ENTRY_CNT) {
|
if(addrListVO.size() > MAX_SINGLE_ENTRY_CNT) {
|
||||||
return new StatusResponse(
|
return new StatusResponse(
|
||||||
HttpStatus.BAD_REQUEST
|
HttpStatus.BAD_REQUEST
|
||||||
, "주소록은 한번에 10만개까지만 등록이 가능합니다."
|
, "주소록은 한번에 100만개까지만 등록이 가능합니다."
|
||||||
, LocalDateTime.now()
|
, LocalDateTime.now()
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -418,7 +423,7 @@ public class AddrServiceImpl extends EgovAbstractServiceImpl implements AddrSer
|
|||||||
if(sumAddrCnt > MAX_ADDR_CNT) {
|
if(sumAddrCnt > MAX_ADDR_CNT) {
|
||||||
return new StatusResponse(
|
return new StatusResponse(
|
||||||
HttpStatus.BAD_REQUEST
|
HttpStatus.BAD_REQUEST
|
||||||
, "주소록은 총 50만개까지만 등록이 가능합니다."
|
, "주소록은 총 1000만개까지만 등록이 가능합니다."
|
||||||
, LocalDateTime.now()
|
, LocalDateTime.now()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -364,6 +364,8 @@ public class AddrController {
|
|||||||
|
|
||||||
if(userId != "") {
|
if(userId != "") {
|
||||||
addrVO.setMberId(userId);
|
addrVO.setMberId(userId);
|
||||||
|
} else {
|
||||||
|
return "/web/addr/AddrListAjax";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(addrVO.getPageUnit() != 10) {
|
if(addrVO.getPageUnit() != 10) {
|
||||||
|
|||||||
@ -9,6 +9,9 @@
|
|||||||
<select id="AddrDAO.selectAddrList" parameterClass="addrVO" resultClass="addrVO">
|
<select id="AddrDAO.selectAddrList" parameterClass="addrVO" resultClass="addrVO">
|
||||||
/* AddrDAO.selectAddrList */
|
/* AddrDAO.selectAddrList */
|
||||||
SELECT
|
SELECT
|
||||||
|
/*
|
||||||
|
1 AS totCnt
|
||||||
|
*/
|
||||||
COUNT(1) OVER() AS totCnt
|
COUNT(1) OVER() AS totCnt
|
||||||
,A.ADDR_ID AS addrId
|
,A.ADDR_ID AS addrId
|
||||||
,A.ADDR_GRP_ID AS addrGrpId
|
,A.ADDR_GRP_ID AS addrGrpId
|
||||||
@ -56,9 +59,19 @@
|
|||||||
</iterate>
|
</iterate>
|
||||||
</isNotEmpty>
|
</isNotEmpty>
|
||||||
|
|
||||||
<isNotEmpty property="addrGrpId">
|
AND A.ADDR_GRP_ID in (
|
||||||
AND A.ADDR_GRP_ID = #addrGrpId#
|
select addr_grp_id
|
||||||
</isNotEmpty>
|
from mj_addr_grp
|
||||||
|
where 1=1
|
||||||
|
<isNotEmpty property="mberId">
|
||||||
|
AND MBER_ID = #mberId#
|
||||||
|
</isNotEmpty>
|
||||||
|
<isNotEmpty property="addrGrpId">
|
||||||
|
AND ADDR_GRP_ID = #addrGrpId#
|
||||||
|
</isNotEmpty>
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
<isNotEmpty property="searchKeyword">
|
<isNotEmpty property="searchKeyword">
|
||||||
<isEqual property="searchCondition" compareValue="">
|
<isEqual property="searchCondition" compareValue="">
|
||||||
AND ( A.ADDR_PHONE_NO LIKE CONCAT ('%', #searchKeyword#,'%')
|
AND ( A.ADDR_PHONE_NO LIKE CONCAT ('%', #searchKeyword#,'%')
|
||||||
@ -146,6 +159,121 @@
|
|||||||
LIMIT #recordCountPerPage# OFFSET #firstIndex#
|
LIMIT #recordCountPerPage# OFFSET #firstIndex#
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 주소록 목록 조회 -->
|
||||||
|
<select id="AddrDAO.selectAddrListCount" parameterClass="addrVO" resultClass="int">
|
||||||
|
/* AddrDAO.selectAddrListCount */
|
||||||
|
SELECT
|
||||||
|
COUNT(1) AS totCnt
|
||||||
|
FROM
|
||||||
|
MJ_ADDR A
|
||||||
|
LEFT OUTER JOIN
|
||||||
|
MJ_ADDR_TRANS_HIST C
|
||||||
|
ON
|
||||||
|
A.ADDR_GRP_ID = C.ADDR_GRP_ID
|
||||||
|
WHERE 1=1
|
||||||
|
<isNotEmpty property="mberId">
|
||||||
|
AND A.MBER_ID = #mberId#
|
||||||
|
</isNotEmpty>
|
||||||
|
|
||||||
|
AND (C.RECV_STATUS = 'Y' OR C.RECV_STATUS IS NULL)
|
||||||
|
|
||||||
|
<isNotEmpty property="addrIdList">
|
||||||
|
<iterate prepend="AND A.ADDR_ID IN " open="(" close=")" conjunction="," property="addrIdList">
|
||||||
|
#addrIdList[]#
|
||||||
|
</iterate>
|
||||||
|
</isNotEmpty>
|
||||||
|
|
||||||
|
AND A.ADDR_GRP_ID in (
|
||||||
|
select addr_grp_id
|
||||||
|
from mj_addr_grp
|
||||||
|
where 1=1
|
||||||
|
<isNotEmpty property="mberId">
|
||||||
|
AND MBER_ID = #mberId#
|
||||||
|
</isNotEmpty>
|
||||||
|
<isNotEmpty property="addrGrpId">
|
||||||
|
AND ADDR_GRP_ID = #addrGrpId#
|
||||||
|
</isNotEmpty>
|
||||||
|
)
|
||||||
|
|
||||||
|
<isNotEmpty property="searchKeyword">
|
||||||
|
<isEqual property="searchCondition" compareValue="">
|
||||||
|
AND ( A.ADDR_PHONE_NO LIKE CONCAT ('%', #searchKeyword#,'%')
|
||||||
|
OR A.ADDR_NM LIKE CONCAT ('%', #searchKeyword#,'%')
|
||||||
|
)
|
||||||
|
</isEqual>
|
||||||
|
<isEqual property="searchCondition" compareValue="1">
|
||||||
|
AND A.ADDR_PHONE_NO LIKE CONCAT ('%', #searchKeyword#,'%')
|
||||||
|
</isEqual>
|
||||||
|
<isEqual property="searchCondition" compareValue="2">
|
||||||
|
AND A.ADDR_NM LIKE CONCAT ('%', #searchKeyword#,'%')
|
||||||
|
</isEqual>
|
||||||
|
<isEqual property="searchCondition" compareValue="3">
|
||||||
|
AND A.MBER_ID LIKE CONCAT ('%', #searchKeyword#,'%')
|
||||||
|
</isEqual>
|
||||||
|
</isNotEmpty>
|
||||||
|
<isNotEmpty property="searchAddrGrpId">
|
||||||
|
<isEqual property="searchAddrGrpId" compareValue="bookmark">
|
||||||
|
AND A.BOOKMARK = 'Y'
|
||||||
|
</isEqual>
|
||||||
|
<isNotEqual property="searchAddrGrpId" compareValue="bookmark">
|
||||||
|
<isEqual property="searchAddrGrpId" compareValue="noGrp">
|
||||||
|
AND A.ADDR_GRP_ID = '0' AND A.BOOKMARK = 'N'
|
||||||
|
</isEqual>
|
||||||
|
<isNotEqual property="searchAddrGrpId" compareValue="noGrp">
|
||||||
|
AND A.ADDR_GRP_ID = #searchAddrGrpId#
|
||||||
|
</isNotEqual>
|
||||||
|
</isNotEqual>
|
||||||
|
</isNotEmpty>
|
||||||
|
<isEqual property="startKeyword" compareValue="1">
|
||||||
|
AND (A.ADDR_NM RLIKE '^(ㄱ|ㄲ)' OR (A.ADDR_NM <![CDATA[>=]]> '가' AND A.ADDR_NM <![CDATA[<]]> '나'))
|
||||||
|
</isEqual>
|
||||||
|
<isEqual property="startKeyword" compareValue="2">
|
||||||
|
AND (A.ADDR_NM RLIKE '^(ㄴ)' OR (A.ADDR_NM <![CDATA[>=]]> '나' AND A.ADDR_NM <![CDATA[<]]> '다'))
|
||||||
|
</isEqual>
|
||||||
|
<isEqual property="startKeyword" compareValue="3">
|
||||||
|
AND (A.ADDR_NM RLIKE '^(ㄷ|ㄸ)' OR (A.ADDR_NM <![CDATA[>=]]> '다' AND A.ADDR_NM <![CDATA[<]]> '라'))
|
||||||
|
</isEqual>
|
||||||
|
<isEqual property="startKeyword" compareValue="4">
|
||||||
|
AND (A.ADDR_NM RLIKE '^(ㄹ)' OR (A.ADDR_NM <![CDATA[>=]]> '라' AND A.ADDR_NM <![CDATA[<]]> '마'))
|
||||||
|
</isEqual>
|
||||||
|
<isEqual property="startKeyword" compareValue="5">
|
||||||
|
AND (A.ADDR_NM RLIKE '^(ㅁ)' OR (A.ADDR_NM <![CDATA[>=]]> '마' AND A.ADDR_NM <![CDATA[<]]> '바'))
|
||||||
|
</isEqual>
|
||||||
|
<isEqual property="startKeyword" compareValue="6">
|
||||||
|
AND (A.ADDR_NM RLIKE '^(ㅂ|ㅃ)' OR (A.ADDR_NM <![CDATA[>=]]> '바' AND A.ADDR_NM <![CDATA[<]]> '사'))
|
||||||
|
</isEqual>
|
||||||
|
<isEqual property="startKeyword" compareValue="7">
|
||||||
|
AND (A.ADDR_NM RLIKE '^(ㅅ|ㅆ)' OR (A.ADDR_NM <![CDATA[>=]]> '사' AND A.ADDR_NM <![CDATA[<]]> '아'))
|
||||||
|
</isEqual>
|
||||||
|
<isEqual property="startKeyword" compareValue="8">
|
||||||
|
AND (A.ADDR_NM RLIKE '^(ㅇ)' OR (A.ADDR_NM <![CDATA[>=]]> '아' AND A.ADDR_NM <![CDATA[<]]> '자'))
|
||||||
|
</isEqual>
|
||||||
|
<isEqual property="startKeyword" compareValue="9">
|
||||||
|
AND (A.ADDR_NM RLIKE '^(ㅈ|ㅉ)' OR (A.ADDR_NM <![CDATA[>=]]> '자' AND A.ADDR_NM <![CDATA[<]]> '차'))
|
||||||
|
</isEqual>
|
||||||
|
<isEqual property="startKeyword" compareValue="10">
|
||||||
|
AND (A.ADDR_NM RLIKE '^(ㅊ)' OR (A.ADDR_NM <![CDATA[>=]]> '차' AND A.ADDR_NM <![CDATA[<]]> '카'))
|
||||||
|
</isEqual>
|
||||||
|
<isEqual property="startKeyword" compareValue="11">
|
||||||
|
AND (A.ADDR_NM RLIKE '^(ㅋ)' OR (A.ADDR_NM <![CDATA[>=]]> '카' AND A.ADDR_NM <![CDATA[<]]> '타'))
|
||||||
|
</isEqual>
|
||||||
|
<isEqual property="startKeyword" compareValue="12">
|
||||||
|
AND (A.ADDR_NM RLIKE '^(ㅌ)' OR (A.ADDR_NM <![CDATA[>=]]> '타' AND A.ADDR_NM <![CDATA[<]]> '파'))
|
||||||
|
</isEqual>
|
||||||
|
<isEqual property="startKeyword" compareValue="13">
|
||||||
|
AND (A.ADDR_NM RLIKE '^(ㅍ)' OR (A.ADDR_NM <![CDATA[>=]]> '파' AND A.ADDR_NM <![CDATA[<]]> '하'))
|
||||||
|
</isEqual>
|
||||||
|
<isEqual property="startKeyword" compareValue="14">
|
||||||
|
AND (A.ADDR_NM RLIKE '^(ㅎ)' OR (A.ADDR_NM <![CDATA[>=]]> '하' AND A.ADDR_NM <![CDATA[<=]]> '힣'))
|
||||||
|
</isEqual>
|
||||||
|
<isEqual property="startKeyword" compareValue="a">
|
||||||
|
AND (A.ADDR_NM <![CDATA[>=]]> 'a' AND A.ADDR_NM <![CDATA[<=]]> 'z')
|
||||||
|
</isEqual>
|
||||||
|
<isEqual property="startKeyword" compareValue="0">
|
||||||
|
AND (A.ADDR_NM <![CDATA[>=]]> '0' AND A.ADDR_NM <![CDATA[<=]]>'9')
|
||||||
|
</isEqual>
|
||||||
|
</select>
|
||||||
|
|
||||||
<!-- 주소록 목록 조회(속도개선) -->
|
<!-- 주소록 목록 조회(속도개선) -->
|
||||||
<select id="AddrDAO.selectAddrNewList" parameterClass="addrVO" resultClass="addrVO">
|
<select id="AddrDAO.selectAddrNewList" parameterClass="addrVO" resultClass="addrVO">
|
||||||
SELECT
|
SELECT
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user