공지사항 조회 수정

main
이범준 2 months ago
parent 448123aa56
commit 08b5d7f7b6

@ -54,8 +54,6 @@ public class Mngt01Controller extends ApplicationController {
mav.setViewName("fims/mngt/mngt01010-main"); mav.setViewName("fims/mngt/mngt01010-main");
mav.addObject("pageName", "mngt01010"); mav.addObject("pageName", "mngt01010");
List<DataObject> allSggList = sggDeptService.getSigunguList(new SigunguQuery());
mav.addObject("sggList", allSggList);
FimsUser currentUser = (FimsUser) currentUser().getUser(); FimsUser currentUser = (FimsUser) currentUser().getUser();
if(currentUser.getCntnSeCd().equals("01")) { if(currentUser.getCntnSeCd().equals("01")) {
@ -64,6 +62,38 @@ public class Mngt01Controller extends ApplicationController {
mav.addObject("isPublicOfficer", false); mav.addObject("isPublicOfficer", false);
} }
List<DataObject> sggList = null;
if(currentUser.getCntnSeCd().equals("01")){
sggList = sggDeptService.getSigunguList(new SigunguQuery());
if(!currentUser.getOrgID().equals("ADMIN")) {
String upSggCd = "";
List<DataObject> curSggInfo = sggDeptService.getSigunguList(new SigunguQuery().setSggIDs(currentUser.getOrgID()));
if(curSggInfo != null && !curSggInfo.isEmpty()) {
upSggCd = curSggInfo.get(0).string("UP_SGG_CD");
}
final String UP_SGG_CD = upSggCd.equals("") ? "" : upSggCd;
sggList = sggList.stream().filter((item) -> {
if(item.string("SGG_CD").equals(currentUser.getOrgID())) {
return true;
}
if(item.string("UP_SGG_CD").equals(currentUser.getOrgID())) {
return true;
}
if(!UP_SGG_CD.equals("")) {
if(item.string("SGG_CD").equals(UP_SGG_CD)) {
return true;
}
}
return false;
}).toList();
}
}
mav.addObject("sggList", sggList);
return mav; return mav;
} }
@ -103,7 +133,7 @@ public class Mngt01Controller extends ApplicationController {
* @return jsonView * @return jsonView
*/ */
@RequestMapping(name="공지사항 상세 조회", value=METHOD_URL.getNtcInfo) @RequestMapping(name="공지사항 상세 조회", value=METHOD_URL.getNtcInfo)
public ModelAndView getNtcInfo(String ntcId) { public ModelAndView getNtcInfo(String ntcId, String cntnSeCd) {
boolean json = jsonResponse(); boolean json = jsonResponse();
ModelAndView mav = new ModelAndView(json ? "jsonView" : "fims/mngt/mngt01020-info"); ModelAndView mav = new ModelAndView(json ? "jsonView" : "fims/mngt/mngt01020-info");
mav.addObject("pageName", "mngt01020"); mav.addObject("pageName", "mngt01020");
@ -122,8 +152,42 @@ public class Mngt01Controller extends ApplicationController {
mav.addObject("isPublicOfficer", false); mav.addObject("isPublicOfficer", false);
} }
List<DataObject> allSggList = sggDeptService.getSigunguList(new SigunguQuery()); List<DataObject> allSggList = sggDeptService.getSigunguList(new SigunguQuery());
mav.addObject("sggList", allSggList); mav.addObject("allSggList", allSggList);
List<DataObject> selectableSggList = null;
if(currentUser.getCntnSeCd().equals("01")) {
selectableSggList = sggDeptService.getSigunguList(new SigunguQuery());
if(!currentUser.getOrgID().equals("ADMIN")) {
String upSggCd = "";
List<DataObject> curSggInfo = sggDeptService.getSigunguList(new SigunguQuery().setSggIDs(currentUser.getOrgID()));
if(curSggInfo != null && !curSggInfo.isEmpty()) {
upSggCd = curSggInfo.get(0).string("UP_SGG_CD");
}
mav.addObject("upSggCd", upSggCd);
final String UP_SGG_CD = upSggCd.equals("") ? "" : upSggCd;
selectableSggList = selectableSggList.stream().filter((item) -> {
if(item.string("SGG_CD").equals(currentUser.getOrgID())) {
return true;
}
if(item.string("UP_SGG_CD").equals(currentUser.getOrgID())) {
return true;
}
if(!UP_SGG_CD.equals("")) {
if(item.string("SGG_CD").equals(UP_SGG_CD)) {
return true;
}
}
return false;
}).toList();
}
}
mav.addObject("selectableSggList", toJson(selectableSggList));
mav.addObject("cntnSeCd", cntnSeCd);
return mav; return mav;
} }

@ -25,7 +25,8 @@
<result property="modifiedBy" column="MDFR" /> <!-- 수정자 --> <result property="modifiedBy" column="MDFR" /> <!-- 수정자 -->
</resultMap> </resultMap>
<sql id="select">SELECT SGG_CD <!-- 시군구 코드 --> <sql id="select">
SELECT SGG_CD <!-- 시군구 코드 -->
, SGG_NM <!-- 시군구 이름 --> , SGG_NM <!-- 시군구 이름 -->
, INST_CD <!-- 기관 코드 --> , INST_CD <!-- 기관 코드 -->
, INST_SE_CD <!-- 기관 구분 --> , INST_SE_CD <!-- 기관 구분 -->
@ -35,27 +36,38 @@
, INST_ZIP <!-- 기관 우편번호 --> , INST_ZIP <!-- 기관 우편번호 -->
, OFFCS_FILE_PATH <!-- 직인 파일 경로 --> , OFFCS_FILE_PATH <!-- 직인 파일 경로 -->
, OFFCS_FILE_NM <!-- 직인 파일 명 --> , OFFCS_FILE_NM <!-- 직인 파일 명 -->
, UP_SGG_CD <!-- 상위 시군구코드 -->
, USE_YN <!-- 사용 여부 --> , USE_YN <!-- 사용 여부 -->
, REG_DT <!-- 등록 일시 --> , REG_DT <!-- 등록 일시 -->
, RGTR <!-- 등록자 --> , RGTR <!-- 등록자 -->
, MDFCN_DT <!-- 수정 일시 --> , MDFCN_DT <!-- 수정 일시 -->
, MDFR <!-- 수정자 --> , MDFR <!-- 수정자 -->
FROM TB_SGG</sql> FROM TB_SGG
</sql>
<select id="selectSigunguList" parameterType="map" resultType="dataobject">/* 시군구 목록 조회(sigunguMapper.selectSigunguList) */ <select id="selectSigunguList" parameterType="map" resultType="dataobject">
/* 시군구 목록 조회(sigunguMapper.selectSigunguList) */
<include refid="utility.paging-prefix" /> <include refid="utility.paging-prefix" />
<include refid="select" /> <include refid="select" />
<where> <where>
<if test="@org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(by) and @org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(term)"> <if test="@org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(by) and @org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(term)">
AND ${by} LIKE CONCAT('%', #{term}, '%') AND ${by} LIKE CONCAT('%', #{term}, '%')
</if> </if>
<if test="sggIDs != null"> AND SGG_CD IN (<foreach collection="sggIDs" item="sggID" separator=",">#{sggID}</foreach>)</if> <if test="sggIDs != null">
<if test="instCodes != null"> AND INST_CD IN (<foreach collection="instCodes" item="instCode" separator=",">#{instCode}</foreach>)</if> AND SGG_CD IN (<foreach collection="sggIDs" item="sggID" separator=",">#{sggID}</foreach>)
<if test="!includeAll">AND USE_YN = 'Y'</if></where> </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.orderBy" />
<include refid="utility.paging-suffix" /></select> <include refid="utility.paging-suffix" /></select>
<select id="selectSigungus" parameterType="map" resultMap="sggRow">/* 시군구 객체 가져오기(sigunguMapper.selectSigungus) */ <select id="selectSigungus" parameterType="map" resultMap="sggRow">
/* 시군구 객체 가져오기(sigunguMapper.selectSigungus) */
<include refid="select" /> <include refid="select" />
<where> <where>
<if test="@org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(by) and @org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(term)"> <if test="@org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(by) and @org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(term)">
@ -66,7 +78,8 @@
<if test="!includeAll"> AND USE_YN = 'Y'</if></where> <if test="!includeAll"> AND USE_YN = 'Y'</if></where>
</select> </select>
<insert id="insert" parameterType="cokr.xit.base.user.Sigungu">/* 시군구 등록(sigunguMapper.insert) */ <insert id="insert" parameterType="cokr.xit.base.user.Sigungu">
/* 시군구 등록(sigunguMapper.insert) */
INSERT INTO TB_SGG ( INSERT INTO TB_SGG (
SGG_CD <!-- 시군구 코드 --> SGG_CD <!-- 시군구 코드 -->
, SGG_NM <!-- 시군구 이름 --> , SGG_NM <!-- 시군구 이름 -->
@ -99,9 +112,11 @@ INSERT INTO TB_SGG (
, #{createdBy} <!-- 등록자 --> , #{createdBy} <!-- 등록자 -->
, #{lastModified} <!-- 수정 일시 --> , #{lastModified} <!-- 수정 일시 -->
, #{modifiedBy} <!-- 수정자 --> , #{modifiedBy} <!-- 수정자 -->
)</insert> )
</insert>
<update id="update" parameterType="cokr.xit.base.user.Sigungu">/* 시군구 수정(sigunguMapper.update) */ <update id="update" parameterType="cokr.xit.base.user.Sigungu">
/* 시군구 수정(sigunguMapper.update) */
UPDATE TB_SGG UPDATE TB_SGG
SET INST_CD = #{instCode} <!-- 기관 코드 --> SET INST_CD = #{instCode} <!-- 기관 코드 -->
, INST_SE_CD = #{instType} <!-- 기관 구분 --> , INST_SE_CD = #{instType} <!-- 기관 구분 -->
@ -115,13 +130,16 @@ UPDATE TB_SGG
, USE_YN = #{useYN} <!-- 사용 여부 --> , USE_YN = #{useYN} <!-- 사용 여부 -->
, MDFCN_DT = #{lastModified} <!-- 수정 일시 --> , MDFCN_DT = #{lastModified} <!-- 수정 일시 -->
, MDFR = #{modifiedBy} <!-- 수정자 --> , MDFR = #{modifiedBy} <!-- 수정자 -->
WHERE SGG_CD = #{sggID}</update> WHERE SGG_CD = #{sggID}
</update>
<update id="delete" parameterType="map">/* 시군구 삭제(sigunguMapper.delete) */ <update id="delete" parameterType="map">
/* 시군구 삭제(sigunguMapper.delete) */
UPDATE TB_SGG UPDATE TB_SGG
SET USE_YN = 'N' SET USE_YN = 'N'
, MDFCN_DT =<include refid="utility.now" /> , MDFCN_DT =<include refid="utility.now" />
, MDFR = #{currentUser.id} , MDFR = #{currentUser.id}
WHERE SGG_CD IN (<foreach collection="sggIDs" item="sggID" separator=",">#{sggID}</foreach>)</update> WHERE SGG_CD IN (<foreach collection="sggIDs" item="sggID" separator=",">#{sggID}</foreach>)
</update>
</mapper> </mapper>
Loading…
Cancel
Save