단속아이디 채번 수정

main
이범준 1 year ago
parent c930c5380c
commit 4e72366371

@ -6,7 +6,9 @@ import java.util.Map;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import cokr.xit.base.code.CommonCode; import cokr.xit.base.code.CommonCode;
@ -83,8 +85,8 @@ public class Crdn05Controller extends ApplicationController {
* "saved": true, false * "saved": true, false
* }</code></pre> * }</code></pre>
*/ */
@RequestMapping(name="단속자료 수기 등록", value="/030/create.do") @PostMapping(name="단속자료 수기 등록", value="/030/create.do")
public ModelAndView createCrdnDataByManual(Crdn crdn) { public ModelAndView createCrdnDataByManual(Crdn crdn, MultipartFile[] uploadFileList) {
boolean saved = crdn05Service.create(crdn); boolean saved = crdn05Service.create(crdn);

@ -5,7 +5,7 @@
<insert id="insertCrdn" parameterType="map"> <insert id="insertCrdn" parameterType="map">
/* 단속 대장 등록(crdn05Mapper.insertCrdn) */ /* 단속 대장 등록(crdn05Mapper.insertCrdn) */
<selectKey resultType="string" keyProperty="crdn.crdnId" keyColumn="NEW_ID" order="BEFORE"> <selectKey resultType="string" keyProperty="crdn.crdnId" keyColumn="NEW_ID" order="BEFORE">
SELECT LPAD(CONVERT(IFNULL(MAX(CRDN_ID) + 1, 1),INT), 20, '0') NEW_ID FROM TB_CRDN SELECT CAST(IFNULL(MAX(CRDN_ID) + 1, 1) AS INT) AS NEW_ID FROM TB_CRDN
</selectKey> </selectKey>
INSERT INTO TB_CRDN ( INSERT INTO TB_CRDN (
CRDN_ID <!-- 단속 ID --> CRDN_ID <!-- 단속 ID -->

@ -1,6 +1,8 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> <%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<div class="d-flex flex-row justify-content-evenly"> <div class="d-flex flex-row justify-content-evenly">
<div class="card" style="max-width:1100px;" title="단속정보"> <div class="card" style="max-width:1100px;" title="단속정보">
<form id="frm--${pageName}" class="dpv eca"> <form id="frm--${pageName}" class="dpv eca">
<input name="crdnId" type="hidden" data-map="CRDN_ID" /> <input name="crdnId" type="hidden" data-map="CRDN_ID" />
@ -150,8 +152,15 @@
</form> </form>
</div> </div>
<div class="card" style="width:400px;"> <div class="card" style="width:400px;">
사진 <form id="frmDummy--${pageName}" class="dpv eca" method="post" enctype="multipart/form-data">
<input type="file" id="uploadFileList--${pageName}" name="uploadFileList" multiple />
</form>
<div id="display--${pageName}">
</div>
</div> </div>
</div> </div>
<script> <script>
@ -161,16 +170,21 @@
pageObject["${pageName}"] = {}; pageObject["${pageName}"] = {};
$(document).ready(function(){ $(document).ready(function(){
var $P = pageObject["${pageName}"]; var $P = pageObject["${pageName}"];
/************************************************************************** /**************************************************************************
* DatasetControl * DatasetControl, Dataset, FormFields
**************************************************************************/ **************************************************************************/
$P.formFields = new FimsFormFields("#frm--${pageName}");
$P.uploadSet = uploadSupport("#uploadFileList--${pageName}");
$P.crdnControl = new DatasetControl({ $P.crdnControl = new DatasetControl({
prefix:"crdn", prefixName:"단속", infoSize:"xxl", prefix:"crdn", prefixName:"단속", infoSize:"xxl",
urls : { load : "" }, urls : { load : "", create : wctx.url("/${taskSeCd}/crdn/crdn05/030/create.do") },
keymapper:info => info ? info.CRDN_ID : "", keymapper:info => info ? info.CRDN_ID : "",
dataGetter:obj => obj.crdnList, dataGetter:obj => obj.crdnList,
appendData:true, appendData:true,
@ -178,21 +192,48 @@ $(document).ready(function(){
} }
}); });
$P.crdnControl.urls.create = wctx.url("/${taskSeCd}/crdn/crdn05/030/create.do");
$P.crdnControl.save = (info) => {
if (!info) return;
var item = $P.crdnControl.getCurrent("item"),
create = "added" == item.state;
var formData = new FormData(document.getElementById("frmDummy--${pageName}"));
for(var key in info) {
var value = info[key];
formData.append(key,value);
}
ajax.post({
url:!create ? $P.crdnControl.urls.update : $P.crdnControl.urls.create,
data: formData, contentType : false, processData : false,
success:resp => $P.crdnControl.onSave(resp)
});
};
/**************************************************************************
* DatasetControl.on, Dataset.on
**************************************************************************/
$P.uploadSet.onDatasetChange = () => { $P.uploadSet.onRemove(); };
$P.uploadSet.onRemove = () => { $P.fnDisplay(); };
/************************************************************************** /**************************************************************************
* pageObject.function * pageObject.function
**************************************************************************/ **************************************************************************/
$P.formFields = new FimsFormFields("#frm--${pageName}");
$P.fnSave = () => { $P.fnDisplay = () => {
var displayArea = document.querySelector("#display--${pageName}");
var imgTags = $P.uploadSet.inStrings("<img src='{url}' width='200' height='200' />").join("\n");
displayArea.innerHTML = imgTags;
};
$P.fnSave = () => {
if (!$("#frm--${pageName} input").validInputs()) return; if (!$("#frm--${pageName} input").validInputs()) return;
dialog.alert({ dialog.alert({
content:"현재 단속 정보를 저장하시겠습니까?", content:"현재 단속 정보를 저장하시겠습니까?",
onOK:() => { onOK:() => {
pageObject["crdn05030-info"].crdnControl.save($P.formFields.get()); $P.crdnControl.save($P.formFields.get());
} }
}); });
}; };
@ -212,6 +253,7 @@ $(document).ready(function(){
fn_securityModeToggle($("#securityMode--top").is(":checked")); fn_securityModeToggle($("#securityMode--top").is(":checked"));
$P.crdnControl.dataset.append({}); $P.crdnControl.dataset.append({});
}); });

@ -32,6 +32,7 @@
<script src="<c:url value="/resources/js/base/base.js?${ver}"/>"></script> <script src="<c:url value="/resources/js/base/base.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/base/base-fims.js?${ver}"/>"></script> <script src="<c:url value="/resources/js/base/base-fims.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/base/dataset.js?${ver}"/>"></script> <script src="<c:url value="/resources/js/base/dataset.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/base/upload-support.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/base/code.js"/>?${ver}"></script> <script src="<c:url value="/resources/js/base/code.js"/>?${ver}"></script>
<script src="<c:url value="/resources/js/base/code-support.js?${ver}"/>"></script> <script src="<c:url value="/resources/js/base/code-support.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/base/menu.js"/>?${ver}"></script> <script src="<c:url value="/resources/js/base/menu.js"/>?${ver}"></script>

Loading…
Cancel
Save