feat: 우편번호관리 feat

main
minuk926 2 years ago
parent af71d8a8b8
commit 70d3a56666

@ -0,0 +1,30 @@
package kr.xit.framework.biz.mng.code.mapper;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.session.RowBounds;
import egovframework.rte.psl.dataaccess.mapper.Mapper;
import kr.xit.framework.biz.mng.code.model.XitZipCodeMngVO;
/**
*
* @: Mapper
* @:
* @: 2020. 4. 16. 9:38:07
* @:
* @author ()
* @since 2002. 2. 2.
* @version 1.0 Copyright(c) XIT All rights reserved.
*/
@SuppressWarnings("MybatisXMapperMethodInspection")
@Mapper
public interface IZipCodeMgtMapper {
List<XitZipCodeMngVO> selectZips(Map<String, Object> paraMap, RowBounds rowBounds);
<T> XitZipCodeMngVO selectZip(T t);
int insertZip(final XitZipCodeMngVO vo);
int updateZip(final XitZipCodeMngVO vo);
int deleteZip(final XitZipCodeMngVO vo);
}

@ -1,18 +1,21 @@
package kr.xit.framework.biz.mng.code.model;
import kr.xit.framework.core.model.BaseVO;
/**
*
* @: VO
* @:
* @: 2020. 4. 16. 9:40:44
* @:
* @author ()
* @since 2002. 2. 2.
* @version 1.0 Copyright(c) XIT All rights reserved.
*/
public class XitZipCodeMngVO extends BaseVO {
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
@Builder
@ToString
public class XitZipCodeMngVO {
/**
* serialVersionUID
@ -22,190 +25,45 @@ public class XitZipCodeMngVO extends BaseVO {
/*
*
*/
private String zip = "";
private String zip;
/*
*
*/
private int sn = 0;
private int sn;
/*
*
*/
private String ctprvnNm = "";
private String ctprvnNm;
/*
*
*/
private String signguNm = "";
private String signguNm;
/*
*
*/
private String emdNm = "";
private String emdNm;
/*
*
*/
private String liBuldNm = "";
private String liBuldNm;
/*
*
*/
private String lnbrDongHo = "";
private String lnbrDongHo;
/*
* ID
*/
private String frstRegisterId = "";
private String frstRegisterId;
/*
* ID
*/
private String lastUpdusrId = "";
/**
* zip attribute .
* @return String
*/
public String getZip() {
return zip;
}
/**
* zip attribute .
* @param zip String
*/
public void setZip(String zip) {
this.zip = zip;
}
/**
* sn attribute .
* @return int
*/
public int getSn() {
return sn;
}
/**
* sn attribute .
* @param sn int
*/
public void setSn(int sn) {
this.sn = sn;
}
/**
* ctprvnNm attribute .
* @return String
*/
public String getCtprvnNm() {
return ctprvnNm;
}
/**
* ctprvnNm attribute .
* @param ctprvnNm String
*/
public void setCtprvnNm(String ctprvnNm) {
this.ctprvnNm = ctprvnNm;
}
/**
* signguNm attribute .
* @return String
*/
public String getSignguNm() {
return signguNm;
}
/**
* signguNm attribute .
* @param signguNm String
*/
public void setSignguNm(String signguNm) {
this.signguNm = signguNm;
}
/**
* emdNm attribute .
* @return String
*/
public String getEmdNm() {
return emdNm;
}
/**
* emdNm attribute .
* @param emdNm String
*/
public void setEmdNm(String emdNm) {
this.emdNm = emdNm;
}
/**
* liBuldNm attribute .
* @return String
*/
public String getLiBuldNm() {
return liBuldNm;
}
/**
* liBuldNm attribute .
* @param liBuldNm String
*/
public void setLiBuldNm(String liBuldNm) {
this.liBuldNm = liBuldNm;
}
/**
* lnbrDongHo attribute .
* @return String
*/
public String getLnbrDongHo() {
return lnbrDongHo;
}
/**
* lnbrDongHo attribute .
* @param lnbrDongHo String
*/
public void setLnbrDongHo(String lnbrDongHo) {
this.lnbrDongHo = lnbrDongHo;
}
/**
* frstRegisterId attribute .
* @return String
*/
public String getFrstRegisterId() {
return frstRegisterId;
}
/**
* frstRegisterId attribute .
* @param frstRegisterId String
*/
public void setFrstRegisterId(String frstRegisterId) {
this.frstRegisterId = frstRegisterId;
}
/**
* lastUpdusrId attribute .
* @return String
*/
public String getLastUpdusrId() {
return lastUpdusrId;
}
/**
* lastUpdusrId attribute .
* @param lastUpdusrId String
*/
public void setLastUpdusrId(String lastUpdusrId) {
this.lastUpdusrId = lastUpdusrId;
}
private String lastUpdusrId;
}

@ -0,0 +1,87 @@
package kr.xit.framework.biz.mng.code.service;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.session.RowBounds;
import kr.xit.framework.biz.mng.code.model.XitZipCodeMngVO;
/**
*
* @: Service
* @:
* @: 2020. 4. 16. 9:38:56
* @:
* @author ()
* @since 2002. 2. 2.
* @version 1.0 Copyright(c) XIT All rights reserved.
*/
public interface IZipCodeMgtService {
List<XitZipCodeMngVO> findZipCodes(final Map<String, Object> paraMap, final RowBounds rowBounds);
<T> XitZipCodeMngVO findZipCode(T t);
void addZipCode(final XitZipCodeMngVO vo);
void modifyZipCode(final XitZipCodeMngVO vo);
void removeZipcode(final XitZipCodeMngVO vo);
/**
* <pre> : </pre>
* @param vo void
* @author:
* @date: 2020. 4. 16.
*/
public void addProc(XitZipCodeMngVO vo);
/**
* <pre> : </pre>
* @param vo void
* @author:
* @date: 2020. 4. 16.
*/
public void addsProc(InputStream fis) throws Exception;
/**
* <pre> : </pre>
* @param vo void
* @author:
* @date: 2020. 4. 16.
*/
public void modifyProc(XitZipCodeMngVO vo);
/**
* <pre> : </pre>
* @param vo void
* @author:
* @date: 2020. 4. 16.
*/
public void removeProc(XitZipCodeMngVO vo);
/**
* <pre> : </pre>
* @param zips
* @param sns
* @return void
* @author:
* @date: 2020. 4. 16.
*/
public void removesProc(String zips, String sns);
}

@ -0,0 +1,151 @@
package kr.xit.framework.biz.mng.code.service;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Service;
import egovframework.rte.fdl.excel.EgovExcelService;
import egovframework.rte.fdl.idgnr.EgovIdGnrService;
import kr.xit.framework.biz.cmm.model.XitZipVO;
import kr.xit.framework.biz.cmm.service.XitFrameCrudService;
import kr.xit.framework.biz.mng.code.mapper.IZipCodeMgtMapper;
import kr.xit.framework.biz.mng.code.model.XitZipCodeMngVO;
import kr.xit.framework.core.message.XitMessageSource;
@Service
public class ZipCodeMgtService implements IZipCodeMgtService {
@Resource
private IZipCodeMgtMapper mapper;
@Resource
private XitFrameCrudService xitFrameCrudService;
@Resource(name="groupIdGnrService")
private EgovIdGnrService idgenService;
@Resource
private XitMessageSource xitMessageSource;
@Resource(name = "egovExcelService")
private EgovExcelService excelZipService;
@Override
public List<XitZipCodeMngVO> findZipCodes(final Map<String, Object> paraMap, final RowBounds rowBounds) {
return mapper.selectZips(paraMap, rowBounds);
}
@Override
public <T> XitZipCodeMngVO findZipCode(T t) {
return mapper.selectZip(t);
}
@Override
public void addZipCode(final XitZipCodeMngVO vo) {
mapper.insertZip(vo);
}
@Override
public void modifyZipCode(final XitZipCodeMngVO vo) {
mapper.updateZip(vo);
}
@Override
public void removeZipcode(final XitZipCodeMngVO vo) {
mapper.deleteZip(vo);
}
@Override
public void addProc(XitZipCodeMngVO vo) {
/**
*
*/
XitZipVO zipVO = convertToCrudVO(vo);
zipVO.setFrst_register_id(vo.getFrstRegisterId());
/**
*
*/
xitFrameCrudService.addXitZip(zipVO);
}
@Override
public void addsProc(InputStream fis) throws Exception {
/**
*
*/
xitFrameCrudService.removesXitZip(new XitZipVO());
excelZipService.uploadExcel("kr.xit.framework.biz.cmm.dao.XitFrameCrudMapper.addXitZip", fis, 2, 5000);
}
@Override
public void modifyProc(XitZipCodeMngVO vo) {
/**
*
*/
XitZipVO zipVO = convertToCrudVO(vo);
zipVO.setLast_updusr_id(vo.getLastUpdusrId());
/**
*
*/
xitFrameCrudService.modifyXitZip(zipVO);
}
@Override
public void removeProc(XitZipCodeMngVO vo) {
/**
*
*/
XitZipVO zipVO = convertToCrudVO(vo);
/**
*
*/
xitFrameCrudService.removeXitZip(zipVO);
}
@Override
public void removesProc(String zips, String sns) {
/**
*
*/
String [] arrZip = zips.split(";");
String [] arrSn = sns.split(";");
for(int i=0; i<arrZip.length;i++) {
XitZipCodeMngVO vo = new XitZipCodeMngVO();
vo.setZip(arrZip[i]);
vo.setSn(Integer.valueOf(arrSn[i]));
this.removeProc(vo);
}
}
/**
* <pre>
* : VO CRUD Service VO .
* </pre>
*
* @return XitZipVO
* @author:
* @date: 2020. 4. 16.
*/
private XitZipVO convertToCrudVO(XitZipCodeMngVO vo) {
XitZipVO crudVO = new XitZipVO();
crudVO.setZip (vo.getZip()); //우편번호
crudVO.setSn (String.valueOf(vo.getSn())); //순번
crudVO.setCtprvn_nm (vo.getCtprvnNm()); //시도 명
crudVO.setSigngu_nm (vo.getSignguNm()); //시군구 명
crudVO.setEmd_nm (vo.getEmdNm()); //읍면동 명
crudVO.setLi_buld_nm (vo.getLiBuldNm()); //리 건물 명
crudVO.setLnbr_dong_ho (vo.getLnbrDongHo()); //번지 동 호
return crudVO;
}
}

@ -54,7 +54,7 @@ import kr.xit.framework.support.util.AjaxUtils;
* @version 1.0 Copyright(c) XIT All rights reserved.
*/
@Controller
@RequestMapping("/framework/biz/mng/code/")
@RequestMapping("/framework/biz/mng/ccode/")
public class XitZipCodeMngController {
private static final Logger logger = LoggerFactory.getLogger(XitZipCodeMngController.class);

@ -0,0 +1,327 @@
package kr.xit.framework.biz.mng.code.web;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.support.SessionStatus;
import org.springframework.web.servlet.ModelAndView;
import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper;
import kr.xit.framework.biz.cmm.model.XitLoginVO;
import kr.xit.framework.biz.mng.auth.model.XitAuthRuleMngVO;
import kr.xit.framework.biz.mng.code.model.XitZipCodeMngSearchVO;
import kr.xit.framework.biz.mng.code.model.XitZipCodeMngVO;
import kr.xit.framework.biz.mng.code.service.IZipCodeMgtService;
import kr.xit.framework.core.constants.FrameworkConstants;
import kr.xit.framework.core.constants.FrameworkConstants.TILES_TYPE;
import kr.xit.framework.core.message.XitMessageSource;
import kr.xit.framework.core.model.ResultResponse;
import kr.xit.framework.core.utils.XitCmmnUtil;
import kr.xit.framework.core.utils.attachfile.XitAttachFileUtil;
import kr.xit.framework.core.utils.attachfile.XitAttachFileVO;
import kr.xit.framework.core.validation.XitBeanValidator;
import kr.xit.framework.support.mybatis.MybatisUtils;
import kr.xit.framework.support.util.AjaxMessageMapRenderer;
import kr.xit.framework.support.util.AjaxUtils;
import kr.xit.framework.support.util.Checks;
import kr.xit.framework.support.util.ValidationError;
import kr.xit.framework.support.util.constants.MessageKey;
@Controller
@RequestMapping("/framework/biz/mng/code")
public class ZipCodeMgtController {
@Resource
private IZipCodeMgtService service;
@Autowired
private XitBeanValidator beanValidator;
@Resource(name = "xitMessageSource")
XitMessageSource xitMessageSource;
@RequestMapping(value = "/mngZipCodeMgtForm")
public void mngZipCodeMgtForm() {
}
@RequestMapping(value = "/mngZipCodeMgtPopup")
public ModelAndView mngZipCodeMgtPopup(final XitZipCodeMngVO vo) {
ModelAndView mav = new ModelAndView();
mav.addObject("zip", Checks.isEmpty(vo.getZip())? new XitAuthRuleMngVO(): service.findZipCode(vo));
mav.addObject("pageTitle", "우편번호 등록 / 변경");
mav.setViewName(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH + "mng/code/mngZipCodeMgtPopup.popup");
return mav;
}
@GetMapping(value = "/findZipCodes")
public ModelAndView findZipCodes(final Map<String, Object> paraMap){
return ResultResponse.of(service.findZipCodes(paraMap, MybatisUtils.getPagingInfo(paraMap)));
}
@GetMapping(value = "/findZipCode")
public ModelAndView findZipCode(final XitZipCodeMngVO vo){
return ResultResponse.of(service.findZipCode(vo));
}
@PostMapping(value = "/addZipCode")
public ModelAndView addZipCode(final XitZipCodeMngVO vo, final BindingResult bindingResult){
ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW);
ValidationError.of("zip", vo, bindingResult);
service.addZipCode(vo);
AjaxMessageMapRenderer.success(mav, MessageKey.CMM_INSERT_SUCCESS);
return mav;
}
@PostMapping(value = "/modifyZipCode")
public ModelAndView modifyZipCode(final XitZipCodeMngVO vo, final BindingResult bindingResult){
ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW);
ValidationError.of("zip", vo, bindingResult);
service.modifyZipCode(vo);
AjaxMessageMapRenderer.success(mav, MessageKey.CMM_UPDATE_SUCCESS);
return mav;
}
@PostMapping(value = "/removeZipCode")
public ModelAndView removeZipCode(final XitZipCodeMngVO vo){
ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW);
service.removeZipcode(vo);
AjaxMessageMapRenderer.success(mav, MessageKey.CMM_DELETE_SUCCESS);
return mav;
}
@RequestMapping(value = "ZipCodeMng_{cmd}_popup", method={RequestMethod.GET, RequestMethod.POST})
public String ZipCodeMng_page_popup(@PathVariable String cmd
, @ModelAttribute("zip") XitZipCodeMngVO vo
, @ModelAttribute XitZipCodeMngSearchVO searchVO
, ModelMap model) {
switch (cmd) {
case "": //
break;
default:
throw new RuntimeException("유효하지 않은 요청 입니다.");
}
return FrameworkConstants.FRAMEWORK_JSP_BASE_PATH +"mng/code/XitZipCodeMng_"+cmd+"_popup"+TILES_TYPE.POPUP.getVal();
}
/**
* <pre> : CUD </pre>
* @return String
* @author:
* @date: 2020. 4. 16.
*/
@RequestMapping(value = "ZipCodeMng_{cmd}_proc", method=RequestMethod.POST)
public void ZipCodeMng_cmd_proc(@PathVariable String cmd
,@ModelAttribute("vo") XitZipCodeMngVO vo
,@ModelAttribute("searchVO") XitZipCodeMngSearchVO searchVO
,@RequestParam(value="zips", required=false, defaultValue="") String zips
,@RequestParam(value="sns", required=false, defaultValue="") String sns
,BindingResult bindingResult
,SessionStatus status
,Model model
,HttpServletRequest request
,HttpServletResponse response
) throws ServletException, IOException {
/**
*
*/
XitLoginVO loginVO = (XitLoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
String sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_list";
String message = null;
switch (cmd) {
case "insert": //등록
//유효성 확인
//2020.11.24. 주석처리
beanValidator.validate(vo, bindingResult);
// beanValidator.validate("zip", vo, bindingResult);
if (bindingResult.hasErrors()) {
message = xitMessageSource.getMessage("fail.common.insert");
sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_input";
break;
}
//처리
try {
vo.setFrstRegisterId(loginVO.getUniqId());
service.addProc(vo);
status.setComplete();
message = xitMessageSource.getMessage("success.common.insert");
} catch (RuntimeException e) {
message = e.getMessage();
sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_input";
} catch (Exception e) {
message = xitMessageSource.getMessage("fail.common.insert");
sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_input";
}
break;
case "inserts": //다건 등록
List<XitAttachFileVO> listAttchFile = null;
try {
listAttchFile = XitAttachFileUtil.fileUpload(request, XitCmmnUtil.setOsPath("/home/tempUpload"), true, 5);
} catch (RuntimeException | IOException e1) {
message = xitMessageSource.getMessage("fail.common.msg");
sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_inputs";
}
if(XitCmmnUtil.isEmpty(listAttchFile)) {
message = xitMessageSource.getMessage("fail.common.msg");
sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_inputs";
}else {
FileInputStream fis = null;
try {
XitAttachFileVO fileVO = listAttchFile.get(0);
File file = new File(fileVO.getFileFullPath());
fis = new FileInputStream(file);
if (!"".equals(fileVO.getFileName())) {
// 2011.10.07 업로드 파일에 대한 확장자를 체크
if (fileVO.getFileName().toLowerCase().endsWith(".xls") || fileVO.getFileName().toLowerCase().endsWith(".xlsx")) {
service.addsProc(fis);
status.setComplete();
message = xitMessageSource.getMessage("success.common.insert");
} else {
//log.info("xls, xlsx 파일 타입만 등록이 가능합니다.");
message = xitMessageSource.getMessage("fail.common.msg");
model.addAttribute("message", message);
sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_inputs";
}
} else {
message = xitMessageSource.getMessage("fail.common.msg");
}
} catch (Exception e) {
} finally {
try {
if (fis != null) {
fis.close();
}
} catch (IOException ee) {
}
}
}
sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_inputs";
break;
case "update": //수정
//유효성 확인
//2020.11.24. 주석처리
beanValidator.validate(vo, bindingResult);
// beanValidator.validate("zip", vo, bindingResult);
if (bindingResult.hasErrors()) {
message = xitMessageSource.getMessage("fail.common.update");
sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_edit";
break;
}
//처리
try {
vo.setLastUpdusrId(loginVO.getUniqId());
service.modifyProc(vo);
status.setComplete();
message = xitMessageSource.getMessage("success.common.update");
} catch (RuntimeException e) {
message = e.getMessage();
sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_edit";
} catch (Exception e) {
message = xitMessageSource.getMessage("fail.common.update");
sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_edit";
}
break;
case "delete": //삭제
//처리
try {
service.removeProc(vo);
status.setComplete();
message = xitMessageSource.getMessage("success.common.delete");
break;
} catch (RuntimeException e) {
message = e.getMessage();
sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_edit";
} catch (Exception e) {
message = xitMessageSource.getMessage("fail.common.delete");
sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_edit";
}
break;
case "deletes": //다건 삭제
//처리
try {
service.removesProc(zips, sns);
status.setComplete();
message = xitMessageSource.getMessage("success.common.delete");
} catch (RuntimeException e) {
message = e.getMessage();
} catch (Exception e) {
message = xitMessageSource.getMessage("fail.common.delete");
}
break;
default:
new RuntimeException("유효하지 않은 요청 입니다.");
}
/**
*
*/
/* ============================
* 2020.09.10
*
* - ajax json
* [AS-IS] String, return url "forward"
* [TO-BE] void, DispatchServlet forward , ajax json forward
============================ */
//2020.09.10 주석처리
// model.addAttribute("message", message);
// return sLocationUrl;
model.addAttribute("message", message);
if(AjaxUtils.isAjaxRequest(request)){ //ajax 요청시
//반환 데이터 설정
Map<String, Object> resultMap = new HashMap<String, Object>();
resultMap.put("message", message);
XitCmmnUtil.forwardForAjaxRequest(request, response, resultMap);
}else { //submit 요청 시
XitCmmnUtil.forwardForSubmitRequest(request, response, sLocationUrl, model.asMap());
}
}
}

