feat : BBS 기능추가 진행

main
sjh88 2 years ago
parent 826bcf53c3
commit bf7ac01143

@ -25,6 +25,8 @@ public interface IBoardBasicMgtMapper {
<T> XitBasicBbsMngVO selectBoardBasic(final T t); <T> XitBasicBbsMngVO selectBoardBasic(final T t);
<T> XitBasicBbsMngVO selectBoardMaster(final T t);
int insertBoardBasic(final XitBasicBbsMngVO vo); int insertBoardBasic(final XitBasicBbsMngVO vo);
int updateBoardBasic(final XitBasicBbsMngVO vo); int updateBoardBasic(final XitBasicBbsMngVO vo);

@ -2,8 +2,10 @@ package kr.xit.framework.biz.mng.bbs.model;
import java.util.List; import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnore;
import kr.xit.framework.core.model.BaseVO; import kr.xit.framework.core.model.BaseVO;
import lombok.*; import lombok.*;
import org.springframework.web.multipart.MultipartFile;
/** /**
* *
@ -15,155 +17,179 @@ import lombok.*;
* @since 2002. 2. 2. * @since 2002. 2. 2.
* @version 1.0 Copyright(c) XIT All rights reserved. * @version 1.0 Copyright(c) XIT All rights reserved.
*/ */
@Getter @Data
@Setter
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@EqualsAndHashCode @EqualsAndHashCode
@Builder @Builder
@ToString @ToString
public class XitBasicBbsMngVO { public class XitBasicBbsMngVO {
/**
* serialVersionUID
*/
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* * ID
*/ */
private String atchFileId; private String nttId;
/** /**
* * ID
*/ */
private String bbsId; private String bbsId;
/** /**
* *
*/ */
private String frstRegisterId; private double nttNo;
/** /**
* *
*/ */
private String frstRegisterNm; private String nttSj;
/** /**
* *
*/ */
private String frstRegisterPnttm; private String nttCn;
/** /**
* *
*/ */
private String lastUpdusrId; private String answerAt;
/** /**
* *
*/ */
private String lastUpdusrPnttm; private double parntsSntncNo;
/** /**
* *
*/ */
private String ntceBgnde; private double answerLc;
/** /**
* *
*/ */
private String ntceEndde; private double sortOrdr;
/** /**
* *
*/ */
private String ntcrId; private double rdcnt;
/** /**
* *
*/ */
private String ntcrNm; private String useAt;
/**
*
*/
private String nttCn;
/** /**
* *
*/ */
private long nttId = 0L; private String ntceBeginDe;
/** /**
* *
*/ */
private long nttNo = 0L; private String ntceEndDe;
/** /**
* * ID
*/ */
private String nttSj; private String ntcrId;
/** /**
* *
*/ */
private String parnts = "0"; private String ntcrNm;
/** /**
* *
*/ */
private String password; private String password;
/** /**
* * ID
*/ */
private int inqireCo = 0; private String atchFileId;
/**
*
*/
private String replyAt;
/** /**
* *
*/ */
private String replyLc = "0"; private String frstRegistPnttm;
/** /**
* * ID
*/ */
private long sortOrdr = 0L; private String frstRegisterId;
/** /**
* *
*/ */
private String useAt; private String lastUpdtPnttm;
/** /**
* * ID
*/ */
private String ntceEnddeView; private String lastUpdusrId;
/** /**
* *
*/ */
private String ntceBgndeView; @JsonIgnore
private MultipartFile[] files;
/** 유효여부 */ //BBS_MASTER
private String isExpired = "N";
/** 상위 정렬 순서 */ /** 게시판 속성코드 */
private String parntsSortOrdr; private String bbsAttrbCode;
/** 상위 답변 위치 */ /** 게시판 명 */
private String parntsReplyLc; private String bbsNm;
/** 게시판 유형코드 */ /** 게시판 유형코드 */
private String bbsTyCode; private String bbsTyCode;
/** 게시판 속성코드 */ /** 파일첨부가능여부 */
private String bbsAttrbCode; private String fileAtchPosblAt;
/** 게시판 명 */ /** 첨부가능파일숫자 */
private String bbsNm; private int atchPosblFileNumber = 0;
/** 첨부가능파일숫자 */
private int posblAtchFileNumber = 0;
/** 답장가능여부 */
private String replyPosblAt;
//기타
/**
*
*/
private String ntceBgnde;
/** 파일첨부가능여부 */ /** 유효여부 */
private String fileAtchPosblAt; private String isExpired = "N";
/** 첨부가능파일숫자 */ /** 조회 수 증가 여부 */
private int posblAtchFileNumber = 0; private boolean plusCount = false;
/** 답장가능여부 */ /**
private String replyPosblAt; *
*/
private String replyAt;
/** 조회 수 증가 여부 */ /**
private boolean plusCount = false; *
*/
private String replyLc = "0";
/**
*
*/
private String parnts = "0";
/**
*
*/
private int inqireCo = 0;
/**
*
*/
private String frstRegisterNm;
/**
*
*/
private String frstRegisterPnttm;
//--------------------------------- //---------------------------------
// 2009.06.29 : 2단계 기능 추가 // 2009.06.29 : 2단계 기능 추가
//--------------------------------- //---------------------------------
/** 하위 페이지 인덱스 (댓글 및 만족도 조사 여부 확인용) */ /** 하위 페이지 인덱스 (댓글 및 만족도 조사 여부 확인용) */
private String subPageIndex; private String subPageIndex;
////------------------------------- ////-------------------------------
//--------------------------------- //---------------------------------
// 2020.09.15 : tui-grid tree구조 변수 // 2020.09.15 : tui-grid tree구조 변수
//--------------------------------- //---------------------------------
List<XitBasicBbsMngVO> _children; List<XitBasicBbsMngVO> _children;
} }

@ -34,9 +34,25 @@ public class BoardBasicMgtService implements IBoardBasicMgtService {
return mapper.selectBoardBasic(t); return mapper.selectBoardBasic(t);
} }
@Override
@Transactional(readOnly = true)
public <T> XitBasicBbsMngVO findBoardMaster(final T t) {
return mapper.selectBoardMaster(t);
}
@Override @Override
@Transactional @Transactional
public void addBoardBasic(final XitBasicBbsMngVO vo) { public void addBoardBasic(final XitBasicBbsMngVO vo) {
//댓글여부
boolean isReply = "Y".equals(vo.getReplyAt());
if(!isReply) {
//댓글이 아닌 경우 초기설정
vo.setParntsSntncNo(0); //부모 게시물번호
vo.setAnswerLc(0); //댓글위치
vo.setAnswerAt("N"); //댓글여부
}
vo.setFrstRegisterId(getUserUniqId()); vo.setFrstRegisterId(getUserUniqId());
mapper.insertBoardBasic(vo); mapper.insertBoardBasic(vo);
} }

