공지사항 관련 소스 위치 변경

main
이범준 2 months ago
parent fe57e23e7a
commit 442bd11df5

@ -0,0 +1,43 @@
package cokr.xit.fims.mngt;
import cokr.xit.foundation.AbstractEntity;
import lombok.Getter;
import lombok.Setter;
/**
* @author leebj
*/
@Getter
@Setter
public class Ntc extends AbstractEntity {
/**
* ID
*/
private String ntcId;
/**
*
*/
private String ntcTtl;
/**
*
*/
private String ntcCn;
/**
*
*/
private String delYn;
/**
*
*/
private String delRsn;
/**
*
*/
private String sggCd;
}

@ -0,0 +1,19 @@
package cokr.xit.fims.mngt;
import cokr.xit.fims.cmmn.CmmnQuery;
/**
*
* <p> :
*
* <pre>
* ============ ============
* 2024-01-02 leebj
* ================================
* </pre>
*/
public class NtcQuery extends CmmnQuery {
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,91 @@
package cokr.xit.fims.mngt.dao;
import java.util.List;
import java.util.Map;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.fims.mngt.Ntc;
import cokr.xit.fims.mngt.NtcQuery;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
/** DAO
* @author leebj
*/
@Mapper("ntcMapper")
public interface NtcMapper extends AbstractMapper {
/** .<br />
* @param req
* @return
*/
List<DataObject> selectNtcList(NtcQuery req);
/** ID .
* @param ntcId ID
* @return
*/
DataObject selectNtcInfo(String ntcId);
/** .
* @param params
* <ul><li>"ntc" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int insertNtc(Map<String, Object> params);
/** .
* @param ntc
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean insert(Ntc ntc) {
return ntc != null && insertNtc(params().set("ntc", ntc)) == 1;
}
/** .
* @param params
* <ul><li>"ntc" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int updateNtc(Map<String, Object> params);
/** .
* @param ntc
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean update(Ntc ntc) {
return ntc != null && updateNtc(params().set("ntc", ntc)) == 1;
}
/** .
* @param params
* <ul><li>"ntc" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int deleteNtc(Map<String, ?> params);
/** .
* @param ntc
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean delete(Ntc ntc) {
return ntc != null && deleteNtc(params().set("ntc", ntc)) == 1;
}
}

@ -0,0 +1,50 @@
package cokr.xit.fims.mngt.service;
import java.util.List;
import cokr.xit.fims.mngt.Ntc;
import cokr.xit.fims.mngt.NtcQuery;
import cokr.xit.foundation.data.DataObject;
public interface NtcService {
/** .
* @param req
* @return
*/
List<DataObject> getNtcList(NtcQuery req);
/** ID .
* @param ntcId ID
* @return
*/
DataObject getNtcInfo(String ntcId);
/** .
* @param ntc
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
String create(Ntc ntc);
/** .
* @param ntc
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
String update(Ntc ntc);
/** .
* @param ntc
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
String remove(Ntc ntc);
}

@ -0,0 +1,73 @@
package cokr.xit.fims.mngt.service.bean;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import cokr.xit.fims.mngt.Ntc;
import cokr.xit.fims.mngt.NtcQuery;
import cokr.xit.fims.mngt.dao.NtcMapper;
import cokr.xit.foundation.component.AbstractBean;
import cokr.xit.foundation.data.DataObject;
/** Bean
* @author leebj
*/
@Component("ntcBean")
public class NtcBean extends AbstractBean {
@Resource(name="ntcMapper")
private NtcMapper ntcMapper;
/** .
* @param req
* @return
*/
public List<DataObject> getNtcList(NtcQuery req) {
return ntcMapper.selectNtcList(req);
}
/** ID .
* @param ntcId ID
* @return
*/
public DataObject getNtcInfo(String ntcId) {
return ntcMapper.selectNtcInfo(ntcId);
}
/** .
* @param ntc
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean create(Ntc ntc) {
return ntcMapper.insert(ntc);
}
/** .
* @param ntc
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean update(Ntc ntc) {
return ntcMapper.update(ntc);
}
/** .
* @param ntc
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean remove(Ntc ntc) {
return ntcMapper.delete(ntc);
}
}

@ -0,0 +1,46 @@
package cokr.xit.fims.mngt.service.bean;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import cokr.xit.fims.mngt.Ntc;
import cokr.xit.fims.mngt.NtcQuery;
import cokr.xit.fims.mngt.service.NtcService;
import cokr.xit.foundation.component.AbstractServiceBean;
import cokr.xit.foundation.data.DataObject;
@Service("ntcService")
public class NtcServiceBean extends AbstractServiceBean implements NtcService {
@Resource(name="ntcBean")
private NtcBean ntcBean;
@Override
public List<DataObject> getNtcList(NtcQuery req) {
return ntcBean.getNtcList(req);
}
@Override
public DataObject getNtcInfo(String ntcId) {
return ntcBean.getNtcInfo(ntcId);
}
@Override
public String create(Ntc ntc) {
return ntcBean.create(ntc) ? "[S]" : "[F]";
}
@Override
public String update(Ntc ntc) {
return ntcBean.update(ntc) ? "[S]" : "[F]";
}
@Override
public String remove(Ntc ntc) {
return ntcBean.remove(ntc) ? "[S]" : "[F]";
}
}

@ -0,0 +1,171 @@
package cokr.xit.fims.mngt.web;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import cokr.xit.base.user.SigunguQuery;
import cokr.xit.base.user.service.SigunguDepartmentService;
import cokr.xit.base.web.ApplicationController;
import cokr.xit.fims.base.FimsUser;
import cokr.xit.fims.mngt.Ntc;
import cokr.xit.fims.mngt.NtcQuery;
import cokr.xit.fims.mngt.service.NtcService;
import cokr.xit.foundation.data.DataObject;
/** .<br />
* { }/mngt/mngt01 .
* @author leebj
*/
@Controller
@RequestMapping(name="공지사항 관리", value=Mngt01Controller.CLASS_URL)
public class Mngt01Controller extends ApplicationController {
public static final String CLASS_URL = "/mngt/mngt01";
public class METHOD_URL {
public static final String
ntcMain = "/010/main.do",
getNtcList = "/010/list.do",
getNtcInfo = "/020/info.do",
create = "/020/create.do",
update = "/020/update.do",
remove = "/020/remove.do"
;
}
@Resource(name="ntcService")
private NtcService ntcService;
@Resource(name="sigunguDepartmentService")
private SigunguDepartmentService sggDeptService;
/** .
* @return fims/mngt/mngt01010-main
*/
@RequestMapping(name="공지사항 메인", value=METHOD_URL.ntcMain)
public ModelAndView ntcMain() {
ModelAndView mav = new ModelAndView();
mav.setViewName("fims/mngt/mngt01010-main");
mav.addObject("pageName", "mngt01010");
return mav;
}
/** .<br />
* {@link NtcService#getNtcList(NtcQuery)}
* @param req
* @return jsonView
* <pre><code> {
* "ntcList": [ ]
* "ntcStart":
* "ntcFetch":
* "ntcTotal":
* }</code></pre>
*/
@RequestMapping(name="공지사항 목록 조회", value=METHOD_URL.getNtcList)
public ModelAndView getNtcList(NtcQuery req) {
ModelAndView mav = new ModelAndView("jsonView");
setFetchSize(req);
FimsUser currentUser = (FimsUser) currentUser().getUser();
String sggCd = currentUser.getOrgID();
req.setSggCd(sggCd);
List<DataObject> list = ntcService.getNtcList(req);
return setPagingInfo(mav, list, "");
}
/** .<br />
* {@link NtcService#getNtcInfo(NtcQuery)}
* @param ntcId ID
* @return jsonView
*/
@RequestMapping(name="공지사항 상세 조회", value=METHOD_URL.getNtcInfo)
public ModelAndView getNtcInfo(String ntcId) {
boolean json = jsonResponse();
ModelAndView mav = new ModelAndView(json ? "jsonView" : "fims/mngt/mngt01020-info");
mav.addObject("pageName", "mngt01020");
DataObject info = new DataObject();
if(!ifEmpty(ntcId, ()->"").equals("")) {
info = ntcService.getNtcInfo(ntcId);
} else {
info = null;
}
mav.addObject("ntcInfo", json ? info : toJson(info));
List<DataObject> allSggList = sggDeptService.getSigunguList(new SigunguQuery());
mav.addObject("sggList", allSggList);
return mav;
}
/** .
* @param ntc
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
@RequestMapping(name="공지사항 등록", value=METHOD_URL.create)
public ModelAndView create(Ntc ntc) {
ModelAndView mav = new ModelAndView("jsonView");
boolean saved = false;
String rtnMsg = ntcService.create(ntc);
if(rtnMsg.contains("[S]")) {
saved = true;
}
mav.addObject("saved", saved);
return mav;
}
/** .
* @param ntc
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
@RequestMapping(name="공지사항 수정", value=METHOD_URL.update)
public ModelAndView update(Ntc ntc) {
ModelAndView mav = new ModelAndView("jsonView");
boolean saved = false;
String rtnMsg = ntcService.update(ntc);
if(rtnMsg.contains("[S]")) {
saved = true;
}
mav.addObject("saved", saved);
return mav;
}
/** .
* @param ntcIDs
* @return jsonView
* <pre><code> {
* "affected":
* "saved": true, false
* }</code></pre>
*/
@RequestMapping(name="공지사항 삭제", value=METHOD_URL.remove)
public ModelAndView remove(Ntc ntc) {
ModelAndView mav = new ModelAndView("jsonView");
boolean saved = false;
String rtnMsg = ntcService.remove(ntc);
if(rtnMsg.contains("[S]")) {
saved = true;
}
mav.addObject("saved", saved);
return mav;
}
}

@ -0,0 +1,119 @@
<?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.fims.mngt.dao.NtcMapper">
<!-- 공지사항 정보 매퍼
========== 변경 이력 ==========
2024-02-26 leebj 최초 작성
============================ -->
<resultMap id="ntcRow" type="cokr.xit.fims.mngt.Ntc"> <!-- 공지사항 -->
<result property="ntcId" column="NTC_ID" /> <!-- 공지 ID -->
<result property="sggCd" column="SGG_CD" /> <!-- 시군구 코드 -->
<result property="ntcTtl" column="NTC_TTL" /> <!-- 공지 제목 -->
<result property="ntcCn" column="NTC_CN" /> <!-- 공지 내용 -->
<result property="delYn" column="DEL_YN" /> <!-- 삭제 여부 -->
<result property="createdAt" column="REG_DT" /> <!-- 등록 일시 -->
<result property="createdBy" column="RGTR" /> <!-- 등록자 -->
<result property="lastModified" column="MDFCN_DT" /> <!-- 수정 일시 -->
<result property="modifiedBy" column="MDFR" /> <!-- 수정자 -->
<result property="removedAt" column="DEL_DT" /> <!-- 삭제 일시 -->
<result property="removedBy" column="DLTR" /> <!-- 삭제자 -->
<result property="delRsn" column="DEL_RSN" /> <!-- 삭제 사유 -->
</resultMap>
<sql id="select">
SELECT A.NTC_ID <!-- 공지 ID -->
, A.SGG_CD <!-- 시군구 코드 -->
, (CASE
WHEN (SELECT SGG_NM FROM TB_SGG WHERE SGG_CD = A.SGG_CD) IS NOT NULL
THEN (SELECT SGG_NM FROM TB_SGG WHERE SGG_CD = A.SGG_CD)
ELSE '전체' END) AS SGG_NM
, A.NTC_TTL <!-- 공지 제목 -->
, A.NTC_CN <!-- 공지 내용 -->
, A.DEL_YN <!-- 삭제 여부 -->
, A.REG_DT <!-- 등록 일시 -->
, A.RGTR <!-- 등록자 -->
, A.MDFCN_DT <!-- 수정 일시 -->
, A.MDFR <!-- 수정자 -->
, A.DEL_DT <!-- 삭제 일시 -->
, A.DLTR <!-- 삭제자 -->
, A.DEL_RSN <!-- 삭제 사유 -->
FROM TB_NOTICE A
</sql>
<select id="selectNtcList" parameterType="map" resultType="dataobject">
/* 공지사항 목록 조회(ntcMapper.selectNtcList) */
<include refid="utility.paging-prefix" />
<include refid="select" />
WHERE A.DEL_YN = 'N'
<if test="sggCd != null and sggCd != ''">
AND (A.SGG_CD = #{sggCd} OR A.SGG_CD = '' OR A.SGG_CD IS NULL)
</if>
<if test="@org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(by) and @org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(term)">
AND A.${by} LIKE CONCAT('%',#{term},'%')
</if>
<include refid="utility.orderBy" />
<include refid="utility.paging-suffix" />
</select>
<select id="selectNtcInfo" parameterType="string" resultType="dataobject">
/* 공지사항 상세 내용 조회(ntcMapper.selectNtcInfo) */
<include refid="select" />
WHERE A.DEL_YN = 'N'
AND A.NTC_ID = #{ntcId}
</select>
<insert id="insertNtc" parameterType="map">
/* 공지사항 등록(ntcMapper.insertNtc) */
<selectKey resultType="string" keyProperty="ntc.ntcId" keyColumn="NEW_ID" order="BEFORE">
<include refid="numbering.key">
<property name="TABLE_NAME" value="TB_NOTICE" />
<property name="TABLE_KEY" value="NTC_ID" />
<property name="pad" value="10" />
</include>
</selectKey>
INSERT
INTO TB_NOTICE (
NTC_ID <!-- 공지 ID -->
, SGG_CD <!-- 시군구 코드 -->
, NTC_TTL <!-- 공지 제목 -->
, NTC_CN <!-- 공지 내용 -->
, DEL_YN <!-- 삭제 여부 -->
, REG_DT <!-- 등록 일시 -->
, RGTR <!-- 등록자 -->
, MDFCN_DT <!-- 수정 일시 -->
, MDFR <!-- 수정자 -->
) VALUES (
#{ntc.ntcId} <!-- 공지 ID -->
, #{ntc.sggCd} <!-- 시군구 코드 -->
, #{ntc.ntcTtl} <!-- 공지 제목 -->
, #{ntc.ntcCn} <!-- 공지 내용 -->
, 'N' <!-- 삭제 여부 -->
, <include refid="utility.now" /> <!-- 등록 일시 -->
, #{currentUser.id} <!-- 등록자 -->
, <include refid="utility.now" /> <!-- 수정 일시 -->
, #{currentUser.id} <!-- 수정자 -->
)
</insert>
<update id="updateNtc" parameterType="map">
/* 공지사항 수정(ntcMapper.updateNtc) */
UPDATE TB_NOTICE
SET NTC_TTL = #{ntc.ntcTtl} <!-- 공지 제목 -->
, NTC_CN = #{ntc.ntcCn} <!-- 공지 내용 -->
, MDFCN_DT = <include refid="utility.now" /> <!-- 수정 일시 -->
, MDFR = #{currentUser.id} <!-- 수정자 -->
WHERE NTC_ID = #{ntc.ntcId}
</update>
<update id="deleteNtc" parameterType="map">
/* 공지사항 삭제(ntcMapper.deleteNtc) */
UPDATE TB_NOTICE
SET DEL_YN = 'Y'
, DEL_DT = <include refid="utility.now" />
, DLTR = #{currentUser.id}
WHERE NTC_ID = #{ntc.ntcId}
</update>
</mapper>
Loading…
Cancel
Save