@ -1,6 +1,6 @@
<?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="kr.xit.framework.biz.mng.code.mapper.XitZipCodeMngMapper">
<mapper namespace="kr.xit.framework.biz.mng.code.mapper.IZipCodeMgtMapper">
<!-- *************************************************************************************************************
* xit_zip : 우편번호
@ -28,17 +28,17 @@
</where>
</sql>
<select id="selectCmmnClCodes" resultType="kr.xit.framework.biz.mng.code.model.XitClCodeMngVO">
<select id="selectZips" resultType="kr.xit.framework.biz.mng.code.model.XitClCodeMngVO">
/* code-cfn-mysql-mapper|selectCmmnClCodes-분류코드 목록 조회|julim */
<include refid="sqlZip"/>
</select>
<select id="selectCmmnClCode" resultType="kr.xit.framework.biz.mng.code.model.XitClCodeMngVO">
<select id="selectZip" resultType="kr.xit.framework.biz.mng.code.model.XitClCodeMngVO">
/* code-cfn-mysql-mapper|selectCmmnClCode-분류코드 정보 조회|julim */
<include refid="sqlZip"/>
</select>
<insert id="insertCmmnClCode">
<insert id="insertZip">
/* code-cfn-mysql-mapper|insertCmmnClCode-분류코드 정보 등록|julim */
INSERT
INTO xit_cmmn_cl_code (
@ -58,7 +58,7 @@
)
</insert>
<update id="updateCmmnClCode">
<update id="updateZip">
/* code-cfn-mysql-mapper|updateCmmnClCode-분류코드 정보 변경|julim */
UPDATE xit_cmmn_cl_code
SET cl_code_nm = IF(cl_code_nm = #{clCodeNm}, cl_code_nm, #{clCodeNm})
@ -69,7 +69,7 @@
WHERE cl_code = #{clCode}
</update>
<delete id="deleteCmmnClCode">
<delete id="deleteZip">
/* code-cfn-mysql-mapper|deleteCmmnClCode-분류코드 정보 삭제|julim */
DELETE
FROM xit_cmmn_cl_code
@ -78,6 +78,117 @@
<select id="findXitZips" resultType="kr.xit.framework.biz.cmm.model.XitZipVO">
/** findXitZips */
/** 우편번호 다건 조회 */
SELECT ZIP
,SN
,CTPRVN_NM
,SIGNGU_NM
,EMD_NM
,LI_BULD_NM
,LNBR_DONG_HO
,FRST_REGIST_PNTTM
,FRST_REGISTER_ID
,LAST_UPDT_PNTTM
,LAST_UPDUSR_ID
FROM XIT_ZIP
WHERE 1=1
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(zip )">AND ZIP = #{zip }</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(sn )">AND SN = #{sn }</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(ctprvn_nm )">AND CTPRVN_NM = #{ctprvn_nm }</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(signgu_nm )">AND SIGNGU_NM = #{signgu_nm }</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(emd_nm )">AND EMD_NM = #{emd_nm }</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(li_buld_nm )">AND LI_BULD_NM = #{li_buld_nm }</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(lnbr_dong_ho )">AND LNBR_DONG_HO = #{lnbr_dong_ho }</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(frst_regist_pnttm)">AND FRST_REGIST_PNTTM = #{frst_regist_pnttm}</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(frst_register_id )">AND FRST_REGISTER_ID = #{frst_register_id }</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(last_updt_pnttm )">AND LAST_UPDT_PNTTM = #{last_updt_pnttm }</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(last_updusr_id )">AND LAST_UPDUSR_ID = #{last_updusr_id }</if>
</select>
<select id="findXitZip" resultType="kr.xit.framework.biz.cmm.model.XitZipVO">
/** findXitZip */
/** 우편번호 조회 */
SELECT ZIP
,SN
,CTPRVN_NM
,SIGNGU_NM
,EMD_NM
,LI_BULD_NM
,LNBR_DONG_HO
,FRST_REGIST_PNTTM
,FRST_REGISTER_ID
,LAST_UPDT_PNTTM
,LAST_UPDUSR_ID
FROM XIT_ZIP
WHERE 1=1
AND ZIP = #{zip}
AND SN = #{sn }
</select>
<insert id="addXitZip">
/** addXitZip */
/** 우편번호 등록 */
INSERT INTO XIT_ZIP(
ZIP
,SN
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(ctprvn_nm )">,CTPRVN_NM </if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(signgu_nm )">,SIGNGU_NM </if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(emd_nm )">,EMD_NM </if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(li_buld_nm )">,LI_BULD_NM </if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(lnbr_dong_ho )">,LNBR_DONG_HO </if>
,FRST_REGIST_PNTTM
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(frst_register_id )">,FRST_REGISTER_ID </if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(last_updt_pnttm )">,LAST_UPDT_PNTTM </if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(last_updusr_id )">,LAST_UPDUSR_ID </if>
)VALUES(
#{zip }
,#{sn }
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(ctprvn_nm )">,#{ctprvn_nm }</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(signgu_nm )">,#{signgu_nm }</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(emd_nm )">,#{emd_nm }</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(li_buld_nm )">,#{li_buld_nm }</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(lnbr_dong_ho )">,#{lnbr_dong_ho }</if>
,NOW()
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(frst_register_id )">,#{frst_register_id }</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(last_updt_pnttm )">,#{last_updt_pnttm }</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(last_updusr_id )">,#{last_updusr_id }</if>
)
</insert>
<update id="modifyXitZip">
/** modifyXitZip */
/** 우편번호 수정 */
UPDATE XIT_ZIP
SET
LAST_UPDT_PNTTM = NOW()
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notBlank(ctprvn_nm )">,CTPRVN_NM = #{ctprvn_nm }</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notBlank(signgu_nm )">,SIGNGU_NM = #{signgu_nm }</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notBlank(emd_nm )">,EMD_NM = #{emd_nm }</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notBlank(li_buld_nm )">,LI_BULD_NM = #{li_buld_nm }</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notBlank(lnbr_dong_ho )">,LNBR_DONG_HO = #{lnbr_dong_ho }</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notBlank(frst_regist_pnttm)">,FRST_REGIST_PNTTM = #{frst_regist_pnttm}</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notBlank(frst_register_id )">,FRST_REGISTER_ID = #{frst_register_id }</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notBlank(last_updusr_id )">,LAST_UPDUSR_ID = #{last_updusr_id }</if>
WHERE 1=1
AND ZIP = #{zip}
AND SN = #{sn }
</update>
<delete id="removeXitZip">
/** removeXitZip */
/** 우편번호 삭제 */
DELETE FROM XIT_ZIP
WHERE 1=1
AND ZIP = #{zip}
AND SN = #{sn }
</delete>
<delete id="removesXitZip">
/** removesXitZip */
/** 우편번호 다건 삭제 */
DELETE FROM XIT_ZIP
WHERE 1=1
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(zip)">AND ZIP = #{zip}</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(sn )">AND SN = #{sn }</if>
</delete>

@ -0,0 +1,187 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/framework/taglibs.jsp" %>
<form name="listForm" id="listForm" method="post">
<input type="hidden" id="searchAt" name="searchAt" value="Y">
<input type="hidden" id="searchGubun" name="searchGubun" value="excel">
<div class="search r2">
<table>
<caption>검색조건</caption>
<colgroup>
<col style="width: 600px;"/>
<col/>
<col/>
<col/>
<col/>
<col/>
<col/>
</colgroup>
<tbody>
<tr>
<td>
<select id="searchCondition" name="searchCondition" title="조회조건">
<option selected value=''>--선택하세요--</option>
<option value='zip'>우편번호</option>
<option value='ctprvnNm'>시도명</option>
<option value='signguNm'>시군구명</option>
<option value='emdNm'>읍면동명</option>
<option value='liBuldNm'>리건물명</option>
</select>
<input name="searchKeyword" title="검색어" type="text" value="<c:out value="${userSearchVO.searchKeyword}"/>" />
</td>
<td colspan="6">
<input type="button" id="btnSearch" class="btn_search" title="검색" value="검색" />
</td>
</tr>
</tbody>
</table>
</div>
</form>
<!-- //검색 -->
<div class="page_btn">
<span class="fll">
<a href="#" class="btn darkgray" id="btnRegist" title="권한등록">등록</a>
<a href="#" class="btn lightgray" id="excel_btn" title="권한취소">엑셀등록</a>
</span>
</div>
<!-- //버튼 및 페이지정보 -->
<!-- 데이터 출력 -->
<div id="grid"></div>
<script type="text/javaScript">
/**************************************************************************
* Global Variable
**************************************************************************/
var callbackSearch = () => fnBiz.search(); // 데이터 조회 : popup에서 사용
let GRID = null;
/* *******************************
* Biz function
******************************* */
const fnBiz = {
search: () => {
GRID.reloadData();
}
,pagePopup: function(flag, params){
let url = '<c:url value="/framework/biz/mng/code/mngZipCodeMgtPopup.do"/>';
let popTitle;
let popOption = {width: 950, height:550}
switch (flag) {
case "add": //등록
popTitle = "우편번호 등록";
break;
case "detail": //상세
popTitle = "우편번호 상세";
break;
default:
break;
}
CmmPopup.open(url, params, popOption, popTitle);
}
,onClickGrid: function(props){
const rowData = props.grid.getRow(props.rowKey);
fnBiz.pagePopup('detail', rowData);
}
,onClickZipBtn: function(props){
const rowData = props.grid.getRow(props.rowKey);
fnBiz.pagePopup('detail', {zip: rowData.zip, sn: rowData.sn});
}
}
/**************************************************************************
* event
**************************************************************************/
$(() => {
$('#btnSearch').on('click', () => {
fnBiz.search();
});
$('#btnRegist').on('click', () => {
fnBiz.pagePopup('add', null);
});
});
/* *******************************
* Grid
******************************* */
const initGrid = () => {
/* ******************************
* Grid start
****************************** */
const gridColumns = [ //Grid 컬럼 정보(명칭,매핑 field, 기타옵션 등)
{
header: '우편번호',
name: 'zip',
width: 120,
sortable: true,
sortingType: 'desc',
align: 'center',
renderer: {
type: CustomButtonRenderer,
options: {
formatter: (props) => {
const rowData = props.grid.getRow(props.rowKey);
return {
formatter: rowData.zip.substring(0,3)+ "-"+ rowData.zip.substring(3,6)
,element: "text"
}
}
,eventFunction: fnBiz.onClickZipBtn //function(){alert("1234")}
,eventType : "click"
}
}
},
{
header: '주소',
name: 'address',
minWidth: 300,
sortable: false,
//align: 'center',
renderer: {
type: CustomButtonRenderer,
options: {
formatter: (props) => {
const rowData = props.grid.getRow(props.rowKey);
return {
formatter: rowData.ctprvnNm +' '+ rowData.signguNm +' '+ rowData.emdNm +' '+ rowData.liBuldNm +' '+ rowData.lnbrDongHo
,element: "text"
}
}
,eventFunction: fnBiz.onClickGrid //function(props){XitZipCodeMng_list.fnClickDetail(props)} //function(){alert("1234")}
,eventType : "click"
}
}
}
];
const gridDatasource = {
initialRequest: true,
api: {
readData: {
url: '<c:url value="/framework/biz/mng/code/findZipCodes.do"/>'
,serializer: (params) => fnAddPageInfo(document.frmSearch, params)
}
}
}
const gridOptions = {
el: 'grid',
rowHeaders: ['rowNum'],
columns: gridColumns,
};
GRID = TuiGrid.of(gridOptions, gridDatasource, (res) => {
});
};
/**************************************************************************
* initialize
**************************************************************************/
$(document).ready(function(){
initGrid();
});
</script>

@ -0,0 +1,156 @@
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/framework/taglibs.jsp" %>
<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator" %>
<c:url var="ImgUrl" value="/resources/"/>
<c:set var="isUpdate" value="${!empty zip.zip}"/>
<c:set var="bizName" value="우편번호"/>
<script type="text/javascript" src="<c:url value="/framework/util/validator.do"/>"></script>
<validator:javascript formName="zip" staticJavascript="false" xhtml="true" cdata="false"/>
<div class="popup" style="min-width: 100%;">
<div class="popup_inner" style="max-width: 600px;">
<%@include file="/WEB-INF/jsp/framework/biz-popup-title.jsp"%>
<%--@elvariable id="zip" type="validator"--%>
<form:form commandName="zip" name="zip" method="post">
<table class="tbl03">
<caption><c:out value="${bizName}"/> 등록 / 변경</caption>
<colgroup>
<col style="width: 20%;"/>
<col style="width: 80%;"/>
</colgroup>
<tbody>
<tr>
<th class="required" scope="row" nowrap>
<label for="zip">우편번호</label>
</th>
<td nowrap="nowrap">
<input style="width: 30%" type="text" id="zip" name="zip" size="6" maxlength="6"/>
<form:errors path="zip"/> &nbsp;* 우편번호의 '-'를 제외하고 입력하시오.
</td>
</tr>
<tr>
<th class="required" scope="row" nowrap >
<label for="ctprvnNm">시도명</label>
</th>
<td nowrap="nowrap">
<form:input path="ctprvnNm" size="20" maxlength="20" id="ctprvnNm"/>
<form:errors path="ctprvnNm"/>
</td>
</tr>
<tr>
<th height="23" class="required" scope="row" nowrap >
<label for="signguNm">시군구명</label>
</th>
<td nowrap="nowrap">
<form:input path="signguNm" size="20" maxlength="20" id="signguNm"/>
<form:errors path="signguNm"/>
</td>
</tr>
<tr>
<th height="23" class="required" scope="row" nowrap >
<label for="emdNm">읍면동명</label>
</th>
<td nowrap="nowrap">
<form:input path="emdNm" size="30" maxlength="30" id="emdNm"/>
<form:errors path="emdNm"/>
</td>
</tr>
<tr>
<th height="23" scope="row" nowrap >
<label for="liBuldNm">리건물명</label>
</th>
<td nowrap="nowrap">
<form:input path="liBuldNm" size="60" maxlength="60" id="liBuldNm"/>
<form:errors path="liBuldNm"/>
</td>
</tr>
<tr>
<th scope="row" nowrap >
<label for="lnbrDongHo">번지동호</label>
</th>
<td nowrap="nowrap">
<form:input path="lnbrDongHo" size="20" maxlength="20" id="lnbrDongHo"/>
<form:errors path="lnbrDongHo"/>
</td>
</tr>
</tbody>
</table>
</form:form>
<%@include file="/WEB-INF/jsp/framework/biz-popup-btn.jsp" %>
<!-- //등록버튼 -->
</div>
</div>
<!-- //popup -->
<script type="text/javaScript">
/**************************************************************************
* Global Variable
**************************************************************************/
let orgData;
/* *******************************
* Biz function
******************************* */
const fnBiz = {
add: () => {
if (!fnBiz.validate()) return;
cmmBizAjax('add', {
url: '<c:url value="/framework/biz/mng/code/addZipCode.do"/>'
, data: $("#zip").serialize()
})
}
,modify: () => {
if (!fnBiz.validate()) return;
cmmBizAjax('modify', {
url: '<c:url value="/framework/biz/mng/code/modifyZipCode.do"/>'
,data: $("#cmmnCode").serialize()
});
}
,remove: () => {
cmmBizAjax('remove', {
url: '<c:url value="/framework/biz/mng/code/removeZipCode.do"/>'
,data: $("#cmmnCode").serialize()
});
}
,validate: () => {
if(orgData === $('form').serialize()){
alert('변경된 내용이 없습니다.');
return false;
}
if(!validateZip(document.getElementById("zip"))){
return false;
}
return true;
}
};
/**************************************************************************
* event
**************************************************************************/
$(() => {
$('#btnRegist').on('click', () => {
fnBiz.add();
});
$('#btnModify').on('click', () => {
fnBiz.modify();
});
$('#btnRemove').on('click', () => {
fnBiz.remove();
});
});
/**************************************************************************
* initialize
**************************************************************************/
$(document).ready(function () {
orgData = $('form').serialize();
});
</script>
Loading…
Cancel
Save