조회수 증가 ,게시판 수정
This commit is contained in:
parent
67551b54b0
commit
1312ac6b5d
@ -187,7 +187,10 @@ public class BoardController {
|
||||
@GetMapping("/{boardId}")
|
||||
public ApiResponse<MapDto> getBoardDetail(@PathVariable("boardId") Long boardId) {
|
||||
log.info("Fetching details for board ID: {}", boardId);
|
||||
|
||||
|
||||
// 조회수 증가
|
||||
boardService.incrementViewCount(boardId);
|
||||
|
||||
// 게시물 상세정보 조회
|
||||
MapDto boardDetail = boardService.getBoardDetail(boardId);
|
||||
if (boardDetail == null) {
|
||||
|
||||
@ -15,7 +15,10 @@ public interface localbordMapper {
|
||||
|
||||
// 자유/비밀 게시판 조회
|
||||
List<MapDto> getGeneralPosts(MapDto map);
|
||||
|
||||
|
||||
// 조회수 증가
|
||||
void incrementViewCount(Long boardId);
|
||||
|
||||
// 게시물 작성
|
||||
void createBoard(MapDto map);
|
||||
|
||||
|
||||
@ -33,7 +33,11 @@ public class localbordService {
|
||||
|
||||
return PageUtil.redefineNavigation(new PageInfo<>(result, size));
|
||||
}
|
||||
|
||||
|
||||
// 게시글 조회수 증가
|
||||
public void incrementViewCount(Long boardId) {
|
||||
boardMapper.incrementViewCount(boardId);
|
||||
}
|
||||
|
||||
public BigInteger createBoard(MapDto map) {
|
||||
boardMapper.createBoard(map); // 게시물 작성
|
||||
|
||||
@ -8,7 +8,8 @@
|
||||
LOCBRDSEQ AS id,
|
||||
LOCBRDTTL AS title,
|
||||
LOCBRDCON AS content,
|
||||
LOCBRDRDT AS date
|
||||
LOCBRDUDT AS date,
|
||||
LOCBRDCNT AS cnt
|
||||
FROM localbord
|
||||
WHERE LOCBRDTYP = 'N'
|
||||
<if test="searchKeyword != null and searchKeyword != ''">
|
||||
@ -23,7 +24,8 @@
|
||||
LOCBRDSEQ AS id,
|
||||
LOCBRDTTL AS title,
|
||||
LOCBRDCON AS content,
|
||||
LOCBRDRDT AS date
|
||||
LOCBRDUDT AS date,
|
||||
LOCBRDCNT AS cnt
|
||||
FROM localbord
|
||||
WHERE LOCBRDTYP IN ('F', 'S')
|
||||
<if test="searchKeyword != null and searchKeyword != ''">
|
||||
@ -31,9 +33,11 @@
|
||||
</if>
|
||||
ORDER BY LOCBRDUDT DESC
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
<update id="incrementViewCount">
|
||||
UPDATE localbord SET LOCBRDCNT = LOCBRDCNT + 1 WHERE LOCBRDSEQ = #{LOCBRDSEQ}
|
||||
</update>
|
||||
|
||||
<!-- 게시물 작성 -->
|
||||
<insert id="createBoard" parameterType="map" useGeneratedKeys="true" keyProperty="LOCBRDSEQ">
|
||||
INSERT INTO localbord (LOCBRDTTL, LOCBRDCON, LOCBRDCAT, MEMBERSEQ, LOCBRDCNT, LOCBRDRDT, LOCBRDUDT, LOCBRDPWD, LOCBRDTYP)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user