답변 내용 저장 기능 추가

main
이범준 1 year ago
parent f385cbd62e
commit 2cbb2297d7

@ -115,4 +115,10 @@ public interface CrdnCvlcptMapper extends AbstractMapper {
*/ */
DataObject selectCvlcptAnswerBasicWordsInfo(CrdnQuery crdnQuery); DataObject selectCvlcptAnswerBasicWordsInfo(CrdnQuery crdnQuery);
/** .
* @param crdnCvlcpt
* @return
*/
int updateAnswerContent(CrdnCvlcpt crdnCvlcpt);
} }

@ -56,5 +56,10 @@ public interface CrdnCvlcptService {
*/ */
boolean copyCvlcptCrdnInfo(String crdnId); boolean copyCvlcptCrdnInfo(String crdnId);
/** .
* @param crdnCvlcpt
* @return
*/
boolean updateAnswerContent(CrdnCvlcpt crdnCvlcpt);
} }

@ -534,4 +534,16 @@ public class CrdnCvlcptServiceBean extends AbstractServiceBean implements CrdnCv
return true; return true;
} }
@Override
public boolean updateAnswerContent(CrdnCvlcpt crdnCvlcpt) {
int effected = crdnCvlcptMapper.updateAnswerContent(crdnCvlcpt);
if(effected != 1) {
throw new RuntimeException("답변 내용 저장에 실패하였습니다.");
}
return true;
}
} }

@ -342,4 +342,23 @@ public class Cvlc01Controller extends ApplicationController {
return mav; return mav;
} }
/** .
* @param crdnCvlcpt
* @return jsonView
* <pre><code> {
* "affected":
* "saved": true, false
* }</code></pre>
*/
@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);
}
} }

@ -635,6 +635,7 @@ SELECT A.HEADER_CN
<select id="selectAnswerPreview" parameterType="map" resultType="dataobject"> <select id="selectAnswerPreview" parameterType="map" resultType="dataobject">
/* 민원답변 미리보기(crdnCvlcptMapper.selectAnswerPreview) */ /* 민원답변 미리보기(crdnCvlcptMapper.selectAnswerPreview) */
SELECT C.CRDN_ID <!-- 단속 ID --> SELECT C.CRDN_ID <!-- 단속 ID -->
, CC.CVLCPT_LINK_ID <!-- 민원 연계 ID -->
, CC.CVLCPT_APLY_CN <!-- 민원 신청 내용 --> , CC.CVLCPT_APLY_CN <!-- 민원 신청 내용 -->
, CC.CVLCPT_PRCS_RSLT_CN <!-- 민원 처리 결과 내용 --> , CC.CVLCPT_PRCS_RSLT_CN <!-- 민원 처리 결과 내용 -->
FROM TB_CRDN C FROM TB_CRDN C
@ -643,4 +644,13 @@ SELECT C.CRDN_ID <!-- 단속 ID -->
AND C.CRDN_ID = #{crdnId} AND C.CRDN_ID = #{crdnId}
</select> </select>
<update id="updateAnswerContent" parameterType="cokr.xit.fims.cvlc.CrdnCvlcpt">
/* 답변 내용 변경(crdnCvlcptMapper.updateAnswerContent) */
UPDATE TB_CRDN_CVLCPT
SET CVLCPT_PRCS_RSLT_CN = #{cvlcptPrcsRsltCn}
, MDFCN_DT = <include refid="utility.now" /> /* 수정일시 */
, MDFR = #{modifiedBy} /* 수정자 */
WHERE CVLCPT_LINK_ID = #{cvlcptLinkId};
</update>
</mapper> </mapper>

@ -6,6 +6,7 @@
<div class="card" title="민원답변내용미리보기"> <div class="card" title="민원답변내용미리보기">
<form id="frmEdit--${pageName}"> <form id="frmEdit--${pageName}">
<input id="crdnId--${pageName}" name="crdnId" type="hidden" data-map="CRDN_ID" /> <input id="crdnId--${pageName}" name="crdnId" type="hidden" data-map="CRDN_ID" />
<input id="cvlcptLinkId--${pageName}" name="cvlcptLinkId" type="hidden" data-map="CVLCPT_LINK_ID" />
<div class="row g-1"> <div class="row g-1">
<div class="col-md-6"> <div class="col-md-6">
@ -26,14 +27,14 @@
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
<label for="cvlcptPrcsRsltCn--${pageName}" class="w-px-150 bg-lighter pe-2 col-form-label text-sm-center"> <label for="cvlcptPrcsRsltCn--${pageName}" class="required w-px-150 bg-lighter pe-2 col-form-label text-sm-center">
답변 내용 답변 내용
</label> </label>
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
<div class="px-2"> <div class="px-2">
<textarea rows="10" style="width:100%" id="cvlcptPrcsRsltCn--${pageName}" name="cvlcptPrcsRsltCn" data-map="CVLCPT_PRCS_RSLT_CN" <textarea id="cvlcptPrcsRsltCn--${pageName}" name="cvlcptPrcsRsltCn" data-map="CVLCPT_PRCS_RSLT_CN"
></textarea> required rows="10" style="width:100%"></textarea>
</div> </div>
</div> </div>
@ -41,7 +42,7 @@
변경할내용이있으면 수정하시오. 변경할내용이있으면 수정하시오.
</div> </div>
<div class="col-md-6 text-end"> <div class="col-md-6 text-end">
<button type="button" class="btn btn-primary">변경 내용 저장</button> <button type="button" id="btnSave--${pageName}" class="btn btn-primary">변경 내용 저장</button>
</div> </div>
</div> </div>
</form> </form>
@ -78,7 +79,11 @@ $(document).ready(function() {
$P.formFields = new FimsFormFields("#frmEdit--${pageName}"); $P.formFields = new FimsFormFields("#frmEdit--${pageName}");
$P.cvlcptControl = new DatasetControl({ $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 : "", keymapper:info => info ? info.CRDN_ID : "",
dataGetter:obj => obj.cvlcptInfo, dataGetter:obj => obj.cvlcptInfo,
formats: { 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 * DatasetControl.on, Dataset.on
**************************************************************************/ **************************************************************************/
@ -94,6 +110,12 @@ $(document).ready(function() {
$P.formFields.set(item); $P.formFields.set(item);
} }
$P.cvlcptControl.onSave = (resp) => {
if (resp.saved) {
dialog.alert("저장됐습니다.");
}
}
/************************************************************************** /**************************************************************************
* pageObject.function * pageObject.function
**************************************************************************/ **************************************************************************/
@ -131,12 +153,24 @@ $(document).ready(function() {
}); });
} }
$P.fnSave = () => {
if(!customValidate($("#frmEdit--${pageName} input"))) return;
if(confirm("현재 답변 내용을 저장하시겠습니까?")){
$P.cvlcptControl.save($P.formFields.get());
}
}
/************************************************************************** /**************************************************************************
* element.on * element.on
**************************************************************************/ **************************************************************************/
$("#btnPrev--${pageName}").on("click", () => $P.fnPrev() ); $("#btnPrev--${pageName}").on("click", () => $P.fnPrev() );
$("#btnNext--${pageName}").on("click", () => $P.fnNext() ); $("#btnNext--${pageName}").on("click", () => $P.fnNext() );
$("#btnSave--${pageName}").on("click", () => $P.fnSave() );
/************************************************************************** /**************************************************************************
* 초기화 * 초기화
**************************************************************************/ **************************************************************************/

Loading…
Cancel
Save