no message

main
이범준 7 months ago
parent ec3919bd3b
commit fbc005c29e

@ -42,12 +42,6 @@
</exclusions>
</dependency>
<dependency>
<groupId>cokr.xit.base</groupId>
<artifactId>xit-code</artifactId>
<version>23.04.01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>

@ -1,19 +1,11 @@
package cokr.xit;
import java.util.List;
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.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
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;
@Controller
@ -21,41 +13,11 @@ public class MainController extends AbstractController {
@Autowired
private RequestMappingHandlerMapping requestHandlers;
@Resource(name = "backupBean")
private BackupBean backupBean;
@Resource(name = "codeBean")
private CodeBean codeBean;
@GetMapping(name="홈", value={"/", "/index.do"})
public ModelAndView mainPage() {
return new ModelAndView("index");
}
@GetMapping(name="시군구 추가/삭제 메인", value="/sggAddDelMain.do")
public ModelAndView sggAddDelMain() {
ModelAndView mav = new ModelAndView();
mav.setViewName("sgg/sggAddDelMain");
mav.addObject("pageName","sggAddDelMain");
return mav;
}
@GetMapping(name="시군구 설정 복사 메인", value="/copySggStngMain.do")
public ModelAndView copySggStngMain() {
ModelAndView mav = new ModelAndView();
CodeQuery cq = new CodeQuery();
cq.setGroupIDs("FIM054");
List<DataObject> taskSeCdList = codeBean.getCodeList(cq);
mav.addObject("taskSeCdList", taskSeCdList);
List<DataObject> sggList = backupBean.getAllList("TB_SGG", "SGG_NM");
mav.addObject("sggList", sggList);
mav.setViewName("sgg/copySggStngMain");
mav.addObject("pageName","copySggStngMain");
return mav;
}
}

@ -6,7 +6,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import cokr.xit.custom.boot.CommonConfig1;
import cokr.xit.custom.boot.DatasourceConfig1;
import cokr.xit.custom.boot.DatasourceConfig2;
import cokr.xit.custom.boot.MvcConfig1;
import cokr.xit.custom.boot.ServletConfig1;
import cokr.xit.custom.boot.ServletConfig2;
@ -23,15 +22,14 @@ import testserver.wsdlserver.lvisserver.WebServiceConfig;
MvcConfig1.class,
DatasourceConfig1.class,
DatasourceConfig2.class,
TransactionConfig1.class,
WebServiceConfig.class
})
public class TsApplication {
public class TestServerApplication {
public static void main(String[] args) {
SpringApplication.run(TsApplication.class, args);
SpringApplication.run(TestServerApplication.class, args);
}
}

@ -1,16 +0,0 @@
package cokr.xit.backup;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class Backup {
String originalTable;
String backupTable;
String pkName;
String[] pks;
}

@ -1,25 +0,0 @@
package cokr.xit.backup.dao;
import java.util.List;
import java.util.Map;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.backup.Backup;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
@Mapper("backupMapper")
public interface BackupMapper extends AbstractMapper {
List<DataObject> selectAllList(Map<String, String> map);
int insertOriginalData(Backup backup);
int deleteOriginalData(Backup backup);
int insertBackupData(Backup backup);
int deleteBackupData(Backup backup);
}

@ -1,53 +0,0 @@
package cokr.xit.backup.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.backup.Backup;
import cokr.xit.backup.dao.BackupMapper;
import cokr.xit.foundation.AbstractComponent;
import cokr.xit.foundation.data.DataObject;
@Component("backupBean")
public class BackupBean extends AbstractComponent {
@Resource(name = "backupMapper")
private BackupMapper backupMapper;
public List<DataObject> getAllList(String originalTable, String pkName) {
Map<String,String> map = new HashMap<String,String>();
map.put("originalTable", originalTable);
map.put("pkName", pkName);
return backupMapper.selectAllList(map);
}
public List<DataObject> getAllList(String backupTable, String originalTable, String pkName) {
Map<String,String> map = new HashMap<String,String>();
map.put("originalTable", originalTable);
map.put("backupTable", backupTable);
map.put("pkName", pkName);
return backupMapper.selectAllList(map);
}
public boolean activate(Backup backup) {
return backupMapper.insertOriginalData(backup) > 0;
}
public boolean deactivate(Backup backup) {
backupMapper.deleteBackupData(backup);
int result1 = backupMapper.insertBackupData(backup);
int result2 = backupMapper.deleteOriginalData(backup);
return ((result1 != 0) && (result1 == result2));
}
}

@ -1,56 +0,0 @@
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<DataObject> originalDataList = backupBean.getAllList(originalTable, pkName);
List<DataObject> 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;
}
}

