단속 납부자 이력 소스코드 생성

main
이범준 1 year ago
parent ba75c99cf5
commit bf2a86b1a8

@ -0,0 +1,29 @@
package cokr.xit.fims.cmmn;
import cokr.xit.foundation.AbstractEntity;
import java.lang.String;
import lombok.Getter;
import lombok.Setter;
/**
*
* @author leebj
*/
@Getter
@Setter
public class CrdnPayerHstry extends AbstractEntity {
/**
* ID
*/
private String chgHstryId;
/**
* ID
*/
private String crdnId;
/**
* ID
*/
private String rtpyrId;
}

@ -0,0 +1,17 @@
package cokr.xit.fims.cmmn;
import cokr.xit.foundation.component.QueryRequest;
/**
*
* <p> :
*
* <pre>
* ============ ============
* 2023-08-16 leebj
* ================================
* </pre>
*/
public class CrdnPayerHstryQuery extends QueryRequest {
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,116 @@
package cokr.xit.fims.cmmn.dao;
import java.util.List;
import java.util.Map;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.fims.cmmn.CrdnPayerHstry;
import cokr.xit.fims.cmmn.CrdnPayerHstryQuery;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
/** DAO
*
* <p> :
*
* <pre>
* ============ ============
* 2023-08-16 leebj
* ================================
* </pre>
*/
@Mapper("crdnPayerHstryMapper")
public interface CrdnPayerHstryMapper extends AbstractMapper {
/** .<br />
* @param req
* @return
*/
List<DataObject> selectCrdnPayerHstryList(CrdnPayerHstryQuery req);
/** .
* @param req
* @return
*/
List<CrdnPayerHstry> selectCrdnPayerHstrys(CrdnPayerHstryQuery req);
/** .
* @param params
* <ul><li>"crdnPayerHstry" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int insertCrdnPayerHstry(Map<String, Object> params);
/** .
* @param crdnPayerHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean insert(CrdnPayerHstry crdnPayerHstry) {
return crdnPayerHstry != null && insertCrdnPayerHstry(params().set("crdnPayerHstry", crdnPayerHstry)) == 1;
}
/** .
* @param params
* <ul><li>"crdnPayerHstry" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int updateCrdnPayerHstry(Map<String, Object> params);
/** .
* @param crdnPayerHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean update(CrdnPayerHstry crdnPayerHstry) {
return crdnPayerHstry != null && updateCrdnPayerHstry(params().set("crdnPayerHstry", crdnPayerHstry)) == 1;
}
/** .
* @param params
* <ul><li>"crdnPayerHstry" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int deleteCrdnPayerHstry(Map<String, ?> params);
/** .
* @param crdnPayerHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean delete(CrdnPayerHstry crdnPayerHstry) {
return crdnPayerHstry != null && deleteCrdnPayerHstry(params().set("crdnPayerHstry", crdnPayerHstry)) == 1;
}
/**(TB_CRDN) ID .
* @param params
* <ul><li>"crdnPayerHstry" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int updateCrdnPyr(Map<String, Object> params);
/**(TB_CRDN) ID .
* @param crdnPayerHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean updateCrdn(CrdnPayerHstry crdnPayerHstry) {
return crdnPayerHstry != null && updateCrdnPyr(params().set("crdnPayerHstry", crdnPayerHstry)) == 1;
}
}

@ -0,0 +1,67 @@
package cokr.xit.fims.cmmn.service;
import java.util.List;
import cokr.xit.fims.cmmn.CrdnPayerHstry;
import cokr.xit.fims.cmmn.CrdnPayerHstryQuery;
import cokr.xit.foundation.data.DataObject;
/** .
*
* <p> :
*
* <pre>
* ============ ============
* 2023-08-16 leebj
* ================================
* </pre>
*/
public interface CrdnPayerHstryService {
/** .
* @param req
* @return
*/
List<DataObject> getCrdnPayerHstryList(CrdnPayerHstryQuery req);
/** .
* @param req
* @return
*/
List<CrdnPayerHstry> getCrdnPayerHstrys(CrdnPayerHstryQuery req);
/** .
* @param crdnPayerHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
boolean create(CrdnPayerHstry crdnPayerHstry);
/** .
* @param crdnPayerHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
boolean update(CrdnPayerHstry crdnPayerHstry);
/** .
* @param crdnPayerHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
boolean remove(CrdnPayerHstry crdnPayerHstry);
/** , .
* @param crdnPayerHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
boolean createHstryUpdateCrdnPyr(CrdnPayerHstry crdnPayerHstry);
}

@ -0,0 +1,106 @@
package cokr.xit.fims.cmmn.service.bean;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import cokr.xit.fims.cmmn.CrdnPayerHstry;
import cokr.xit.fims.cmmn.CrdnPayerHstryQuery;
import cokr.xit.fims.cmmn.dao.CrdnPayerHstryMapper;
import cokr.xit.foundation.AbstractComponent;
import cokr.xit.foundation.data.DataObject;
/** Bean
*
* <p> :
*
* <pre>
* ============ ============
* 2023-08-16 leebj
* ================================
* </pre>
*/
@Component("crdnPayerHstryBean")
public class CrdnPayerHstryBean extends AbstractComponent {
/** 단속 납부자 이력 정보 DAO */
@Resource(name = "crdnPayerHstryMapper")
private CrdnPayerHstryMapper crdnPayerHstryMapper;
/** .
* @param req
* @return
*/
public List<DataObject> getCrdnPayerHstryList(CrdnPayerHstryQuery req) {
return crdnPayerHstryMapper.selectCrdnPayerHstryList(req);
}
/** .
* @param req
* @return
*/
public List<CrdnPayerHstry> getCrdnPayerHstrys(CrdnPayerHstryQuery req) {
return crdnPayerHstryMapper.selectCrdnPayerHstrys(req);
}
/** .
* @param crdnPayerHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean create(CrdnPayerHstry crdnPayerHstry) {
return crdnPayerHstryMapper.insert(crdnPayerHstry);
}
/** .
* @param crdnPayerHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean update(CrdnPayerHstry crdnPayerHstry) {
return crdnPayerHstryMapper.update(crdnPayerHstry);
}
/** .
* @param crdnPayerHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean remove(CrdnPayerHstry crdnPayerHstry) {
return crdnPayerHstryMapper.delete(crdnPayerHstry);
}
/** , .
* @param crdnPayerHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean createHstryUpdateCrdnPyr(CrdnPayerHstry crdnPayerHstry) {
boolean retSuccess = false; // DB 처리 결과
// 단속 납부자 이력 정보를 등록한다.
retSuccess = crdnPayerHstryMapper.insert(crdnPayerHstry);
if (!retSuccess) {
// 예외를 발생시켜서 오류메세지를 보내고 Database 롤백..
throw new RuntimeException("단속 납부자 이력 정보를 등록 중 오류가 발생하였습니다.");
}
// 단속 대장 납부자ID를 변경한다.
retSuccess = crdnPayerHstryMapper.updateCrdn(crdnPayerHstry);
if (!retSuccess) {
// 예외를 발생시켜서 오류메세지를 보내고 Database 롤백..
throw new RuntimeException("단속 납부자 이력 정보를 등록 중 오류가 발생하였습니다.");
}
return retSuccess;
}
}

@ -0,0 +1,60 @@
package cokr.xit.fims.cmmn.service.bean;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import cokr.xit.fims.cmmn.CrdnPayerHstry;
import cokr.xit.fims.cmmn.CrdnPayerHstryQuery;
import cokr.xit.fims.cmmn.service.CrdnPayerHstryService;
import cokr.xit.foundation.component.AbstractServiceBean;
import cokr.xit.foundation.data.DataObject;
/** .
*
* <p> :
*
* <pre>
* ============ ============
* 2023-08-16 leebj
* ================================
* </pre>
*/
@Service("crdnPayerHstryService")
public class CrdnPayerHstryServiceBean extends AbstractServiceBean implements CrdnPayerHstryService {
/** 단속 납부자 이력 정보 Bean */
@Resource(name = "crdnPayerHstryBean")
private CrdnPayerHstryBean crdnPayerHstryBean;
@Override
public List<DataObject> getCrdnPayerHstryList(CrdnPayerHstryQuery req) {
return crdnPayerHstryBean.getCrdnPayerHstryList(req);
}
@Override
public List<CrdnPayerHstry> getCrdnPayerHstrys(CrdnPayerHstryQuery req) {
return crdnPayerHstryBean.getCrdnPayerHstrys(req);
}
@Override
public boolean create(CrdnPayerHstry crdnPayerHstry) {
return crdnPayerHstryBean.create(crdnPayerHstry);
}
@Override
public boolean update(CrdnPayerHstry crdnPayerHstry) {
return crdnPayerHstryBean.update(crdnPayerHstry);
}
@Override
public boolean remove(CrdnPayerHstry crdnPayerHstry) {
return crdnPayerHstryBean.remove(crdnPayerHstry);
}
@Override
public boolean createHstryUpdateCrdnPyr(CrdnPayerHstry crdnPayerHstry) {
return crdnPayerHstryBean.createHstryUpdateCrdnPyr(crdnPayerHstry);
}
}

@ -0,0 +1,103 @@
package cokr.xit.fims.cmmn.web;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import cokr.xit.foundation.web.AbstractController;
import cokr.xit.fims.cmmn.CrdnPayerHstry;
import cokr.xit.fims.cmmn.CrdnPayerHstryQuery;
import cokr.xit.fims.cmmn.service.CrdnPayerHstryService;
/**
*
* <p> :
*
* <pre>
* ============ ============
* 2023-08-16 leebj
* ================================
* </pre>
*/
@RequestMapping(name = "단속 납부자 이력", value = "/crdnPayerHstry")
public class CrdnPayerHstryController extends AbstractController {
/**단속 납부자 이력 서비스*/
@Resource(name = "crdnPayerHstryService")
private CrdnPayerHstryService crdnPayerHstryService;
/** (crdnPayerHstry/crdnPayerHstry-main) .
* {@link #getCrdnPayerHstryList(CrdnPayerHstryQuery) } .
* @return /crdnPayerHstry/crdnPayerHstry-main
*/
@RequestMapping(name = "단속 납부자 이력 메인", value = "/main.do")
public ModelAndView main() {
ModelAndView mav = getCrdnPayerHstryList(new CrdnPayerHstryQuery().setPageNum(1));
mav.setViewName("/crdnPayerHstry/crdnPayerHstry-main");
return mav.addObject("crdnPayerHstryList", toJson(mav.getModel().get("crdnPayerHstryList")));
}
/** .<br />
* {@link CrdnPayerHstryService#getCrdnPayerHstryList(CrdnPayerHstryQuery)}
* @param req
* @return jsonView
* <pre><code> {
* "crdnPayerHstryList": [ ]
* "crdnPayerHstryStart":
* "crdnPayerHstryFetch":
* "crdnPayerHstryTotal":
* }</code></pre>
*/
@RequestMapping(name = "단속 납부자 이력 조회", value = "/list.do")
public ModelAndView getCrdnPayerHstryList(CrdnPayerHstryQuery req) {
List<?> result = crdnPayerHstryService.getCrdnPayerHstryList(setFetchSize(req));
return setCollectionInfo(new ModelAndView("jsonView"), result, "crdnPayerHstry");
}
/** .
* @param crdnPayerHstry
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
@PostMapping(name = "단속 납부자 이력 등록", value = "/create.do")
public ModelAndView create(CrdnPayerHstry crdnPayerHstry) {
boolean saved = crdnPayerHstryService.create(crdnPayerHstry);
return new ModelAndView("jsonView")
.addObject("saved", saved);
}
/** .
* @param crdnPayerHstry
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
@PostMapping(name = "단속 납부자 이력 수정", value = "/update.do")
public ModelAndView update(CrdnPayerHstry crdnPayerHstry) {
boolean saved = crdnPayerHstryService.update(crdnPayerHstry);
return new ModelAndView("jsonView")
.addObject("saved", saved);
}
/** .
* @param crdnPayerHstryIDs
* @return jsonView
* <pre><code> {
* "affected":
* "saved": true, false
* }</code></pre>
*/
@PostMapping(name = "단속 납부자 이력 제거", value = "/remove.do")
public ModelAndView remove(CrdnPayerHstry crdnPayerHstry) {
boolean saved = crdnPayerHstryService.remove(crdnPayerHstry);
return new ModelAndView("jsonView")
.addObject("saved", saved);
}
}

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cokr.xit.fims.cmmn.dao.CrdnPayerHstryMapper">
<!-- 단속 납부자 이력 정보 매퍼
========== 변경 이력 ==========
2023-08-16 leebj 최초 작성
============================ -->
<resultMap id="crdnPayerHstryRow" type="cokr.xit.fims.cmmn.CrdnPayerHstry"> <!-- 단속 납부자 이력 -->
<result property="chgHstryId" column="CHG_HSTRY_ID" /> <!-- 변경 이력 ID -->
<result property="crdnId" column="CRDN_ID" /> <!-- 단속 ID -->
<result property="rtpyrId" column="RTPYR_ID" /> <!-- 납부자 ID -->
<result property="createdAt" column="REG_DT" /> <!-- 등록 일시 -->
<result property="createdBy" column="RGTR" /> <!-- 등록자 -->
</resultMap>
<sql id="select">
SELECT CHG_HSTRY_ID <!-- 변경 이력 ID -->
, CRDN_ID <!-- 단속 ID -->
, RTPYR_ID <!-- 납부자 ID -->
, REG_DT <!-- 등록 일시 -->
, RGTR <!-- 등록자 -->
FROM TB_CRDN_PAYER_HSTRY
</sql>
<select id="selectCrdnPayerHstryList" parameterType="map" resultType="dataobject">
/* 단속 납부자 이력 목록 조회(crdnPayerHstryMapper.selectCrdnPayerHstryList) */
<include refid="utility.paging-prefix" />
<include refid="select" />
<where>
</where>
<include refid="utility.orderBy" />
<include refid="utility.paging-suffix" />
</select>
<select id="selectCrdnPayerHstrys" parameterType="map" resultMap="crdnPayerHstryRow">
/* 단속 납부자 이력 객체 가져오기(crdnPayerHstryMapper.selectCrdnPayerHstrys) */
<include refid="select" />
<where>
</where>
<include refid="utility.orderBy" />
</select>
<insert id="insertCrdnPayerHstry" parameterType="map">
/* 단속 납부자 이력 등록(crdnPayerHstryMapper.insertCrdnPayerHstry) */
<selectKey resultType="string" keyProperty="crdnPayerHstry.chgHstryId" keyColumn="NEW_ID" order="BEFORE">
SELECT CONCAT(DATE_FORMAT(CURRENT_DATE, '%Y'), LPAD(CAST(IFNULL(MAX(SUBSTRING(CHG_HSTRY_ID, 5)) + 1, 1) AS INT), 16, '0')) AS NEW_ID
FROM TB_CRDN_PAYER_HSTRY
WHERE CHG_HSTRY_ID LIKE CONCAT(DATE_FORMAT(CURRENT_DATE, '%Y'), '%')
</selectKey>
INSERT INTO TB_CRDN_PAYER_HSTRY (
CHG_HSTRY_ID <!-- 변경 이력 ID -->
, CRDN_ID <!-- 단속 ID -->
, RTPYR_ID <!-- 납부자 ID -->
, REG_DT <!-- 등록 일시 -->
, RGTR <!-- 등록자 -->
) VALUES (
#{crdnPayerHstry.chgHstryId} <!-- 변경 이력 ID -->
, #{crdnPayerHstry.crdnId} <!-- 단속 ID -->
, #{crdnPayerHstry.rtpyrId} <!-- 납부자 ID -->
, <include refid="utility.now" /> <!-- 등록 일시 -->
, #{currentUser.id} <!-- 등록자 -->
)
</insert>
<update id="updateCrdnPayerHstry" parameterType="map">
/* 단속 납부자 이력 수정(crdnPayerHstryMapper.updateCrdnPayerHstry) */
UPDATE TB_CRDN_PAYER_HSTRY
SET
CRDN_ID = #{crdnPayerHstry.crdnId} <!-- 단속 ID -->
, RTPYR_ID = #{crdnPayerHstry.rtpyrId} <!-- 납부자 ID -->
WHERE CHG_HSTRY_ID = #{crdnPayerHstry.chgHstryId}
</update>
<update id="deleteCrdnPayerHstry" parameterType="map">
/* 단속 납부자 이력 삭제(crdnPayerHstryMapper.deleteCrdnPayerHstry) */
UPDATE TB_CRDN_PAYER_HSTRY
SET
USE_YN = 'N'
, MDFCN_DT =<include refid="utility.now" />
, MDFR = #{currentUser.id}
WHERE CHG_HSTRY_ID = #{crdnPayerHstry.chgHstryId}
</update>
<update id="updateCrdnPayer" parameterType="map">
/* 단속 납부자 수정(crdnPayerHstryMapper.updateCrdnPayer) */
UPDATE TB_CRDN_PAYER_HSTRY
SET RTPYR_ID = #{crdnSttsHstry.rtpyrId} /* 납부자 ID */
, MDFCN_DT = #{crdnSttsHstry.lastModified} /* 수정 일시 */
, MDFR = #{crdnSttsHstry.modifiedBy} /* 수정자 */
WHERE CRDN_ID = #{crdnSttsHstry.crdnId} /* 단속 ID */
</update>
</mapper>

@ -0,0 +1,49 @@
package cokr.xit.fims.cmmn.service;
import java.util.List;
import javax.annotation.Resource;
import org.junit.jupiter.api.Test;
import cokr.xit.foundation.data.DataObject;
import cokr.xit.foundation.test.TestSupport;
import cokr.xit.fims.cmmn.CrdnPayerHstry;
import cokr.xit.fims.cmmn.CrdnPayerHstryQuery;
/**CrdnPayerHstryService .
*
* <p> :
*
* <pre>
* ============ ============
* 2023-08-16 leebj
* ================================
* </pre>
*/
public class CrdnPayerHstryServiceTest extends TestSupport {
@Resource(name = "crdnPayerHstryService")
private CrdnPayerHstryService crdnPayerHstryService;
@Test
void getCrdnPayerHstryList() {
List<DataObject> crdnPayerHstryList = crdnPayerHstryService.getCrdnPayerHstryList(new CrdnPayerHstryQuery());
crdnPayerHstryList.forEach(System.out::println);
}
@Test
void getCrdnPayerHstrys() {
List<CrdnPayerHstry> crdnPayerHstrys = crdnPayerHstryService.getCrdnPayerHstrys(new CrdnPayerHstryQuery());
crdnPayerHstrys.forEach(System.out::println);
}
@Test
void create() {}
@Test
void update() {}
@Test
void remove() {}
}
Loading…
Cancel
Save