선택한 그림문자의 우선선위 변경 기능 추가

This commit is contained in:
name 2023-09-05 16:52:28 +09:00
parent ab76471cc0
commit 9c4357dd2e
6 changed files with 170 additions and 3 deletions

View File

@ -190,4 +190,18 @@ public interface LetterService {
// 메인베스트 태그 수정 // 메인베스트 태그 수정
public void updateBastMsgTag(LetterVO letterVO) throws Exception ; public void updateBastMsgTag(LetterVO letterVO) throws Exception ;
//(메인태그)설정하고자 하는 우선순위를 포함한 우선순위들을 우선순위 + 체크한 리스트 크기만큼 증가시키기
public int updateChkBastMsgTagAfterSortPlus(LetterVO letterVO) throws Exception;
//(메인태그)체크한 리스트들 우선순위 업데이트
public int updateChkBastMsgTagListSort(LetterVO letterVO) throws Exception;
//(메인태그)그림문자 전체 우선순위 빈값없이 정렬하기
public int updateBastMsgTagOrderBySort(LetterVO letterVO) throws Exception;
//(메인태그)우선순위가 null 인값 우선순위 초기세팅
public int updateBastMsgTagNullSort(LetterVO letterVO) throws Exception;
} }

View File

@ -350,4 +350,20 @@ public class LetterDAO extends EgovAbstractDAO {
public void updateBastMsgTag(LetterVO letterVO) throws Exception { public void updateBastMsgTag(LetterVO letterVO) throws Exception {
update("LetterDAO.updateBastMsgTag", letterVO); update("LetterDAO.updateBastMsgTag", letterVO);
} }
public int updateChkBastMsgTagAfterSortPlus(LetterVO letterVO) throws Exception {
return update("LetterDAO.updateChkBastMsgTagAfterSortPlus", letterVO);
}
public int updateChkBastMsgTagListSort(LetterVO letterVO) throws Exception {
return update("LetterDAO.updateChkBastMsgTagListSort", letterVO);
}
public int updateBastMsgTagOrderBySort(LetterVO letterVO) throws Exception {
return update("LetterDAO.updateBastMsgTagOrderBySort", letterVO);
}
public int updateBastMsgTagNullSort(LetterVO letterVO) throws Exception {
return update("LetterDAO.updateBastMsgTagNullSort", letterVO);
}
} }

View File

@ -431,4 +431,24 @@ public class LetterServiceImpl extends EgovAbstractServiceImpl implements Letter
public void updateBastMsgTag(LetterVO letterVO) throws Exception { public void updateBastMsgTag(LetterVO letterVO) throws Exception {
letterDAO.updateBastMsgTag(letterVO); letterDAO.updateBastMsgTag(letterVO);
} }
@Override
public int updateChkBastMsgTagAfterSortPlus(LetterVO letterVO) throws Exception {
return letterDAO.updateChkBastMsgTagAfterSortPlus(letterVO);
}
@Override
public int updateChkBastMsgTagListSort(LetterVO letterVO) throws Exception {
return letterDAO.updateChkBastMsgTagListSort(letterVO);
}
@Override
public int updateBastMsgTagOrderBySort(LetterVO letterVO) throws Exception {
return letterDAO.updateBastMsgTagOrderBySort(letterVO);
}
@Override
public int updateBastMsgTagNullSort(LetterVO letterVO) throws Exception {
return letterDAO.updateBastMsgTagNullSort(letterVO);
}
} }

View File

