기관/부서관리 추가

dev
mjkhan21 5 months ago
parent 696110cab2
commit 9aae97becb

@ -1,29 +1,12 @@
package cokr.xit.adds;
import java.util.List;
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.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import cokr.xit.foundation.data.DataObject;
import cokr.xit.foundation.web.AbstractController;
import cokr.xit.foundation.web.RequestHandlerReader;
@Controller
public class MainController extends AbstractController {
@Autowired
private RequestMappingHandlerMapping requestHandlers;
@GetMapping(name="로그인", value="/login.do")
public String loginPage() {
return "login";
}
public class MainController extends cokr.xit.base.web.MainController {
@Override
@GetMapping(name="홈", value={"/", "/index.do"})
public ModelAndView mainPage() {
ModelAndView mav = dashboard();
@ -35,12 +18,4 @@ public class MainController extends AbstractController {
public ModelAndView dashboard() {
return new ModelAndView("dashboard");
}
@RequestMapping(name="기능 URL 선택", value="/urls.do")
public ModelAndView getURLs(boolean multiple) {
List<DataObject> urls = new RequestHandlerReader().read(requestHandlers);
return new ModelAndView("select-url")
.addObject("multiple", multiple)
.addObject("urls", toJson(urls));
}
}

@ -0,0 +1,10 @@
package cokr.xit.base;
import org.springframework.stereotype.Controller;
import cokr.xit.base.user.Department;
import cokr.xit.base.user.Sigungu;
import cokr.xit.base.user.web.SigunguDepartmentController;
@Controller
public class SggDeptController extends SigunguDepartmentController<Sigungu, Department> {}

@ -0,0 +1,111 @@
<?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.user.dao.DepartmentMapper">
<!-- 부서 정보 정보 매퍼
========== 변경 이력 ==========
2023-10-06 mjkhan 최초 작성
============================ -->
<resultMap id="deptRow" type="cokr.xit.base.user.Department"> <!-- 부서 정보 -->
<result property="deptID" column="DEPT_CD" /> <!-- 부서 코드 -->
<result property="sggID" column="SGG_CD" /> <!-- 시군구 코드 -->
<result property="instCode" column="INST_CD" /> <!-- 기관 코드 -->
<result property="name" column="DEPT_NM" /> <!-- 부서 명 -->
<result property="telno" column="DEPT_TELNO" /> <!-- 부서 전화번호 -->
<result property="faxno" column="DEPT_FXNO" /> <!-- 부서 팩스번호 -->
<result property="useYN" column="USE_YN" /> <!-- 사용 여부 -->
<result property="createdAt" column="REG_DT" /> <!-- 등록 일시 -->
<result property="createdBy" column="RGTR" /> <!-- 등록자 -->
<result property="lastModified" column="MDFCN_DT" /> <!-- 수정 일시 -->
<result property="modifiedBy" column="MDFR" /> <!-- 수정자 -->
</resultMap>
<sql id="select">SELECT DEPT_CD <!-- 부서 코드 -->
, SGG_CD <!-- 시군구 코드 -->
, INST_CD <!-- 기관 코드 -->
, DEPT_NM <!-- 부서 명 -->
, DEPT_TELNO <!-- 부서 전화번호 -->
, DEPT_FXNO <!-- 부서 팩스번호 -->
, USE_YN <!-- 사용 여부 -->
, REG_DT <!-- 등록 일시 -->
, RGTR <!-- 등록자 -->
, MDFCN_DT <!-- 수정 일시 -->
, MDFR <!-- 수정자 -->
FROM TB_DEPT</sql>
<select id="selectDepartmentList" parameterType="map" resultType="dataobject">/* 부서 정보 목록 조회(departmentMapper.selectDepartmentList) */
<include refid="utility.paging-prefix" />
<include refid="select" />
<where><if test="by != null and term != null"> AND ${by} LIKE CONCAT('%', #{term}, '%')</if>
<if test="sggID != null"> AND SGG_CD = #{sggID}</if>
<if test="instCode != null"> AND INST_CD = #{instCode}</if>
<if test="deptIDs != null"> AND DEPT_CD IN (<foreach collection="deptIDs" item="deptID" separator=",">#{deptID}</foreach>)</if>
<if test="!includeAll"> AND USE_YN = 'Y'</if>
</where>
<include refid="utility.orderBy" />
<include refid="utility.paging-suffix" /></select>
<select id="selectDepartments" parameterType="map" resultMap="deptRow">/* 부서 정보 객체 가져오기(departmentMapper.selectDepartments) */
<include refid="select" />
WHERE SGG_CD = #{sggID}
<if test="deptIDs != null">AND DEPT_CD IN (<foreach collection="deptIDs" item="deptID" separator=",">#{deptID}</foreach>)</if>
<include refid="utility.orderBy" /></select>
<sql id="sggDepts">SELECT A.SGG_CD, SGG_NM, A.INST_CD, INST_NM, DEPT_CD, DEPT_NM
FROM TB_SGG A, TB_DEPT B
WHERE A.USE_YN = 'Y'
AND B.USE_YN = 'Y'
AND A.SGG_CD = B.SGG_CD
AND A.INST_CD = B.INST_CD</sql>
<select id="selectSggDepts" resultType="dataobject"><include refid="sggDepts" />
ORDER BY A.SGG_CD, A.INST_CD, DEPT_CD</select>
<insert id="insert" parameterType="cokr.xit.base.user.Department">/* 부서 정보 등록(departmentMapper.insert) */
INSERT INTO TB_DEPT (
DEPT_CD <!-- 부서 코드 -->
, SGG_CD <!-- 시군구 코드 -->
, INST_CD <!-- 기관 코드 -->
, DEPT_NM <!-- 부서 명 -->
, DEPT_TELNO <!-- 부서 전화번호 -->
, DEPT_FXNO <!-- 부서 팩스번호 -->
, USE_YN <!-- 사용 여부 -->
, REG_DT <!-- 등록 일시 -->
, RGTR <!-- 등록자 -->
, MDFCN_DT <!-- 수정 일시 -->
, MDFR <!-- 수정자 -->
) VALUES (
#{deptID} <!-- 부서 코드 -->
, #{sggID} <!-- 시군구 코드 -->
, #{instCode} <!-- 기관 코드 -->
, #{name} <!-- 부서 명 -->
, #{telno} <!-- 부서 전화번호 -->
, #{faxno} <!-- 부서 팩스번호 -->
, #{useYN} <!-- 사용 여부 -->
, #{createdAt} <!-- 등록 일시 -->
, #{createdBy} <!-- 등록자 -->
, #{lastModified} <!-- 수정 일시 -->
, #{modifiedBy} <!-- 수정자 -->
)</insert>
<update id="update" parameterType="cokr.xit.base.user.Department">/* 부서 정보 수정(departmentMapper.update) */
UPDATE TB_DEPT
SET SGG_CD = #{sggID} <!-- 시군구 코드 -->
, INST_CD = #{instCode} <!-- 기관 코드 -->
, DEPT_NM = #{name} <!-- 부서 명 -->
, DEPT_TELNO = #{telno} <!-- 부서 전화번호 -->
, DEPT_FXNO = #{faxno} <!-- 부서 팩스번호 -->
, MDFCN_DT = #{lastModified} <!-- 수정 일시 -->
, MDFR = #{modifiedBy} <!-- 수정자 -->
WHERE DEPT_CD = #{deptID}</update>
<update id="delete" parameterType="map">/* 부서 정보 삭제(departmentMapper.deleteDepartment) */
UPDATE TB_DEPT
SET USE_YN = 'N'
, MDFCN_DT =<include refid="utility.now" />
, MDFR = #{currentUser.id}
<where><if test="sggIDs != null"> AND SGG_CD IN (<foreach collection="sggIDs" item="sggID" separator=",">#{sggID}</foreach>)</if>
<if test="deptIDs != null"> AND DEPT_CD IN (<foreach collection="deptIDs" item="deptID" separator=",">#{deptID}</foreach>)</if></where></update>
</mapper>

@ -0,0 +1,121 @@
<?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.user.dao.SigunguMapper">
<!-- 시군구 정보 매퍼
========== 변경 이력 ==========
2023-10-06 mjkhan 최초 작성
============================ -->
<resultMap id="sggRow" type="cokr.xit.base.user.Sigungu"> <!-- 시군구 -->
<result property="sggID" column="SGG_CD" /> <!-- 시군구 코드 -->
<result property="sggName" column="SGG_NM" /> <!-- 시군구 이름 -->
<result property="instCode" column="INST_CD" /> <!-- 기관 코드 -->
<result property="instType" column="INST_SE_CD" /> <!-- 기관 구분 -->
<result property="instName" column="INST_NM" /> <!-- 기관 명 -->
<result property="instAddress" column="INST_ADDR" /> <!-- 기관 주소 -->
<result property="instDetailAddress" column="INST_DADDR" /> <!-- 기관 상세주소 -->
<result property="instZipCode" column="INST_ZIP" /> <!-- 기관 우편번호 -->
<result property="officialSealFilepath" column="OFFCS_FILE_PATH" /> <!-- 직인 파일 경로 -->
<result property="officialSealFilename" column="OFFCS_FILE_NM" /> <!-- 직인 파일 명 -->
<result property="useYN" column="USE_YN" /> <!-- 사용 여부 -->
<result property="createdAt" column="REG_DT" /> <!-- 등록 일시 -->
<result property="createdBy" column="RGTR" /> <!-- 등록자 -->
<result property="lastModified" column="MDFCN_DT" /> <!-- 수정 일시 -->
<result property="modifiedBy" column="MDFR" /> <!-- 수정자 -->
</resultMap>
<sql id="select">SELECT SGG_CD <!-- 시군구 코드 -->
, SGG_NM <!-- 시군구 이름 -->
, INST_CD <!-- 기관 코드 -->
, INST_SE_CD <!-- 기관 구분 -->
, INST_NM <!-- 기관 명 -->
, INST_ADDR <!-- 기관 주소 -->
, INST_DADDR <!-- 기관 상세주소 -->
, INST_ZIP <!-- 기관 우편번호 -->
, OFFCS_FILE_PATH <!-- 직인 파일 경로 -->
, OFFCS_FILE_NM <!-- 직인 파일 명 -->
, USE_YN <!-- 사용 여부 -->
, REG_DT <!-- 등록 일시 -->
, RGTR <!-- 등록자 -->
, MDFCN_DT <!-- 수정 일시 -->
, MDFR <!-- 수정자 -->
FROM TB_SGG</sql>
<select id="selectSigunguList" parameterType="map" resultType="dataobject">/* 시군구 목록 조회(sigunguMapper.selectSigunguList) */
<include refid="utility.paging-prefix" />
<include refid="select" />
<where><if test="by != null and term != null"> AND ${by} LIKE CONCAT('%', #{term}, '%')</if>
<if test="sggIDs != null"> AND SGG_CD IN (<foreach collection="sggIDs" item="sggID" separator=",">#{sggID}</foreach>)</if>
<if test="instCodes != null"> AND INST_CD IN (<foreach collection="instCodes" item="instCode" separator=",">#{instCode}</foreach>)</if>
<if test="!includeAll">AND USE_YN = 'Y'</if></where>
<include refid="utility.orderBy" />
<include refid="utility.paging-suffix" /></select>
<select id="selectSigungus" parameterType="map" resultMap="sggRow">/* 시군구 객체 가져오기(sigunguMapper.selectSigungus) */
<include refid="select" />
<where><if test="by != null and term != null"> AND ${by} LIKE CONCAT('%', #{term}, '%')</if>
<if test="sggIDs != null">AND SGG_CD IN (<foreach collection="sggIDs" item="sggID" separator=",">#{sggID}</foreach>)</if>
<if test="instCodes != null">AND INST_CD IN (<foreach collection="instCodes" item="instCode" separator=",">#{instCode}</foreach>)</if>
<if test="!includeAll"> AND USE_YN = 'Y'</if></where>
</select>
<insert id="insert" parameterType="cokr.xit.base.user.Sigungu">/* 시군구 등록(sigunguMapper.insert) */
INSERT INTO TB_SGG (
SGG_CD <!-- 시군구 코드 -->
, SGG_NM <!-- 시군구 이름 -->
, INST_CD <!-- 기관 코드 -->
, INST_SE_CD <!-- 기관 구분 -->
, INST_NM <!-- 기관 명 -->
, INST_ADDR <!-- 기관 주소 -->
, INST_DADDR <!-- 기관 상세주소 -->
, INST_ZIP <!-- 기관 우편번호 -->
, OFFCS_FILE_PATH <!-- 직인 파일 경로 -->
, OFFCS_FILE_NM <!-- 직인 파일 명 -->
, USE_YN <!-- 사용 여부 -->
, REG_DT <!-- 등록 일시 -->
, RGTR <!-- 등록자 -->
, MDFCN_DT <!-- 수정 일시 -->
, MDFR <!-- 수정자 -->
) VALUES (
#{sggID} <!-- 시군구 코드 -->
, #{sggName} <!-- 시군구 이름 -->
, #{instCode} <!-- 기관 코드 -->
, #{instType} <!-- 기관 구분 -->
, #{instName} <!-- 기관 명 -->
, #{instAddress} <!-- 기관 주소 -->
, #{instDetailAddress} <!-- 기관 상세주소 -->
, #{instZipCode} <!-- 기관 우편번호 -->
, #{officialSealFilepath} <!-- 직인 파일 경로 -->
, #{officialSealFilename} <!-- 직인 파일 명 -->
, #{useYN} <!-- 사용 여부 -->
, #{createdAt} <!-- 등록 일시 -->
, #{createdBy} <!-- 등록자 -->
, #{lastModified} <!-- 수정 일시 -->
, #{modifiedBy} <!-- 수정자 -->
)</insert>
<update id="update" parameterType="cokr.xit.base.user.Sigungu">/* 시군구 수정(sigunguMapper.update) */
UPDATE TB_SGG
SET INST_CD = #{instCode} <!-- 기관 코드 -->
, INST_SE_CD = #{instType} <!-- 기관 구분 -->
, SGG_NM = #{sggName} <!-- 시군구 이름 -->
, INST_NM = #{instName} <!-- 기관 명 -->
, INST_ADDR = #{instAddress} <!-- 기관 주소 -->
, INST_DADDR = #{instDetailAddress} <!-- 기관 상세주소 -->
, INST_ZIP = #{instZipCode} <!-- 기관 우편번호 -->
, OFFCS_FILE_PATH = #{officialSealFilepath} <!-- 직인 파일 경로 -->
, OFFCS_FILE_NM = #{officialSealFilename} <!-- 직인 파일 명 -->
, USE_YN = #{useYN} <!-- 사용 여부 -->
, MDFCN_DT = #{lastModified} <!-- 수정 일시 -->
, MDFR = #{modifiedBy} <!-- 수정자 -->
WHERE SGG_CD = #{sggID}</update>
<update id="delete" parameterType="map">/* 시군구 삭제(sigunguMapper.delete) */
UPDATE TB_SGG
SET USE_YN = 'N'
, MDFCN_DT =<include refid="utility.now" />
, MDFR = #{currentUser.id}
WHERE SGG_CD IN (<foreach collection="sggIDs" item="sggID" separator=",">#{sggID}</foreach>)</update>
</mapper>

@ -0,0 +1,101 @@
<%@ 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="dept-form">
<div class="row g-3">
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end" for="deptID">부서코드</label>
<div class="col-sm-9">
<input name="deptID" type="text" required data-map="DEPT_CD" maxlength="7" class="form-control" placeholder="부서코드" />
<input name="sggID" type="hidden" data-map="SGG_CD" />
<input name="instCode" type="hidden" data-map="INST_CD" />
</div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end" for="name">부서이름</label>
<div class="col-sm-9">
<input name="name" type="text" required data-map="DEPT_NM" maxlength="100" class="form-control" placeholder="부서이름" />
</div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end" for="telno">전화번호</label>
<div class="col-sm-9">
<input name="telno" type="text" data-map="DEPT_TELNO" maxlength="20" class="form-control" placeholder="전화번호"/>
</div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end" for="faxno">팩스번호</label>
<div class="col-sm-9">
<input name="faxno" type="text" data-map="DEPT_FXNO" maxlength="20" class="form-control" placeholder="팩스번호"/>
</div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end" for="createdBy">등록자</label>
<div class="col-sm-9">
<input type="text" data-map="RGTR" readonly class="form-control" placeholder="등록자"/>
</div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end" for="description">등록일자</label>
<div class="col-sm-9">
<input type="text" data-map="REG_DT" readonly class="form-control" placeholder="등록일자"/>
</div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end" for="description">사용여부</label>
<div class="col-sm-9" style="padding:.5em .7em;">
<input name="useYN" type="hidden" data-map="USE_YN" />
<span id="deptInUse"></span>
</div>
</div>
</div>
<div class="row mt-4 justify-content-end">
<div class="col-sm-12" style="text-align:right;">
<button onclick="saveDept();" type="button" class="btn btn-primary">저장</button>
</div>
</div>
</form>
<script type="text/javascript">
var deptFields = new FormFields("#dept-form");
sggDeptControl.depts.setInfo = obj => {
let info = obj.data;
deptFields.set(sggDeptControl.depts, obj);
let create = isEmpty(info.DEPT_CD);
$("input[name='deptID']").prop("readonly", !create);
$("#dept-form input").onEnterPress(saveDept);
$("#deptInUse").html("Y" == info.USE_YN ? "사용 중" : "사용하지 않음");
document.querySelector("input[name='" + (create ? "deptID" : "name") + "']").focus();
}
sggDeptControl.depts.onModify = (changed) => {
if (["DEPT_NM"].filter(e => changed.includes(e)).length < 1)
return;
renderDeptList();
sggDeptControl.depts.dataset.setState();
}
function saveDept() {
if (!$("#dept-form input").validInputs()) return;
dialog.alert({
content:"현재 부서 정보를 저장하시겠습니까?",
onOK:() => sggDeptControl.depts.save(deptFields.get())
});
}
//# sourceURL=dept-info.jsp
</script>

@ -0,0 +1,57 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<!-- Page Body -->
<div id="DataTables_Table_0_wrapper" class="dataTables_wrapper dt-bootstrap5 no-footer">
<table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0">
<thead>
<tr><th class="sorting sorting_asc" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="2" aria-sort="ascending" style="">시군구</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="2" style="">기관</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="2" style="">부서</th>
</tr>
</thead>
<tbody id="sggDeptList">
</tbody>
<template id="sggDeptRow">
<tr data-key="{dataKey}">
<td onclick="sggDepts.setCurrent('{dataKey}')">{SGG_CD}</td>
<td onclick="sggDepts.setCurrent('{dataKey}')">{SGG_NM}</td>
<td onclick="sggDepts.setCurrent('{dataKey}')">{INST_CD}</td>
<td onclick="sggDepts.setCurrent('{dataKey}')">{INST_NM}</td>
<td onclick="sggDepts.setCurrent('{dataKey}')">{DEPT_CD}</td>
<td onclick="sggDepts.setCurrent('{dataKey}')">{DEPT_NM}</td>
</tr>
</template>
<template id="sggDeptNotFound">
<tr class="odd">
<td valign="top" colspan="4" class="dataTables_empty text-center">부서정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
</div>
<!--/ Page Body -->
<script >
var sggDepts = new Dataset({
keymapper: info => info.dataKey,
onDatasetChange: obj => {
let empty = sggDepts.empty;
let trs = empty ?
[document.getElementById("sggDeptNotFound").innerHTML] : <%-- from template#${infoPrefix}NotFound --%>
sggDepts.inStrings(document.getElementById("sggDeptRow").innerHTML); <%-- from template#${infoPrefix}Row --%>
$("#sggDeptList").html(trs.join());
},
onCurrentChange: item => {
if (!item) return;
let key = item.data.dataKey;
$("#sggDeptList").setCurrentRow(key);
}
});
function getSelectedDept() {
return sggDepts.getCurrent();
}
sggDepts.setData(${sggDepts});
//# sourceURL=select-sggDepts.jsp
</script>

@ -0,0 +1,245 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<c:set var="prefixName" scope="request">기관 정보</c:set>
<!-- Page Body -->
<div class="d-flex flex-column flex-grow-1">
<div id="DataTables_Table_0_wrapper" class="dataTables_wrapper dt-bootstrap5 no-footer">
<div class="d-flex flex-row justify-content-evenly">
<div style="width:49%;">
<h5 class="mt-3">${prefixName}</h5>
<div class="d-flex flex-row justify-content-between p-3">
<%--div>
<div class="input-group" id="DataTables_Table_0_length">
<select id="by" onchange="document.getElementById('term').focus();" aria-controls="DataTables_Table_0" class="form-select">
<option value="sggName">이름</option>
<option value="sggID">아이디</option>
</select>
<input id="term" autofocus type="text" placeholder="조회 조건을 입력하십시오." class="form-control">
</div>
</div--%>
<div>
<%--button onclick="searchSggs();" class="btn btn-primary">찾기</button--%>
<button onclick="sggDeptControl.newSgg();" class="btn btn-primary">+ 추가</button>
<button id="btnRemoveSggs" onclick="removeSggs();" class="btn btn-primary">- 제거</button>
</div>
</div>
<table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
<thead>
<tr><th tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" style="text-align:center;"><input onchange="sggDeptControl.sggs.select(this.checked);" type="checkbox" class="form-check-input"></th>
<th class="text-center sorting sorting_asc" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="2" aria-sort="ascending">시군구</th>
<th class="text-center sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="2">기관</th>
</tr>
</thead>
<tbody id="sggList">
</tbody>
<template id="sggRow">
<tr data-key="{SGG_CD}"{notUsed}>
<td style="text-align:center;"><input value="{SGG_CD}" onchange="sggDeptControl.sggs.select('{SGG_CD}', this.checked);" type="checkbox" class="form-check-input"></td>
<td onclick="sggDeptControl.sggs.setCurrent('{SGG_CD}')" ondblclick="sggDeptControl.sggs.getInfo({})">{SGG_CD}</td>
<td onclick="sggDeptControl.sggs.setCurrent('{SGG_CD}')" ondblclick="sggDeptControl.sggs.getInfo({})">{SGG_NM}</td>
<td onclick="sggDeptControl.sggs.setCurrent('{SGG_CD}')" ondblclick="sggDeptControl.sggs.getInfo({})">{INST_CD}</td>
<td onclick="sggDeptControl.sggs.setCurrent('{SGG_CD}')" ondblclick="sggDeptControl.sggs.getInfo({})">{INST_NM}</td>
</tr>
</template>
<template id="sggNotFound">
<tr class="odd">
<td valign="top" colspan="5" class="dataTables_empty text-center">${prefixName}를 찾지 못했습니다.</td>
</tr>
</template>
</table>
<div class="d-flex flex-row p-3 justify-content-between">
<label id="sggPagingInfo" class="dataTables_info" role="status" aria-live="polite"></label>
<ul id="sggPaging" class="pagination pagination-primary">
</ul>
</div>
</div>
<div style="width:49%;">
<h5 class="mt-3">부서 정보</h5>
<div class="d-flex flex-row justify-content-end p-3">
<div>
<button id="btnAddDept" onclick="sggDeptControl.newDept();" class="btn btn-primary">+ 추가</button>
<button id="btnRemoveDepts" onclick="removeDepts();" class="btn btn-primary">- 제거</button>
</div>
</div>
<table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
<thead>
<tr><th tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" style="text-align:center;"><input id="deptToggler" onchange="sggDeptControl.depts.select(this.checked);" type="checkbox" class="form-check-input"></th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1">부서코드</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1">부서이름</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1">전화번호</th>
</tr>
</thead>
<tbody id="deptList">
</tbody>
<template id="deptRow">
<tr data-key="{DEPT_CD}"{notUsed}>
<td style="text-align:center;"><input value="{DEPT_CD}" onchange="sggDeptControl.depts.select('{DEPT_CD}', this.checked);" type="checkbox" class="form-check-input"></td>
<td onclick="sggDeptControl.depts.setCurrent('{DEPT_CD}')" ondblclick="sggDeptControl.depts.getInfo({})">{DEPT_CD}</td>
<td onclick="sggDeptControl.depts.setCurrent('{DEPT_CD}')" ondblclick="sggDeptControl.depts.getInfo({})">{DEPT_NM}</td>
<td onclick="sggDeptControl.depts.setCurrent('{DEPT_CD}')" ondblclick="sggDeptControl.depts.getInfo({})">{DEPT_TELNO}</td>
</tr>
</template>
<template id="deptNotFound">
<tr class="odd">
<td valign="top" colspan="4" class="dataTables_empty text-center">부서 정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
<div class="d-flex flex-row p-3 justify-content-between">
<label id="deptPagingInfo" class="dataTables_info" role="status" aria-live="polite"></label>
<ul id="deptPaging" class="pagination pagination-primary">
</ul>
</div>
</div>
</div>
</div>
</div>
<!--/ Page Body -->
<script >
var sggDeptControl = new SggDeptControl();
sggDeptControl.sggs.query = {includeAll: true};
<%--
function searchSggs() {
sggDeptControl.sggs.query = {
by:$("#by").val(),
term:$("#term").val(),
includeAll: true
};
sggDeptControl.sggs.load(1);
}--%>
function removeSggs() {
dialog.alert({
content:"선택한 ${prefixName} 정보를 제거하시겠습니까?",
onOK:() => {
sggDeptControl.sggs.remove();
}
});
}
function removeDepts() {
dialog.alert({
content:"선택한 코드를 삭제하시겠습니까?",
onOK:() => {
sggDeptControl.depts.remove();
}
});
}
function renderSggList() {
let sggList = sggDeptControl.sggs.dataset;
let empty = sggList.empty;
let trs = empty ?
[document.getElementById("sggNotFound").innerHTML] : <%-- from template#sggNotFound --%>
sggList.inStrings(
document.getElementById("sggRow").innerHTML,
(tmpl, item) => tmpl.replace(/{notUsed}/gi, item.getValue("USE_YN") == "N" ? "class=\"not-used\"" : "")
); <%-- from template#sggRow --%>
$("#sggList").html(trs.join());
$("th input[type='checkbox']").prop("checked", false);
}
sggDeptControl.sggs.onDatasetChange = obj => {
renderSggList();
$("#sggPaging").setPaging({
list:sggDeptControl.sggs.dataset,
prefix:sggDeptControl.sggs.prefix,
start:obj.sggStart,
totalSize:obj.sggTotal,
fetchSize:obj.sggFetch,
func:"sggDeptControl.sggs.load({index})"
});
};
sggDeptControl.sggs.onCurrentChange = item => {
$("#btnAddDept").prop("disabled", !item);
if (!item) return;
let key = item.data.SGG_CD;
$("#sggList").setCurrentRow(key);
sggDeptControl.getDepts({includeAll: true});
};
sggDeptControl.sggs.onSelectionChange = selected => {
let sggList = sggDeptControl.sggs.dataset;
let keys = selected.map(e => sggList.getKey(e));
$("#sggList input[type='checkbox']").each(function() {
let checkbox = $(this);
checkbox.prop("checked", keys.includes(checkbox.val()));
});
$("#btnRemoveSggs").prop("disabled", keys.length < 1);
};
function renderDeptList() {
let deptList = sggDeptControl.depts.dataset;
let empty = deptList.empty;
let trs = empty ?
[document.getElementById("deptNotFound").innerHTML] : <%-- from template#sggNotFound --%>
deptList.inStrings(
document.getElementById("deptRow").innerHTML,
(tmpl, item) => tmpl.replace(/{notUsed}/gi, item.getValue("USE_YN") == "N" ? "class=\"not-used\"" : "")
); <%-- from template#sggRow --%>
$("#deptList").html(trs.join());
$("#deptToggler").prop("checked", false);
}
sggDeptControl.depts.onDatasetChange = obj => {
renderDeptList();
$("#deptPaging").setPaging({
list:sggDeptControl.depts.dataset,
prefix:sggDeptControl.depts.prefix,
start:obj ? obj.deptStart : -1,
totalSize:obj ? obj.deptTotal : 0,
fetchSize:obj ? obj.deptFetch : 10,
func:"sggDeptControl.depts.load({index})"
});
};
sggDeptControl.depts.onCurrentChange = item => {
if (!item) return;
let data = item.data;
let key = data.DEPT_CD;
$("#deptList").setCurrentRow(key);
};
sggDeptControl.depts.onSelectionChange = selected => {
let deptList = sggDeptControl.depts.dataset;
let keys = selected.map(e => deptList.getKey(e));
$("#deptList input[type='checkbox']").each(function() {
let checkbox = $(this);
checkbox.prop("checked", keys.includes(checkbox.val()));
});
let sgg = sggDeptControl.sggs.getCurrent();
sgg = sgg ? sgg.USE_YN : "N";
$("#btnAddDept").prop("disabled", "N" == sgg);
$("#btnRemoveDepts").prop("disabled", selected.length < 1);
};
$(function(){
${onload}
sggDeptControl.sggs.setData({
sggList:${sggList},
sggStart:${sggStart},
sggFetch:${sggFetch},
sggTotal:${sggTotal}
});
sggDeptControl.depts.setData({
deptList:${deptList},
deptStart:${deptStart},
deptFetch:${deptFetch},
deptTotal:${deptTotal}
});
<%-- $("#term").onEnterPress(searchSggs); --%>
});
//# sourceURL=sgg-dept.jsp
</script>

@ -0,0 +1,122 @@
<%@ 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="sgg-form">
<div class="row g-3">
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end">시군구</label>
<div class="col-sm-9">
<div class="row justify-content-between" style="padding: 0 .75rem;">
<input name="sggID" type="text" required data-map="SGG_CD" maxlength="5" class="form-control" style="width: 28%;" placeholder="시군구 코드" />
<input name="sggName" type="text" required data-map="SGG_NM" maxlength="60" class="form-control" style="width: 70%;" placeholder="시군구 이름" />
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end">기관</label>
<div class="col-sm-9">
<div class="row justify-content-between" style="padding: 0 .75rem;">
<select name="instType" data-map="INST_SE_CD" class="form-control" style="width: 24%;">
<option value="">구분</option>
<option value="01">시청</option>
<option value="02">구청</option>
<option value="03">군청</option>
<option value="04">도청</option>
<option value="05">출장소</option>
<option value="06">사무소</option>
</select>
<input name="instCode" type="text" data-map="INST_CD" maxlength="7" class="form-control" style="width: 25%;" placeholder="기관 코드"/>
<input name="instName" type="text" data-map="INST_NM" maxlength="100" class="form-control" style="width: 48%;" placeholder="기관 이름"/>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end">주소</label>
<div class="col-sm-9">
<div class="row justify-content-between" style="padding: 0 .75rem;">
<input name="instAddress" type="text" data-map="INST_ADDR" maxlength="200" class="form-control" placeholder="주소"/>
<input name="instDetailAddress" type="text" data-map="INST_DADDR" maxlength="200" class="form-control" style="margin: .5rem 0;" placeholder="상세주소"/>
<input name="instZipCode" type="text" data-map="INST_ZIP" maxlength="6" class="form-control" style="width: 32%;" placeholder="기관 우편번호"/>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end">직인 파일</label>
<div class="col-sm-9">
<div class="row justify-content-between" style="padding: 0 .75rem;">
<input name="officialSealFilepath" type="text" data-map="OFFCS_FILE_PATH" maxlength="200" class="form-control" placeholder="직인 파일경로"/>
<input name="officialSealFilename" type="text" data-map="OFFCS_FILE_NM" maxlength="100" class="form-control" style="margin: .5rem 0;" placeholder="직인 파일이름"/>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end" for="createdBy">등록자</label>
<div class="col-sm-9">
<input type="text" data-map="RGTR" readonly class="form-control" placeholder="등록자"/>
</div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end">등록일자</label>
<div class="col-sm-9">
<input type="text" data-map="REG_DT" readonly class="form-control" placeholder="등록일자"/>
</div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end">사용여부</label>
<div class="col-sm-9" style="padding:.5em .7em;">
<input name="useYN" type="hidden" data-map="USE_YN" />
<span id="sggInUse"></span>
</div>
</div>
</div>
<div class="row mt-4 justify-content-end">
<div class="col-sm-12" style="text-align:right;">
<button onclick="saveSgg();" type="button" class="btn btn-primary">저장</button>
</div>
</div>
</form>
<script type="text/javascript">
var sggFields = new FormFields("#sgg-form");
sggDeptControl.sggs.setInfo = obj => {
let info = obj.data;
sggFields.set(sggDeptControl.sggs, obj);
let create = isEmpty(info.SGG_CD);
$("input[name='sggID']").prop("readonly", !create);
$("#sgg-form input").onEnterPress(saveSgg);
$("#sggInUse").html(info.USE_YN == "Y" ? "사용 중" : "사용하지 않음");
document.querySelector("input[name='" + (create ? "sggID" : "sggName") + "']").focus();
}
sggDeptControl.sggs.onModify = (changed) => {
if (["SGG_NM"].filter(e => changed.includes(e)).length < 1)
return;
renderSggList();
sggDeptControl.sggs.dataset.setState();
}
function saveSgg() {
if (!$("#sgg-form input").validInputs()) return;
dialog.alert({
content:"현재 시군구 정보를 저장하시겠습니까?",
onOK:() => sggDeptControl.sggs.save(sggFields.get())
});
}
//# sourceURL=sgg-info.jsp
</script>

@ -1,5 +1,6 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<c:set var="admin">${currentUser.hasAuthorities("ROLE_ADMIN")}</c:set>
<form id="infoPrefix-form">
<div class="row g-3">
<div class="col-md-6">
@ -44,6 +45,26 @@
</div>
</div>
</div>
<div class="col-md-6">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end" for="institute">기관</label>
<div class="col-sm-9">
<select name="institute" data-map="NSTT_CD" class="form-control" onchange="setDepts(this.value);"<c:if test='${!admin}'> disabled</c:if>>
<option value="">기관 선택</option>
</select>
</div>
</div>
</div>
<div class="col-md-6">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end" for="deptCode">부서</label>
<div class="col-sm-9">
<select name="deptCode" data-map="DEPT_CD" class="form-control"<c:if test='${!admin}'> disabled</c:if>>
<option value="">부서 선택</option>
</select>
</div>
</div>
</div>
<div class="col-md-6">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end" for="birthday"
@ -151,6 +172,23 @@
</div>
</form>
<script type="text/javascript">
var sggDepts = new SggDeptControl();
sggDepts.sggs.onDatasetChange = obj => {
let tags = sggDepts.sggs.dataset.inStrings("<option value=\"{INST_CD}\">{INST_NM}</option>");
if (tags.length < 1)
tags.push("<option value=\"\">등록된 기관정보가 없습니다.</option>")
document.querySelector("#infoPrefix-form select[name='institute']").innerHTML += tags.join("");
};
sggDepts.depts.onDatasetChange = obj => {
let tags = ["<option value=\"\">부서 선택</option>"].concat(
sggDepts.depts.dataset.inStrings("<option value=\"{DEPT_CD}\">{DEPT_NM}</option>")
);
if (tags.length < 2)
tags.push("<option value=\"\">등록된 부서정보가 없습니다.</option>")
document.querySelector("#infoPrefix-form select[name='deptCode']").innerHTML = tags.join("");
};
sggDepts.sggs.setData({sggList: ${sggs}});
sggDepts.depts.setData({deptList: ${depts}});
var infoPrefixFields = new FormFields("#infoPrefix-form");
<c:if test="${!empty userInfo}">infoPrefixControl.setData([${userInfo}]);</c:if>
@ -164,7 +202,7 @@ infoPrefixControl.setInfo = obj => {
let password = $(this).prop("required", create);
let div = password.parent().parent().parent();
if (create) {
$("input[name='institute']").val("default");
$("#infoPrefix-form *[name='institute']").val("${institute}");
div.show();
} else
div.hide();
@ -225,5 +263,10 @@ async function initPassword() {
}
});
}
function setDepts(instCode) {
sggDepts.getDepts({instCode: instCode});
}
//# sourceURL=user-info.jsp
</script>

@ -28,6 +28,7 @@
<script src="<c:url value="/webjars/js/base/menu-support.js"/>"></script>
<script src="<c:url value="/webjars/js/base/actionGroup.js"/>"></script>
<script src="<c:url value="/webjars/js/base/user.js"/>"></script>
<script src="<c:url value="/webjars/js/base/sgg-dept.js?${ver}"/>"></script>
<script src="<c:url value="/webjars/js/base/authority.js"/>"></script>

@ -55,6 +55,12 @@
<div class="d-flex col-12 col-lg-5 col-xl-6 align-items-center mx-2 px-3 h-px-600" style="letter-spacing: -0.6px;">
<div class="w-px-400 mx-auto">
<div id="formAuthentication" class="mb-3">
<c:if test="${multipleSggs}"><div class="mb-3">
<label for="institute" class="form-label">기관</label>
<select id="institute" class="form-control">
</select>
</div></c:if>
<c:if test="${!multipleSggs}"><input id="institute" type="hidden" /></c:if>
<div class="mb-3">
<label for="userId" class="form-label">아이디</label>
<input id="userId" type="text" value="${cookie['userAccount'].getValue()}" required class="form-control" placeholder="아이디를 입력하십시오." autofocus />
@ -62,11 +68,6 @@
<div class="mb-3 form-password-toggle">
<div class="d-flex justify-content-between">
<label class="form-label" for="password">비밀번호</label>
<!-- 기능 미구현
<<a href="auth-forgot-password-cover.html" style="color: #35A354 !important;">
<small>비밀번호 찾기</small>
</a>
-->
</div>
<div class="input-group input-group-merge">
<input id="password" type="password" required class="form-control" placeholder="비밀번호를 입력하십시오." aria-describedby="password" />
@ -75,6 +76,11 @@
</div>
<button class="btn btn-label-primary02 d-grid w-100" style="letter-spacing: -0.6px;" onclick="login();">로그인</button>
<div class="mt-3 form-chcek">
<input id="remember" type="checkbox" class="form-check-input">
<label class="form-check-label">로그인 정보 유지</label>
</div>
</div>
</div>
@ -91,13 +97,24 @@
<!-- Main JS -->
<script>
${functions}
<c:if test="${multipleSggs}">let sggs = new Dataset({
keymapper: row => row.INST_CD,
onDatasetChange: obj => {
document.querySelector("#institute").innerHTML = sggs.inStrings("<option value=\"{INST_CD}\">{INST_NM}</option>");
}
});
sggs.setData(${sggs});</c:if>
<c:if test="${!multipleSggs}">document.querySelector("#institute").value = ${sggs}[0].INST_CD;</c:if>
function login() {
if (!$("#formAuthentication input").validInputs()) return;
var params = {
account:$("#userId").val(),
password:$("#password").val(),
institute:"4050000"
institute: $("#institute").val(),
rememberCredentials: $("#remember").prop("checked")
};
ajax.post({
url:wctx.url("/login.do"),
@ -122,6 +139,20 @@ $(function(){
$("#formAuthentication input").onEnterPress(login);
if ($("#userId").val())
$("#password").focus();
let input = document.querySelector("#institute"),
stored = "${cookie['userInstitute'].getValue()}";
if (stored)
input.value = stored;
input = document.querySelector("#userId");
input.value = "${cookie['userAccount'].getValue()}";
let remember = !isEmpty(input.value);
if (remember)
document.querySelector(!remember ? "#userId" : "#password").focus();
input = document.querySelector("#remember");
input.checked = remember;
});
</script>
</body>

Loading…
Cancel
Save