부서 삭제 기능 추가

main
이범준 9 months ago
parent bc2f7b84d9
commit 936170b69d

@ -176,24 +176,25 @@ public interface FactionMapper extends AbstractMapper {
return dept != null && updateDept(params().set("dept", dept)) == 1;
}
/** .
/** .
* @param params
* <ul><li>"dept" - </li>
* <ul><li>"deptCds" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int deleteDept(Map<String, ?> params);
int setStatus(Map<String, ?> params);
/** .
* @param dept
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
/** .
* @param deptCds
* @return
*/
default boolean delete(FineIntegrationDepartment dept) {
return dept != null && deleteDept(params().set("dept", dept)) == 1;
default int setStatus(String useYn, String... deptCds) {
DataObject params = params();
params.set("useYn", useYn);
params.set("deptCds", deptCds);
int effected = setStatus(params);
return effected;
}
}

@ -51,11 +51,11 @@ public interface FactionService {
boolean update(FineIntegrationDepartment dept);
/** .
* @param dept
* @param deptCds
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
boolean remove(FineIntegrationDepartment dept);
boolean remove(String... deptCds);
}

@ -125,13 +125,13 @@ public class FactionBean extends AbstractComponent {
}
/** .
* @param dept
* @param deptCds
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean remove(FineIntegrationDepartment dept) {
return factionMapper.delete(dept);
public boolean remove(String... deptCds) {
return factionMapper.setStatus("N", deptCds) > 0 ? true : false;
}
}

@ -56,7 +56,7 @@ public class FactionServiceBean extends AbstractServiceBean implements FactionSe
}
@Override
public boolean remove(FineIntegrationDepartment dept) {
return factionBean.remove(dept);
public boolean remove(String... deptCds) {
return factionBean.remove(deptCds);
}
}

@ -26,6 +26,7 @@ public class Mngt04Controller extends ApplicationController {
deptMngtMain = "/010/main.do"
, getDeptList = "/010/list.do"
, getDeptInfo = "/020/info.do"
, removeDept = "/010/remove.do"
;
}
@ -87,4 +88,20 @@ public class Mngt04Controller extends ApplicationController {
mav.addObject("deptInfo", json ? deptInfo : toJson(deptInfo));
return mav;
}
/** .
* @param deptCds
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
public ModelAndView removeDept(String... deptCds) {
ModelAndView mav = new ModelAndView("jsonView");
boolean saved = factionService.remove(deptCds);
mav.addObject("saved", saved);
return mav;
}
}

@ -661,6 +661,11 @@ public class CmnController {
return super.getDeptInfo(query);
}
@Override
@RequestMapping(name="부서 삭제", value=METHOD_URL.removeDept)
public ModelAndView removeDept(String... deptCds) {
return super.removeDept(deptCds);
}
}
@Controller

@ -155,8 +155,6 @@ UPDATE TB_SGG
</update>
<resultMap id="deptRow" type="cokr.xit.fims.mngt.FineIntegrationDepartment"> <!-- 부서 정보 -->
<result property="deptCd" column="DEPT_CD" /> <!-- 부서 코드 -->
<result property="sggCd" column="SGG_CD" /> <!-- 시군구 코드 -->
@ -213,6 +211,7 @@ UPDATE TB_SGG
, D.DOC_HEADER <!-- 문서 머릿말 -->
, D.SRVR_OS <!-- 서버 OS -->
, D.USE_YN <!-- 사용 여부 -->
, GET_CODE_NM('CMN003', D.USE_YN) AS USE_YN_NM <!-- 사용 여부 명 -->
, D.REG_DT <!-- 등록 일시 -->
, D.RGTR <!-- 등록자 -->
, D.MDFCN_DT <!-- 수정 일시 -->
@ -220,7 +219,8 @@ UPDATE TB_SGG
FROM TB_DEPT D
</sql>
<select id="selectDeptList" parameterType="map" resultType="dataobject">/* 부서 목록 조회(factionMapper.selectDeptList) */
<select id="selectDeptList" parameterType="map" resultType="dataobject">
/* 부서 목록 조회(factionMapper.selectDeptList) */
<include refid="utility.paging-prefix" />
<include refid="selectDept" />
WHERE D.SGG_CD = #{sggCd} <!-- 시군구 코드 -->
@ -237,7 +237,8 @@ UPDATE TB_SGG
<include refid="utility.paging-suffix" />
</select>
<select id="selectDepts" parameterType="map" resultType="dataobject">/* 부서 객체 가져오기(factionMapper.selectDepts) */
<select id="selectDepts" parameterType="map" resultType="dataobject">
/* 부서 객체 가져오기(factionMapper.selectDepts) */
<include refid="selectDept" />
<where>
<if test="sggCd != null">
@ -256,7 +257,8 @@ UPDATE TB_SGG
<include refid="utility.orderBy" />
</select>
<insert id="insertDept" parameterType="map">/* 부서 등록(factionMapper.insertDept) */
<insert id="insertDept" parameterType="map">
/* 부서 등록(factionMapper.insertDept) */
INSERT
INTO TB_DEPT (
DEPT_CD <!-- 부서 코드 -->
@ -317,7 +319,8 @@ UPDATE TB_SGG
)
</insert>
<update id="updateDept" parameterType="map">/* 부서 수정(factionMapper.updateDept) */
<update id="updateDept" parameterType="map">
/* 부서 수정(factionMapper.updateDept) */
UPDATE TB_DEPT
SET SGG_CD = #{dept.sggCd} <!-- 시군구 코드 -->
, INST_CD = #{dept.instCd} <!-- 기관 코드 -->
@ -346,13 +349,13 @@ UPDATE TB_SGG
AND USE_YN = 'Y'
</update>
<update id="deleteDept" parameterType="map">/* 부서 삭제(factionMapper.deleteDept) */
<update id="setStatus" parameterType="map">
/* 부서 사용 여부 변경(factionMapper.setStatus) */
UPDATE TB_DEPT
SET USE_YN = 'N' <!-- 사용 여부 -->
SET USE_YN = #{useYn} <!-- 사용 여부 -->
, MDFCN_DT = <include refid="utility.now" /> <!-- 수정 일시 -->
, MDFR = #{currentUser.id} <!-- 수정자 -->
WHERE DEPT_CD = #{dept.deptCd} <!-- 부서 코드 -->
AND USE_YN = 'Y'
WHERE DEPT_CD IN ( <foreach collection="deptCds" item="deptCd" separator=","> #{deptCd} </foreach> )<!-- 부서 코드 -->
</update>

@ -548,12 +548,12 @@ $(document).ready(function(){
url : $P.crdnControl.urls.remove,
data : params,
success : (resp) => {
$P.removeCallback(selected, resp);
$P.removeCallback(resp);
}
});
}
$P.removeCallback = (selected, resp) => {
$P.removeCallback = (resp) => {
if (resp.saved){
$P.toast.show();
sleep(1000).then(() => $P.refreshCrdnList());

@ -95,6 +95,7 @@
<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>
@ -113,6 +114,7 @@
<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 onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{USE_YN_NM}</td>
<td class="dummy-td"></td>
</tr>
</template>
@ -128,6 +130,13 @@
</div>
</div>
<div class="toast-container position-fixed bottom-0 end-0 p-3">
<div id="divToast--${pageName}" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-body bg-black text-white">
삭제 되었습니다.
</div>
</div>
</div>
</div>
</div>
@ -148,6 +157,12 @@ $(document).ready(function(){
var $P = pageObject["${pageName}"];
$P.toast = new bootstrap.Toast(document.getElementById('divToast--${pageName}'), {
animation: true,
autohide: true,
delay: 2000
});
/**************************************************************************
* DatasetControl
**************************************************************************/
@ -156,7 +171,8 @@ $(document).ready(function(){
keymapper : info => info ? info.DEPT_CD : "",
urls : {
load : wctx.url("/mngt/mngt04/010/list.do"),
getInfo : wctx.url("/mngt/mngt04/020/info.do")
getInfo : wctx.url("/mngt/mngt04/020/info.do"),
remove : wctx.url("/mngt/mngt04/010/remove.do")
},
formats: {
REG_DT : datetimeFormat,
@ -300,11 +316,29 @@ $(document).ready(function(){
}
$P.removeDept = () => {
//$P.deptControl.dataset.getKeys("selected");
var selected = $P.deptControl.dataset.getKeys("selected");
if (selected.length < 1) {
return;
}
var params = {
"deptCds" : selected.join(",")
};
ajax.post({
url : $P.deptControl.urls.remove,
data : params,
success : (resp) => {
$P.removeCallback(resp);
}
});
}
$P.removeCallback = (resp) => {
//
if (resp.saved){
$P.toast.show();
sleep(1000).then(() => $P.refreshDeptList());
}
}
/**************************************************************************

Loading…
Cancel
Save