주소록관리 왼쪽화면 로딩속도 개선

This commit is contained in:
itn 2023-08-30 15:27:26 +09:00
parent 47f4edf866
commit df8a240896
6 changed files with 184 additions and 63 deletions

View File

@ -22,8 +22,14 @@ public interface AddrGroupService {
public AddrGroupVO selectAddrGroupDetail(AddrGroupVO addrGroupVO) throws Exception; public AddrGroupVO selectAddrGroupDetail(AddrGroupVO addrGroupVO) throws Exception;
// 주소록 그룹 카운트 조회 // 주소록 그룹 카운트 조회(전체)
public AddrGroupVO selectAddrGroupCnt(AddrGroupVO addrGroupVO) throws Exception; public AddrGroupVO selectAddrGroupTotCnt(AddrGroupVO addrGroupVO) throws Exception;
// 주소록 그룹 카운트 조회(그룹미지정)
public AddrGroupVO selectAddrGroupNogrpCnt(AddrGroupVO addrGroupVO) throws Exception;
// 주소록 그룹 카운트 조회(자주보내는 번호)
public AddrGroupVO selectAddrGroupBookmarkCnt(AddrGroupVO addrGroupVO) throws Exception;
public String insertAddrGroup(AddrGroupVO addrGroupVO) throws Exception; public String insertAddrGroup(AddrGroupVO addrGroupVO) throws Exception;

View File

@ -45,16 +45,21 @@ public class AddrGroupDAO extends EgovAbstractDAO {
return (AddrGroupVO) select("AddrGroupDAO.selectAddrGroupDetail", addrGroupVO); return (AddrGroupVO) select("AddrGroupDAO.selectAddrGroupDetail", addrGroupVO);
} }
/** // 주소록 그룹 카운트 조회(전체)
* 주소록 그룹 카운트 조회 public AddrGroupVO selectAddrGroupTotCnt(AddrGroupVO addrGroupVO) throws Exception {
* @param addrGroupVO return (AddrGroupVO) select("AddrGroupDAO.selectAddrGroupTotCnt", addrGroupVO);
* @return
* @throws Exception
*/
public AddrGroupVO selectAddrGroupCnt(AddrGroupVO addrGroupVO) throws Exception {
return (AddrGroupVO) select("AddrGroupDAO.selectAddrGroupCnt", addrGroupVO);
} }
// 주소록 그룹 카운트 조회(그룹미지정)
public AddrGroupVO selectAddrGroupNogrpCnt(AddrGroupVO addrGroupVO) throws Exception {
return (AddrGroupVO) select("AddrGroupDAO.selectAddrGroupNogrpCnt", addrGroupVO);
}
// 주소록 그룹 카운트 조회(자주보내는 번호)
public AddrGroupVO selectAddrGroupBookmarkCnt(AddrGroupVO addrGroupVO) throws Exception {
return (AddrGroupVO) select("AddrGroupDAO.selectAddrGroupBookmarkCnt", addrGroupVO);
}
/** /**
* 주소록 그룹 등록 * 주소록 그룹 등록
* @param addrGroupVO * @param addrGroupVO

View File

@ -46,9 +46,19 @@ public class AddrGroupServiceImpl extends EgovAbstractServiceImpl implements Ad
return addrGroupDAO.selectAddrGroupDetail(addrGroupVO); return addrGroupDAO.selectAddrGroupDetail(addrGroupVO);
} }
// 주소록 그룹 카운트 조회 // 주소록 그룹 카운트 조회(전체)
public AddrGroupVO selectAddrGroupCnt(AddrGroupVO addrGroupVO) throws Exception { public AddrGroupVO selectAddrGroupTotCnt(AddrGroupVO addrGroupVO) throws Exception {
return addrGroupDAO.selectAddrGroupCnt(addrGroupVO); return addrGroupDAO.selectAddrGroupTotCnt(addrGroupVO);
}
// 주소록 그룹 카운트 조회(그룹미지정)
public AddrGroupVO selectAddrGroupNogrpCnt(AddrGroupVO addrGroupVO) throws Exception {
return addrGroupDAO.selectAddrGroupNogrpCnt(addrGroupVO);
}
// 주소록 그룹 카운트 조회(자주보내는 번호)
public AddrGroupVO selectAddrGroupBookmarkCnt(AddrGroupVO addrGroupVO) throws Exception {
return addrGroupDAO.selectAddrGroupBookmarkCnt(addrGroupVO);
} }
public String insertAddrGroup(AddrGroupVO addrGroupVO) throws Exception { public String insertAddrGroup(AddrGroupVO addrGroupVO) throws Exception {

View File

@ -429,18 +429,9 @@ public class AddrGroupController {
return "/web/addr/AddrGroupSelectAjax"; return "/web/addr/AddrGroupSelectAjax";
} }
/** // 주소록 그룹 카운트 조회(전체) Ajax
* 주소록 그룹 카운트 조회 Ajax @RequestMapping("/web/addr/selectAddrGroupTotCntAjax.do")
* public ModelAndView selectAddrGroupTotCntAjax(HttpServletRequest request,
* @param request
* @param addrGroupVO
* @param redirectAttributes
* @param model
* @return
* @throws Exception
*/
@RequestMapping("/web/addr/selectAddrGroupCntAjax.do")
public ModelAndView selectAddrGroupCntAjax(HttpServletRequest request,
@ModelAttribute("searchVO") AddrGroupVO addrGroupVO @ModelAttribute("searchVO") AddrGroupVO addrGroupVO
, Model model) throws Exception { , Model model) throws Exception {
@ -449,18 +440,14 @@ public class AddrGroupController {
boolean isSuccess = true; boolean isSuccess = true;
String msg = ""; String msg = "";
int bookmarkCnt = 0;
int nogrpCnt = 0;
int addrTotCnt = 0; int addrTotCnt = 0;
try{ try{
LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
addrGroupVO.setMberId(user.getId()); addrGroupVO.setMberId(user.getId());
addrGroupVO = addrGroupService.selectAddrGroupCnt(addrGroupVO); addrGroupVO = addrGroupService.selectAddrGroupTotCnt(addrGroupVO);
if (addrGroupVO != null) { if (addrGroupVO != null) {
bookmarkCnt = addrGroupVO.getBookmarkCnt();
nogrpCnt = addrGroupVO.getNogrpCnt();
addrTotCnt = addrGroupVO.getAddrTotCnt(); addrTotCnt = addrGroupVO.getAddrTotCnt();
} }
} }
@ -472,7 +459,73 @@ public class AddrGroupController {
modelAndView.addObject("isSuccess", isSuccess); modelAndView.addObject("isSuccess", isSuccess);
modelAndView.addObject("msg", msg); modelAndView.addObject("msg", msg);
modelAndView.addObject("addrTotCnt", addrTotCnt); modelAndView.addObject("addrTotCnt", addrTotCnt);
return modelAndView;
}
// 주소록 그룹 카운트 조회(전체) Ajax
@RequestMapping("/web/addr/selectAddrGroupNogrpCntAjax.do")
public ModelAndView selectAddrGroupNogrpCntAjax(HttpServletRequest request,
@ModelAttribute("searchVO") AddrGroupVO addrGroupVO
, Model model) throws Exception {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
boolean isSuccess = true;
String msg = "";
int nogrpCnt = 0;
try{
LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
addrGroupVO.setMberId(user.getId());
addrGroupVO = addrGroupService.selectAddrGroupNogrpCnt(addrGroupVO);
if (addrGroupVO != null) {
nogrpCnt = addrGroupVO.getNogrpCnt();
}
}
catch(Exception e) {
isSuccess = false;
msg = e.getMessage();
}
modelAndView.addObject("isSuccess", isSuccess);
modelAndView.addObject("msg", msg);
modelAndView.addObject("nogrpCnt", nogrpCnt); modelAndView.addObject("nogrpCnt", nogrpCnt);
return modelAndView;
}
// 주소록 그룹 카운트 조회(전체) Ajax
@RequestMapping("/web/addr/selectAddrGroupBookmarkCntAjax.do")
public ModelAndView selectAddrGroupBookmarkCntAjax(HttpServletRequest request,
@ModelAttribute("searchVO") AddrGroupVO addrGroupVO
, Model model) throws Exception {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
boolean isSuccess = true;
String msg = "";
int bookmarkCnt = 0;
try{
LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
addrGroupVO.setMberId(user.getId());
addrGroupVO = addrGroupService.selectAddrGroupBookmarkCnt(addrGroupVO);
if (addrGroupVO != null) {
bookmarkCnt = addrGroupVO.getBookmarkCnt();
}
}
catch(Exception e) {
isSuccess = false;
msg = e.getMessage();
}
modelAndView.addObject("isSuccess", isSuccess);
modelAndView.addObject("msg", msg);
modelAndView.addObject("bookmarkCnt", bookmarkCnt); modelAndView.addObject("bookmarkCnt", bookmarkCnt);
return modelAndView; return modelAndView;

View File

@ -70,37 +70,36 @@
AND a.ADDR_GRP_ID = #addrGrpId# AND a.ADDR_GRP_ID = #addrGrpId#
</select> </select>
<!-- 주소록 그룹 카운트 조회 --> <select id="AddrGroupDAO.selectAddrGroupTotCnt" parameterClass="addrGroupVO" resultClass="addrGroupVO">
<select id="AddrGroupDAO.selectAddrGroupCnt" parameterClass="addrGroupVO" resultClass="addrGroupVO">
SELECT SELECT
( COUNT(0) AS addrTotCnt
SELECT FROM MJ_ADDR A
COUNT(0) WHERE A.MBER_ID = #mberId#
FROM MJ_ADDR A AND (A.RECV_STATUS = 'Y' OR A.RECV_STATUS = 'S' OR A.RECV_STATUS IS NULL)
WHERE A.MBER_ID = #mberId# AND A.DELETE_YN = 'N'
AND A.BOOKMARK = 'Y'
AND A.DELETE_YN = 'N'
) bookmarkCnt
, (
SELECT
COUNT(0)
FROM MJ_ADDR A
WHERE A.MBER_ID = #mberId#
AND A.ADDR_GRP_ID = '0'
AND A.BOOKMARK = 'N'
AND A.DELETE_YN = 'N'
) nogrpCnt
, (
SELECT
COUNT(0)
FROM MJ_ADDR A
WHERE A.MBER_ID = #mberId#
AND (A.RECV_STATUS = 'Y' OR A.RECV_STATUS = 'S' OR A.RECV_STATUS IS NULL)
AND A.DELETE_YN = 'N'
) addrTotCnt
FROM DUAL
</select> </select>
<!-- 주소록 그룹 카운트 조회(그룹미지정) -->
<select id="AddrGroupDAO.selectAddrGroupNogrpCnt" parameterClass="addrGroupVO" resultClass="addrGroupVO">
SELECT
COUNT(0) AS nogrpCnt
FROM MJ_ADDR A
WHERE A.MBER_ID = #mberId#
AND A.ADDR_GRP_ID = '0'
AND A.BOOKMARK = 'N'
AND A.DELETE_YN = 'N'
</select>
<!-- 주소록 그룹 카운트 조회(그룹미지정) -->
<select id="AddrGroupDAO.selectAddrGroupBookmarkCnt" parameterClass="addrGroupVO" resultClass="addrGroupVO">
SELECT
COUNT(0) AS bookmarkCnt
FROM MJ_ADDR A
WHERE A.MBER_ID = #mberId#
AND A.BOOKMARK = 'Y'
AND A.DELETE_YN = 'N'
</select>
<!-- 주소록 그룹 등록 --> <!-- 주소록 그룹 등록 -->
<insert id="AddrGroupDAO.insertAddrGroup" parameterClass="addrGroupVO"> <insert id="AddrGroupDAO.insertAddrGroup" parameterClass="addrGroupVO">
INSERT INTO MJ_ADDR_GRP ( INSERT INTO MJ_ADDR_GRP (

View File

@ -10,23 +10,71 @@ var successHtml="";
$(document).ready(function(){ $(document).ready(function(){
// 주소록 그룹 카운트 // 주소록 그룹 카운트(전체)
getAddrGroupCnt(); getAddrGroupTotCnt();
//주소록 그룹 카운트(그룹미지정)
getAddrGroupNogrpCnt();
//주소록 그룹 카운트(자주보내는 번호)
getAddrGroupBookmarkCnt();
}); });
// 주소록 그룹 카운트 // 주소록 그룹 카운트(전체)
function getAddrGroupCnt() { function getAddrGroupTotCnt() {
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "/web/addr/selectAddrGroupCntAjax.do", url: "/web/addr/selectAddrGroupTotCntAjax.do",
data: {}, data: {},
dataType:'json', dataType:'json',
async: true, async: true,
success: function (data) { success: function (data) {
if (data.isSuccess) { if (data.isSuccess) {
$("#addrTotCnt").html(numberWithCommas(data.addrTotCnt)); $("#addrTotCnt").html(numberWithCommas(data.addrTotCnt));
}
else {
//alert("Msg : " + data.msg);
}
},
error: function (e) {
//alert("ERROR : " + JSON.stringify(e));
}
});
}
//주소록 그룹 카운트(그룹미지정)
function getAddrGroupNogrpCnt() {
$.ajax({
type: "POST",
url: "/web/addr/selectAddrGroupNogrpCntAjax.do",
data: {},
dataType:'json',
async: true,
success: function (data) {
if (data.isSuccess) {
$("#nogrpCnt").html(data.nogrpCnt); $("#nogrpCnt").html(data.nogrpCnt);
}
else {
//alert("Msg : " + data.msg);
}
},
error: function (e) {
//alert("ERROR : " + JSON.stringify(e));
}
});
}
//주소록 그룹 카운트(자주보내는 번호)
function getAddrGroupBookmarkCnt() {
$.ajax({
type: "POST",
url: "/web/addr/selectAddrGroupBookmarkCntAjax.do",
data: {},
dataType:'json',
async: true,
success: function (data) {
if (data.isSuccess) {
$("#bookmarkCnt").html(data.bookmarkCnt); $("#bookmarkCnt").html(data.bookmarkCnt);
} }
else { else {