부서 목록 조회 추가

main
이범준 9 months ago
parent eb971bee60
commit 78f485b8b7

@ -7,6 +7,7 @@ import javax.annotation.Resource;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import cokr.xit.base.web.ApplicationController; import cokr.xit.base.web.ApplicationController;
import cokr.xit.fims.cmmn.CmmnQuery;
import cokr.xit.fims.mngt.dao.FactionMapper; import cokr.xit.fims.mngt.dao.FactionMapper;
import cokr.xit.fims.mngt.service.FactionService; import cokr.xit.fims.mngt.service.FactionService;
import cokr.xit.fims.mngt.service.bean.FactionBean; import cokr.xit.fims.mngt.service.bean.FactionBean;
@ -23,6 +24,8 @@ public class Mngt04Controller extends ApplicationController {
public class METHOD_URL { public class METHOD_URL {
public static final String public static final String
deptMngtMain = "/010/main.do" deptMngtMain = "/010/main.do"
, getDeptList = "/010/list.do"
, getDeptInfo = "/020/info.do"
; ;
} }
@ -52,4 +55,36 @@ public class Mngt04Controller extends ApplicationController {
return mav; return mav;
} }
/** .<br />
* {@link FactionService#getDeptList(CmmnQuery)}
* @param query
* @return jsonView
*/
public ModelAndView getDeptList(CmmnQuery query) {
setFetchSize(query);
return setCollectionInfo(new ModelAndView("jsonView"), factionService.getDeptList(query),"");
}
/** ID (info) .
* @param query
* @return fims/mngt/mngt04020-info jsonView
* <pre>{
* "deptInfo":
* }</pre>
*/
public ModelAndView getDeptInfo(CmmnQuery query) {
DataObject deptInfo = factionService.getDeptInfo(query);
boolean json = jsonResponse();
ModelAndView mav = new ModelAndView(json ? "jsonView" : "fims/mngt/mngt04020-info");
mav.addObject("pageName", "mngt04020");
mav.addObject("deptInfo", json ? deptInfo : toJson(deptInfo));
return mav;
}
} }

@ -649,6 +649,18 @@ public class CmnController {
return super.deptMngtMain(); return super.deptMngtMain();
} }
@Override
@RequestMapping(name="부서 목록 조회", value=METHOD_URL.getDeptList)
public ModelAndView getDeptList(CmmnQuery query) {
return super.getDeptList(query);
}
@Override
@RequestMapping(name="부서 상세 조회", value=METHOD_URL.getDeptInfo)
public ModelAndView getDeptInfo(CmmnQuery query) {
return super.getDeptInfo(query);
}
} }
@Controller @Controller

@ -190,7 +190,9 @@ UPDATE TB_SGG
<sql id="selectDept"> <sql id="selectDept">
SELECT D.DEPT_CD <!-- 부서 코드 --> SELECT D.DEPT_CD <!-- 부서 코드 -->
, D.SGG_CD <!-- 시군구 코드 --> , D.SGG_CD <!-- 시군구 코드 -->
, (SELECT SGG_NM FROM TB_SGG WHERE SGG_CD = D.SGG_CD) AS SGG_NM <!-- 시군구 명 -->
, D.INST_CD <!-- 기관 코드 --> , D.INST_CD <!-- 기관 코드 -->
, (SELECT INST_NM FROM TB_SGG WHERE INST_CD = D.INST_CD) AS INST_NM <!-- 기관 명 -->
, D.DEPT_NM <!-- 부서 명 --> , D.DEPT_NM <!-- 부서 명 -->
, D.DEPT_TELNO <!-- 부서 전화번호 --> , D.DEPT_TELNO <!-- 부서 전화번호 -->
, D.DEPT_FXNO <!-- 부서 팩스번호 --> , D.DEPT_FXNO <!-- 부서 팩스번호 -->
@ -238,7 +240,7 @@ UPDATE TB_SGG
<select id="selectDepts" parameterType="map" resultType="dataobject">/* 부서 객체 가져오기(factionMapper.selectDepts) */ <select id="selectDepts" parameterType="map" resultType="dataobject">/* 부서 객체 가져오기(factionMapper.selectDepts) */
<include refid="selectDept" /> <include refid="selectDept" />
<where> <where>
<if test="deptCd != null"> <if test="sggCd != null">
AND D.SGG_CD = #{sggCd} <!-- 시군구 코드 --> AND D.SGG_CD = #{sggCd} <!-- 시군구 코드 -->
</if> </if>
<if test="deptCd != null"> <if test="deptCd != null">

