게시판 관리 리스트
parent
e3c91a9449
commit
36d9d28d9d
|
|
@ -1,13 +1,184 @@
|
||||||
import React from 'react';
|
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
||||||
|
import { Link, useLocation } from 'react-router-dom';
|
||||||
|
|
||||||
|
import * as EgovNet from 'api/egovFetch';
|
||||||
|
import URL from 'constants/url';
|
||||||
|
|
||||||
function List(props) {
|
import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin';
|
||||||
|
import EgovPaging from 'components/EgovPaging';
|
||||||
|
|
||||||
|
import { itemIdxByPage } from 'utils/calc';
|
||||||
|
|
||||||
|
function EgovAdminBoardList(props) {
|
||||||
|
console.group("EgovAdminBoardList");
|
||||||
|
console.log("[Start] EgovAdminBoardList ------------------------------");
|
||||||
|
console.log("EgovAdminBoardList [props] : ", props);
|
||||||
|
|
||||||
|
const location = useLocation();
|
||||||
|
console.log("EgovAdminBoardList [location] : ", location);
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
const [searchCondition, setSearchCondition] = useState(location.state?.searchCondition || { pageIndex: 1, searchCnd: '0', searchWrd: '' });// 기존 조회에서 접근 했을 시 || 신규로 접근 했을 시
|
||||||
|
const [paginationInfo, setPaginationInfo] = useState({});
|
||||||
|
|
||||||
|
const [listTag, setListTag] = useState([]);
|
||||||
|
|
||||||
|
const retrieveList = useCallback(() => {
|
||||||
|
console.groupCollapsed("AdminBoardList.retrieveList()");
|
||||||
|
|
||||||
|
const retrieveListURL = '/admin/boards/board-list';
|
||||||
|
|
||||||
|
const requestOptions = {
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
'Content-type': 'application/json',
|
||||||
|
|
||||||
|
},
|
||||||
|
body: JSON.stringify()
|
||||||
|
}
|
||||||
|
|
||||||
|
EgovNet.requestFetch(retrieveListURL,
|
||||||
|
requestOptions,
|
||||||
|
(resp) => {
|
||||||
|
|
||||||
|
let mutListTag = [];
|
||||||
|
listTag.push(<p className="no_data" key="0">검색된 결과가 없습니다.</p>); // 게시판 목록 초기값
|
||||||
|
|
||||||
|
// 리스트 항목 구성
|
||||||
|
resp.result.boardList.forEach(function (item, index) {
|
||||||
|
if (index === 0) mutListTag = []; // 목록 초기화
|
||||||
|
|
||||||
|
mutListTag.push(
|
||||||
|
<Link className="list_item">
|
||||||
|
<div>{item.bbsSeq}</div>
|
||||||
|
<div>{item.bbsId}</div>
|
||||||
|
<div>{item.bbsTitle}</div>
|
||||||
|
<div>{item.frstCrtId}</div>
|
||||||
|
<div>{item.frstCrtDt}</div>
|
||||||
|
<div>{item.lastChgDt}</div>
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
setListTag(mutListTag);
|
||||||
|
console.log("@@@ resp : ");
|
||||||
|
},
|
||||||
|
function (resp) {
|
||||||
|
console.log("err response : ", resp);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
console.groupEnd("EgovAdminBoardList.retrieveList()");
|
||||||
|
},[]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
retrieveList(searchCondition);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
console.log("------------------------------EgovAdminBoardList [End]");
|
||||||
|
console.groupEnd("EgovAdminBoardList");
|
||||||
return (
|
return (
|
||||||
<div className="container">
|
<div className="container">
|
||||||
List
|
<div className="c_wrap">
|
||||||
|
{/* <!-- Location --> */}
|
||||||
|
<div className="location">
|
||||||
|
<ul>
|
||||||
|
<li><Link to={URL.MAIN} className="home">Home</Link></li>
|
||||||
|
<li><Link to={URL.ADMIN}>사이트관리</Link></li>
|
||||||
|
<li>게시판생성 관리</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{/* <!--// Location --> */}
|
||||||
|
|
||||||
|
<div className="layout">
|
||||||
|
{/* <!-- Navigation --> */}
|
||||||
|
<EgovLeftNav></EgovLeftNav>
|
||||||
|
{/* <!--// Navigation --> */}
|
||||||
|
|
||||||
|
<div className="contents BOARD_CREATE_LIST" id="contents">
|
||||||
|
{/* <!-- 본문 --> */}
|
||||||
|
|
||||||
|
<div className="top_tit">
|
||||||
|
<h1 className="tit_1">사이트관리</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h2 className="tit_2">게시판생성 관리</h2>
|
||||||
|
|
||||||
|
{/* <!-- 검색조건 --> */}
|
||||||
|
{/*<div className="condition">
|
||||||
|
<ul>
|
||||||
|
<li className="third_1 L">
|
||||||
|
<span className="lb">검색유형선택</span>
|
||||||
|
<label className="f_select" htmlFor="searchCnd">
|
||||||
|
<select id="searchCnd" name="searchCnd" title="검색유형선택" ref={cndRef}
|
||||||
|
onChange={e => {
|
||||||
|
cndRef.current.value = e.target.value;
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<option value="0">게시판명</option>
|
||||||
|
<option value="1">게시판유형</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
<li className="third_2 R">
|
||||||
|
<span className="lb">검색어</span>
|
||||||
|
<span className="f_search w_400">
|
||||||
|
<input type="text" name="" defaultValue={searchCondition && searchCondition.searchWrd} placeholder="" ref={wrdRef}
|
||||||
|
onChange={e => {
|
||||||
|
wrdRef.current.value = e.target.value;
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<button type="button"
|
||||||
|
onClick={() => {
|
||||||
|
retrieveList({ ...searchCondition, pageIndex: 1, searchCnd: cndRef.current.value, searchWrd: wrdRef.current.value });
|
||||||
|
}}>조회</button>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<Link to={URL.ADMIN_BOARD_CREATE} className="btn btn_blue_h46 pd35">등록</Link>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>*/}
|
||||||
|
{/* <!--// 검색조건 --> */}
|
||||||
|
|
||||||
|
{/* <!-- 게시판목록 --> */}
|
||||||
|
<div className="board_list BRD006">
|
||||||
|
<div className="head">
|
||||||
|
<span>번호</span>
|
||||||
|
<span>아이디</span>
|
||||||
|
<span>제목</span>
|
||||||
|
<span>작성자</span>
|
||||||
|
<span>작성일</span>
|
||||||
|
<span>수정일</span>
|
||||||
|
</div>
|
||||||
|
<div className="result">
|
||||||
|
{listTag}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/* <!--// 게시판목록 --> */}
|
||||||
|
|
||||||
|
<div className="board_bot">
|
||||||
|
{/* <!-- Paging --> */}
|
||||||
|
{/*<EgovPaging pagination={paginationInfo} moveToPage={passedPage => {
|
||||||
|
retrieveList({ ...searchCondition, pageIndex: passedPage, searchCnd: cndRef.current.value, searchWrd: wrdRef.current.value })
|
||||||
|
}} />*/}
|
||||||
|
{/* <!--/ Paging --> */}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* <!--// 본문 --> */}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default List;
|
export default EgovAdminBoardList;
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.dbnt.kcscbackend.admin.boards;
|
||||||
|
|
||||||
|
import com.dbnt.kcscbackend.admin.boards.service.AdminBoardsService;
|
||||||
|
import com.dbnt.kcscbackend.config.common.BaseController;
|
||||||
|
import com.dbnt.kcscbackend.config.common.ResultVO;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
|
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping("/admin/boards")
|
||||||
|
@Tag(name="AdminBoardsController", description = "사이트관리 게시판현황")
|
||||||
|
public class AdminBoardsController extends BaseController {
|
||||||
|
|
||||||
|
private final AdminBoardsService adminBoardsService;
|
||||||
|
|
||||||
|
@Operation(
|
||||||
|
summary = "게시판 목록 조회",
|
||||||
|
description = "게시판 목록 조회",
|
||||||
|
tags = {"AdminBoardsController"}
|
||||||
|
)
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "조회 성공"),
|
||||||
|
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||||
|
})
|
||||||
|
@RequestMapping(method = RequestMethod.GET, value = "/board-list", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResultVO getBoardList() throws Exception {
|
||||||
|
ResultVO resultVO = new ResultVO();
|
||||||
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
|
|
||||||
|
resultMap.put("boardList", adminBoardsService.selectBoardList());
|
||||||
|
resultVO.setResult(resultMap);
|
||||||
|
return resultVO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
package com.dbnt.kcscbackend.admin.boards.entity;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.annotations.DynamicInsert;
|
||||||
|
import org.hibernate.annotations.DynamicUpdate;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@NoArgsConstructor
|
||||||
|
@DynamicInsert
|
||||||
|
@DynamicUpdate
|
||||||
|
@Table(name = "tn_bbs")
|
||||||
|
public class TnBbs {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "bbs_seq")
|
||||||
|
private Long bbsSeq;
|
||||||
|
|
||||||
|
@Column(name = "bbs_id", nullable = false)
|
||||||
|
private String bbsId;
|
||||||
|
|
||||||
|
@Column(name = "bbs_title", nullable = false)
|
||||||
|
private String bbsTitle;
|
||||||
|
|
||||||
|
@Column(name = "bbs_desc")
|
||||||
|
private String bbsDesc;
|
||||||
|
|
||||||
|
@Column(name = "bbs_type")
|
||||||
|
private String bbsType;
|
||||||
|
|
||||||
|
@Column(name = "bbs_ans_yn", nullable = false)
|
||||||
|
private char bbsAnsYn;
|
||||||
|
|
||||||
|
@Column(name = "bbs_repl_yn", nullable = false)
|
||||||
|
private char bbsReplYn;
|
||||||
|
|
||||||
|
@Column(name = "read_role_grp_id")
|
||||||
|
private String readRoleGrpId;
|
||||||
|
|
||||||
|
@Column(name = "write_role_grp_id")
|
||||||
|
private String writeRoleGrpId;
|
||||||
|
|
||||||
|
@Column(name = "sec_role_grp_id")
|
||||||
|
private String secRoleGrpId;
|
||||||
|
|
||||||
|
@Column(name = "frst_crt_id", nullable = false)
|
||||||
|
private String frstCrtId;
|
||||||
|
|
||||||
|
@Column(name = "frst_crt_dt", nullable = false)
|
||||||
|
private LocalDate frstCrtDt;
|
||||||
|
|
||||||
|
@Column(name = "last_chg_id")
|
||||||
|
private String lastChgId;
|
||||||
|
|
||||||
|
@Column(name = "last_chg_dt")
|
||||||
|
private LocalDate lastChgDt;
|
||||||
|
|
||||||
|
@Column(name = "use_yn", nullable = false)
|
||||||
|
private char useYn;
|
||||||
|
|
||||||
|
@Column(name = "oldd_seq")
|
||||||
|
private Long olddSeq;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.dbnt.kcscbackend.admin.boards.repository;
|
||||||
|
|
||||||
|
import com.dbnt.kcscbackend.admin.boards.entity.TnBbs;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface TnBbsRepository extends JpaRepository<TnBbs, Long> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.dbnt.kcscbackend.admin.boards.service;
|
||||||
|
|
||||||
|
import com.dbnt.kcscbackend.admin.boards.entity.TnBbs;
|
||||||
|
import com.dbnt.kcscbackend.admin.boards.repository.TnBbsRepository;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AdminBoardsService extends EgovAbstractServiceImpl {
|
||||||
|
|
||||||
|
private final TnBbsRepository tnBbsRepository;
|
||||||
|
|
||||||
|
public List<TnBbs> selectBoardList() { return tnBbsRepository.findAll(); }
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue