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

@ -34,9 +34,25 @@ public class BoardBasicMgtService implements IBoardBasicMgtService {
return mapper.selectBoardBasic(t);
}
@Override
@Transactional(readOnly = true)
public <T> XitBasicBbsMngVO findBoardMaster(final T t) {
return mapper.selectBoardMaster(t);
}
@Override
@Transactional
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());
mapper.insertBoardBasic(vo);
}

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

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

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

@ -14,7 +14,7 @@
<result column="frstRegisterNm" property="frstRegisterNm" />
<result column="frstRegisterPnttm" property="frstRegisterPnttm" />
<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="use_at" property="useAt" />
<result column="atch_file_id" property="atchFileId" />

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

@ -6,113 +6,169 @@
<!-- *************************************************************************************************************
* xit_bbs_basic : 게시판 기본
************************************************************************************************************** -->
<sql id="sqlBoardBasic">
SELECT xb.NTT_SJ AS "nttSj"
,xb.NTCR_ID AS "ntcrId"
,xb.NTCR_NM AS "ntcrNm"
,xb.NTT_NO AS "nttNo"
,xb.NTT_CN AS "nttCn"
,xb.PASSWORD AS "password"
,xb.FRST_REGISTER_ID AS "frstRegisterId"
,IFNULL (B.USER_NM, xb.NTCR_NM) AS "frstRegisterNm"
,DATE_FORMAT(xb.FRST_REGIST_PNTTM, '%Y-%m-%d') AS "frstRegisterPnttm"
,xb.NTCE_BEGIN_DE AS "ntceBgnde"
,xb.NTCE_END_DE AS "ntceEndde"
,xb.RDCNT AS "inqireCo"
,xb.USE_AT AS "useAt"
,xb.ATCH_FILE_ID AS "atchFileId"
,xb.BBS_ID AS "bbsId"
,xb.NTT_ID AS "nttId"
,xb.PARNTS_SNTNC_NO AS "parnts"
,xb.ANSWER_AT AS "replyAt"
,xb.ANSWER_LC AS "replyLc"
,xb.SORT_ORDR AS "sortOrdr"
,C.BBS_TY_CODE AS "bbsTyCode"
,C.BBS_ATTRB_CODE AS "bbsAttrbCode"
,C.REPLY_POSBL_AT AS "replyPosblAt"
,C.FILE_ATCH_POSBL_AT AS "fileAtchPosblAt"
,C.ATCH_POSBL_FILE_NUMBER AS "posblAtchFileNumber"
,C.BBS_NM AS "bbsNm"
FROM XIT_BBS xb
LEFT OUTER JOIN XIT_VW_USER_MASTR xvum ON xb.FRST_REGISTER_ID = B.ESNTL_ID
LEFT OUTER JOIN XIT_BBS_MASTR C ON xb.BBS_ID = C.BBS_ID
<sql id="sqlBoardMaster">
, xbm.bbs_ty_code
, xbm.bbs_attrb_code
, xbm.reply_posbl_at
, xbm.file_atch_posbl_at
, xbm.atch_posbl_file_number
, xbm.bbs_nm
</sql>
<sql id="sqlBoardBasic">
SELECT xb.ntt_sj
, xb.ntcr_id
, xb.ntcr_nm
, xb.ntt_no
, xb.ntt_cn
, xb.password
, xb.frst_register_id
, IFNULL (xvum.user_nm, xb.ntcr_nm) AS "frstRegisterNm"
, xb.frst_regist_pnttm
, xb.ntce_begin_de
, xb.ntce_end_de
, xb.rdcnt AS "inqireco"
, xb.use_at
, xb.atch_file_id
, xb.bbs_id
, xb.ntt_id
, xb.parnts_sntnc_no AS "parnts"
, xb.answer_at AS "replyat"
, 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>
<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"/>
<where>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(useAt)">
AND xbm.use_at = #{useAt}
AND xb.bbs_id = #{bbsId}
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 test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(bbsNm)">
AND INSTR(xbm.bbs_nm, #{bbsNm}) > 0
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(nttCn)">
AND xb.ntt_cn LIKE CONCAT('%',#{nttCn},'%')
</if>
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(bbsTyCodeNm)">
AND INSTR(cdc.code_nm, #{bbsTyCodeNm}) > 0
<if test="@kr.xit.framework.core.utils.XitCmmnUtil@notEmpty(ntcrNm)">
AND xvum.user_nm LIKE CONCAT('%',#{ntcrNm},'%')
</if>
</where>
ORDER BY xbm.frst_regist_pnttm DESC
ORDER BY xb.frst_regist_pnttm DESC
</select>
<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"/>
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 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">
/* 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
INTO xit_bbs_mastr (
bbs_id
, bbs_nm
, bbs_intrcn
, bbs_ty_code
, bbs_attrb_code
, atch_posbl_file_number
, atch_posbl_file_size
, tmplat_id
, use_at
, frst_regist_pnttm
, frst_register_id
INTO xit_bbs (
ntt_id
, bbs_id
, ntt_no
, ntt_sj
, ntt_cn
, answer_at
, parnts_sntnc_no
, answer_lc
, sort_ordr
, rdcnt
, ntce_begin_de
, ntce_end_de
, ntcr_id
, ntcr_nm
, password
, atch_file_id
, frst_regist_pnttm
, frst_register_id
) VALUES (
#{bbsId}
, #{bbsNm}
, #{bbsIntrcn}
, #{bbsTyCode}
, #{bbsAttrbCode}
, #{atchPosblFileNumber}
, #{atchPosblFileSize}
, #{tmplatId}
, #{useAt}
, NOW()
, #{frstRegisterId}
#{nttId}
, #{bbsId}
, #{nttNo}
, #{nttSj}
, #{nttCn}
, #{answerAt}
, #{parntsSntncNo}
, #{answerLc}
, #{sortOrdr}
, 0
, #{ntceBeginDe}
, #{ntceEndDe}
, #{ntcrId}
, #{ntcrNm}
, #{password}
, #{atchFileId}
, NOW()
, #{frstRegisterId}
)
</insert>
<update id="updateBoardBasic">
/* board-mastr-mysql-mapper|updateBoardBasic-BBS 마스터(생성) 정보 변경|julim */
UPDATE xit_bbs_mastr
SET bbs_nm = IF(bbs_nm = #{bbsNm}, bbs_nm, #{bbsNm})
, bbs_intrcn = IF(bbs_intrcn = #{bbsIntrcn}, bbs_intrcn, #{bbsIntrcn})
, bbs_ty_code = IF(bbs_ty_code = #{bbsTyCode}, bbs_ty_code, #{bbsTyCode})
, bbs_attrb_code = IF(bbs_attrb_code = #{bbsAttrbCode}, bbs_attrb_code, #{bbsAttrbCode})
, atch_posbl_file_number = IF(atch_posbl_file_number = #{atchPosblFileNumber}, atch_posbl_file_number, #{atchPosblFileNumber})
, atch_posbl_file_size = IF(atch_posbl_file_size = #{atchPosblFileSize}, atch_posbl_file_size, #{atchPosblFileSize})
, tmplat_id = IF(tmplat_id = #{tmplatId}, tmplat_id, #{tmplatId})
, use_at = IF(use_at = #{useAt}, use_at, #{useAt})
, last_updt_pnttm = NOW()
, last_updusr_id = #{lastUpdusrId}
WHERE bbs_id = #{bbsId}
/* board-mastr-mysql-mapper|updateBoardBasic-BBS 기본(생성) 정보 변경|sjh88 */
UPDATE xit_bbs
SET ntt_sj = IF(ntt_sj = #{nttSj}, ntt_sj, #{nttSj})
, ntt_cn = IF(ntt_cn = #{nttCn}, ntt_cn, #{nttCn})
, sort_ordr = IF(sort_ordr = #{sortOrdr}, sort_ordr, #{sortOrdr})
, ntce_begin_de = IF(ntce_begin_de = #{ntceBeginDe}, ntce_begin_de, #{ntceBeginDe})
, ntce_end_de = IF(ntce_end_de = #{ntceEndDe}, ntce_end_de, #{ntceEndDe})
, ntcr_id = IF(ntcr_id = #{ntcrId}, ntcr_id, #{ntcrId})
, ntcr_nm = IF(ntcr_nm = #{ntcrNm}, ntcr_nm, #{ntcrNm})
, password = IF(password = #{password}, password, #{password})
, atch_file_id = IF(atch_file_id = #{atchFileId}, atch_file_id, #{atchFileId})
, last_updt_pnttm = NOW()
, last_updusr_id = #{lastUpdusrId}
WHERE bbs_id = #{bbsId}
AND ntt_id = #{nttId}
</update>
<delete id="deleteBoardBasic">
/* board-mastr-mysql-mapper|deleteBoardBasic-BBS 마스터(생성) 정보 삭제|julim */
DELETE
FROM xit_bbs_mastr
WHERE bbs_id = #{bbsId}
</delete>
</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
*/
//게시판 - 기본 화면 관리(게시판 기본 양식)
,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