@ -2641,6 +2641,45 @@ public class LetterController {
} }
@RequestMapping("/letter/messages/updateBastMsgTagSortChangeAjax.do")
@ResponseBody
public ModelAndView updateBastMsgTagSortChangeAjax(LetterVO letterVO,
ModelMap model,
HttpServletRequest request) throws Exception {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("jsonView");
Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
if (!isAuthenticated) {
modelAndView.addObject("result", "auth_fail");
return modelAndView;
}
letterVO.setChkIdsSize(letterVO.getChkIds().length);
try {
//1. 설정하고자 하는 우선순위를 포함한 우선순위들을 우선순위 + 체크한 리스트 크기만큼 증가시키기
int result = letterService.updateChkBastMsgTagAfterSortPlus(letterVO);
//2. 체크한 리스트들 우선순위 업데이트
result += letterService.updateChkBastMsgTagListSort(letterVO);
//3. 그림문자 전체 우선순위 빈값없이 정렬하기
result += letterService.updateBastMsgTagOrderBySort(letterVO);
//4. 우선순위가 null인 우선순위 부여
result += letterService.updateBastMsgTagNullSort(letterVO);
modelAndView.addObject("result", "success");
} catch (Exception e) {
System.out.println(e.getMessage());
modelAndView.addObject("result", "fail");
}
return modelAndView;
}
@RequestMapping(value={"/letter/photo/updateMultiMjonMsgAgentStsDataAjax.do"}) @RequestMapping(value={"/letter/photo/updateMultiMjonMsgAgentStsDataAjax.do"})
public ModelAndView updateMultiMjonMsgAgentStsDataAjax(@ModelAttribute("mjonMsgAgentStsVO") MjonMsgAgentStsVO mjonMsgAgentStsVO) throws Exception { public ModelAndView updateMultiMjonMsgAgentStsDataAjax(@ModelAttribute("mjonMsgAgentStsVO") MjonMsgAgentStsVO mjonMsgAgentStsVO) throws Exception {

View File

@ -1316,4 +1316,81 @@
WHERE 1=1 WHERE 1=1
AND MAIN_SEARCH_TAG_NO = #mainSearchTagNo# AND MAIN_SEARCH_TAG_NO = #mainSearchTagNo#
</update> </update>
<update id="LetterDAO.updateChkBastMsgTagAfterSortPlus" parameterClass="letterVO">
UPDATE
MJ_MAIN_SEARCH_TAG
SET
SORT = SORT + #chkIdsSize#
WHERE SORT >= #sort#
</update>
<update id="LetterDAO.updateChkBastMsgTagListSort" parameterClass="letterVO">
UPDATE
MJ_MAIN_SEARCH_TAG a
,(
SELECT
e.MAIN_SEARCH_TAG_NO
, @rownum:=@rownum+1 AS rowNum
FROM
MJ_MAIN_SEARCH_TAG e
,(SELECT @rownum := #sort#-1)rn
WHERE
e.MAIN_SEARCH_TAG_NO IN
<iterate property="chkIds" open="(" close=")" conjunction=",">
#chkIds[]#
</iterate>
ORDER BY e.SORT
)b
SET a.SORT = b.rowNum
WHERE a.MAIN_SEARCH_TAG_NO = b.MAIN_SEARCH_TAG_NO
</update>
<update id="LetterDAO.updateBastMsgTagOrderBySort" parameterClass="letterVO">
UPDATE
MJ_MAIN_SEARCH_TAG a
,(
SELECT
e.SORT
, @rownum:=@rownum+1 AS rowNum
FROM
MJ_MAIN_SEARCH_TAG e
, (SELECT @rownum := 0) rn
WHERE
e.SORT is not null
ORDER BY e.SORT
)b
SET
a.SORT = b.rowNum
WHERE
a.SORT = b.SORT
AND a.SORT is not null
</update>
<update id="LetterDAO.updateBastMsgTagNullSort" parameterClass="letterVO">
UPDATE
MJ_MAIN_SEARCH_TAG a
,(
SELECT
@rownum:=@rownum+1 AS rowNum
, e.MAIN_SEARCH_TAG_NO
FROM
MJ_MAIN_SEARCH_TAG e
, (SELECT @rownum :=
(SELECT
CASE
WHEN MAX(c.SORT) is null
THEN 0
else MAX(c.SORT)
END
FROM MJ_MAIN_SEARCH_TAG c
)
) rn
WHERE e.SORT IS NULL
) b
SET a.SORT = b.rowNum
WHERE a.MAIN_SEARCH_TAG_NO = b.MAIN_SEARCH_TAG_NO
</update>
</sqlMap> </sqlMap>

View File

@ -27,6 +27,7 @@ function fn_search(){
function linkPage(pageNo){ function linkPage(pageNo){
var listForm = document.listForm ; var listForm = document.listForm ;
listForm.pageIndex.value = pageNo ; listForm.pageIndex.value = pageNo ;
listForm.action = "/letter/messages/selectBastMsgTagList.do";
listForm.submit(); listForm.submit();
} }
@ -86,7 +87,7 @@ function fnSortChange(){
} }
} }
} }
var url = "/letter/messages/updateMainTagSortChangeAjax.do"; var url = "/letter/messages/updateBastMsgTagSortChangeAjax.do";
//배열 직렬화 //배열 직렬화
jQuery.ajaxSettings.traditional = true; jQuery.ajaxSettings.traditional = true;
@ -117,7 +118,7 @@ function fnSortChange(){
}); });
} }
</script> </script>
<form name="listForm" action="<c:url value='/letter/messages/selectMainTagList.do'/>" method="post"> <form name="listForm" action="<c:url value='/letter/messages/selectBastMsgTagList.do'/>" method="post">
<input name="pageIndex" type="hidden" value="<c:out value='${searchVO.pageIndex}'/>"/> <input name="pageIndex" type="hidden" value="<c:out value='${searchVO.pageIndex}'/>"/>
<input type="hidden" name="mainSearchTagNo" /> <input type="hidden" name="mainSearchTagNo" />
<input type="hidden" name="searchSortCnd" value="<c:out value="${searchVO.searchSortCnd}" />" /> <input type="hidden" name="searchSortCnd" value="<c:out value="${searchVO.searchSortCnd}" />" />