no message
parent
ec3919bd3b
commit
fbc005c29e
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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>
|
|
@ -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}">추가 >></button>
|
|
||||||
<button type="button" id="btnDel--${pageName}"><< 삭제</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…
Reference in New Issue