본문 바로가기

IT/ETC

Service interface + ServiceImpl class

반응형

1. a. Board interface

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
 
 
public interface BoardService {
 
    List<Board> selectAll(Pagination pagination);
    void insert(Board board);
    Board select(Board board);
    void delete(Board board);
    void update(Board board);
    void hit(int board);
    void reply(Board board);
    List<Board> search(String search, String type);
    
    public int getBoardListCnt() throws Exception;
}
 
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
 

b. BoardServiceImpl

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
 
 
import org.springframework.stereotype.Service;
 
 
@Service
public class BoardServiceImpl implements BoardService{
 
    @Autowired
    BoardMapper boardMapper;
 
    @Override
    public List<Board> selectAll(Pagination pagination) {
        
        return boardMapper.selectAll(pagination);
    }
 
    @Override
    public void insert(Board board) {
    }
 
    @Override
    public Board select(Board board) {
        return boardMapper.select(board);
    }
 
    @Override
    public void delete(Board board) {
    }
 
    @Override
    public void update(Board board) {
    }
 
    @Override
    public void hit(int board) {
        boardMapper.hit(board);
    }
 
    @Override
    public void reply(Board board) {
        boardMapper.replyShape(board);
    }
 
    @Override
    public List<Board> search(String search, String type) {
        System.out.println(search + type);
        System.out.println("its boardserviceimpl" + boardMapper.search(search, type));
        return boardMapper.search(search, type);
    }
    
    @Override
    public int getBoardListCnt() throws Exception {
        return boardMapper.getBoardListCnt();
    }
    
    
}
 
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
 

2.a. CommentServic interface

1
2
3
4
5
6
7
8
9
10
11
12
 
 
 
public interface CommentService {
    List<Comment> selectAll(int boardId);
    void insert(Comment comment);
    void delete(int comment);
}
 
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
 

b. commentserviceimpl 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 
 
import org.springframework.stereotype.Service;
 
 
@Service
public class CommentServiceImpl implements CommentService{
 
    @Autowired
    CommentMapper commentMapper;
 
    @Override
    public List<Comment> selectAll(int comment) {
        return commentMapper.selectAll(comment);
    }
 
    @Override
    public void insert(Comment comment) {
    }
 
    @Override
    public void delete(int comment) {
    }
    
    
}
 
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
 

3. a. MemberService interface

1
2
3
4
5
6
7
8
9
 
 
public interface MemberService {
    boolean checkMember(Boardmember member);
    void registerMember(Boardmember member);
}
 
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
 

b. MemberServiceImpl 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
import org.springframework.stereotype.Service;
 
 
@Service
public class MemberServiceImpl implements MemberService{
 
    @Autowired
    MemberMapper memberMapper;
    
    @Override
    public boolean checkMember(Boardmember member) {
        return memberMapper.checkMember(member) != null;
    }
 
    @Override
    public void registerMember(Boardmember member) {
        memberMapper.registerMember(member);
    }
    
}
 
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
 

 

반응형

'IT > ETC' 카테고리의 다른 글

Settings  (0) 2019.11.14
Controller  (1) 2019.11.14
Paging  (0) 2019.11.14
Mapper interface + Mapper xml  (0) 2019.11.14
게시판 DTO  (3) 2019.11.14