@ -1,4 +1,338 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> <%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<c:set var="pageKorName" scope="request">부서관리</c:set> <c:set var="pageKorName" scope="request">부서관리</c:set>
부서관리 메인 <div class="content-wrapper">
<div class="container-xxl flex-grow-1 px-0">
<div class="card wrapper-list">
<div class="container-page-btn">
<button type="button" id="btnReset--${pageName}" class="btn btn-outline-dark w-px-120" title="초기화">
초기화
</button>
<span class="container-window-btn-right">
<button type="button" id="btnSearch--${pageName}" class="btn btn-search w-px-120" title="검색">
검색
</button>
</span>
</div>
<form id="frmSearch--${pageName}" name="frmSearch">
<div class="container-search">
<div class="row g-1">
<div class="col-3">
<label class="form-label fw-bold form-search-title">시군구</label>
<select id="sggCd--${pageName}" name="sggCd" class="form-select" disabled>
<option value="">전체</option>
<c:forEach items="${sggList}" var="item">
<option value="${item.SGG_CD}">${item.SGG_NM}</option>
</c:forEach>
</select>
</div>
<div class="col-3">
<label class="form-label fw-bold form-search-title">기관명</label>
<input type="text" id="instNm--${pageName}" name="instNm" class="form-control" />
</div>
<div class="col-3">
<label class="form-label fw-bold form-search-title">기관코드</label>
<input type="text" id="instCd--${pageName}" name="instCd" class="form-control" maxlength="7" />
</div>
</div>
<div class="row g-1">
<div class="col-3">
<label class="form-label fw-bold form-search-title">부서명</label>
<input type="text" id="deptNm--${pageName}" name="deptNm" class="form-control" />
</div>
<div class="col-3">
<label class="form-label fw-bold form-search-title">부서코드</label>
<input type="text" id="deptCd--${pageName}" name="deptCd" class="form-control" maxlength="7" />
</div>
<div class="col-6">
</div>
</div>
</div>
</form>
<div>
<div id="gridbuttonArea--${pageName}" class="container-page-btn">
<div class="d-flex flex-row justify-content-between">
<label id="deptPaging--${pageName}PagingInfo" class="dataTables_info" role="status" aria-live="polite"></label>
<ul id="deptPaging--${pageName}" class="pagination pagination-primary">
</ul>
</div>
<span class="container-window-btn-right">
<span>
<button type="button" class="btn btn-primary w-px-120"
id="btnAdd--${pageName}" title="추가">
추가
</button>
<button type="button" class="btn btn-primary w-px-120"
id="btnDel--${pageName}" title="삭제">
삭제
</button>
</span>
</span>
</div>
</div>
<div class="card-datatable text-nowrap">
<div id="DataTables_Table_0_wrapper--${pageName}" class="dataTables_wrapper dt-bootstrap5 no-footer">
<div id="table-responsive--${pageName}" class="table-responsive"
style="overflow-x: scroll;height:500px;overflow-y: scroll;">
<table id="DataTables_Table_0--${pageName}"
class="table-layout-fixed datatables-ajax table table-bordered dataTable no-footer">
<thead class="sticky-thead">
<tr id="deptThead--${pageName}">
<th style="width: 80px;" class="cmn">No.</th>
<th class="cmn" style="width: 56px;">
<input type="checkbox" class="form-check-input"
onchange="pageObject['${pageName}'].deptControl.select(this.checked);" />
</th>
<th style="width: 200px;">시군구명</th>
<th style="width: 200px;">시군구코드</th>
<th style="width: 200px;">기관명</th>
<th style="width: 200px;">기관코드</th>
<th style="width: 200px;">부서명</th>
<th style="width: 200px;">부서코드</th>
<th class="dummy-th"></th>
</tr>
</thead>
<tbody id="deptTbody--${pageName}">
</tbody>
<template id="deptRow--${pageName}">
<tr data-key="{DEPT_CD}">
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-end">{ROW_NUM}</td>
<td class="text-center">
<input type="checkbox" class="form-check-input" value="{DEPT_CD}"
onchange="pageObject['${pageName}'].deptControl.select('{DEPT_CD}', this.checked);">
</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{SGG_NM}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{SGG_CD}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{INST_NM}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{INST_CD}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{DEPT_NM}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{DEPT_CD}</td>
<td class="dummy-td"></td>
</tr>
</template>
<template id="deptNotFound--${pageName}">
<tr>
<td valign="top" colspan="99" class="dataTables_empty text-center">
부서 정보를 찾지 못했습니다.
</td>
</tr>
</template>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="content-backdrop fade"></div>
</div>
<script>
/**************************************************************************
* Global Variable
**************************************************************************/
pageObject["${pageName}"] = {};
$(document).ready(function(){
var $P = pageObject["${pageName}"];
/**************************************************************************
* DatasetControl
**************************************************************************/
$P.deptControl = new DatasetControl({
urls : {
load : wctx.url("/mngt/mngt04/010/list.do"),
getInfo : wctx.url("/mngt/mngt04/020/info.do")
},
dataGetter : obj => obj["List"], appendData:true,
keymapper : info => info ? info.DEPT_CD : "",
formats: {
REG_DT : datetimeFormat,
MDFCN_DT : datetimeFormat
}
});
$P.deptControl.defaultFetchSize = FETCH_XS;
$P.deptControl.untilPageNum = 0;
$P.deptControl.beforeCurrent = null;
$P.deptControl.tableRenderComplete = false;
/**************************************************************************
* DatasetControl.on
**************************************************************************/
$P.deptControl.onDatasetChange = (obj) => {
$P.renderDeptList(obj["Total"]);
$("#deptPaging--${pageName}").setPagingInfo({
list: $P.deptControl.dataset,
prefix: "deptPaging--${pageName}",
start: obj["Start"],
totalSize: obj["Total"],
fetchSize: obj["Fetch"],
func: "pageObject['${pageName}'].deptControl.load({index})"
});
$P.deptControl.tableRenderComplete = true;
};
$P.deptControl.onCurrentChange = (item) => {
if(!$P.deptControl.tableRenderComplete){
return;
}
$P.deptControl.tableRenderComplete = false;
if(!item){
$P.clickDeptList("", true);
} else {
$P.clickDeptList($P.deptControl.getCurrent()["DEPT_CD"], true);
}
}
$P.deptControl.onSelectionChange = (selected) => {
var deptDS = $P.deptControl.dataset;
var keys = selected.map(e => deptDS.getKey(e));
$("#deptTbody--${pageName} input[type='checkbox']").each(function() {
var checkbox = $(this);
checkbox.prop("checked", keys.includes(checkbox.val()));
});
$("#btnDel--${pageName}").prop("disabled", keys.length < 1);
};
/**************************************************************************
* pageObject.function
**************************************************************************/
$P.fnReset = () => {
var searchForm = $("#frmSearch--${pageName}");
searchForm.find("input[type='radio']").not("[name='taskSeCd']").prop("checked", false);
searchForm.find("input[type='checkbox']").prop("checked", false);
searchForm.find("input[type='hidden']").val("");
searchForm.find("input[type='text']").val("");
searchForm.find("select[name='sggCd']").val(MY_INFO.info.sggCd);
$P.deptControl.setData([]);
}
$P.refreshDeptList = () => {
$P.deptControl.untilPageNum = $P.deptControl.query.pageNum;
$P.deptControl.query.fetchSize = $P.deptControl.defaultFetchSize * $P.deptControl.query.pageNum;
$P.deptControl.load(1);
}
$P.searchDeptList = () => {
$P.deptControl.query = $P.getParams();
$P.deptControl.load(1);
}
$P.scrollDeptList = () => {
$P.deptControl.load($P.deptControl.query.pageNum + 1);
}
$P.clickDeptList = (dataKey, auto) => {
if(dataKey == ""){
return;
}
$("#deptTbody--${pageName}").setCurrentRow(dataKey);
if(!auto){
$P.deptControl.setCurrent(dataKey);
}
}
$P.dblclickDeptList = (dataKey) => {
var params = {
deptCd : dataKey
};
ajax.get({
url : $P.deptControl.urls.getInfo,
data : params,
success : resp => {
dialog.open({
id : "deptInfoDialog",
title : "부서 정보", size : "xxl",
content : resp,
init : () => {}
});
}
});
}
$P.renderDeptList = (total) => {
var deptList = $P.deptControl.dataset;
var empty = deptList.empty;
var found = document.getElementById("deptRow--${pageName}").innerHTML;
var notFound = [document.getElementById("deptNotFound--${pageName}").innerHTML];
var replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickDeptList('" + dataItem.getValue("DEPT_CD") + "');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].dblclickDeptList('" + dataItem.getValue("DEPT_CD") + "');");
var trs = empty ? notFound : deptList.inStrings(found, replacer);
var noMore = (total == deptList.length);
var initScroll = ($P.deptControl.query.pageNum < 2) && ($P.deptControl.untilPageNum == 0);
$("#table-responsive--${pageName}")[0].changeContent(trs.join(), initScroll, noMore);
fn_securityModeToggle($("#securityMode--top").is(":checked")); //보안모드
if($P.deptControl.untilPageNum != 0){
$P.deptControl.query.fetchSize = $P.deptControl.defaultFetchSize;
$P.deptControl.query.pageNum = $P.deptControl.untilPageNum;
$P.deptControl.untilPageNum = 0;
}
}
$P.getParams = () => {
var formFields = new FimsFormFields("#frmSearch--${pageName}");
var data = formFields.get();
data.fetchSize = $P.deptControl.defaultFetchSize;
return data;
}
/**************************************************************************
* element.on
**************************************************************************/
$('#btnReset--${pageName}').on('click', () => $P.fnReset());
$('#btnSearch--${pageName}').on('click', () => $P.searchDeptList());
/**************************************************************************
* 초기화
**************************************************************************/
fnMakeResizableTable($("#table-responsive--${pageName}")[0]);
fnMakeScrollableTable($("#table-responsive--${pageName}")[0], $P.scrollDeptList);
$P.fnReset();
fn_securityModeToggle($("#securityMode--top").is(":checked")); //보안모드
if(MY_INFO.institute == "default"){
$("#sggCd--${pageName}").removeAttr("disabled");
}
});
</script>

@ -0,0 +1,3 @@
<%@ 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="pageKorName" scope="request">부서 정보</c:set>
Loading…
Cancel
Save