@ -21,6 +21,7 @@ public interface IBoardBasicMgtService {
List<XitBasicBbsMngVO> findBoardBasicList(final Map<String, Object> paraMap, final RowBounds rowBounds); List<XitBasicBbsMngVO> findBoardBasicList(final Map<String, Object> paraMap, final RowBounds rowBounds);
<T> List<XitBasicBbsMngVO> findBoardBasicList(final T t); <T> List<XitBasicBbsMngVO> findBoardBasicList(final T t);
<T> XitBasicBbsMngVO findBoardBasic(final T t); <T> XitBasicBbsMngVO findBoardBasic(final T t);
<T> XitBasicBbsMngVO findBoardMaster(final T t);
void addBoardBasic(final XitBasicBbsMngVO vo); void addBoardBasic(final XitBasicBbsMngVO vo);
void modifyBoardBasic(final XitBasicBbsMngVO vo); void modifyBoardBasic(final XitBasicBbsMngVO vo);

@ -51,8 +51,8 @@ public class XitBasicBbsMngServiceImpl implements XitBasicBbsMngService {
while (iter.hasNext()) { while (iter.hasNext()) {
vo = (XitBasicBbsMngVO)iter.next(); vo = (XitBasicBbsMngVO)iter.next();
if (!"".equals(vo.getNtceBgnde()) || !"".equals(vo.getNtceEndde())) { if (!"".equals(vo.getNtceBgnde()) || !"".equals(vo.getAtchPosblFileNumber())) {
if (EgovDateUtil.getDaysDiff(today, vo.getNtceBgnde()) > 0 || EgovDateUtil.getDaysDiff(today, vo.getNtceEndde()) < 0) { if (EgovDateUtil.getDaysDiff(today, vo.getNtceBgnde()) > 0 || EgovDateUtil.getDaysDiff(today, String.valueOf(vo.getAtchPosblFileNumber())) < 0) {
// 시작일이 오늘날짜보다 크거나, 종료일이 오늘 날짜보다 작은 경우 // 시작일이 오늘날짜보다 크거나, 종료일이 오늘 날짜보다 작은 경우
vo.setIsExpired("Y"); vo.setIsExpired("Y");
} }
@ -214,7 +214,7 @@ public class XitBasicBbsMngServiceImpl implements XitBasicBbsMngService {
// crudVO.setRdcnt(vo.getInqireCo()+""); //조회수 // crudVO.setRdcnt(vo.getInqireCo()+""); //조회수
crudVO.setUse_at(vo.getUseAt()); //사용 여부 crudVO.setUse_at(vo.getUseAt()); //사용 여부
crudVO.setNtce_begin_de(vo.getNtceBgnde()); //게시 시작 일 crudVO.setNtce_begin_de(vo.getNtceBgnde()); //게시 시작 일
crudVO.setNtce_end_de(vo.getNtceEndde()); //게시 종료 일 crudVO.setNtce_end_de(String.valueOf(vo.getAtchPosblFileNumber())); //게시 종료 일
crudVO.setNtcr_id(vo.getNtcrId()); //게시자 id crudVO.setNtcr_id(vo.getNtcrId()); //게시자 id
crudVO.setNtcr_nm(vo.getNtcrNm()); //게시자 명 crudVO.setNtcr_nm(vo.getNtcrNm()); //게시자 명
crudVO.setPassword(vo.getPassword()); //비밀번호 crudVO.setPassword(vo.getPassword()); //비밀번호

@ -38,16 +38,9 @@ public class BoardBasicMgtController {
private final IBoardBasicMgtService service; private final IBoardBasicMgtService service;
@RequestMapping(value = "/mngBoardBasicMgtForm") @RequestMapping(value = "/mngBoardBasicMgtForm")
public void mngBoardBasicMgtForm(){ public ModelAndView mngBoardBasicMgtForm(@RequestParam final Map<String, Object> paraMap){
}
@RequestMapping(value = "/mngBoardBasicSchPopup")
public ModelAndView mngBoardBasicSchPopup(@RequestParam final Map<String, Object> paraMap){
ModelAndView mav = new ModelAndView(); ModelAndView mav = new ModelAndView();
mav.addAllObjects(paraMap); mav.addObject("boardMaster", service.findBoardMaster(paraMap));
mav.addObject("pageTitle","템플릿 조회");
mav.setViewName(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH +"mng/bbs/mngBoardBasicSchPopup.popup");
return mav; return mav;
} }
@ -55,12 +48,12 @@ public class BoardBasicMgtController {
public ModelAndView mngBoardBasicMgtPopup(final XitBasicBbsMngVO vo) { public ModelAndView mngBoardBasicMgtPopup(final XitBasicBbsMngVO vo) {
ModelAndView mav = new ModelAndView(); ModelAndView mav = new ModelAndView();
if(Checks.isNotEmpty(vo) && Checks.isNotEmpty(vo.getBbsId())){ if(Checks.isNotEmpty(vo) && Checks.isNotEmpty(vo.getNttSj())){
mav.addObject("boardMaster", service.findBoardBasic(vo)); mav.addObject("boardBasic", service.findBoardBasic(vo));
} else { } else {
mav.addObject("boardMaster", vo); mav.addObject("boardBasic", vo);
} }
mav.addObject("pageTitle", "게시판 템플릿 등록 / 변경"); mav.addObject("pageTitle", "게시판 등록 / 변경");
mav.setViewName(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH + "mng/bbs/mngBoardBasicMgtPopup.popup"); mav.setViewName(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH + "mng/bbs/mngBoardBasicMgtPopup.popup");
return mav; return mav;
} }
@ -70,11 +63,11 @@ public class BoardBasicMgtController {
return ResultResponse.of(service.findBoardBasicList(paraMap, MybatisUtils.getPagingInfo(paraMap))); return ResultResponse.of(service.findBoardBasicList(paraMap, MybatisUtils.getPagingInfo(paraMap)));
} }
@PostMapping(value = "/addBoardBasic") @PostMapping(value = "/addBoardBasic")//, consumes = "multipart/form-data"
public ModelAndView addBoardBasic(final XitBasicBbsMngVO vo, final BindingResult bindingResult){ public ModelAndView addBoardBasic(final XitBasicBbsMngVO vo, final BindingResult bindingResult){
ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW); ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW);
ValidationError.of("boardMaster", vo, bindingResult); ValidationError.of("boardBasic", vo, bindingResult);
service.addBoardBasic(vo); service.addBoardBasic(vo);
AjaxMessageMapRenderer.success(mav, MessageKey.CMM_INSERT_SUCCESS); AjaxMessageMapRenderer.success(mav, MessageKey.CMM_INSERT_SUCCESS);
return mav; return mav;
@ -84,7 +77,7 @@ public class BoardBasicMgtController {
public ModelAndView modifyBoardBasic(final XitBasicBbsMngVO vo, final BindingResult bindingResult){ public ModelAndView modifyBoardBasic(final XitBasicBbsMngVO vo, final BindingResult bindingResult){
ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW); ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW);
ValidationError.of("boardMaster", vo, bindingResult); ValidationError.of("boardBasic", vo, bindingResult);
service.modifyBoardBasic(vo); service.modifyBoardBasic(vo);
AjaxMessageMapRenderer.success(mav, MessageKey.CMM_UPDATE_SUCCESS); AjaxMessageMapRenderer.success(mav, MessageKey.CMM_UPDATE_SUCCESS);
return mav; return mav;

@ -14,7 +14,7 @@
<result column="frstRegisterNm" property="frstRegisterNm" /> <result column="frstRegisterNm" property="frstRegisterNm" />
<result column="frstRegisterPnttm" property="frstRegisterPnttm" /> <result column="frstRegisterPnttm" property="frstRegisterPnttm" />
<result column="ntce_bgn_de" property="ntceBgnde" /> <result column="ntce_bgn_de" property="ntceBgnde" />
<result column="ntce_end_de" property="ntceEndde" /> <result column="ntce_end_de" property="ntceEndDe" />
<result column="inqireCo" property="inqireCo" /> <result column="inqireCo" property="inqireCo" />
<result column="use_at" property="useAt" /> <result column="use_at" property="useAt" />
<result column="atch_file_id" property="atchFileId" /> <result column="atch_file_id" property="atchFileId" />

@ -22,7 +22,7 @@
,IFNULL (B.USER_NM, A.NTCR_NM) AS "frstRegisterNm" ,IFNULL (B.USER_NM, A.NTCR_NM) AS "frstRegisterNm"
,DATE_FORMAT(A.FRST_REGIST_PNTTM, '%Y-%m-%d') AS "frstRegisterPnttm" ,DATE_FORMAT(A.FRST_REGIST_PNTTM, '%Y-%m-%d') AS "frstRegisterPnttm"
,A.NTCE_BEGIN_DE AS "ntceBgnde" ,A.NTCE_BEGIN_DE AS "ntceBgnde"
,A.NTCE_END_DE AS "ntceEndde" ,A.NTCE_END_DE AS "nposblAtchFileNumber"
,A.RDCNT AS "inqireCo" ,A.RDCNT AS "inqireCo"
,A.USE_AT AS "useAt" ,A.USE_AT AS "useAt"
,A.ATCH_FILE_ID AS "atchFileId" ,A.ATCH_FILE_ID AS "atchFileId"
@ -73,7 +73,7 @@
<result column="frstRegisterNm" property="frstRegisterNm" /> <result column="frstRegisterNm" property="frstRegisterNm" />
<result column="frstRegisterPnttm" property="frstRegisterPnttm" /> <result column="frstRegisterPnttm" property="frstRegisterPnttm" />
<result column="ntceBgnde" property="ntceBgnde" /> <result column="ntceBgnde" property="ntceBgnde" />
<result column="ntceEndde" property="ntceEndde" /> <result column="nposblAtchFileNumber" property="nposblAtchFileNumber" />
<result column="inqireCo" property="inqireCo" /> <result column="inqireCo" property="inqireCo" />
<result column="useAt" property="useAt" /> <result column="useAt" property="useAt" />
<result column="atchFileId" property="atchFileId" /> <result column="atchFileId" property="atchFileId" />

@ -6,113 +6,169 @@
<!-- ************************************************************************************************************* <!-- *************************************************************************************************************
* xit_bbs_basic : 게시판 기본 * xit_bbs_basic : 게시판 기본
************************************************************************************************************** --> ************************************************************************************************************** -->
<sql id="sqlBoardBasic">
SELECT xb.NTT_SJ AS "nttSj" <sql id="sqlBoardMaster">
,xb.NTCR_ID AS "ntcrId" , xbm.bbs_ty_code
,xb.NTCR_NM AS "ntcrNm" , xbm.bbs_attrb_code
,xb.NTT_NO AS "nttNo" , xbm.reply_posbl_at
,xb.NTT_CN AS "nttCn" , xbm.file_atch_posbl_at
,xb.PASSWORD AS "password" , xbm.atch_posbl_file_number
,xb.FRST_REGISTER_ID AS "frstRegisterId" , xbm.bbs_nm
,IFNULL (B.USER_NM, xb.NTCR_NM) AS "frstRegisterNm" </sql>
,DATE_FORMAT(xb.FRST_REGIST_PNTTM, '%Y-%m-%d') AS "frstRegisterPnttm"
,xb.NTCE_BEGIN_DE AS "ntceBgnde" <sql id="sqlBoardBasic">
,xb.NTCE_END_DE AS "ntceEndde" SELECT xb.ntt_sj
,xb.RDCNT AS "inqireCo" , xb.ntcr_id
,xb.USE_AT AS "useAt" , xb.ntcr_nm
,xb.ATCH_FILE_ID AS "atchFileId" , xb.ntt_no
,xb.BBS_ID AS "bbsId" , xb.ntt_cn
,xb.NTT_ID AS "nttId" , xb.password
,xb.PARNTS_SNTNC_NO AS "parnts" , xb.frst_register_id
,xb.ANSWER_AT AS "replyAt" , IFNULL (xvum.user_nm, xb.ntcr_nm) AS "frstRegisterNm"
,xb.ANSWER_LC AS "replyLc" , xb.frst_regist_pnttm
,xb.SORT_ORDR AS "sortOrdr" , xb.ntce_begin_de
,C.BBS_TY_CODE AS "bbsTyCode" , xb.ntce_end_de
,C.BBS_ATTRB_CODE AS "bbsAttrbCode" , xb.rdcnt AS "inqireco"
,C.REPLY_POSBL_AT AS "replyPosblAt" , xb.use_at
,C.FILE_ATCH_POSBL_AT AS "fileAtchPosblAt" , xb.atch_file_id
,C.ATCH_POSBL_FILE_NUMBER AS "posblAtchFileNumber" , xb.bbs_id
,C.BBS_NM AS "bbsNm" , xb.ntt_id
FROM XIT_BBS xb , xb.parnts_sntnc_no AS "parnts"
LEFT OUTER JOIN XIT_VW_USER_MASTR xvum ON xb.FRST_REGISTER_ID = B.ESNTL_ID , xb.answer_at AS "replyat"
LEFT OUTER JOIN XIT_BBS_MASTR C ON xb.BBS_ID = C.BBS_ID , xb.answer_lc AS "replylc"
, xb.sort_ordr
<include refid="sqlBoardMaster"/>
FROM xit_bbs xb
LEFT OUTER JOIN xit_vw_user_mastr xvum
ON xb.frst_register_id = xvum.esntl_id
LEFT OUTER JOIN xit_bbs_mastr xbm
ON xb.bbs_id = xbm.bbs_id
</sql> </sql>
<select id="selectBoardBasics" resultType="kr.xit.framework.biz.mng.bbs.model.XitBasicBbsMngVO"> <select id="selectBoardBasics" resultType="kr.xit.framework.biz.mng.bbs.model.XitBasicBbsMngVO">
/* board-mastr-mysql-mapper|selectBoardBasics-BBS 마스터(생성) 목록 조회|julim */ /* board-mastr-mysql-mapper|sqlBoardBasic-BBS 기본 정보 조회|sjh88 */
<include refid="sqlBoardBasic"/> <include refid="sqlBoardBasic"/>
<where> <where>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(useAt)"> AND xb.bbs_id = #{bbsId}
AND xbm.use_at = #{useAt} AND xb.parnts_sntnc_no = 0
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(nttSj)">
AND xb.ntt_sj LIKE CONCAT('%',#{nttSj},'%')
</if> </if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(bbsNm)"> <if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(nttCn)">
AND INSTR(xbm.bbs_nm, #{bbsNm}) > 0 AND xb.ntt_cn LIKE CONCAT('%',#{nttCn},'%')
</if> </if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(bbsTyCodeNm)"> <if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(ntcrNm)">
AND INSTR(cdc.code_nm, #{bbsTyCodeNm}) > 0 AND xvum.user_nm LIKE CONCAT('%',#{ntcrNm},'%')
</if> </if>
</where> </where>
ORDER BY xbm.frst_regist_pnttm DESC ORDER BY xb.frst_regist_pnttm DESC
</select> </select>
<select id="selectBoardBasic" resultType="kr.xit.framework.biz.mng.bbs.model.XitBasicBbsMngVO"> <select id="selectBoardBasic" resultType="kr.xit.framework.biz.mng.bbs.model.XitBasicBbsMngVO">
/* boards-mastr-mysql-mapper|selectBoardBasic-BBS 마스터(생성) 정보 조회|julim */ /* board-mastr-mysql-mapper|selectBoardBasics-BBS 기본(생성) 목록 조회|sjh88 */
<include refid="sqlBoardBasic"/> <include refid="sqlBoardBasic"/>
WHERE xbm.bbs_id = #{bbsId} <where>
AND xb.bbs_id = #{bbsId}
AND xb.parnts_sntnc_no = 0
AND xb.ntt_no = #{nttNo}
</where>
ORDER BY xb.frst_regist_pnttm DESC
</select> </select>
<select id="selectBoardMaster" resultType="kr.xit.framework.biz.mng.bbs.model.XitBasicBbsMngVO">
/* boards-mastr-mysql-mapper|selectBoardMaster-BBS 마스터 정보 조회|sjh88 */
SELECT #{bbsId} AS "bbsId"
<include refid="sqlBoardMaster"/>
FROM xit_bbs_mastr xbm
<where>
AND xbm.bbs_id = #{bbsId}
</where>
</select>
<!-- <select id="findMaxNttId" resultType="String">-->
<!-- /** XitBasicBbsMngMapper.findMaxNttId */-->
<!-- &lt;!&ndash; SELECT IFNULL(MAX(CAST(NTT_ID)),0)+1 AS "NTT_ID" FROM XIT_BBS [2021.12.23]임현수 : 디비 버전문제로 문법오류 나서 수정함&ndash;&gt;-->
<!-- </select>-->
<!-- <select id="findMaxNttNo" resultType="String">-->
<!-- /** XitBasicBbsMngMapper.findMaxNttNo */-->
<!-- </select>-->
<insert id="insertBoardBasic"> <insert id="insertBoardBasic">
/* board-mastr-mysql-mapper|insertBoardBasic-BBS 마스터(생성) 정보 등록|julim */ /* board-mastr-mysql-mapper|insertBoardBasic-BBS 기본(생성) 정보 등록|sjh88 */
<selectKey resultType="hashmap" keyColumn="nttId,nttNo" keyProperty="nttId,nttNo" order="BEFORE">
SELECT
(/** 게시물ID 채번 */
SELECT CAST(IFNULL(MAX(CAST(ntt_id AS DECIMAL)),0)+1 AS CHAR)
FROM xit_bbs
WHERE bbs_id = #{bbsId}
) AS "nttId",
(/** 게시물번호 채번 */
SELECT CAST(IFNULL(MAX(ntt_no),0)+1 AS DOUBLE)
FROM xit_bbs
WHERE bbs_id = #{bbsId}
AND parnts_sntnc_no = #{parntsSntncNo}
) AS "nttNo"
FROM DUAL
</selectKey>
INSERT INSERT
INTO xit_bbs_mastr ( INTO xit_bbs (
bbs_id ntt_id
, bbs_nm , bbs_id
, bbs_intrcn , ntt_no
, bbs_ty_code , ntt_sj
, bbs_attrb_code , ntt_cn
, atch_posbl_file_number , answer_at
, atch_posbl_file_size , parnts_sntnc_no
, tmplat_id , answer_lc
, use_at , sort_ordr
, frst_regist_pnttm , rdcnt
, frst_register_id , ntce_begin_de
, ntce_end_de
, ntcr_id
, ntcr_nm
, password
, atch_file_id
, frst_regist_pnttm
, frst_register_id
) VALUES ( ) VALUES (
#{bbsId} #{nttId}
, #{bbsNm} , #{bbsId}
, #{bbsIntrcn} , #{nttNo}
, #{bbsTyCode} , #{nttSj}
, #{bbsAttrbCode} , #{nttCn}
, #{atchPosblFileNumber} , #{answerAt}
, #{atchPosblFileSize} , #{parntsSntncNo}
, #{tmplatId} , #{answerLc}
, #{useAt} , #{sortOrdr}
, NOW() , 0
, #{frstRegisterId} , #{ntceBeginDe}
, #{ntceEndDe}
, #{ntcrId}
, #{ntcrNm}
, #{password}
, #{atchFileId}
, NOW()
, #{frstRegisterId}
) )
</insert> </insert>
<update id="updateBoardBasic"> <update id="updateBoardBasic">
/* board-mastr-mysql-mapper|updateBoardBasic-BBS 마스터(생성) 정보 변경|julim */ /* board-mastr-mysql-mapper|updateBoardBasic-BBS 기본(생성) 정보 변경|sjh88 */
UPDATE xit_bbs_mastr UPDATE xit_bbs
SET bbs_nm = IF(bbs_nm = #{bbsNm}, bbs_nm, #{bbsNm}) SET ntt_sj = IF(ntt_sj = #{nttSj}, ntt_sj, #{nttSj})
, bbs_intrcn = IF(bbs_intrcn = #{bbsIntrcn}, bbs_intrcn, #{bbsIntrcn}) , ntt_cn = IF(ntt_cn = #{nttCn}, ntt_cn, #{nttCn})
, bbs_ty_code = IF(bbs_ty_code = #{bbsTyCode}, bbs_ty_code, #{bbsTyCode}) , sort_ordr = IF(sort_ordr = #{sortOrdr}, sort_ordr, #{sortOrdr})
, bbs_attrb_code = IF(bbs_attrb_code = #{bbsAttrbCode}, bbs_attrb_code, #{bbsAttrbCode}) , ntce_begin_de = IF(ntce_begin_de = #{ntceBeginDe}, ntce_begin_de, #{ntceBeginDe})
, atch_posbl_file_number = IF(atch_posbl_file_number = #{atchPosblFileNumber}, atch_posbl_file_number, #{atchPosblFileNumber}) , ntce_end_de = IF(ntce_end_de = #{ntceEndDe}, ntce_end_de, #{ntceEndDe})
, atch_posbl_file_size = IF(atch_posbl_file_size = #{atchPosblFileSize}, atch_posbl_file_size, #{atchPosblFileSize}) , ntcr_id = IF(ntcr_id = #{ntcrId}, ntcr_id, #{ntcrId})
, tmplat_id = IF(tmplat_id = #{tmplatId}, tmplat_id, #{tmplatId}) , ntcr_nm = IF(ntcr_nm = #{ntcrNm}, ntcr_nm, #{ntcrNm})
, use_at = IF(use_at = #{useAt}, use_at, #{useAt}) , password = IF(password = #{password}, password, #{password})
, last_updt_pnttm = NOW() , atch_file_id = IF(atch_file_id = #{atchFileId}, atch_file_id, #{atchFileId})
, last_updusr_id = #{lastUpdusrId} , last_updt_pnttm = NOW()
WHERE bbs_id = #{bbsId} , last_updusr_id = #{lastUpdusrId}
WHERE bbs_id = #{bbsId}
AND ntt_id = #{nttId}
</update> </update>
<delete id="deleteBoardBasic">
/* board-mastr-mysql-mapper|deleteBoardBasic-BBS 마스터(생성) 정보 삭제|julim */
DELETE
FROM xit_bbs_mastr
WHERE bbs_id = #{bbsId}
</delete>
</mapper> </mapper>

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1//EN"
"http://jakarta.apache.org/commons/dtds/validator_1_1.dtd">
<form-validation>
<formset>
<form name="boardBasic">
<field property="nttSj" depends="required, maxlength">
<arg0 key="nttSj" />
<arg1 key="1200" resource="false"/>
<var>
<var-name>maxlength</var-name>
<var-value>1200</var-value>
</var>
</field>
<field property="nttCn" depends="required">
<arg0 key="nttCn" />
</field>
<field property="ntceBeginDe" depends="required">
<arg0 key="ntceBeginDe" />
</field>
<field property="ntceEndDe" depends="required">
<arg0 key="ntceEndDe" />
</field>
</form>
</formset>
</form-validation>

@ -0,0 +1,226 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/framework/taglibs.jsp" %>
<form name="frmSearch" id="frmSearch">
<div class="search r2">
<table>
<caption>검색조건</caption>
<colgroup>
<col style="width: 500px;"/>
<col/>
<col/>
<col/>
<col/>
<col/>
<col/>
</colgroup>
<tbody>
<tr>
<td>
<select id="searchCondition" name="searchCondition" title="조회조건">
<option value="nttSj">제목</option>
<option value="nttCn">내용</option>
<option value="ntcrNm">작성자</option>
</select>
<input title="검색값입력" id="searchKeyword" name="searchKeyword" type="text" size="35" maxlength="35" >
</td>
<td rowspan="2">
<input type="button" id="btnSearch" class="btn_search" title="검색" value="검색" />
</td>
</tr>
</tbody>
</table>
</div>
</form>
<!-- //검색 -->
<div class="page_btn">
<span class="fll">
<div class="list clearfix" id="totCnt">전체 ㅣ <span></span></div>
</span>
<span class="flr">
<a href="#" class="btn darkgray" id="btnRegist" title="권한등록">등록</a>
</span>
</div>
<!-- //버튼 및 페이지정보 -->
<!-- 데이터 출력 -->
<div id="grid"></div>
<script type="text/javaScript">
/**************************************************************************
* Global Variable
**************************************************************************/
let GRID = null;
const boardMaster = {
"bbsId": '<c:out value="${boardMaster.bbsId}"/>',
"bbsAttrbCode": '<c:out value="${boardMaster.bbsAttrbCode}"/>',
"fileAtchPosblAt": '<c:out value="${boardMaster.fileAtchPosblAt}"/>',
"atchPosblFileNumber": '<c:out value="${boardMaster.atchPosblFileNumber}"/>'
};
var callbackSearch = () => fnBiz.search();
/* *******************************
* Biz function
******************************* */
const fnBiz = {
search: () => {
GRID.reloadData();
}
,pagePopup: function(flag, params){
<%--let url = '<c:url value="/framework/biz/mng/bbs/mngBoardBasicMgtPopup.do"/>';--%>
let url = frwkApiUrl.POPUP_BOARD_BASIC;
let popTitle;
let popOption = {width: 950, height:550};
switch (flag) {
case "add": //등록
popTitle = "게시글 생성 등록";
break;
case "detail": //상세
popTitle = "게시글 생성 상세";
break;
default:
break;
}
$.blockUI({message: '' ,css: {width: '100%', height: '100%'}
//모달창 외부 클릭시 닫기
,onOverlayClick: () => {
$.unblockUI();
popup.self.close();
}
});
CmmPopup.open(url, params, popOption, popTitle);
}
,onClickGrid: function(props){
const rowData = props.grid.getRow(props.rowKey);
fnBiz.pagePopup('detail', rowData);
}
,onSearchChange: () => {
if($('#searchCondition').val() === 'tmplatSeCode'){
$('select[name="searchKeyword"]')
.css('display', 'inline-block')
.attr('disabled', false);
$('input[name="searchKeyword"]')
.css('display', 'none')
.attr('disabled', true);
}else{
$('select[name="searchKeyword"]')
.css('display', 'none')
.attr('disabled', true);
$('input[name="searchKeyword"]')
.css('display', 'inline-block')
.attr('disabled', false);
}
}
,onClickAnswerPopup: function(props) {
const rowData = props.grid.getRow(props.rowKey);
$.blockUI({
message: '', css: {width: '100%', height: '100%'}
//모달창 외부 클릭시 닫기
, onOverlayClick: () => {
$.unblockUI();
popup?.self?.close();
}
});
fnBiz.pagePopup('answer', {interfaceSeqN: rowData.interfaceSeqN});
}
}
/**************************************************************************
* event
**************************************************************************/
$(() => {
$('#btnSearch').on('click', () => fnBiz.search());
$('#btnRegist').on('click', () => {
fnBiz.pagePopup('add', Object.assign({},boardMaster));
});
});
/* *******************************
* Grid
******************************* */
const initGrid = () => {
const gridColumns = [
{
header: '제목',
name: 'nttSj',
minWidth: 120,
sortable: true,
sortingType: 'desc',
//align: 'center',
renderer: {
type: CustomButtonRenderer,
options: {
formatter: (props) => {
return {
formatter: props.grid.getRow(props.rowKey).nttSj
,element : "text"
}
}
,eventFunction: fnBiz.onClickGrid
,eventType: "click"
}
}
},
{
header: '작성자',
name: 'frstRegisterNm',
width: 80,
sortable: false,
align: 'center'
},
{
header: '작성일',
name: 'frstRegistPnttm',
width: 160,
sortable: false,
align: 'center',
formatter({value}){
return setDateTimeFmt(value.substring(0,10));
}
},
{
header: '조회수',
name: 'inqireCo',
width: 80,
sortable: false,
align: 'center'
}
];
const gridOptions = {
el: 'grid',
rowHeaders: ['rowNum'],
columns: gridColumns
};
const gridDatasource = {
initialRequest: true, // 화면 load시 조회 안함 - default
api: {
readData: {
<%--url: '<c:url value="/framework/biz/mng/bbs/findBoardBasics.do"/>'--%>
url: frwkApiUrl.FIND_BOARD_BASICS
,serializer: (params) => {
const schKey = $('#searchCondition').val();
let schValue = $('input[name=searchKeyword]').val();
params = Object.assign(params,boardMaster);
return getPageParam({[schKey]: schValue}, params);
}
}
}
};
GRID = TuiGrid.of(gridOptions, gridDatasource, (res) => {
});
}
/**************************************************************************
* initialize
**************************************************************************/
$(document).ready(function(){
initGrid();
});
</script>

@ -0,0 +1,268 @@
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/framework/taglibs.jsp" %>
<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator" %>
<c:set var="isUpdate" value="${!empty boardBasic.nttSj}"/>
<c:set var="bizName" value="게시글 생성"/>
<script type="text/javascript" src="<c:url value="/framework/util/validator.do"/>"></script>
<validator:javascript formName="boardBasic" staticJavascript="false" xhtml="true" cdata="false"/>
<div class="popup" style="min-width: 100px;">
<div class="popup_inner" style="max-width: 800px;">
<%@include file="/WEB-INF/jsp/framework/biz-popup-title.jsp" %>
<%--@elvariable id="boardBasic" type="validator"--%>
<form:form commandName="boardBasic" name="boardBasic" method="post" enctype="multipart/form-data">
<table class="tbl03">
<caption><c:out value="${bizName}"/> 등록 / 변경</caption>
<colgroup>
<col style="width: 15%;"/>
<col style="width: 35%;"/>
<col style="width: 15%;"/>
<col style="width: 35%;"/>
</colgroup>
<tbody>
<tr>
<th class="required" scope="row" nowrap>
<label for="nttSj">게시글명</label>
</th>
<td colspan="3">
<form:input path="nttSj" size="60" maxlength="60" title="게시글명"/>
<form:errors path="nttSj" />
</td>
</tr>
<tr>
<th class="required" scope="row" nowrap>
<label for="nttCn">게시글 소개</label>
</th>
<td colspan="3">
<form:textarea path="nttCn" cols="75" rows="4" title="게시글소개"/>
<form:errors path="nttCn" />
</td>
</tr>
<c:choose>
<c:when test="${boardBasic.bbsAttrbCode == 'BBSA01'}">
<tr>
<th class="required" scope="row" nowrap>
<label for="ntceBeginDe">게시기간</label>
</th>
<td colspan="3">
<input id="ntceBeginDe" class="inputText cal" name="ntceBeginDe" type="text" title="시작 날짜 선택" value="">
<button type="button" name="ntceBeginDe" class="calendar"><span class="ico far fa-calendar-alt">
<img style="width:18px;" src="${ctx }/resources/biz/content/images/common/main/calendar.png"/><em>달력</em></span>
</button>
~
<input id="ntceEndDe" class="inputText cal" name="ntceEndDe" type="text" title="종료 날짜 선택" placeholder="날짜를 선택하세요">
<button type="button" name="ntceEndDe" class="calendar"><span class="ico far fa-calendar-alt">
<img style="width:18px;" src="${ctx }/resources/biz/content/images/common/main/calendar.png"/><em>달력</em></span>
</button>
</td>
</tr>
</c:when>
<c:otherwise>
<input name="ntceBeginDe" type="hidden" value="10000101">
<input name="ntceEndDe" type="hidden" value="99991231">
</c:otherwise>
</c:choose>
<c:if test="${boardBasic.fileAtchPosblAt == 'Y'}">
<tr>
<th height="23"><label for="files">파일첨부</label></th>
<td colspan="3">
<input id="files" type="file" multiple />
<div id="preview"></div>
<span id="warnMsg" style="color: red; font-weight: bold; display: inline-block">동일한 데이타 선택시 중복 처리될수 있습니다.</span>
</td>
</tr>
</c:if>
</tbody>
</table>
</form:form>
<%@include file="/WEB-INF/jsp/framework/biz-popup-use-btn.jsp" %>
<!-- //등록버튼 -->
</div>
</div>
<!-- //popup -->
<script type="text/javascript">
/**************************************************************************
* Global Variable
**************************************************************************/
let orgData;
let arrFiles = [];
const maxFileNum = nvl('<c:out value="${boardBasic.atchPosblFileNumber}"/>', 3);
const bbsId = '<c:out value="${boardBasic.bbsId}"/>';
const preview = document.getElementById('preview');
/* *******************************
* Biz function
******************************* */
const fnBiz = {
add: () => {
if (!fnBiz.validate()) return;
const formData = fnBiz.formSetting('add');
cmmBizAjax('add', {
<%--url: '<c:url value="/framework/biz/mng/bbs/addBoardBasic.do"/>'--%>
url: frwkApiUrl.SAVE_BOARD_BASIC
, data: formData
, processData: false
, contentType: false
})
}
,modify: () => {
if (!fnBiz.validate()) return;
const formData = fnBiz.formSetting('modify');
cmmBizAjax('modify', {
<%--url: '<c:url value="/framework/biz/mng/bbs/modifyBoardBasic.do"/>'--%>
url: frwkApiUrl.MODIFY_BOARD_BASIC
,data: formData
});
}
,remove: () => {
const formData = fnBiz.formSetting('remove');
cmmBizAjax('remove', {
<%--url: '<c:url value="/framework/biz/mng/bbs/removeBoardBasic.do"/>'--%>
url: frwkApiUrl.REMOVE_BOARD_BASIC
,data: formData
});
}
,validate: () => {
if(orgData === $('form').serialize()){
alert('변경된 내용이 없습니다.');
return false;
}
if(!validateBoardBasic(document.getElementById("boardBasic"))) return false;
return true;
}
,formSetting: (e) => {
const formTemp = new FormData($("#boardBasic")[0]);
formTemp.append("bbsId", bbsId);
formTemp.append("jobSeCode", "");
if (e === "add"){
formTemp.append("replyAt", "N");
if(arrFiles.length > 0) arrFiles.forEach((f)=> {
formTemp.append("files", f)
})
}
if (e === "modify"){
if(arrFiles.length > 0) arrFiles.forEach((f)=> {
formTemp.append("files", f)
})
}
if (e === "remove") formTemp.append("useAt", "N");
return formTemp;
}
,fileSelect: (e) => {
const files = e.target.files;
if(arrFiles.length + files.length > maxFileNum){
let msgTemp = "업로드 파일 개수는 최대 " + maxFileNum + "개 등록 가능합니다.";
if(files.length > maxFileNum){
alert(msgTemp + " 다시 입력해주세요.");
e.target.value = "";
return false;
}
if(confirm(msgTemp + " \n 기존에 등록된 자료를 초기화 후 등록하시겠습니까?")) {
arrFiles = [];
preview.innerHTML = "";
}else{
return false;
}
}
fnBiz.fileArray(files, "add");
}
,fileRemove: (e) => {//x버튼 클릭 했을 시
const fileInput = document.getElementById('files');
const removeTargetId = e.dataset.index;
let dataTranster = new DataTransfer();
for(let i = 0; i < arrFiles.length; i++){
if(removeTargetId != arrFiles[i].lastModified + "_" + i) dataTranster.items.add(arrFiles[i]);
}
fileInput.files = dataTranster.files;
$("#"+removeTargetId).remove();
fnBiz.fileArray(fileInput.files, "remove");
}
,fileArray: (files, proc) => {
//초기화
if(proc === "remove") arrFiles = [];
const promise1 = new Promise((resolve) => {
setTimeout(() => {
for(let i=0; i< files.length; i++){
arrFiles.push(files[i]);
}
}, 100);
resolve("Done1");
});
const promise2 = new Promise((resolve) => {
setTimeout(() => {
preview.innerHTML = "";
for (let i=0; i<arrFiles.length; i++) {
preview.innerHTML +=
"<p id='" + arrFiles[i].lastModified + "_" + i + "'> " + arrFiles[i].name
+ "<button data-index='" + arrFiles[i].lastModified + "_" + i + "' onClick='fnBiz.fileRemove(this)' class='file-remove'>X</button> </p>";
}
}, 100);
resolve("Done2");
});
Promise.all([promise1, promise2])
.then((result) => console.log(result))
.catch((e) => console.error(e));
}
};
/**************************************************************************
* event
**************************************************************************/
$(() => {
$(window).on("unload", function (e) {
window.opener?.unblockUI();
return null;
});
$("#btnClose").on('click', () => {
window.opener?.unblockUI();
window.close()
});
$('#btnRegist').on('click', () => {
fnBiz.add();
});
$('#btnModify').on('click', () => {
fnBiz.modify();
});
$('#btnPreview').on('click', () => {
fnBiz.preview();
});
$('#btnRemove').on('click', () => {
fnBiz.remove();
});
$('#files').on('change', function(e) {
fnBiz.fileSelect(e)
});
});
/**************************************************************************
* initialize
**************************************************************************/
$(document).ready(function () {
// $('#ntceBeginDe').datepicker('setDate', new Date());
// $('#ntceEndDe').datepicker('setDate', new Date());
$('#ntceBeginDe').datepicker('setDate', new Date());
$('#ntceEndDe').datepicker('setDate', '99991231');
orgData = $('form').serialize();
});
</script>

@ -14,4 +14,10 @@ const frwkApiUrl = {
/** /**
* framework 업무 API URL * framework 업무 API URL
*/ */
//게시판 - 기본 화면 관리(게시판 기본 양식)
,FIND_BOARD_BASICS: '/framework/biz/mng/bbs/findBoardBasics.do'
,POPUP_BOARD_BASIC: '/framework/biz/mng/bbs/mngBoardBasicMgtPopup.do'
,SAVE_BOARD_BASIC: '/framework/biz/mng/bbs/addBoardBasic.do'
,MODIFY_BOARD_BASIC: '/framework/biz/mng/bbs/modifyBoardBasic.do'
,REMOVE_BOARD_BASIC: '/framework/biz/mng/bbs/removeBoardBasic.do'
} }

Loading…
Cancel
Save