diff --git a/pom.xml b/pom.xml index 0139070f..65d9ca8d 100644 --- a/pom.xml +++ b/pom.xml @@ -42,6 +42,12 @@ + + cokr.xit.base + xit-code + 23.04.01-SNAPSHOT + + org.springframework.boot spring-boot-starter-web diff --git a/src/main/java/cokr/xit/MainController.java b/src/main/java/cokr/xit/MainController.java index 7985301c..62d6c83b 100644 --- a/src/main/java/cokr/xit/MainController.java +++ b/src/main/java/cokr/xit/MainController.java @@ -7,12 +7,12 @@ import javax.annotation.Resource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; -import cokr.xit.backup.Backup; import cokr.xit.backup.service.bean.BackupBean; +import cokr.xit.base.code.service.CodeQuery; +import cokr.xit.base.code.service.bean.CodeBean; import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.web.AbstractController; @@ -24,6 +24,9 @@ public class MainController extends AbstractController { @Resource(name = "backupBean") private BackupBean backupBean; + @Resource(name = "codeBean") + private CodeBean codeBean; + @GetMapping(name="홈", value={"/", "/index.do"}) public ModelAndView mainPage() { return new ModelAndView("index"); @@ -38,39 +41,21 @@ public class MainController extends AbstractController { return mav; } - @GetMapping(name="백업 테이블 및 실사용 테이블 자료 조회", value="/backup/list.do") - public ModelAndView getBackupList(String backupTable, String originalTable, String pkName) { - ModelAndView mav = new ModelAndView("jsonView"); - - List originalDataList = backupBean.getAllList(originalTable, pkName); - List backupDataList = backupBean.getAllList(backupTable, originalTable, pkName); - - mav.addObject("originalDataList", originalDataList); - mav.addObject("backupDataList", backupDataList); - - - return mav; - } - - @PostMapping(name="백업 테이블 자료를 사용 테이블로 복사", value="/backup/activate.do") - public ModelAndView add(Backup backup) { - ModelAndView mav = new ModelAndView("jsonView"); + @GetMapping(name="시군구 설정 복사 메인", value="/copySggStngMain.do") + public ModelAndView copySggStngMain() { + ModelAndView mav = new ModelAndView(); - boolean saved = backupBean.activate(backup); + CodeQuery cq = new CodeQuery(); + cq.setGroupIDs("FIM054"); + List taskSeCdList = codeBean.getCodeList(cq); + mav.addObject("taskSeCdList", taskSeCdList); - mav.addObject("saved", saved); + List sggList = backupBean.getAllList("TB_SGG", "SGG_NM"); + mav.addObject("sggList", sggList); + mav.setViewName("sgg/copySggStngMain"); + mav.addObject("pageName","copySggStngMain"); return mav; } - @PostMapping(name="사용 테이블 자료 삭제 및 백업", value="/backup/deactivate.do") - public ModelAndView del(Backup backup) { - ModelAndView mav = new ModelAndView("jsonView"); - - boolean saved = backupBean.deactivate(backup); - - mav.addObject("saved", saved); - - return mav; - } } \ No newline at end of file diff --git a/src/main/java/cokr/xit/backup/web/BackupController.java b/src/main/java/cokr/xit/backup/web/BackupController.java new file mode 100644 index 00000000..1151baa5 --- /dev/null +++ b/src/main/java/cokr/xit/backup/web/BackupController.java @@ -0,0 +1,56 @@ +package cokr.xit.backup.web; + +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.servlet.ModelAndView; + +import cokr.xit.backup.Backup; +import cokr.xit.backup.service.bean.BackupBean; +import cokr.xit.foundation.data.DataObject; + +@Controller +public class BackupController { + @Resource(name = "backupBean") + private BackupBean backupBean; + + @GetMapping(name="백업 테이블 및 실사용 테이블 자료 조회", value="/backup/list.do") + public ModelAndView getBackupList(String backupTable, String originalTable, String pkName) { + ModelAndView mav = new ModelAndView("jsonView"); + + List originalDataList = backupBean.getAllList(originalTable, pkName); + List backupDataList = backupBean.getAllList(backupTable, originalTable, pkName); + + mav.addObject("originalDataList", originalDataList); + mav.addObject("backupDataList", backupDataList); + + + return mav; + } + + @PostMapping(name="백업 테이블 자료를 사용 테이블로 복사", value="/backup/activate.do") + public ModelAndView add(Backup backup) { + ModelAndView mav = new ModelAndView("jsonView"); + + boolean saved = backupBean.activate(backup); + + mav.addObject("saved", saved); + + return mav; + } + + @PostMapping(name="사용 테이블 자료 삭제 및 백업", value="/backup/deactivate.do") + public ModelAndView del(Backup backup) { + ModelAndView mav = new ModelAndView("jsonView"); + + boolean saved = backupBean.deactivate(backup); + + mav.addObject("saved", saved); + + return mav; + } +} diff --git a/src/main/java/cokr/xit/copyStng/dao/CopyStngMapper.java b/src/main/java/cokr/xit/copyStng/dao/CopyStngMapper.java new file mode 100644 index 00000000..41bd3198 --- /dev/null +++ b/src/main/java/cokr/xit/copyStng/dao/CopyStngMapper.java @@ -0,0 +1,19 @@ +package cokr.xit.copyStng.dao; + +import java.util.List; +import java.util.Map; + +import org.egovframe.rte.psl.dataaccess.mapper.Mapper; + +import cokr.xit.foundation.component.AbstractMapper; + +@Mapper("copyStngMapper") +public interface CopyStngMapper extends AbstractMapper { + + int copyTask(Map param); + + List selectVltnList(Map param); + + int copyVltn(Map param); + +} diff --git a/src/main/java/cokr/xit/copyStng/service/bean/CopyStngBean.java b/src/main/java/cokr/xit/copyStng/service/bean/CopyStngBean.java new file mode 100644 index 00000000..de5573b9 --- /dev/null +++ b/src/main/java/cokr/xit/copyStng/service/bean/CopyStngBean.java @@ -0,0 +1,39 @@ +package cokr.xit.copyStng.service.bean; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Component; + +import cokr.xit.copyStng.dao.CopyStngMapper; +import cokr.xit.foundation.AbstractComponent; + +@Component("copyStngBean") +public class CopyStngBean extends AbstractComponent { + + @Resource(name = "copyStngMapper") + private CopyStngMapper copyStngMapper; + + public boolean copy(String taskSeCd, String srcSgg, String trgtSgg) { + Map param = new HashMap<>(); + param.put("taskSeCd",taskSeCd); + param.put("srcSgg",srcSgg); + param.put("trgtSgg",trgtSgg); + + copyStngMapper.copyTask(param); + + List vltnCds = copyStngMapper.selectVltnList(param); + param.put("vltnCds", vltnCds); + int result2 = copyStngMapper.copyVltn(param); + if(result2 == vltnCds.size()) { + return true; + } else { + return false; + } + + } + +} diff --git a/src/main/java/cokr/xit/copyStng/web/CopyStngController.java b/src/main/java/cokr/xit/copyStng/web/CopyStngController.java new file mode 100644 index 00000000..0b0bb891 --- /dev/null +++ b/src/main/java/cokr/xit/copyStng/web/CopyStngController.java @@ -0,0 +1,28 @@ +package cokr.xit.copyStng.web; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.servlet.ModelAndView; + +import cokr.xit.copyStng.service.bean.CopyStngBean; + +@Controller +public class CopyStngController { + + @Resource(name = "copyStngBean") + private CopyStngBean copyStngBean; + + @GetMapping(name="시군구 설정 복사", value="/copyStng/copy.do") + public ModelAndView copy(String taskSeCd, String srcSgg, String trgtSgg) { + ModelAndView mav = new ModelAndView("jsonView"); + + boolean saved = copyStngBean.copy(taskSeCd, srcSgg, trgtSgg); + + mav.addObject("saved", saved); + + return mav; + } + +} diff --git a/src/main/resources/sql/mapper/base/code-mapper.xml b/src/main/resources/sql/mapper/base/code-mapper.xml new file mode 100644 index 00000000..be27d2b6 --- /dev/null +++ b/src/main/resources/sql/mapper/base/code-mapper.xml @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +SELECT * + FROM TB_CODE_CTGR + WHERE USE_YN = 'Y' + AND CTGR_ID IN (#{categoryID}) + + + +/* 코드 카테고리 목록 조회(codeMapper.getCategoryList) */ + + +/*코드 카테고리 가져오기(codeMapper.getCategories)*/ + + +/* 코드 카테고리 등록(codeMapper.insertCategory) */ +INSERT INTO TB_CODE_CTGR ( + CTGR_ID + , CTGR_NM + , DSCRP + , REG_DT + , RGTR + , MDFCN_DT + , MDFR + , USE_YN +) VALUES ( + #{category.id} + , #{category.name} + , #{category.description} + , + , #{currentUser.id} + , + , #{currentUser.id} + , 'Y' +) + +/* 코드 카테고리 수정(codeMapper.updateCategory) */ +UPDATE TB_CODE_CTGR SET + CTGR_NM = #{category.name} + , DSCRP = #{category.description} + , MDFCN_DT = + , MDFR = #{currentUser.id} +WHERE CTGR_ID = #{category.id} + +/* 코드 카테고리 제거(codeMapper.removeCategories) */ +UPDATE TB_CODE_CTGR SET + MDFCN_DT = + , MDFR = #{currentUser.id} + , USE_YN = 'N' +WHERE CTGR_ID IN (#{categoryID}) + + +SELECT * + FROM TB_CODE_GRP + WHERE USE_YN = 'Y' +AND CTGR_ID IN (#{categoryID}) +AND GRP_ID IN (#{groupID}) + + + +/* 코드그룹 목록 조회(codeMapper.getGroupList) */ + + +/* 코드그룹 가져오기(codeMapper.getGroups) */ + + +/* 코드그룹 등록(codeMapper.insertGroup) */ +INSERT INTO TB_CODE_GRP ( + GRP_ID + , GRP_NM + , CTGR_ID + , DSCRP + , REG_DT + , RGTR + , MDFCN_DT + , MDFR + , USE_YN +) VALUES ( + #{group.id} + , #{group.name} + , #{group.categoryID} + , #{group.description} + , + , #{currentUser.id} + , + , #{currentUser.id} + , 'Y' +) + +/* 코드그룹 수정(codeMapper.updateGroup) */ +UPDATE TB_CODE_GRP SET + GRP_NM = #{group.name} + , CTGR_ID = #{group.categoryID} + , DSCRP = #{group.description} + , MDFCN_DT = + , MDFR = #{currentUser.id} + WHERE GRP_ID = #{group.id} + +/*코드그룹 제거(codeMapper.removeGroups) */ +UPDATE TB_CODE_GRP SET + USE_YN = 'N' + , MDFCN_DT = + , MDFR = #{currentUser.id} + +CTGR_ID IN (#{categoryID}) +GRP_ID IN (#{groupID}) + + + +SELECT * + FROM TB_CMN_CODE + WHERE USE_YN = 'Y' + AND GRP_ID IN (#{groupID}) + AND CODE IN (#{code}) + + + +/* 그룹별 코드 가져오기(codeMapper.getCodeList) */ + + +/* 코드 가져오기(codeMapper.getCodes) */ + + +/* 코드 등록(codeMapper.insertCode) */ +INSERT INTO TB_CMN_CODE ( + GRP_ID + , CODE + , CODE_VAL + , DSCRP + , ETC_1 + , ETC_2 + , ETC_3 + , SRT_ORD + , REG_DT + , RGTR + , MDFCN_DT + , MDFR + , USE_YN +) VALUES ( + #{code.groupID} + , #{code.code} + , #{code.value} + , #{code.description} + , #{code.etc1} + , #{code.etc2} + , #{code.etc3} + , #{code.sortOrder} + , + , #{currentUser.id} + , + , #{currentUser.id} + , 'Y' +) + +/* 코드 수정(codeMapper.updateCode) */ +UPDATE TB_CMN_CODE SET + CODE_VAL = #{code.value} + , DSCRP = #{code.description} + , ETC_1 = #{code.etc1} + , ETC_2 = #{code.etc2} + , ETC_3 = #{code.etc3} + , MDFCN_DT = + , MDFR = #{currentUser.id} + WHERE GRP_ID = #{code.groupID} + AND CODE = #{code.code} + +/* 코드 정렬순서 변경(codeMapper.reorderCodes) */ +UPDATE TB_CMN_CODE SET + SRT_ORD = CASE CODE + WHEN #{code} THEN #{index} + ELSE SRT_ORD + END + , MDFCN_DT = + , MDFR = #{currentUser.id} + WHERE GRP_ID = #{groupID} + AND CODE IN (#{code}) + +/* 코드 제거(codeMapper.removeCodes) */ +UPDATE TB_CMN_CODE SET + MDFCN_DT = + , MDFR = #{currentUser.id} + , USE_YN = 'N' + +AND GRP_ID IN (#{groupID}) +AND CODE IN (#{code}) + + + \ No newline at end of file diff --git a/src/main/resources/sql/mapper/copyStng/copyStng-mapper.xml b/src/main/resources/sql/mapper/copyStng/copyStng-mapper.xml new file mode 100644 index 00000000..0c872f97 --- /dev/null +++ b/src/main/resources/sql/mapper/copyStng/copyStng-mapper.xml @@ -0,0 +1,78 @@ + + + + + +INSERT + INTO TB_TASK +SELECT #{trgtSgg} AS SGG_CD + , B.TASK_SE_CD + , B.TASK_SE_NM + , B.ADVNTCE_DAY_CNT + , B.ADVNTCE_RDUCT_RT + , B.WKSN_RDUCT_RT + , B.FFNLG_ADTN_YMD + , B.FFNLG_ADTN_RT + , B.FFNLG_INADTN_RT + , B.FFNLG_INADTN_MXMM_CNT + , B.NXRP_LINK_SE_CD + , B.NXRP_LINK_SE_DTL_SN + , B.USE_YN + , B.REG_DT + , B.RGTR + , B.MDFCN_DT + , B.MDFR + FROM TB_TASK B + WHERE B.SGG_CD = #{srcSgg} + AND B.TASK_SE_CD = #{taskSeCd} + + + +SELECT A.VLTN_CD + FROM TB_VLTN A + WHERE A.SGG_CD = #{srcSgg} + AND A.TASK_SE_CD = #{taskSeCd} + + + + + SELECT + LPAD(CAST(IFNULL(MAX(VLTN_ID) + 1, 1) AS INT), 10, '0') + AS NEW_ID + FROM TB_VLTN + + INSERT + INTO TB_VLTN + SELECT (CASE B.VLTN_CD + + WHEN #{vltnCd} THEN LPAD(CAST(${vltnId}+${index} AS INT), 10, '0') + + ELSE '' END) AS VLTN_ID + , #{trgtSgg} AS SGG_CD + , B.TASK_SE_CD + , B.VLTN_CD + , B.VLTN_ARTCL + , B.VLTN_LAW_NM + , B.VLTN_LAW1 + , B.VLTN_LAW2 + , B.VLTN_LAW_ETC + , B.ACNTG_SE_CD + , B.ACNTG_SE_NM + , B.TXITM_CD + , B.TXITM_NM + , B.OPER_ITEM_CD + , B.OPER_ITEM_NM + , B.SPCL_BIZ_CD + , B.SPCL_BIZ_NM + , B.USE_YN + , B.REG_DT + , B.RGTR + , B.MDFCN_DT + , B.MDFR + FROM TB_VLTN B + WHERE B.SGG_CD = #{srcSgg} + AND B.TASK_SE_CD = #{taskSeCd} + AND B.VLTN_CD IN (#{vltnCd}) + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/index.jsp b/src/main/webapp/WEB-INF/jsp/index.jsp index 0b9cd3bc..c28be07c 100644 --- a/src/main/webapp/WEB-INF/jsp/index.jsp +++ b/src/main/webapp/WEB-INF/jsp/index.jsp @@ -16,6 +16,8 @@ 시군구 시군구 추가/삭제 + 시군구 설정 복사 + @@ -75,6 +77,26 @@ }); }); + $("#btnForCopySggStng").on("click", function(){ + $.ajax({ + type : "GET", + ContentType : "text/html;charset=UTF-8", + url : "/copySggStngMain.do", + data: {}, + success: (resp) => { + console.log(resp); + + dialog.open({ + id: "copySggStngDialog", + title: "시군구 설정 복사", + content: resp , + size: "fullscreen", + init:() => {} + }); + } + }); + }); + $(function(){ }); diff --git a/src/main/webapp/WEB-INF/jsp/sgg/copySggStngMain.jsp b/src/main/webapp/WEB-INF/jsp/sgg/copySggStngMain.jsp new file mode 100644 index 00000000..f3851116 --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/sgg/copySggStngMain.jsp @@ -0,0 +1,64 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> + + + + + + 업무 + + + ${item.CODE_VAL} + + + + + 소스 시군구 + + + ${item.SGG_NM} + + + + + 타겟 시군구 + + + ${item.SGG_NM} + + + + + + 업무,위반 설정 복사 + + + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/sgg/sggAddDelMain.jsp b/src/main/webapp/WEB-INF/jsp/sgg/sggAddDelMain.jsp index bbaa75e6..3f46f6ae 100644 --- a/src/main/webapp/WEB-INF/jsp/sgg/sggAddDelMain.jsp +++ b/src/main/webapp/WEB-INF/jsp/sgg/sggAddDelMain.jsp @@ -30,8 +30,8 @@ - 추가 >> - << 삭제 + 추가 >> + << 삭제 @@ -130,7 +130,7 @@ function getBackupAndOriginalDataList(){ }); } -$("#btnAdd-${pageName}").on("click", function(){ +$("#btnAdd--${pageName}").on("click", function(){ var checked = $("#backupSggTbody--${pageName}").find("input[type='checkbox']:checked"); if(checked.length < 1){ return; @@ -157,7 +157,7 @@ $("#btnAdd-${pageName}").on("click", function(){ }); }); -$("#btnDel-${pageName}").on("click", function(){ +$("#btnDel--${pageName}").on("click", function(){ var checked = $("#originalSggTbody--${pageName}").find("input[type='checkbox']:checked"); if(checked.length < 1){ return;