feat: 우편번호 관리 반영

main
Jonguk. Lim 2 years ago
parent 70d3a56666
commit c4a8607f23

@ -8,7 +8,6 @@ import org.apache.ibatis.session.RowBounds;
import egovframework.rte.psl.dataaccess.mapper.Mapper;
import kr.xit.framework.biz.mng.code.model.XitClCodeMngVO;
@Mapper
public interface ICodeCfnMgtMapper {

@ -8,7 +8,6 @@ import org.apache.ibatis.session.RowBounds;
import egovframework.rte.psl.dataaccess.mapper.Mapper;
import kr.xit.framework.biz.mng.code.model.XitDetailCodeMngVO;
@SuppressWarnings("MybatisXMapperMethodInspection")
@Mapper
public interface ICodeDtlMgtMapper {

@ -8,7 +8,6 @@ import org.apache.ibatis.session.RowBounds;
import egovframework.rte.psl.dataaccess.mapper.Mapper;
import kr.xit.framework.biz.mng.code.model.XitCmmnCodeMngVO;
@SuppressWarnings("MybatisXMapperMethodInspection")
@Mapper
public interface ICodeGrpMgtMapper {

@ -18,7 +18,6 @@ import kr.xit.framework.biz.mng.code.model.XitZipCodeMngVO;
* @since 2002. 2. 2.
* @version 1.0 Copyright(c) XIT All rights reserved.
*/
@SuppressWarnings("MybatisXMapperMethodInspection")
@Mapper
public interface IZipCodeMgtMapper {

@ -1,49 +0,0 @@
package kr.xit.framework.biz.mng.code.mapper;
import java.sql.SQLException;
import java.util.List;
import egovframework.rte.psl.dataaccess.mapper.Mapper;
import kr.xit.framework.biz.mng.code.model.XitZipCodeMngSearchVO;
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.
*/
@Mapper
public interface XitZipCodeMngMapper {
/**
* <pre> : </pre>
* @param searchVO
* @return List<XitZipCodeMngVO>
* @author:
* @date: 2020. 4. 16.
*/
public List<XitZipCodeMngVO> findList(XitZipCodeMngSearchVO searchVO) throws SQLException;
/**
* <pre> : </pre>
* @param searchVO
* @return int
* @author:
* @date: 2020. 4. 16.
*/
public int findListTotCnt(XitZipCodeMngSearchVO searchVO) throws SQLException;
/**
* <pre> : </pre>
* @param vo
* @return XitZipCodeMngVO
* @author:
* @date: 2020. 4. 16.
*/
public XitZipCodeMngVO findView(XitZipCodeMngVO vo) throws SQLException;
}

@ -1,22 +0,0 @@
package kr.xit.framework.biz.mng.code.model;
import kr.xit.framework.core.model.XitBaseSearchVO;
/**
*
* @: SearchVO
* @:
* @: 2020. 4. 16. 9:44:22
* @:
* @author ()
* @since 2002. 2. 2.
* @version 1.0 Copyright(c) XIT All rights reserved.
*/
public class XitZipCodeMngSearchVO extends XitBaseSearchVO{
/**
* serialVersionUID
*/
private static final long serialVersionUID = 1L;
}

@ -25,63 +25,4 @@ public interface IZipCodeMgtService {
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);
}

@ -1,90 +0,0 @@
package kr.xit.framework.biz.mng.code.service;
import java.io.InputStream;
import java.util.List;
import kr.xit.framework.biz.mng.code.model.XitZipCodeMngSearchVO;
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 XitZipCodeMngService {
/**
* <pre> : </pre>
* @param searchVO
* @return List<XitZipCodeMngVO>
* @author:
* @date: 2020. 4. 16.
*/
public List<XitZipCodeMngVO> findList(XitZipCodeMngSearchVO searchVO);
/**
* <pre> : </pre>
* @param searchVO
* @return int
* @author:
* @date: 2020. 4. 16.
*/
public int findListTotCnt(XitZipCodeMngSearchVO searchVO);
/**
* <pre> : </pre>
* @param vo
* @return XitZipCodeMngVO
* @author:
* @date: 2020. 4. 16.
*/
public XitZipCodeMngVO findView(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);
}

@ -16,20 +16,13 @@ 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;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
@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;
private final IZipCodeMgtMapper mapper;
@Override
public List<XitZipCodeMngVO> findZipCodes(final Map<String, Object> paraMap, final RowBounds rowBounds) {
@ -55,97 +48,4 @@ public class ZipCodeMgtService implements IZipCodeMgtService {
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;
}
}

@ -1,158 +0,0 @@
package kr.xit.framework.biz.mng.code.service.impl;
import java.io.InputStream;
import java.sql.SQLException;
import java.util.List;
import javax.annotation.Resource;
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.model.XitZipCodeMngSearchVO;
import kr.xit.framework.biz.mng.code.model.XitZipCodeMngVO;
import kr.xit.framework.biz.mng.code.service.XitZipCodeMngService;
import kr.xit.framework.biz.mng.code.mapper.XitZipCodeMngMapper;
import kr.xit.framework.core.message.XitMessageSource;
@Service
public class XitZipCodeMngServiceImpl implements XitZipCodeMngService {
@Resource
private XitZipCodeMngMapper xitZipCodeMngMapper;
@Resource
private XitFrameCrudService xitFrameCrudService;
@Resource(name="groupIdGnrService")
private EgovIdGnrService idgenService;
@Resource
private XitMessageSource xitMessageSource;
@Resource(name = "egovExcelService")
private EgovExcelService excelZipService;
@Override
public List<XitZipCodeMngVO> findList(XitZipCodeMngSearchVO searchVO) {
List<XitZipCodeMngVO> result = null;
try {
result = xitZipCodeMngMapper.findList(searchVO);
} catch (SQLException e) {
throw new RuntimeException("사용자그룹관리 목록 조회 FAIL::", e);
}
return result;
}
@Override
public int findListTotCnt(XitZipCodeMngSearchVO searchVO) {
int result = 0;
try {
result = xitZipCodeMngMapper.findListTotCnt(searchVO);
} catch (SQLException e) {
throw new RuntimeException("사용자그룹관리 목록 총건수 조회 FAIL::", e);
}
return result;
}
@Override
public XitZipCodeMngVO findView(XitZipCodeMngVO vo) {
XitZipCodeMngVO result = null;
try {
result = xitZipCodeMngMapper.findView(vo);
} catch (SQLException e) {
throw new RuntimeException("사용자그룹관리 상세정보 조회 FAIL::", e);
}
return result;
}
@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;
}
}

@ -1,380 +0,0 @@
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.slf4j.Logger;
import org.slf4j.LoggerFactory;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.support.SessionStatus;
import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper;
import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
import kr.xit.framework.biz.cmm.model.XitLoginVO;
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.XitZipCodeMngService;
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.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.util.AjaxUtils;
/**
*
* @: Controller
* @:
* @: 2020. 4. 16. 9:39:52
* @:
* @author ()
* @since 2002. 2. 2.
* @version 1.0 Copyright(c) XIT All rights reserved.
*/
@Controller
@RequestMapping("/framework/biz/mng/ccode/")
public class XitZipCodeMngController {
private static final Logger logger = LoggerFactory.getLogger(XitZipCodeMngController.class);
@Resource
private XitZipCodeMngService xitZipCodeMngService;
@Autowired
private XitBeanValidator beanValidator;
@Resource(name = "xitMessageSource")
XitMessageSource xitMessageSource;
/**
* <pre> : </pre>
* @return String
* @author:
* @date: 2020. 4. 16.
*/
@GetMapping(value = "ZipCodeMng_list")
public void ZipCodeMng_list() {
}
/*
<pre> : </pre>
* @return String
* @author:
* @date: 2020. 8.04.
*/
@RequestMapping(value = "ZipCodeMng_list.ajax", method={RequestMethod.GET, RequestMethod.POST})
@ResponseBody
public Map<String, Object> ZipCodeMng_listAjax(@ModelAttribute("searchVO") XitZipCodeMngSearchVO searchVO, ModelMap model) {
/** paging */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(searchVO.getPage()>-1?searchVO.getPage():searchVO.getPageIndex());
paginationInfo.setRecordCountPerPage(searchVO.getPerPage()>-1?searchVO.getPerPage():searchVO.getPageUnit());
paginationInfo.setPageSize(searchVO.getPageSize());
searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
/**
*
*/
int totCnt = xitZipCodeMngService.findListTotCnt(searchVO);
paginationInfo.setTotalRecordCount(totCnt);
/**
*
*/
/* ***************************
* tui Grid Response Set
*************************** */
resultMap.put("result", true); //[tui Grid] result
resultMap.put("message", xitMessageSource.getMessage("success.common.select")); //[tui Grid] result message
Map<String, Object> data = new HashMap<String, Object>();
data.put("contents", xitZipCodeMngService.findList(searchVO)); //[tui Grid] data-contents
Map<String, Integer> pagination = new HashMap<String, Integer>();
pagination.put("page", searchVO.getPage());
pagination.put("totalCount", totCnt);
data.put("pagination", pagination); //[tui Grid] data-paging
resultMap.put("data", data); //[tui Grid] data
/* ***************************
* //tui Grid Response Set
*************************** */
} catch (Exception e) {
/**
*
*/
//tui Grid Response Set
resultMap.put("result", false); //[tui Grid] result
resultMap.put("message", xitMessageSource.getMessage("fail.common.select")); //[tui Grid] result message
}
return resultMap;
}
/**
* <pre> : .</pre>
* @param page
* @param tilesDef Type(none: tiles )
* @param model
* @return String
* @author:
* @date: 2020. 4. 16.
*/
@RequestMapping(value = "ZipCodeMng_{cmd}", method={RequestMethod.GET, RequestMethod.POST})
public String ZipCodeMng_page(@PathVariable String cmd
, @RequestParam(value="tilesDef", required=false, defaultValue="") String tilesDef
, @ModelAttribute("zip") XitZipCodeMngVO vo
, @ModelAttribute XitZipCodeMngSearchVO searchVO
, ModelMap model) {
switch (cmd) {
case "input": //등록 페이지
case "inputs": //다건 등록 페이지
break;
case "edit": //수정 페이지
case "view": //상세 페이지
model.addAttribute("zip", xitZipCodeMngService.findView(vo));
model.addAttribute("message", xitMessageSource.getMessage("success.common.select"));
break;
default:
throw new RuntimeException("유효하지 않은 요청 입니다.");
}
if(!"".equals(tilesDef))
tilesDef = "."+tilesDef;
return FrameworkConstants.FRAMEWORK_JSP_BASE_PATH +"mng/code/XitZipCodeMng_"+cmd+tilesDef;
}
/**
* <pre> : .</pre>
* @param page
* @param model
* @return String
* @author:
* @date: 2020. 4. 16.
*/
@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());
xitZipCodeMngService.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")) {
xitZipCodeMngService.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) {
logger.debug("{}", 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());
xitZipCodeMngService.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 {
xitZipCodeMngService.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 {
xitZipCodeMngService.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,63 +1,33 @@
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.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
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;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
@Controller
@RequestMapping("/framework/biz/mng/code")
public class ZipCodeMgtController {
@Resource
private IZipCodeMgtService service;
@Autowired
private XitBeanValidator beanValidator;
@Resource(name = "xitMessageSource")
XitMessageSource xitMessageSource;
private final IZipCodeMgtService service;
@RequestMapping(value = "/mngZipCodeMgtForm")
public void mngZipCodeMgtForm() {
@ -67,14 +37,23 @@ public class ZipCodeMgtController {
public ModelAndView mngZipCodeMgtPopup(final XitZipCodeMngVO vo) {
ModelAndView mav = new ModelAndView();
mav.addObject("zip", Checks.isEmpty(vo.getZip())? new XitAuthRuleMngVO(): service.findZipCode(vo));
mav.addObject("zipVO", Checks.isEmpty(vo.getZip())? new XitZipCodeMngVO(): service.findZipCode(vo));
mav.addObject("pageTitle", "우편번호 등록 / 변경");
mav.setViewName(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH + "mng/code/mngZipCodeMgtPopup.popup");
return mav;
}
@RequestMapping(value = "/mngZipCodeByExcelPopup")
public ModelAndView mngZipCodeByExcelPopup() {
ModelAndView mav = new ModelAndView();
mav.addObject("pageTitle", "우편번호 Excel 파일 업로드");
mav.setViewName(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH + "mng/code/mngZipCodeByExcelPopup.popup");
return mav;
}
@GetMapping(value = "/findZipCodes")
public ModelAndView findZipCodes(final Map<String, Object> paraMap){
public ModelAndView findZipCodes(@RequestParam final Map<String, Object> paraMap){
return ResultResponse.of(service.findZipCodes(paraMap, MybatisUtils.getPagingInfo(paraMap)));
}
@ -87,7 +66,7 @@ public class ZipCodeMgtController {
public ModelAndView addZipCode(final XitZipCodeMngVO vo, final BindingResult bindingResult){
ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW);
ValidationError.of("zip", vo, bindingResult);
ValidationError.of("zipVO", vo, bindingResult);
service.addZipCode(vo);
AjaxMessageMapRenderer.success(mav, MessageKey.CMM_INSERT_SUCCESS);
return mav;
@ -97,7 +76,7 @@ public class ZipCodeMgtController {
public ModelAndView modifyZipCode(final XitZipCodeMngVO vo, final BindingResult bindingResult){
ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW);
ValidationError.of("zip", vo, bindingResult);
ValidationError.of("zipVO", vo, bindingResult);
service.modifyZipCode(vo);
AjaxMessageMapRenderer.success(mav, MessageKey.CMM_UPDATE_SUCCESS);
return mav;
@ -112,89 +91,19 @@ public class ZipCodeMgtController {
return mav;
}
@PostMapping(value = "/uploadZipCodeByExcel", consumes = {"multipart/form-data"})
//public String uploadZipCodeByExcel(MultipartHttpServletRequest request) {
public ModelAndView uploadZipCodeByExcel(@RequestPart(value = "file", required = false) MultipartFile mf) {
ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW);
@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("유효하지 않은 요청 입니다.");
//service.uploadZipCodeByExcel()
AjaxMessageMapRenderer.success(mav, MessageKey.CMM_SUCCESS);
return mav;
}
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);
@ -215,7 +124,7 @@ public class ZipCodeMgtController {
if (!"".equals(fileVO.getFileName())) {
// 2011.10.07 업로드 파일에 대한 확장자를 체크
if (fileVO.getFileName().toLowerCase().endsWith(".xls") || fileVO.getFileName().toLowerCase().endsWith(".xlsx")) {
service.addsProc(fis);
xitZipCodeMngService.addsProc(fis);
status.setComplete();
message = xitMessageSource.getMessage("success.common.insert");
} else {
@ -235,93 +144,22 @@ public class ZipCodeMgtController {
fis.close();
}
} catch (IOException ee) {
logger.debug("{}", 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;
@Resource(name = "egovExcelService")
private EgovExcelService egovExcelService;
default:
new RuntimeException("유효하지 않은 요청 입니다.");
}
@Override
public void addsProc(InputStream fis) throws Exception {
/**
*
*/
/* ============================
* 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());
}
}
xitFrameCrudService.removesXitZip(new XitZipVO()); // 데이타 모두 삭제???
egovExcelService.uploadExcel("kr.xit.framework.biz.cmm.dao.XitFrameCrudMapper.addXitZip", fis, 2, 5000);
}
*/

@ -1,90 +0,0 @@
<?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">
<!-- SQL 페이징 코드 -->
<sql id="pageBefore">
SELECT LIST.* FROM(
</sql>
<sql id="pageAfter">
) LIST LIMIT #{firstIndex}, #{recordCountPerPage}
</sql>
<sql id="findList_SELECT">
SELECT A.ZIP AS "zip"
,A.SN AS "sn"
,A.CTPRVN_NM AS "ctprvnNm"
,A.SIGNGU_NM AS "signguNm"
,A.EMD_NM AS "emdNm"
,A.LI_BULD_NM AS "liBuldNm"
,A.LNBR_DONG_HO AS "lnbrDongHo"
</sql>
<sql id="findList_FROM">
FROM XIT_ZIP A
</sql>
<sql id="findList_WHERE">
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(searchKeyword)">
<if test="'1'.toString() == searchCondition">
AND A.ZIP = #{searchKeyword}
</if>
<if test="'2'.toString() == searchCondition">
AND A.CTPRVN_NM LIKE CONCAT('%',#{searchKeyword},'%')
</if>
<if test="'3'.toString() == searchCondition">
AND A.SIGNGU_NM LIKE CONCAT('%',#{searchKeyword},'%')
</if>
<if test="'4'.toString() == searchCondition">
AND A.EMD_NM LIKE CONCAT('%',#{searchKeyword},'%')
</if>
<if test="'5'.toString() == searchCondition">
AND A.LI_BULD_NM LIKE CONCAT('%',#{searchKeyword},'%')
</if>
</if>
</sql>
<select id="findList" resultType="kr.xit.framework.biz.mng.code.model.XitZipCodeMngVO">
/** XitZipCodeMngMapper.findList */
/** 우편번호관리 목록 조회 */
<if test="searchGubun == 'list'">
<include refid="pageBefore" />
</if>
<include refid="findList_SELECT"/>
<include refid="findList_FROM"/>
WHERE 1=1
<include refid="findList_WHERE"/>
<if test="searchGubun == 'list'">
<include refid="pageAfter" />
</if>
</select>
<select id="findListTotCnt" resultType="int">
/** XitZipCodeMngMapper.findListTotCnt */
/** 우편번호관리 목록 총건수 조회 */
SELECT COUNT(1) AS "CNT"
<include refid="findList_FROM"/>
WHERE 1=1
<include refid="findList_WHERE"/>
</select>
<select id="findView" resultType="kr.xit.framework.biz.mng.code.model.XitZipCodeMngVO">
/** XitZipCodeMngMapper.findView */
/** 우편번호관리 상세정보 조회 */
<include refid="findList_SELECT"/>
<include refid="findList_FROM"/>
WHERE 1=1
AND ZIP = #{zip}
AND SN = #{sn }
</select>
</mapper>

@ -1,5 +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.IZipCodeMgtMapper">
<!-- *************************************************************************************************************
@ -19,186 +20,83 @@
, last_updusr_id
FROM xit_zip
<where>
<if test="searchCondition eq 'clCode'">
AND INSTR(cl_code, #{searchKeyword}) > 0
<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(ctprvnNm)">
AND ctprvn_nm = #{ctprvnNm}
</if>
<if test="searchCondition eq 'clCodeNm'">
AND INSTR(cl_code_nm, #{searchKeyword}) > 0
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(signguNm)">
AND signgu_nm = #{signguNm}
</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(emdNm)">
AND emd_nm = #{emdNm}
</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(liBuldNm)">
AND li_buld_nm = #{liBuldNm}
</if>
</where>
</sql>
<select id="selectZips" resultType="kr.xit.framework.biz.mng.code.model.XitClCodeMngVO">
/* code-cfn-mysql-mapper|selectCmmnClCodes-분류코드 목록 조회|julim */
<select id="selectZips" resultType="kr.xit.framework.biz.mng.code.model.XitZipCodeMngVO">
/* zip-mysql-mapper|selectZips-우편번호 목록 조회|julim */
<include refid="sqlZip"/>
</select>
<select id="selectZip" resultType="kr.xit.framework.biz.mng.code.model.XitClCodeMngVO">
/* code-cfn-mysql-mapper|selectCmmnClCode-분류코드 정보 조회|julim */
<select id="selectZip" resultType="kr.xit.framework.biz.mng.code.model.XitZipCodeMngVO">
/* zip-mysql-mapper|selectZips-우편번호 정보 조회|julim */
<include refid="sqlZip"/>
</select>
<insert id="insertZip">
/* code-cfn-mysql-mapper|insertCmmnClCode-분류코드 정보 등록|julim */
/* zip-mysql-mapper|insetZip-우편번호 정보 등록|julim */
INSERT
INTO xit_cmmn_cl_code (
cl_code
, cl_code_nm
, cl_code_dc
, use_at
INTO xit_zip (
zip
, sn
, ctprvn_nm
, signgu_nm
, emd_nm
, li_buld_nm
, lnbr_dong_ho
, frst_regist_pnttm
, frst_register_id
) VALUE (
#{clCode}
, #{clCodeNm}
, #{clCodeDc}
, #{useAt}
) VALUES (
#{zip}
, #{sn}
, #{ctprvnNm}
, #{signguNm}
, #{emdNm}
, #{liBuldNm}
, #{lnbrDongHo}
, NOW()
, #{frstRegisterId}
)
</insert>
<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})
, cl_code_dc = IF(cl_code_dc = #{clCodeDc}, cl_code_dc, #{clCodeDc})
, use_at = #{useAt}
/* zip-mysql-mapper|updateZip-우편번호 정보 변경|julim */
UPDATE xit_zip
SET ctprvn_nm = IF(ctprvn_nm = #{ctprvnNm}, ctprvn_nm, #{ctprvnNm})
, signgu_nm = IF(signgu_nm = #{signguNm}, signgu_nm, #{signguNm})
, emd_nm = IF(emd_nm = #{emdNm}, emd_nm, #{emdNm})
, li_buld_nm = IF(li_buld_nm = #{liBuldNm}, li_buld_nm, #{liBuldNm})
, lnbr_dong_ho = IF(lnbr_dong_ho = #{lnbrDongHo}, lnbr_dong_ho, #{lnbrDongHo})
, last_updt_pnttm = NOW()
, last_updusr_id = #{lastUpdusrId}
WHERE cl_code = #{clCode}
WHERE zip = #{zip}
AND sn = #{sn}
</update>
<delete id="deleteZip">
/* code-cfn-mysql-mapper|deleteCmmnClCode-분류코드 정보 삭제|julim */
/* zip-mysql-mapper|deleteZip-우편번호 정보 삭제|julim */
DELETE
FROM xit_cmmn_cl_code
WHERE cl_code = #{clCode}
</delete>
<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>
FROM xit_zip
WHERE zip = #{zip}
AND sn = #{sn}
</delete>
</mapper>

@ -7,7 +7,7 @@
<formset>
<form name="zip">
<form name="zipVO">
<field property="zip" depends="required, maxlength">
<arg0 key="우편번호" resource="false"/>
<arg1 key="6" resource="false"/>

@ -1,263 +0,0 @@
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="ufn" uri="/WEB-INF/tlds/egovfn.tld"%>
<%@ taglib prefix="orderby" uri="/WEB-INF/tlds/orderby.tld" %>
<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator" %>
<c:url var="ImgUrl" value="/resources/"/>
<script type="text/javascript" src="<c:url value="/framework/util/validator.do"/>"></script>
<validator:javascript formName="zip" staticJavascript="false" xhtml="true" cdata="false"/>
<form:form commandName="zip" name="zip" method="post">
<input name="cmd" type="hidden" value="Modify">
<input name="zip" type="hidden" value="${zip.zip}">
<form:hidden path="sn"/>
<form:hidden path="ctprvnNm"/>
<form:hidden path="signguNm"/>
<form:hidden path="emdNm"/>
<div class="popup" style="min-width: 100%;">
<div class="popup_inner" style="max-width: 600px;">
<p class="pop_title">우편번호 상세</p>
<table class="tbl03">
<caption>우편번호 상세</caption>
<tbody>
<tr>
<th width="20%" height="23" class="required" scope="row" nowrap >우편번호<img src="${ImgUrl}/required.gif" alt="필수" width="15" height="15"></th>
<td width="80%" nowrap>
<c:out value='${fn:substring(zip.zip, 0,3)}'/>-<c:out value='${fn:substring(zip.zip, 3,6)}'/>
</td>
</tr>
<tr>
<th width="20%" height="23" class="required" scope="row" nowrap >시도명<img src="${ImgUrl}/required.gif" alt="필수" width="15" height="15"></th>
<td width="80%" nowrap="nowrap">
<c:out value='${zip.ctprvnNm}'/>
</td>
</tr>
<tr>
<th width="20%" height="23" class="required" scope="row" nowrap >시군구명<img src="${ImgUrl}/required.gif" alt="필수" width="15" height="15"></th>
<td width="80%" nowrap="nowrap">
<c:out value='${zip.signguNm}'/>
</td>
</tr>
<tr>
<th width="20%" height="23" class="required" scope="row" nowrap >읍면동명<img src="${ImgUrl}/required.gif" alt="필수" width="15" height="15"></th>
<td width="80%" nowrap="nowrap">
<c:out value='${zip.emdNm}'/>
</td>
</tr>
<tr>
<th width="20%" height="23" nowrap scope="row" ><label for="liBuldNm">리건물명</label></th>
<td width="80%" nowrap="nowrap">
<input name="liBuldNm" type="text" size="60" value="<c:out value='${zip.liBuldNm}'/>" maxlength="60" id="liBuldNm" >
</td>
</tr>
<tr>
<th width="20%" height="23" scope="row" nowrap ><label for="lnbrDongHo">번지동호</label></th>
<td width="80%" nowrap="nowrap">
<input name="lnbrDongHo" type="text" size="20" value="<c:out value='${zip.lnbrDongHo}'/>" maxlength="20" id="lnbrDongHo">
</td>
</tr>
</tbody>
</table>
<div class="popup_btn">
<span class="flr">
<a href="#" class="btn blue" id="update_btn">변경</a>
<a href="#" class="btn red" id="btnRemove">삭제</a>
<a href="#" class="btn lightgray" id="btnClose">닫기</a>
</span>
</div>
<!-- //등록버튼 -->
</div>
</div>
<!-- //popup -->
</form:form>
<script type="text/javaScript" language="javascript" defer="defer">
$(document).ready(function(){
XitZipCodeMng_edit.init();
});
/* *******************************
* 우편번호 관리 수정화면 Functions
******************************* */
var XitZipCodeMng_edit = {
/* ========================
* 초기화
======================== */
init : function(){
//닫기 버튼 EVENT 설정
$("#btnClose").on({
click : function(){
window.close();
}
});
//입력값 유효성 설정
XitZipCodeMng_edit.fn_setInputLimit();
//저장 버튼 Event 설정
$('#btnSave').on({
click: function(){
if (confirm('등록하시겠습니까?')) {
if(!validateZip(document.zip)){
return;
}else{
XitZipCodeMng_edit.addData();
}
}
}
});
$('#update_btn').on({
click: function(){
if (confirm('수정하시겠습니까?')) {
if(!validateZip(document.zip)){
return;
}else{
XitZipCodeMng_edit.modifyData();
}
}
}
});
$('#btnRemove').on({
click: function(){
if (confirm('삭제하시겠습니까?')) {
if(!validateZip(document.zip)){
return;
}else{
XitZipCodeMng_edit.removeData();
}
}
}
});
},
/* ========================
* 입력값 언어 선택
======================== */
fn_setInputLimit : function(){
},
/* ========================
* 데이터 조회
======================== */
findData : function(){
},
/* ========================
* 데이터 등록
======================== */
addData : function(){
var param = $("#zip").serialize();
$.ajax({
url : "<c:url value='/framework/biz/mng/code/ZipCodeMng_insert_proc.do'/>",
data : param,
type : "post",
dataType : "json",
success : function(data) {
alert(data.resp.message);
window.opener.XitZipCodeMng_list.findData();
window.close();
},
error: function(){
}
});
},
/* ========================
* 데이터 수정
======================== */
modifyData : function(){
var param = $("#zip").serialize();
$.ajax({
url : "<c:url value='/framework/biz/mng/code/ZipCodeMng_update_proc.do'/>",
data : param,
type : "post",
dataType : "json",
success : function(data) {
alert(data.resp.message);
window.opener.XitZipCodeMng_list.findData();
window.close();
},
error: function(){
}
});
},
/* ========================
* 데이터 삭제
======================== */
removeData : function(){
var param = $("#zip").serialize();
$.ajax({
url : "<c:url value='/framework/biz/mng/code/ZipCodeMng_delete_proc.do'/>",
data : param,
type : "post",
dataType : "json",
success : function(data) {
alert(data.resp.message);
window.opener.XitZipCodeMng_list.findData();
window.close();
},
error: function(){
}
});
},
/* ========================
* 유효성 검증
-flag에 따라 유효성 검증을 분기처리한다.
======================== */
validate : function(flag){
switch(flag){
case 'update' : //수정
break;
default : break;
}
return true;
},
/* ========================
* 페이지 이동
-외부사이트 링크가 필요 시 사용(내부코드는 각 페이지에 맞게 수정, ex>https://www.gov.kr/portal/main )
======================== */
pageLink: function(flag, url, params){
switch (flag) {
case "move": //페이지 이동
break;
case "popup": //팝업 OPEN
break;
default:
break;
}
},
/* ========================
* 페이지 Open
-팝업페이지를 Open 한다.
======================== */
pagePopup: function(flag, url, params){
var popUrl = url;
if(!(params == undefined || params == null)){
popUrl += "?";
popUrl += params;
}
var popTitle = '';
var popOption = '';
switch (flag) {
case "": //주소 팝업 OPEN
popTitle = "";
popOption = "width=570px, height=420px, resizable=yes, scrollbars=yes, location=no, top=100px, left=100px;";
break;
default:
break;
}
window.open(popUrl, popTitle ,popOption);
}
}
</script>

@ -1,260 +0,0 @@
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="ufn" uri="/WEB-INF/tlds/egovfn.tld"%>
<%@ taglib prefix="orderby" uri="/WEB-INF/tlds/orderby.tld" %>
<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator" %>
<c:url var="ImgUrl" value="/resources/"/>
<script type="text/javascript" src="<c:url value="/framework/util/validator.do"/>"></script>
<validator:javascript formName="zip" staticJavascript="false" xhtml="true" cdata="false"/>
<form:form commandName="zip" name="zip" method="post">
<div class="popup" style="min-width: 100%;">
<div class="popup_inner" style="max-width: 600px;">
<p class="pop_title">우편번호 등록</p>
<table class="tbl03">
<caption>우편번호 등록</caption>
<tbody>
<tr>
<th width="20%" height="23" class="required" scope="row" nowrap ><label for="zip">우편번호</label><img src="${ImgUrl}/required.gif" alt="필수" width="15" height="15"></th>
<td width="80%" 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 width="20%" height="23" class="required" scope="row" nowrap ><label for="ctprvnNm">시도명</label><img src="${ImgUrl}/required.gif" alt="필수" width="15" height="15"></th>
<td width="80%" nowrap="nowrap">
<form:input path="ctprvnNm" size="20" maxlength="20" id="ctprvnNm"/>
<form:errors path="ctprvnNm"/>
</td>
</tr>
<tr>
<th width="20%" height="23" class="required" scope="row" nowrap ><label for="signguNm">시군구명</label><img src="${ImgUrl}/required.gif" alt="필수" width="15" height="15"></th>
<td width="80%" nowrap="nowrap">
<form:input path="signguNm" size="20" maxlength="20" id="signguNm"/>
<form:errors path="signguNm"/>
</td>
</tr>
<tr>
<th width="20%" height="23" class="required" scope="row" nowrap ><label for="emdNm">읍면동명</label><img src="${ImgUrl}/required.gif" alt="필수" width="15" height="15"></th>
<td width="80%" nowrap="nowrap">
<form:input path="emdNm" size="30" maxlength="30" id="emdNm"/>
<form:errors path="emdNm"/>
</td>
</tr>
<tr>
<th width="20%" height="23" scope="row" nowrap ><label for="liBuldNm">리건물명</label></th>
<td width="80%" nowrap="nowrap">
<form:input path="liBuldNm" size="60" maxlength="60" id="liBuldNm"/>
<form:errors path="liBuldNm"/>
</td>
</tr>
<tr>
<th width="20%" height="23" scope="row" nowrap ><label for="lnbrDongHo">번지동호</label></th>
<td width="80%" nowrap="nowrap">
<form:input path="lnbrDongHo" size="20" maxlength="20" id="lnbrDongHo"/>
<form:errors path="lnbrDongHo"/>
</td>
</tr>
</tbody>
</table>
<div class="popup_btn">
<span class="flr">
<a href="#" class="btn blue" id="btnSave">저장</a>
<a href="#" class="btn lightgray" id="btnClose">닫기</a>
</span>
</div>
<!-- //등록버튼 -->
</div>
</div>
<!-- //popup -->
</form:form>
<script type="text/javaScript" language="javascript" defer="defer">
$(document).ready(function(){
XitZipCodeMng_input.init();
});
/* *******************************
* 우편번호 관리 등록화면 Functions
******************************* */
var XitZipCodeMng_input = {
/* ========================
* 초기화
======================== */
init : function(){
//닫기 버튼 EVENT 설정
$("#btnClose").on({
click : function(){
window.close();
}
});
//입력값 유효성 설정
XitZipCodeMng_input.fn_setInputLimit();
//저장 버튼 Event 설정
$('#btnSave').on({
click: function(){
if (confirm('등록하시겠습니까?')) {
if(!validateZip(document.zip)){
return;
}else{
XitZipCodeMng_input.addData();
}
}
}
});
$('#update_btn').on({
click: function(){
if (confirm('수정하시겠습니까?')) {
if(!validateZip(document.zip)){
return;
}else{
XitZipCodeMng_input.modifyData();
}
}
}
});
$('#btnRemove').on({
click: function(){
if (confirm('삭제하시겠습니까?')) {
if(!validateZip(document.zip)){
return;
}else{
XitZipCodeMng_input.removeData();
}
}
}
});
},
/* ========================
* 입력값 언어 선택
======================== */
fn_setInputLimit : function(){
},
/* ========================
* 데이터 조회
======================== */
findData : function(){
},
/* ========================
* 데이터 등록
======================== */
addData : function(){
var param = $("#zip").serialize();
$.ajax({
url : "<c:url value='/framework/biz/mng/code/ZipCodeMng_insert_proc.do'/>",
data : param,
type : "post",
dataType : "json",
success : function(data) {
alert(data.resp.message);
window.opener.XitZipCodeMng_list.findData();
window.close();
},
error: function(){
}
});
},
/* ========================
* 데이터 수정
======================== */
modifyData : function(){
var param = $("#zip").serialize();
$.ajax({
url : "<c:url value='/framework/biz/mng/code/ZipCodeMng_insert_update.do'/>",
data : param,
type : "post",
dataType : "json",
success : function(data) {
alert(data.resp.message);
window.opener.XitZipCodeMng_list.findData();
window.close();
},
error: function(){
}
});
},
/* ========================
* 데이터 삭제
======================== */
removeData : function(){
var param = $("#zip").serialize();
$.ajax({
url : "<c:url value='/framework/biz/mng/code/ZipCodeMng_insert_delete.do'/>",
data : param,
type : "post",
dataType : "json",
success : function(data) {
alert(data.resp.message);
window.opener.XitZipCodeMng_list.findData();
window.close();
},
error: function(){
}
});
},
/* ========================
* 유효성 검증
-flag에 따라 유효성 검증을 분기처리한다.
======================== */
validate : function(flag){
switch(flag){
case 'update' : //수정
break;
default : break;
}
return true;
},
/* ========================
* 페이지 이동
-외부사이트 링크가 필요 시 사용(내부코드는 각 페이지에 맞게 수정, ex>https://www.gov.kr/portal/main )
======================== */
pageLink: function(flag, url, params){
switch (flag) {
case "move": //페이지 이동
break;
case "popup": //팝업 OPEN
break;
default:
break;
}
},
/* ========================
* 페이지 Open
-팝업페이지를 Open 한다.
======================== */
pagePopup: function(flag, url, params){
var popUrl = url;
if(!(params == undefined || params == null)){
popUrl += "?";
popUrl += params;
}
var popTitle = '';
var popOption = '';
switch (flag) {
case "": //주소 팝업 OPEN
popTitle = "";
popOption = "width=570px, height=420px, resizable=yes, scrollbars=yes, location=no, top=100px, left=100px;";
break;
default:
break;
}
window.open(popUrl, popTitle ,popOption);
}
}
</script>

@ -1,231 +0,0 @@
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="ufn" uri="/WEB-INF/tlds/egovfn.tld"%>
<%@ taglib prefix="orderby" uri="/WEB-INF/tlds/orderby.tld" %>
<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator" %>
<c:url var="ImgUrl" value="/resources/"/>
<script type="text/javascript" src="<c:url value="/framework/util/validator.do"/>"></script>
<validator:javascript formName="zip" staticJavascript="false" xhtml="true" cdata="false"/>
<form name="Form" action="<c:url value='/framework/biz/mng/code/ZipCodeMng_inserts_proc.do'/>" method="post" enctype="multipart/form-data" >
<div class="popup" style="min-width: 100%;">
<div class="popup_inner" style="max-width: 600px;">
<p class="pop_title">우편번호 등록</p>
<table class="tbl03">
<caption>우편번호 등록</caption>
<tbody>
<tr>
<th width="20%" height="23" class="required" scope="row" nowrap ><label for="fileNm">우편번호 엑셀파일</label><img src="${ImgUrl}/required.gif" alt="필수" width="15" height="15"></th>
<td><input name="fileNm" type="file" id="fileNm"/></td>
</tr>
</tbody>
</table>
<div class="popup_btn">
<span class="flr">
<a href="#" class="btn blue" id="btnSave">저장</a>
<a href="#" class="btn lightgray" id="btnClose">닫기</a>
</span>
</div>
<!-- //등록버튼 -->
</div>
</div>
<!-- //popup -->
</form>
<script type="text/javaScript" language="javascript" defer="defer">
$(document).ready(function(){
XitZipCodeMng_inputs.init();
});
/* *******************************
* 우편번호 관리 다건 등록 Functions
******************************* */
var XitZipCodeMng_inputs = {
/* ========================
* 초기화
======================== */
init : function(){
//닫기 버튼 EVENT 설정
$("#btnClose").on({
click : function(){
window.close();
}
});
//입력값 유효성 설정
XitZipCodeMng_inputs.fn_setInputLimit();
//저장 버튼 Event 설정
$('#btnSave').on({
click: function(){
var varForm = document.all["Form"];
// 파일 확장명 확인
var arrExt = "xls";
var objInput = varForm.elements["fileNm"];
var strFilePath = objInput.value;
var arrTmp = strFilePath.split(".");
var strExt = arrTmp[arrTmp.length-1].toLowerCase();
if (arrExt != strExt) {
alert("엑셀 파일을 첨부하지 않았습니다.\n확인후 다시 처리하십시오. ");
abort;
}
varForm.action = "/framework/biz/mng/code/ZipCodeMng_inserts_proc.do";
varForm.submit();
}
});
$('#update_btn').on({
click: function(){
if (confirm('수정하시겠습니까?')) {
if(!validateZip(document.zip)){
return;
}else{
XitZipCodeMng_inputs.modifyData();
}
}
}
});
$('#btnRemove').on({
click: function(){
if (confirm('삭제하시겠습니까?')) {
if(!validateZip(document.zip)){
return;
}else{
XitZipCodeMng_inputs.removeData();
}
}
}
});
},
/* ========================
* 입력값 언어 선택
======================== */
fn_setInputLimit : function(){
},
/* ========================
* 데이터 조회
======================== */
findData : function(){
},
/* ========================
* 데이터 등록
======================== */
addData : function(){
var param = $("#zip").serialize();
$.ajax({
url : "<c:url value='/framework/biz/mng/code/ZipCodeMng_insert_proc.do'/>",
data : param,
type : "post",
dataType : "json",
success : function(data) {
alert(data.resp.message);
window.opener.XitZipCodeMng_list.findData();
window.close();
},
error: function(){
}
});
},
/* ========================
* 데이터 수정
======================== */
modifyData : function(){
var param = $("#zip").serialize();
$.ajax({
url : "<c:url value='/framework/biz/mng/code/ZipCodeMng_insert_update.do'/>",
data : param,
type : "post",
dataType : "json",
success : function(data) {
alert(data.resp.message);
window.opener.XitZipCodeMng_list.findData();
window.close();
},
error: function(){
}
});
},
/* ========================
* 데이터 삭제
======================== */
removeData : function(){
var param = $("#zip").serialize();
$.ajax({
url : "<c:url value='/framework/biz/mng/code/ZipCodeMng_insert_delete.do'/>",
data : param,
type : "post",
dataType : "json",
success : function(data) {
alert(data.resp.message);
window.opener.XitZipCodeMng_list.findData();
window.close();
},
error: function(){
}
});
},
/* ========================
* 유효성 검증
-flag에 따라 유효성 검증을 분기처리한다.
======================== */
validate : function(flag){
switch(flag){
case 'update' : //수정
break;
default : break;
}
return true;
},
/* ========================
* 페이지 이동
-외부사이트 링크가 필요 시 사용(내부코드는 각 페이지에 맞게 수정, ex>https://www.gov.kr/portal/main )
======================== */
pageLink: function(flag, url, params){
switch (flag) {
case "move": //페이지 이동
break;
case "popup": //팝업 OPEN
break;
default:
break;
}
},
/* ========================
* 페이지 Open
-팝업페이지를 Open 한다.
======================== */
pagePopup: function(flag, url, params){
var popUrl = url;
if(!(params == undefined || params == null)){
popUrl += "?";
popUrl += params;
}
var popTitle = '';
var popOption = '';
switch (flag) {
case "": //주소 팝업 OPEN
popTitle = "";
popOption = "width=570px, height=420px, resizable=yes, scrollbars=yes, location=no, top=100px, left=100px;";
break;
default:
break;
}
window.open(popUrl, popTitle ,popOption);
}
}
</script>

@ -1,300 +0,0 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<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: 8%;"/>
<col style="width: 20%;"/>
<col style="width: 8%;"/>
<col style="width: ;"/>
<col style="width: 8%;"/>
<col style="width: ;"/>
<col style="width: 7%;"/>
</colgroup>
<tbody>
<td colspan="6">
<select id="searchCondition" name="searchCondition" onchange="onSearchCondition()" title="조회조건">
<option selected value=''>--선택하세요--</option>
<option value='1' <c:if test="${searchVO.searchCondition == '1'}">selected="selected"</c:if>>우편번호</option>
<option value='2' <c:if test="${searchVO.searchCondition == '2'}">selected="selected"</c:if>>시도명</option>
<option value='3' <c:if test="${searchVO.searchCondition == '3'}">selected="selected"</c:if>>시군구명</option>
<option value='4' <c:if test="${searchVO.searchCondition == '4'}">selected="selected"</c:if>>읍면동명</option>
<option value='5' <c:if test="${searchVO.searchCondition == '5'}">selected="selected"</c:if>>리건물명</option>
</select>
<input name="searchKeyword" title="검색어" type="text" value="<c:out value="${userSearchVO.searchKeyword}"/>" />
</td>
<td>
<input type="button" id="btnSearch" class="btn_search" title="검색" value="검색" />
</td>
</tbody>
</table>
</div>
<!-- //검색 -->
<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>
</form>
<script type="text/javaScript" language="javascript" defer="defer">
$(document).ready(function(){
XitZipCodeMng_list.init();
});
/* *******************************
* 우편번호 관리 Functions
******************************* */
var XitZipCodeMng_list = {
init : function(){
/**
* Grid Config Settings
*/
//Grid Style Set
Grid.applyTheme('striped'); // Call API of static method
//Grid 체크박스 checked EventListner
instance.on('check', function(ev) {
// console.log('check!', ev);
});
//Grid 체크박스 unchecked EventListner
instance.on('uncheck', function(ev) {
// console.log('uncheck!', ev);
});
//Grid 체크박스 focus이동 EventListner
instance.on('focusChange', function(ev) {
// console.log('change focused cell!', ev);
});
/**
* Elements EventListener Settings
*/
//검색 Event 설정
$('#btnSearch').on({
click: function(){
XitZipCodeMng_list.findData();
}
});
//등록 Event 설정
$("#btnRegist").click(function(){
XitZipCodeMng_list.pagePopup('input', "<c:url value='/framework/biz/mng/code/ZipCodeMng_input.do'/>");
});
//엑셀등록 Event 설정
$("#excel_btn").click(function(){
XitZipCodeMng_list.pagePopup('excel', "<c:url value='/framework/biz/mng/code/ZipCodeMng_inputs.do'/>");
});
},
/* ========================
* 데이터 조회
======================== */
findData : function(){
instance.reloadData();
},
/* ========================
* 데이터 등록
======================== */
addData : function(){
},
/* ========================
* 데이터 수정
======================== */
modifyData : function(){
},
/* ========================
* 데이터 삭제
======================== */
removeData : function(){
},
/* ========================
* 페이지 이동
-외부사이트 링크가 필요 시 사용(내부코드는 각 페이지에 맞게 수정, ex>https://www.gov.kr/portal/main )
======================== */
pageLink: function(flag, url, params){
switch (flag) {
case "move": //페이지 이동
document.listForm.searchKeyword.value = "";
document.listForm.action = url;
document.listForm.submit();
break;
case "popup": //팝업 OPEN
XitZipCodeMng_list.pagePopup(flag, url, params);
break;
default:
break;
}
},
/* ========================
* 페이지 Open
-팝업페이지를 Open 한다.
======================== */
pagePopup: function(flag, url, params){
var popUrl = url;
popUrl += "?tilesDef=popup";
if(!(params == undefined || params == null)){
popUrl += "&";
popUrl += params;
}
var popTitle = '';
switch (flag) {
case "input": //입력
popTitle = "우편번호 등록";
popOption = "scrollbars = yes, top=100px, left=100px, height=550px, width=950px;";
break;
case "excel"://엑셀
popTitle = "우편번호 상세";
popOption = "scrollbars = yes, top=100px, left=100px, height=550px, width=950px;";
break;
case "detail"://상세
popTitle = "우편번호 상세";
popOption = "scrollbars = yes, top=100px, left=100px, height=550px, width=950px;";
break;
default:
break;
}
window.open(popUrl, popTitle ,popOption);
},
/* ========================
* 상세 팝업 오픈 버튼 클릭
-상세 팝업을 OPEN 한다.
======================== */
fnClickZipBtn: function(props){
var rowData = props.grid.getRow(props.rowKey);
var params = "";
params += "zip=" + rowData.zip;
params += "&sn=" + rowData.sn;
XitZipCodeMng_list.pagePopup('detail', "<c:url value='/framework/biz/mng/code/ZipCodeMng_edit.do'/>", params);
}
}
/* ******************************
* Grid 환경 설정
****************************** */
var GridConfig = new XitTuiGridConfig();
GridConfig.setOptGridId('grid'); //Grid를 출력할 Element ID(해당 Element에 Grid가 출력 됨)
GridConfig.setOptGridHeight(270); //Grid 높이(단위: px)
GridConfig.setOptRowHeight(20); //Grid row 높이(단위: px)
GridConfig.setOptRowHeaderType('rowNum'); //Row 첫번째 Cell 타입(rowNum: 순번, checkbox: 체크박스, '': 아무것도 출력 안함)
GridConfig.setOptPageOptions({ //페이징(Pagination) 옵션
useClient: true //Client Paging 여부(true 설정 시 클라이언트 자체 페이징 처리. 서버호출 X)
,perPage: 10 //페이지당 표시 건수
});
GridConfig.setOptColumnOptions({ //컬럼고정 옵션
});
GridConfig.setOptDataSource({ //DataSource
/* -----------------------
* DataSource Config Setting
* -설정항목은 Global 적용 되며
* -API별 적용을 원할 경우 각 API 안에 작성 가능(우선순위: 개별->글로벌)
----------------------- */
//contentType: 'application/json',
//headers: { 'x-custom-header': 'custom-header' },
initialRequest: true, //디폴트 값은 true(false: 인스턴스 생성 시 요청은 보내지 않음. 이런 경우 "instance.reloadData()"를 사용하여 요청 가능)
//serializer: function(params) {
//return $(document.listForm).serialize();
// },
/* -----------------------
* DataSource API Setting
----------------------- */
api: {
readData : {
url: '<c:url value="/framework/biz/mng/code/ZipCodeMng_list.ajax"/>', method: 'GET'
,initParams: {}
,serializer: function(params) {
var form = document.listForm;
var serializeParam = $(form).serialize();
for(var key in params){
if(key=='perPage'){
if(params[key]==undefined)
serializeParam +='&'+key+'=-1';
else
serializeParam +='&'+key+'='+params[key];
}else
serializeParam +='&'+key+'='+params[key];
}
return serializeParam;
}
}
,createData: { url: '', method: 'POST'}
,updateData: { url: '', method: 'PUT'}
,modifyData: { url: '', method: 'PUT'}
,deleteData: { url: '', method: 'DELETE'}
}
});
GridConfig.setOptHeader({
}); //Grid 헤더 정보(헤더 셀 병합 필요 시 설정)
GridConfig.setOptColumns([ //Grid 컬럼 정보(명칭,매핑 field, 기타옵션 등)
{
header: '우편번호',
name: 'userId',
width: 120,
sortable: true,
sortingType: 'desc',
align: 'center',
renderer: {
type: CustomButtonRenderer,
options: {
formatter : function(props){
var rowData = props.grid.getRow(props.rowKey);
var obj = {
formatter : rowData.zip.substring(0,3)+ "-"+ rowData.zip.substring(3,6)
,element : "text"
}
return obj;
}
,eventFunction: XitZipCodeMng_list.fnClickZipBtn //function(){alert("1234")}
,eventType : "click"
}
}
},
{
header: '주소',
name: 'userNm',
minWidth: 300,
sortable: false,
align: 'center',
renderer: {
type: CustomButtonRenderer,
options: {
formatter : function(props){
var rowData = props.grid.getRow(props.rowKey);
var obj = {
formatter : rowData.ctprvnNm +' '+ rowData.signguNm +' '+ rowData.emdNm +' '+ rowData.liBuldNm +' '+ rowData.lnbrDongHo
,element : "text"
}
return obj;
}
,eventFunction: XitZipCodeMng_list.fnClickZipBtn //function(props){XitZipCodeMng_list.fnClickDetail(props)} //function(){alert("1234")}
,eventType : "click"
}
}
}
]);
var Grid = tui.Grid;
var instance = GridConfig.instance(Grid); //Grid 인스턴스
/* ********************************************************
* 처리결과메시지 출력
******************************************************** */
<c:if test="${!empty message}">alert("${message}");</c:if>
</script>

@ -0,0 +1,72 @@
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/framework/taglibs.jsp" %>
<div class="popup" style="min-width: 100%;">
<div class="popup_inner" style="max-width: 500px;">
<p class="pop_title">우편번호 Excel 파일 업로드</p>
<form>
<table class="tbl03">
<caption>우편번호 Excel 파일 업로드</caption>
<colgroup>
<col style="width: 20%"/>
<col/>
</colgroup>
<tbody>
<tr>
<th class="required" scope="row" nowrap >
<label for="file">우편번호 엑셀파일</label>
</th>
<td>
<input type="file" name="file" id="file" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"/>
</td>
</tr>
</tbody>
</table>
</form>
<div class="popup_btn">
<span class="flr p_flr">
<a href="#" class="btn blue" id="btnSave">엑셀파일 업로드</a>
<a href="#" class="btn lightgray" id="btnClose" onclick="window.close(); return false;">닫기</a>
</span>
</div>
<!-- //등록버튼 -->
</div>
</div>
<!-- //popup -->
<script type="text/javaScript">
$('#btnSave').on('click', () => {
const uploadFile = $("#file")[0];
console.log("uploadFile: ", uploadFile.files)
if(uploadFile.files.length === 0){
alert("파일은 선택해주세요");
return false;
}
const formData = new FormData();
formData.append("file", uploadFile.files[0]);
for(let key of formData.keys()) {
console.log(key);
}
for(let value of formData.values()) {
console.log(value);
}
$.ajax({
type:"POST",
url: '<c:url value="/framework/biz/mng/code/uploadZipCodeByExcel.do"/>',
processData: false,
contentType: false,
data: formData,
success: function(res){
if(res.result) alert('실제 업로드 처리 구현 필요');
},
err: function(err){
console.log("err:", err)
}
})
})
</script>

@ -28,7 +28,7 @@
<option value='emdNm'>읍면동명</option>
<option value='liBuldNm'>리건물명</option>
</select>
<input name="searchKeyword" title="검색어" type="text" value="<c:out value="${userSearchVO.searchKeyword}"/>" />
<input id="searchKeyword" 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="검색" />
@ -41,9 +41,10 @@
<!-- //검색 -->
<div class="page_btn">
<span class="fll">
<span class="flr">
<a href="#" class="btn darkgray" id="btnRegist" title="권한등록">등록</a>
<a href="#" class="btn lightgray" id="excel_btn" title="권한취소">엑셀등록</a>
<button type="button" id="btnExcel"><i class="ico far fa-file-excel"></i>업로드</button>
<%-- <a href="#" class="btn lightgray" id="btnExcel2" title="권한취소">엑셀등록</a>--%>
</span>
</div>
<!-- //버튼 및 페이지정보 -->
@ -77,6 +78,11 @@
case "detail": //상세
popTitle = "우편번호 상세";
break;
case "excel":
url = '<c:url value="/framework/biz/mng/code/mngZipCodeByExcelPopup.do"/>';
popOption = {width: 500, height:280}
popTitle = "excel upload";
break;
default:
break;
}
@ -103,6 +109,10 @@
$('#btnRegist').on('click', () => {
fnBiz.pagePopup('add', null);
});
$('#btnExcel').on('click', () => {
fnBiz.pagePopup('excel', null);
});
});
/* *******************************
@ -164,7 +174,12 @@
api: {
readData: {
url: '<c:url value="/framework/biz/mng/code/findZipCodes.do"/>'
,serializer: (params) => fnAddPageInfo(document.frmSearch, params)
,serializer: (params) => {
const schVal = $('#searchKeyword').val();
const schKey = $('#searchCondition').val();
if(schVal && schKey) return getPageParam({[schKey]: schVal}, params);
return getPageParam(null, params);
}
}
}
}

@ -4,17 +4,17 @@
<c:url var="ImgUrl" value="/resources/"/>
<c:set var="isUpdate" value="${!empty zip.zip}"/>
<c:set var="isUpdate" value="${!empty zipVO.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"/>
<validator:javascript formName="zipVO" 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">
<%--@elvariable id="zipVO" type="validator"--%>
<form:form commandName="zipVO" name="zipVO">
<table class="tbl03">
<caption><c:out value="${bizName}"/> 등록 / 변경</caption>
<colgroup>
@ -27,7 +27,8 @@
<label for="zip">우편번호</label>
</th>
<td nowrap="nowrap">
<input style="width: 30%" type="text" id="zip" name="zip" size="6" maxlength="6"/>
<!--input style="width: 30%" type="text" id="zip" name="zip" size="6" maxlength="6"/-->
<form:input path="zip" size="6" minlength="6" maxlength="6" cssStyle="width: 30%" readonly="${isUpdate}"/>
<form:errors path="zip"/> &nbsp;* 우편번호의 '-'를 제외하고 입력하시오.
</td>
</tr>
@ -100,7 +101,7 @@
cmmBizAjax('add', {
url: '<c:url value="/framework/biz/mng/code/addZipCode.do"/>'
, data: $("#zip").serialize()
, data: $("#zipVO").serialize()
})
}
,modify: () => {
@ -108,13 +109,13 @@
cmmBizAjax('modify', {
url: '<c:url value="/framework/biz/mng/code/modifyZipCode.do"/>'
,data: $("#cmmnCode").serialize()
,data: $("#zipVO").serialize()
});
}
,remove: () => {
cmmBizAjax('remove', {
url: '<c:url value="/framework/biz/mng/code/removeZipCode.do"/>'
,data: $("#cmmnCode").serialize()
,data: $("#zipVO").serialize()
});
}
,validate: () => {
@ -123,7 +124,7 @@
alert('변경된 내용이 없습니다.');
return false;
}
if(!validateZip(document.getElementById("zip"))){
if(!validateZipVO(document.getElementById("zipVO"))){
return false;
}
return true;

@ -134,10 +134,12 @@ var XitCmmnUtil = {
/**
*
* <pre>
* form 객체의 element + paging 정보를 serialize 하여 return
* @param {Object} formEliment form eliment : document.
* @param {Object} params json
* @returns {Object} form data + params = serialize data return
* </pre>
*/
const fnAddPageInfo = (searchForm, params) => {
let serializeParam = $(searchForm).serialize();
@ -153,6 +155,27 @@ const fnAddPageInfo = (searchForm, params) => {
return serializeParam;
}
/**
* <pre>
* json data + paging 정보를 serialize 하여 return
* @param {Object} jsonParam
* @param {Object} params
* @returns {Object} json data + params = serialize data return
* </pre>
*/
const getPageParam = (jsonParam, params) => {
let serializeParam = jsonParam? $.param(jsonParam) : '';
for(var key in params){
if(key=='perPage'){
if(params[key]==undefined)
serializeParam +='&'+key+'=-1';
else
serializeParam +='&'+key+'='+params[key];
}else
serializeParam +='&'+key+'='+params[key];
}
return serializeParam;
}
/**
* toStringByFormatting(new Date(2021, 0, 1));
@ -179,15 +202,15 @@ function toStringByFormatting(source, delimiter = '-') {
* DLR_ID : $("#dealerSelect_dlrId").val()
* ,DLR_NM : $("#dealerSelect_dlrNm").val()
* }
* , success : function(response) { //선택
* alert("success");
* ,success: (response)=>{ //선택
* //callback function
* }
* , exception : function(response) { //선택
* alert("exception");
* ,exception: (response)=>{ //선택
* // callback function
* }
* });
* @param {object} param
* </pre>
* @param param
*/
const cmmAjax = (param) => {
$.ajax({
@ -223,10 +246,10 @@ const cmmAjax = (param) => {
* 일반호출시
* 1) alert confirm 업무처리
* 2) fnBiz.search() 호출
* </pre>
* @param {String} workType add | modify | remove
* @param {Object} param parameter data
*
* @param {string} workType add | modify | remove
* @param {object} param parameter data
* </pre>
*/
const cmmBizAjax = (workType, param, isPopup = true) => {
let confirmMsg = '하시겠습니까?';
@ -255,7 +278,17 @@ const cmmBizAjax = (workType, param, isPopup = true) => {
}
};
window.nvl = function (val, ifNullVal, ifNotNullVal) {
/**
* <pre>
* val 값이 null이면 ifNulVal(미지정시 '')
* null이 아니면 ifNotNullVal(미지정시 val)
* @param {string} val
* @param {string} ifNullVal
* @param {string} ifNotNullVal
* @returns {string|*}
* </pre>
*/
window.nvl = (val, ifNullVal, ifNotNullVal) => {
return val==null
?( ifNullVal==null?"":ifNullVal)
:(ifNotNullVal==null?val:ifNotNullVal);

@ -247,6 +247,7 @@ const CmmPopup = {
}
/**
* <pre>
* modaless CmmPopup.open(). options에 추가적으로 사용할 option 값을 json 객체의 필드 형태로 넘기면 된다.
* @method open
* @param {String} url 문서의 주소
@ -255,6 +256,7 @@ const CmmPopup = {
* @param {String} target default 'nonamePopup'
* @param {String} method default 'get'
* @returns {object} 새로 열린 팝업창의 윈도우 객체.
* </pre>
*/
,open: function (url, params, options, target = 'nonamePopup', method = 'post') {
let extendOptions = $.extend({}, this.defaultOpenOptions, options);

Loading…
Cancel
Save