부서 삭제 기능 추가

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; return dept != null && updateDept(params().set("dept", dept)) == 1;
} }
/** . /** .
* @param params * @param params
* <ul><li>"dept" - </li> * <ul><li>"deptCds" - </li>
* <li>"currentUser" - </li> * <li>"currentUser" - </li>
* </ul> * </ul>
* @return * @return
*/ */
int deleteDept(Map<String, ?> params); int setStatus(Map<String, ?> params);
/** . /** .
* @param dept * @param deptCds
* @return * @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/ */
default boolean delete(FineIntegrationDepartment dept) { default int setStatus(String useYn, String... deptCds) {
return dept != null && deleteDept(params().set("dept", dept)) == 1; 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); boolean update(FineIntegrationDepartment dept);
/** . /** .
* @param dept * @param deptCds
* @return * @return
* <ul><li> true</li> * <ul><li> true</li>
* <li> false</li> * <li> false</li>
* </ul> * </ul>
*/ */
boolean remove(FineIntegrationDepartment dept); boolean remove(String... deptCds);
} }

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

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

@ -26,6 +26,7 @@ public class Mngt04Controller extends ApplicationController {
deptMngtMain = "/010/main.do" deptMngtMain = "/010/main.do"
, getDeptList = "/010/list.do" , getDeptList = "/010/list.do"
, getDeptInfo = "/020/info.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)); mav.addObject("deptInfo", json ? deptInfo : toJson(deptInfo));
return mav; 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); return super.getDeptInfo(query);
} }
@Override
@RequestMapping(name="부서 삭제", value=METHOD_URL.removeDept)
public ModelAndView removeDept(String... deptCds) {
return super.removeDept(deptCds);
}
} }
@Controller @Controller

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

@ -548,12 +548,12 @@ $(document).ready(function(){
url : $P.crdnControl.urls.remove, url : $P.crdnControl.urls.remove,
data : params, data : params,
success : (resp) => { success : (resp) => {
$P.removeCallback(selected, resp); $P.removeCallback(resp);
} }
}); });
} }
$P.removeCallback = (selected, resp) => { $P.removeCallback = (resp) => {
if (resp.saved){ if (resp.saved){
$P.toast.show(); $P.toast.show();
sleep(1000).then(() => $P.refreshCrdnList()); 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 style="width: 200px;">부서코드</th> <th style="width: 200px;">부서코드</th>
<th style="width: 200px;">사용여부</th>
<th class="dummy-th"></th> <th class="dummy-th"></th>
</tr> </tr>
</thead> </thead>
@ -113,6 +114,7 @@
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{INST_CD}</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-start">{DEPT_NM}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{DEPT_CD}</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> <td class="dummy-td"></td>
</tr> </tr>
</template> </template>
@ -128,6 +130,13 @@
</div> </div>
</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>
</div> </div>
@ -148,6 +157,12 @@ $(document).ready(function(){
var $P = pageObject["${pageName}"]; var $P = pageObject["${pageName}"];
$P.toast = new bootstrap.Toast(document.getElementById('divToast--${pageName}'), {
animation: true,
autohide: true,
delay: 2000
});
/************************************************************************** /**************************************************************************
* DatasetControl * DatasetControl
**************************************************************************/ **************************************************************************/
@ -156,7 +171,8 @@ $(document).ready(function(){
keymapper : info => info ? info.DEPT_CD : "", keymapper : info => info ? info.DEPT_CD : "",
urls : { urls : {
load : wctx.url("/mngt/mngt04/010/list.do"), 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: { formats: {
REG_DT : datetimeFormat, REG_DT : datetimeFormat,
@ -300,11 +316,29 @@ $(document).ready(function(){
} }
$P.removeDept = () => { $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) => { $P.removeCallback = (resp) => {
// if (resp.saved){
$P.toast.show();
sleep(1000).then(() => $P.refreshDeptList());
}
} }
/************************************************************************** /**************************************************************************

Loading…
Cancel
Save