DB에 인서트할 때 ID 생성(max+1) 하는 부분 수정.

main
jjh 1 year ago
parent 434f899b85
commit c0f3b38ee4

@ -62,7 +62,9 @@
<insert id="insertCrdnSttsHstry" parameterType="map">/* 단속 상태 이력 등록(crdnSttsHstryMapper.insertCrdnSttsHstry) */ <insert id="insertCrdnSttsHstry" parameterType="map">/* 단속 상태 이력 등록(crdnSttsHstryMapper.insertCrdnSttsHstry) */
<selectKey resultType="string" keyProperty="crdnSttsHstry.sttsHstryId" keyColumn="NEW_ID" order="BEFORE"> <selectKey resultType="string" keyProperty="crdnSttsHstry.sttsHstryId" keyColumn="NEW_ID" order="BEFORE">
SELECT CONCAT(DATE_FORMAT(CURRENT_DATE, '%Y'), LPAD(CAST(IFNULL(MAX(SUBSTRING(STTS_HSTRY_ID,5)) + 1, 1) AS INT), 16, '0')) AS NEW_ID FROM TB_CRDN_STTS_HSTRY SELECT CONCAT(DATE_FORMAT(CURRENT_DATE, '%Y'), LPAD(CAST(IFNULL(MAX(SUBSTRING(STTS_HSTRY_ID, 5)) + 1, 1) AS INT), 16, '0')) AS NEW_ID
FROM TB_CRDN_STTS_HSTRY
WHERE STTS_HSTRY_ID LIKE CONCAT(DATE_FORMAT(CURRENT_DATE, '%Y'), '%')
</selectKey> </selectKey>
INSERT INSERT
INTO TB_CRDN_STTS_HSTRY ( INTO TB_CRDN_STTS_HSTRY (

@ -251,7 +251,9 @@
<insert id="insertLevyExcl" parameterType="map">/* 부과제외 대장 등록(excl01Mapper.insertLevyExcl) */ <insert id="insertLevyExcl" parameterType="map">/* 부과제외 대장 등록(excl01Mapper.insertLevyExcl) */
<selectKey resultType="string" keyProperty="excl01.levyExclId" keyColumn="NEW_ID" order="BEFORE"> <selectKey resultType="string" keyProperty="excl01.levyExclId" keyColumn="NEW_ID" order="BEFORE">
SELECT CONCAT(DATE_FORMAT(CURRENT_DATE, '%Y'), LPAD(CAST(IFNULL(MAX(SUBSTRING(LEVY_EXCL_ID,5)) + 1, 1) AS INT), 16, '0')) AS NEW_ID FROM TB_LEVY_EXCL SELECT CONCAT(DATE_FORMAT(CURRENT_DATE, '%Y'), LPAD(CAST(IFNULL(MAX(SUBSTRING(LEVY_EXCL_ID, 5)) + 1, 1) AS INT), 16, '0')) AS NEW_ID
FROM TB_LEVY_EXCL
WHERE LEVY_EXCL_ID LIKE CONCAT(DATE_FORMAT(CURRENT_DATE, '%Y'), '%')
</selectKey> </selectKey>
INSERT INSERT
INTO TB_LEVY_EXCL ( INTO TB_LEVY_EXCL (

@ -318,6 +318,9 @@
, B.ADDR /* 주소 */ , B.ADDR /* 주소 */
, B.DTL_ADDR /* 상세 주소 */ , B.DTL_ADDR /* 상세 주소 */
, C.OPNN_ID /* 의견 ID */ , C.OPNN_ID /* 의견 ID */
, (SELECT CONCAT(DATE_FORMAT(CURRENT_DATE, '%Y'), LPAD(CAST(IFNULL(MAX(SUBSTRING(RCPT_NO, 5)) + 1, 1) AS INT), 6, '0'))
FROM TB_OPNN_SBMSN
WHERE RCPT_NO LIKE CONCAT(DATE_FORMAT(CURRENT_DATE, '%Y'), '%') ) AS RCPT_NO /* 접수 번호 */
, <include refid="utility.today" /> AS TODAY /* 오늘 일자 */ , <include refid="utility.today" /> AS TODAY /* 오늘 일자 */
FROM TB_CRDN A FROM TB_CRDN A
LEFT OUTER JOIN TB_PAYER B ON (A.RTPYR_ID = B.RTPYR_ID) LEFT OUTER JOIN TB_PAYER B ON (A.RTPYR_ID = B.RTPYR_ID)
@ -327,7 +330,9 @@
<insert id="insertOpnnSbmsn" parameterType="map">/* 의견제출 대장 등록(excl02Mapper.insertOpnnSbmsn) */ <insert id="insertOpnnSbmsn" parameterType="map">/* 의견제출 대장 등록(excl02Mapper.insertOpnnSbmsn) */
<selectKey resultType="string" keyProperty="excl02.opnnId" keyColumn="NEW_ID" order="BEFORE"> <selectKey resultType="string" keyProperty="excl02.opnnId" keyColumn="NEW_ID" order="BEFORE">
SELECT CONCAT(DATE_FORMAT(CURRENT_DATE, '%Y'), LPAD(CAST(IFNULL(MAX(SUBSTRING(OPNN_ID,5)) + 1, 1) AS INT), 16, '0')) AS NEW_ID FROM TB_OPNN_SBMSN SELECT CONCAT(DATE_FORMAT(CURRENT_DATE, '%Y'), LPAD(CAST(IFNULL(MAX(SUBSTRING(OPNN_ID, 5)) + 1, 1) AS INT), 16, '0')) AS NEW_ID
FROM TB_OPNN_SBMSN
WHERE OPNN_ID LIKE CONCAT(DATE_FORMAT(CURRENT_DATE, '%Y'), '%')
</selectKey> </selectKey>
INSERT INSERT
INTO TB_OPNN_SBMSN ( INTO TB_OPNN_SBMSN (

@ -140,7 +140,9 @@
<insert id="insertCrdnReReg" parameterType="map">/* 단속 재등록 등록(excl03Mapper.insertCrdnReReg) */ <insert id="insertCrdnReReg" parameterType="map">/* 단속 재등록 등록(excl03Mapper.insertCrdnReReg) */
<selectKey resultType="string" keyProperty="excl03.reRegId" keyColumn="NEW_ID" order="BEFORE"> <selectKey resultType="string" keyProperty="excl03.reRegId" keyColumn="NEW_ID" order="BEFORE">
SELECT CONCAT(DATE_FORMAT(CURRENT_DATE, '%Y'), LPAD(CAST(IFNULL(MAX(SUBSTRING(RE_REG_ID,5)) + 1, 1) AS INT), 16, '0')) AS NEW_ID FROM TB_CRDN_RE_REG SELECT CONCAT(DATE_FORMAT(CURRENT_DATE, '%Y'), LPAD(CAST(IFNULL(MAX(SUBSTRING(RE_REG_ID, 5)) + 1, 1) AS INT), 16, '0')) AS NEW_ID
FROM TB_CRDN_RE_REG
WHERE RE_REG_ID LIKE CONCAT(DATE_FORMAT(CURRENT_DATE, '%Y'), '%')
</selectKey> </selectKey>
INSERT INTO TB_CRDN_RE_REG ( INSERT INTO TB_CRDN_RE_REG (
RE_REG_ID /* 재등록 ID */ RE_REG_ID /* 재등록 ID */

Loading…
Cancel
Save