이전글
https://greed-yb.tistory.com/210
Service
- service -> board -> impl -> BoardService(interface 로 생성)
package com.example.practice.service.board;
import com.example.practice.util.SearchCriteria;
import com.example.practice.vo.BoardVo;
import java.util.List;
public interface BoardService {
/**
* 글 목록
*/
List<BoardVo> boardSelect(SearchCriteria cri) throws Exception;
/**
* 게시글 수
*/
int totalCount(SearchCriteria cri);
/**
* 글 저장
*/
void boardCreate(BoardVo vo) throws Exception;
/**
* 게시글 상세 페이지
*/
BoardVo boardRead(Integer num) throws Exception;
/**
* 게시글 삭제
*/
void boardDelete(Integer num) throws Exception;
/**
* 게시글 수정 하기
*/
void boardUpdate(BoardVo vo) throws Exception;
}
ServiceImpl
- service -> board ->BoardServiceImple(BoardService 를 implements 받는다)
package com.example.practice.service.board.impl;
import com.example.practice.mapper.board.BoardMapper;
import com.example.practice.service.board.BoardService;
import com.example.practice.util.SearchCriteria;
import com.example.practice.vo.BoardVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class BoardServiceImpl implements BoardService{
@Autowired
private BoardMapper boardMapper;
@Override
public List<BoardVo> boardSelect(SearchCriteria cri) throws Exception {
return boardMapper.boardSelect(cri);
}
@Override
public int totalCount(SearchCriteria cri) {
return boardMapper.totalCount(cri);
}
@Override
public void boardCreate(BoardVo vo) throws Exception {
boardMapper.boardCreate(vo);
}
@Override
public BoardVo boardRead(Integer num) throws Exception {
return boardMapper.boardRead(num);
}
@Override
public void boardDelete(Integer num) throws Exception {
boardMapper.boardDelete(num);
}
@Override
public void boardUpdate(BoardVo vo) throws Exception {
boardMapper.boardUpdate(vo);
}
}
댓글