diff --git a/src/main/java/cokr/xit/fims/cvlc/dao/CrdnCvlcptMapper.java b/src/main/java/cokr/xit/fims/cvlc/dao/CrdnCvlcptMapper.java index 2fe04dd4..1709a502 100644 --- a/src/main/java/cokr/xit/fims/cvlc/dao/CrdnCvlcptMapper.java +++ b/src/main/java/cokr/xit/fims/cvlc/dao/CrdnCvlcptMapper.java @@ -115,4 +115,10 @@ public interface CrdnCvlcptMapper extends AbstractMapper { */ DataObject selectCvlcptAnswerBasicWordsInfo(CrdnQuery crdnQuery); + /**지정한 민원자료의 민원 답변 내용을 변경한다. + * @param crdnCvlcpt 단속민원 정보 + * @return 저장된 정보 수 + */ + int updateAnswerContent(CrdnCvlcpt crdnCvlcpt); + } diff --git a/src/main/java/cokr/xit/fims/cvlc/service/CrdnCvlcptService.java b/src/main/java/cokr/xit/fims/cvlc/service/CrdnCvlcptService.java index cb8b502f..2217e5b8 100644 --- a/src/main/java/cokr/xit/fims/cvlc/service/CrdnCvlcptService.java +++ b/src/main/java/cokr/xit/fims/cvlc/service/CrdnCvlcptService.java @@ -56,5 +56,10 @@ public interface CrdnCvlcptService { */ boolean copyCvlcptCrdnInfo(String crdnId); + /** 단속민원의 답변내용을 변경한다. + * @param crdnCvlcpt 단속민원정보 + * @return 저장여부 + */ + boolean updateAnswerContent(CrdnCvlcpt crdnCvlcpt); } diff --git a/src/main/java/cokr/xit/fims/cvlc/service/bean/CrdnCvlcptServiceBean.java b/src/main/java/cokr/xit/fims/cvlc/service/bean/CrdnCvlcptServiceBean.java index 6ad3c1e1..7eced90c 100644 --- a/src/main/java/cokr/xit/fims/cvlc/service/bean/CrdnCvlcptServiceBean.java +++ b/src/main/java/cokr/xit/fims/cvlc/service/bean/CrdnCvlcptServiceBean.java @@ -534,4 +534,16 @@ public class CrdnCvlcptServiceBean extends AbstractServiceBean implements CrdnCv return true; } + @Override + public boolean updateAnswerContent(CrdnCvlcpt crdnCvlcpt) { + + int effected = crdnCvlcptMapper.updateAnswerContent(crdnCvlcpt); + if(effected != 1) { + throw new RuntimeException("답변 내용 저장에 실패하였습니다."); + } + + return true; + + } + } diff --git a/src/main/java/cokr/xit/fims/cvlc/web/Cvlc01Controller.java b/src/main/java/cokr/xit/fims/cvlc/web/Cvlc01Controller.java index a360ba19..8e073157 100644 --- a/src/main/java/cokr/xit/fims/cvlc/web/Cvlc01Controller.java +++ b/src/main/java/cokr/xit/fims/cvlc/web/Cvlc01Controller.java @@ -342,4 +342,23 @@ public class Cvlc01Controller extends ApplicationController { return mav; } + /**지정한 민원 자료의 답변 내용을 저장한다. + * @param crdnCvlcpt 단속민원 정보 + * @return jsonView + *
 {
+	 *     "affected": 저장된 정보수
+	 *     "saved": 저장되었으면 true, 그렇지 않으면 false
+	 * }
+ */ + @RequestMapping(name="답변 내용 저장", value="/060/update.do") + public ModelAndView updateAnswerContent(CrdnCvlcpt crdnCvlcpt) { + + boolean saved = false; + + saved = crdnCvlcptService.updateAnswerContent(crdnCvlcpt); + + return new ModelAndView("jsonView") + .addObject("saved", saved); + } + } diff --git a/src/main/resources/sql/mapper/fims/cvlc/crdnCvlcpt-mapper.xml b/src/main/resources/sql/mapper/fims/cvlc/crdnCvlcpt-mapper.xml index e309f2d6..fd21a4a5 100644 --- a/src/main/resources/sql/mapper/fims/cvlc/crdnCvlcpt-mapper.xml +++ b/src/main/resources/sql/mapper/fims/cvlc/crdnCvlcpt-mapper.xml @@ -635,6 +635,7 @@ SELECT A.HEADER_CN + +/* 답변 내용 변경(crdnCvlcptMapper.updateAnswerContent) */ +UPDATE TB_CRDN_CVLCPT + SET CVLCPT_PRCS_RSLT_CN = #{cvlcptPrcsRsltCn} + , MDFCN_DT = /* 수정일시 */ + , MDFR = #{modifiedBy} /* 수정자 */ + WHERE CVLCPT_LINK_ID = #{cvlcptLinkId}; + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc01060-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc01060-info.jsp index 44d945a1..df2b9046 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc01060-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc01060-info.jsp @@ -6,6 +6,7 @@
+
@@ -26,14 +27,14 @@
-
- +
@@ -41,7 +42,7 @@ 변경할내용이있으면 수정하시오.
- +
@@ -78,7 +79,11 @@ $(document).ready(function() { $P.formFields = new FimsFormFields("#frmEdit--${pageName}"); $P.cvlcptControl = new DatasetControl({ - urls : { load : "", getInfo : wctx.url("/"+$P.taskSeCd+"/cvlc/cvlc01/060/info.do") }, + urls : { + load : "", + getInfo : wctx.url("/"+$P.taskSeCd+"/cvlc/cvlc01/060/info.do"), + update : wctx.url("/"+$P.taskSeCd+"/cvlc/cvlc01/060/update.do") + }, keymapper:info => info ? info.CRDN_ID : "", dataGetter:obj => obj.cvlcptInfo, formats: { @@ -87,6 +92,17 @@ $(document).ready(function() { } }); + $P.cvlcptControl.save = (info) => { + if (!info) return; + + ajax.post({ + url : $P.cvlcptControl.urls.update, + data : info, + success : resp => { $P.cvlcptControl.onSave(resp); } + }); + + }; + /************************************************************************** * DatasetControl.on, Dataset.on **************************************************************************/ @@ -94,6 +110,12 @@ $(document).ready(function() { $P.formFields.set(item); } + $P.cvlcptControl.onSave = (resp) => { + if (resp.saved) { + dialog.alert("저장됐습니다."); + } + } + /************************************************************************** * pageObject.function **************************************************************************/ @@ -130,13 +152,25 @@ $(document).ready(function() { } }); } - + + $P.fnSave = () => { + + if(!customValidate($("#frmEdit--${pageName} input"))) return; + + if(confirm("현재 답변 내용을 저장하시겠습니까?")){ + $P.cvlcptControl.save($P.formFields.get()); + } + + } + /************************************************************************** * element.on **************************************************************************/ $("#btnPrev--${pageName}").on("click", () => $P.fnPrev() ); $("#btnNext--${pageName}").on("click", () => $P.fnNext() ); + $("#btnSave--${pageName}").on("click", () => $P.fnSave() ); + /************************************************************************** * 초기화 **************************************************************************/