@ -1,19 +0,0 @@
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<String, Object> param);
List<String> selectVltnList(Map<String, Object> param);
int copyVltn(Map<String, Object> param);
}

@ -1,39 +0,0 @@
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<String, Object> param = new HashMap<>();
param.put("taskSeCd",taskSeCd);
param.put("srcSgg",srcSgg);
param.put("trgtSgg",trgtSgg);
copyStngMapper.copyTask(param);
List<String> vltnCds = copyStngMapper.selectVltnList(param);
param.put("vltnCds", vltnCds);
int result2 = copyStngMapper.copyVltn(param);
if(result2 == vltnCds.size()) {
return true;
} else {
return false;
}
}
}

@ -1,28 +0,0 @@
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;
}
}

@ -47,7 +47,7 @@ public class DatasourceConfig1 {
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
bean.setConfigLocation(resolver.getResource("classpath:sql/mybatis-config.xml"));
bean.setMapperLocations(resolver.getResources("classpath:sql/mapper/**/*.xml"));
bean.setMapperLocations(resolver.getResources("classpath:sql/externalmapper/**/*.xml"));
return bean;
} catch (Exception e) {
throw Assert.runtimeException(e);
@ -59,10 +59,10 @@ public class DatasourceConfig1 {
* @return MapperConfigurer
*/
@Bean
public MapperConfigurer internalMapperConfigurer() {
public MapperConfigurer mapperConfigurer() {
MapperConfigurer bean = new MapperConfigurer();
bean.setBasePackage("cokr.xit");
bean.setSqlSessionFactoryBeanName("sqlSession");
bean.setBasePackage("externalsystem");
bean.setSqlSessionFactoryBeanName("sqlSession");
return bean;
}
}

@ -1,57 +0,0 @@
package cokr.xit.custom.boot;
import javax.sql.DataSource;
import org.egovframe.rte.psl.dataaccess.mapper.MapperConfigurer;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import cokr.xit.foundation.Assert;
/**
* <ul><li>{@link #dataSource() } </li>
* <li>{@link #sqlSession() MyBatis} </li>
* <li>{@link #mapperConfigurer() } </li>
* </ul>
* @author mjkhan
*/
@Configuration
public class DatasourceConfig2 {
private DataSource dataSource;
@Bean("externaldataSource")
@ConfigurationProperties(prefix = "spring.datasource2.hikari")
public DataSource externaldataSource() {
return dataSource != null ? dataSource : (dataSource = DataSourceBuilder.create().build());
}
@Bean
public SqlSessionFactoryBean externalSqlSession() {
try {
SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
bean.setDataSource(externaldataSource());
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
bean.setConfigLocation(resolver.getResource("classpath:sql/mybatis-config.xml"));
bean.setMapperLocations(resolver.getResources("classpath:sql/externalmapper/**/*.xml"));
return bean;
} catch (Exception e) {
throw Assert.runtimeException(e);
}
}
@Bean
public MapperConfigurer externalMapperConfigurer() {
MapperConfigurer bean = new MapperConfigurer();
bean.setBasePackage("externalsystem");
bean.setSqlSessionFactoryBeanName("externalSqlSession");
return bean;
}
}

@ -7,7 +7,7 @@ spring:
application:
name: dummy-external-system
main:
allow-bean-definition-overriding: true
allow-bean-definition-overriding: true
# web-application-type: SERVLET
sql:
init:
@ -18,13 +18,6 @@ spring:
resources:
static-locations: /resources/,file:files/
datasource:
hikari:
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
jdbc-url: jdbc:log4jdbc:mariadb://211.119.124.9:4407/fims?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Seoul&useSSL=false&autocommit=false
username: fimsweb
password: fimsweb!@
auto-commit: false
datasource2:
hikari:
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
jdbc-url: jdbc:log4jdbc:mariadb://211.119.124.9:4407/dummysys?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Seoul&useSSL=false&autocommit=false

@ -1,51 +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="cokr.xit.backup.dao.BackupMapper">
<select id="selectAllList" parameterType="map">
<choose>
<when test="backupTable != null">
SELECT *
FROM ${backupTable}
WHERE ${pkName} NOT IN (
SELECT ${pkName}
FROM ${originalTable}
)
</when>
<otherwise>
SELECT *
FROM ${originalTable}
</otherwise>
</choose>
ORDER BY ${pkName}
</select>
<insert id="insertOriginalData" parameterType="cokr.xit.backup.Backup">
INSERT
INTO ${originalTable}
SELECT *
FROM ${backupTable}
WHERE ${pkName} IN (<foreach collection="pks" item="pk" separator=",">#{pk}</foreach>)
</insert>
<delete id="deleteBackupData" parameterType="cokr.xit.backup.Backup">
DELETE
FROM ${backupTable}
WHERE ${pkName} IN (<foreach collection="pks" item="pk" separator=",">#{pk}</foreach>)
</delete>
<insert id="insertBackupData" parameterType="cokr.xit.backup.Backup">
INSERT
INTO ${backupTable}
SELECT *
FROM ${originalTable}
WHERE ${pkName} IN (<foreach collection="pks" item="pk" separator=",">#{pk}</foreach>)
</insert>
<delete id="deleteOriginalData" parameterType="cokr.xit.backup.Backup">
DELETE
FROM ${originalTable}
WHERE ${pkName} IN (<foreach collection="pks" item="pk" separator=",">#{pk}</foreach>)
</delete>
</mapper>

@ -1,230 +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="cokr.xit.base.code.dao.CodeMapper">
<resultMap id="categoryRow" type="cokr.xit.base.code.CodeCategory">
<result property="id" column="CTGR_ID"/>
<result property="name" column="CTGR_NM"/>
<result property="description" column="DSCRP"/>
<result property="createdAt" column="REG_DT"/>
<result property="createdBy" column="RGTR"/>
<result property="lastModified" column="MDFCN_DT"/>
<result property="modifiedBy" column="MDFR"/>
<result property="useYN" column="USE_YN"/>
</resultMap>
<resultMap id="groupRow" type="cokr.xit.base.code.CodeGroup">
<result property="id" column="GRP_ID"/>
<result property="name" column="GRP_NM"/>
<result property="categoryID" column="CTGR_ID"/>
<result property="description" column="DSCRP"/>
<result property="createdAt" column="REG_DT"/>
<result property="createdBy" column="RGTR"/>
<result property="lastModified" column="MDFCN_DT"/>
<result property="modifiedBy" column="MDFR"/>
<result property="useYN" column="USE_YN"/>
</resultMap>
<resultMap id="codeRow" type="cokr.xit.base.code.CommonCode">
<result property="groupID" column="GRP_ID"/>
<result property="code" column="CODE"/>
<result property="value" column="CODE_VAL"/>
<result property="description" column="DSCRP"/>
<result property="etc1" column="ETC_1"/>
<result property="etc2" column="ETC_2"/>
<result property="etc3" column="ETC_3"/>
<result property="sortOrder" column="SRT_ORD"/>
<result property="createdAt" column="REG_DT"/>
<result property="createdBy" column="RGTR"/>
<result property="lastModified" column="MDFCN_DT"/>
<result property="modifiedBy" column="MDFR"/>
<result property="useYN" column="USE_YN"/>
</resultMap>
<sql id="selectCategories"><include refid="utility.paging-prefix" />
SELECT *
FROM TB_CODE_CTGR
WHERE USE_YN = 'Y'
<if test="categoryIDs != null"> AND CTGR_ID IN (<foreach collection="categoryIDs" item="categoryID" separator=",">#{categoryID}</foreach>)</if>
<include refid="utility.orderBy" />
<include refid="utility.paging-suffix" /></sql>
<select id="getCategoryList" parameterType="map" resultType="dataobject">/* 코드 카테고리 목록 조회(codeMapper.getCategoryList) */
<include refid="selectCategories" /></select>
<select id="getCategories" parameterType="map" resultMap="categoryRow">/*코드 카테고리 가져오기(codeMapper.getCategories)*/
<include refid="selectCategories" /></select>
<insert id="insertCategory" parameterType="map">/* 코드 카테고리 등록(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}
,<include refid="utility.now" />
, #{currentUser.id}
,<include refid="utility.now" />
, #{currentUser.id}
, 'Y'
)</insert>
<update id="updateCategory" parameterType="map">/* 코드 카테고리 수정(codeMapper.updateCategory) */
UPDATE TB_CODE_CTGR SET
CTGR_NM = #{category.name}
, DSCRP = #{category.description}
, MDFCN_DT =<include refid="utility.now" />
, MDFR = #{currentUser.id}
WHERE CTGR_ID = #{category.id}</update>
<delete id="removeCategories" parameterType="map">/* 코드 카테고리 제거(codeMapper.removeCategories) */
UPDATE TB_CODE_CTGR SET
MDFCN_DT =<include refid="utility.now" />
, MDFR = #{currentUser.id}
, USE_YN = 'N'
<if test='categoryIDs != null'>WHERE CTGR_ID IN (<foreach collection="categoryIDs" item="categoryID" separator=",">#{categoryID}</foreach>)</if></delete>
<sql id="selectGroups"><include refid="utility.paging-prefix" />
SELECT *
FROM TB_CODE_GRP
WHERE USE_YN = 'Y'
<if test="categoryIDs != null">AND CTGR_ID IN (<foreach collection="categoryIDs" item="categoryID" separator=",">#{categoryID}</foreach>)</if>
<if test="groupIDs != null">AND GRP_ID IN (<foreach collection="groupIDs" item="groupID" separator=",">#{groupID}</foreach>)</if>
<include refid="utility.orderBy" />
<include refid="utility.paging-suffix" /></sql>
<select id="getGroupList" parameterType="dataobject" resultType="dataobject">/* 코드그룹 목록 조회(codeMapper.getGroupList) */
<include refid="selectGroups" /></select>
<select id="getGroups" parameterType="map" resultMap="groupRow">/* 코드그룹 가져오기(codeMapper.getGroups) */
<include refid="selectGroups" /></select>
<insert id="insertGroup" parameterType="map">/* 코드그룹 등록(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}
,<include refid="utility.now" />
, #{currentUser.id}
,<include refid="utility.now" />
, #{currentUser.id}
, 'Y'
)</insert>
<update id="updateGroup" parameterType="map">/* 코드그룹 수정(codeMapper.updateGroup) */
UPDATE TB_CODE_GRP SET
GRP_NM = #{group.name}
, CTGR_ID = #{group.categoryID}
, DSCRP = #{group.description}
, MDFCN_DT =<include refid="utility.now" />
, MDFR = #{currentUser.id}
WHERE GRP_ID = #{group.id}</update>
<update id="removeGroups" parameterType="map">/*코드그룹 제거(codeMapper.removeGroups) */
UPDATE TB_CODE_GRP SET
USE_YN = 'N'
, MDFCN_DT =<include refid="utility.now" />
, MDFR = #{currentUser.id}
<where>
<if test="categoryIDs != null">CTGR_ID IN (<foreach collection="categoryIDs" item="categoryID" separator=",">#{categoryID}</foreach>)</if>
<if test="groupIDs != null">GRP_ID IN (<foreach collection="groupIDs" item="groupID" separator=",">#{groupID}</foreach>)</if>
</where></update>
<sql id="selectCodes"><include refid="utility.paging-prefix" />
SELECT *
FROM TB_CMN_CODE
WHERE USE_YN = 'Y'
<if test='groupIDs != null'>AND GRP_ID IN (<foreach collection="groupIDs" item="groupID" separator=",">#{groupID}</foreach>)</if>
<if test='codes != null'>AND CODE IN (<foreach collection="codes" item="code" separator=",">#{code}</foreach>)</if>
<include refid="utility.orderBy" />
<include refid="utility.paging-suffix" /></sql>
<select id="getCodeList" parameterType="map" resultType="dataobject">/* 그룹별 코드 가져오기(codeMapper.getCodeList) */
<include refid="selectCodes" /></select>
<select id="getCodes" parameterType="map" resultMap="codeRow">/* 코드 가져오기(codeMapper.getCodes) */
<include refid="selectCodes" /></select>
<insert id="insertCode" parameterType="map">/* 코드 등록(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}
,<include refid="utility.now" />
, #{currentUser.id}
,<include refid="utility.now" />
, #{currentUser.id}
, 'Y'
)</insert>
<update id="updateCode" parameterType="map">/* 코드 수정(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 =<include refid="utility.now" />
, MDFR = #{currentUser.id}
WHERE GRP_ID = #{code.groupID}
AND CODE = #{code.code}</update>
<update id="reorderCodes" parameterType="map">/* 코드 정렬순서 변경(codeMapper.reorderCodes) */
UPDATE TB_CMN_CODE SET
SRT_ORD = CASE CODE<foreach collection="codes" item="code" index="index" separator=" ">
WHEN #{code} THEN #{index}</foreach>
ELSE SRT_ORD
END
, MDFCN_DT =<include refid="utility.now" />
, MDFR = #{currentUser.id}
WHERE GRP_ID = #{groupID}
AND CODE IN (<foreach collection="codes" item="code" separator=",">#{code}</foreach>)</update>
<update id="removeCodes" parameterType="map">/* 코드 제거(codeMapper.removeCodes) */
UPDATE TB_CMN_CODE SET
MDFCN_DT =<include refid="utility.now" />
, MDFR = #{currentUser.id}
, USE_YN = 'N'
<where>
<if test="groupIDs != null">AND GRP_ID IN (<foreach collection="groupIDs" item="groupID" separator=",">#{groupID}</foreach>)</if>
<if test="codes != null">AND CODE IN (<foreach collection="codes" item="code" separator=",">#{code}</foreach>) </if>
</where></update>
</mapper>

@ -2,77 +2,6 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cokr.xit.copyStng.dao.CopyStngMapper">
<insert id="copyTask" parameterType="map">
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}
</insert>
<select id="selectVltnList" parameterType="map" resultType="string">
SELECT A.VLTN_CD
FROM TB_VLTN A
WHERE A.SGG_CD = #{srcSgg}
AND A.TASK_SE_CD = #{taskSeCd}
</select>
<insert id="copyVltn" parameterType="map">
<selectKey resultType="string" keyProperty="vltnId" keyColumn="NEW_ID" order="BEFORE">
SELECT
LPAD(CAST(IFNULL(MAX(VLTN_ID) + 1, 1) AS INT), 10, '0')
AS NEW_ID
FROM TB_VLTN
</selectKey>
INSERT
INTO TB_VLTN
SELECT (CASE B.VLTN_CD
<foreach collection="vltnCds" item="vltnCd" index="index" separator=" ">
WHEN #{vltnCd} THEN LPAD(CAST(${vltnId}+${index} AS INT), 10, '0')
</foreach>
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 (<foreach collection="vltnCds" item="vltnCd" separator=",">#{vltnCd}</foreach>)
</insert>
</mapper>

@ -13,12 +13,7 @@
<button type="button" id="btnForCivil" class="btn btn-primary disabled">신고자 모의 테스트</button>
<button type="button" id="btnForSinmungoAdmin" class="btn btn-primary">신문고 담당자 모의 테스트</button>
</div>
<div class="container-xxl container-p-y ms-1">
<h5>시군구</h5>
<button type="button" id="btnForSgg" class="btn btn-primary">시군구 추가/삭제</button>
<button type="button" id="btnForCopySggStng" class="btn btn-primary">시군구 설정 복사</button>
</div>
</div>
</div>
</div>
@ -57,45 +52,7 @@
});
$("#btnForSgg").on("click", function(){
$.ajax({
type : "GET",
ContentType : "text/html;charset=UTF-8",
url : "/sggAddDelMain.do",
data: {},
success: (resp) => {
console.log(resp);
dialog.open({
id: "sggAddDelDialog",
title: "시군구 추가,삭제",
content: resp ,
size: "fullscreen",
init:() => {}
});
}
});
});
$("#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(){

@ -1,64 +0,0 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<form id="frmEdit--${pageName}">
<div class="d-flex flex-row justify-content-evenly">
<div class="card" style="width:1000px;min-height:200px;">
<div class="row">
<div class="col-4">
<label class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">업무</label>
<select id="taskSeCd--${pageName}" name="taskSeCd" class="form-select">
<c:forEach items="${taskSeCdList}" var="item">
<option value="${item.CODE}">${item.CODE_VAL}</option>
</c:forEach>
</select>
</div>
<div class="col-4">
<label class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">소스 시군구</label>
<select id="srcSgg--${pageName}" name="srcSgg" class="form-select">
<c:forEach items="${sggList}" var="item">
<option value="${item.SGG_CD}">${item.SGG_NM}</option>
</c:forEach>
</select>
</div>
<div class="col-4">
<label class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">타겟 시군구</label>
<select id="trgtSgg--${pageName}" name="trgtSgg" class="form-select">
<c:forEach items="${sggList}" var="item">
<option value="${item.SGG_CD}">${item.SGG_NM}</option>
</c:forEach>
</select>
</div>
<div class="col-12">
<span class="float-end p-4">
<button type="button" id="btnCopyStng--${pageName}" class="btn btn-primary">업무,위반 설정 복사</button>
</span>
</div>
</div>
</div>
</div>
</form>
<script>
$("#btnCopyStng--${pageName}").on("click", function(){
if($("#srcSgg--${pageName}").val() == $("#trgtSgg--${pageName}").val()){
alert("동일한 시군구 선택 불가");
return;
}
ajax.get({
url : wctx.url("copyStng/copy.do"),
data : {
taskSeCd : $("#taskSeCd--${pageName}").val(),
srcSgg : $("#srcSgg--${pageName}").val(),
trgtSgg : $("#trgtSgg--${pageName}").val()
},
success : (resp) => {
if(resp.saved){
alert('완료');
}
}
});
});
</script>

@ -1,190 +0,0 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<form id="frmEdit--${pageName}">
<div class="d-flex flex-row justify-content-evenly">
<div class="card" style="width:500px;">
<h3>시군구 백업</h3>
<div class="card-datatable text-nowrap">
<div id="backupSgg-DataTables_Table_0_wrapper--${pageName}" class="dataTables_wrapper dt-bootstrap5 no-footer">
<div id="backupSgg-table-responsive--${pageName}" class="table-responsive"
style="overflow-x: scroll;height:500px;overflow-y: scroll;">
<table id="backupSgg-DataTables_Table_0--${pageName}"
class="table-layout-fixed datatables-ajax table table-bordered dataTable no-footer">
<thead class="sticky-thead">
<tr data-key="{SGG_CD}">
<th style="width: 50px;"></th>
<th style="width: 140px;" >시군구코드</th>
<th style="width: 300px;" >시군구명</th>
<th class="cmn dummy-th"></th>
</tr>
</thead>
<tbody id="backupSggTbody--${pageName}">
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="card" style="width:100px;">
<div style="display: flex;flex-direction: column;justify-content: space-evenly;height: 100%;">
<button type="button" id="btnAdd--${pageName}">추가 &gt;&gt;</button>
<button type="button" id="btnDel--${pageName}">&lt;&lt; 삭제</button>
</div>
</div>
<div class="card" style="width:500px;">
<h3>시군구</h3>
<div class="card-datatable text-nowrap">
<div id="originalSgg-DataTables_Table_0_wrapper--${pageName}" class="dataTables_wrapper dt-bootstrap5 no-footer">
<div id="originalSgg-table-responsive--${pageName}" class="table-responsive"
style="overflow-x: scroll;height:500px;overflow-y: scroll;">
<table id="originalSgg-DataTables_Table_0--${pageName}"
class="table-layout-fixed datatables-ajax table table-bordered dataTable no-footer">
<thead class="sticky-thead">
<tr data-key="{SGG_CD}">
<th style="width: 50px;"></th>
<th style="width: 140px;" >시군구코드</th>
<th style="width: 300px;" >시군구명</th>
<th class="cmn dummy-th"></th>
</tr>
</thead>
<tbody id="originalSggTbody--${pageName}">
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</form>
<template id="sggRow--${pageName}">
<tr data-key="{SGG_CD}">
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center cmn">
<input type="checkbox" value="{SGG_CD}" />
</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center cmn">{SGG_CD}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center cmn">{SGG_NM}</td>
<td class="dummy-td cmn"></td>
</tr>
</template>
<template id="sggNotFound--${pageName}">
<tr>
<td valign="top" colspan="14" class="dataTables_empty text-center">
정보를 찾지 못했습니다.
</td>
</tr>
</template>
<script>
var originalDataset = new Dataset({
keymapper : info => info ? info.SGG_CD : ""
});
var backupDataset = new Dataset({
keymapper : info => info ? info.SGG_CD : ""
});
function fnRenderBackupAndOriginal(list,tbodyId,dataset){
$("#"+tbodyId).html("");
if(list != null && list.length > 0){
dataset.setData(list);
} else {
dataset.setData([]);
}
var empty = dataset.empty;
var notFound = [document.getElementById("sggNotFound--${pageName}").innerHTML];
var found = document.getElementById("sggRow--${pageName}").innerHTML;
var replacer = (str, dataItem) => str.replace(/{onclick}/gi, "");
var trs = empty ? notFound : dataset.inStrings(found, replacer);
$("#"+tbodyId).html(trs.join());
}
function getBackupAndOriginalDataList(){
ajax.get({
url : wctx.url("backup/list.do"),
data : {
originalTable : "TB_SGG",
backupTable : "TB_SGG_ORG",
pkName : "SGG_CD"
},
success : (resp) => {
fnRenderBackupAndOriginal(resp.originalDataList,"originalSggTbody--${pageName}", originalDataset);
fnRenderBackupAndOriginal(resp.backupDataList,"backupSggTbody--${pageName}", backupDataset);
}
});
}
$("#btnAdd--${pageName}").on("click", function(){
var checked = $("#backupSggTbody--${pageName}").find("input[type='checkbox']:checked");
if(checked.length < 1){
return;
}
var arr = [];
checked.each(function(){
arr.push(this.value);
});
ajax.post({
url : wctx.url("backup/activate.do"),
data : {
originalTable : "TB_SGG",
backupTable : "TB_SGG_ORG",
pkName : "SGG_CD",
pks : arr.join(",")
},
success : (resp) => {
if(resp.saved){
getBackupAndOriginalDataList();
}
}
});
});
$("#btnDel--${pageName}").on("click", function(){
var checked = $("#originalSggTbody--${pageName}").find("input[type='checkbox']:checked");
if(checked.length < 1){
return;
}
var arr = [];
checked.each(function(){
arr.push(this.value);
});
ajax.post({
url : wctx.url("backup/deactivate.do"),
data : {
originalTable : "TB_SGG",
backupTable : "TB_SGG_ORG",
pkName : "SGG_CD",
pks : arr.join(",")
},
success : (resp) => {
if(resp.saved){
getBackupAndOriginalDataList();
}
}
});
});
$(document).ready(function(){
getBackupAndOriginalDataList();
});
</script>
Loading…
Cancel
Save