반응형
1. BoardMapper
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
|
package com.test.taewon.model.dao;
import java.util.List;
public interface BoardMapper {
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);
void replyShape(Board board);
// List<Board> search(@Param("search") String search,@Param("type") String type);
List<Board> search(@Param("search") String search,@Param("type") String type);
int getBoardListCnt();
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
2. CommentMapper
1
2
3
4
5
6
7
8
9
10
11
12
|
package com.test.taewon.model.dao;
import java.util.List;
public interface CommentMapper {
void insert(Comment comment);
List<Comment> selectAll(int comment);
void delete(int comment);
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
3. MemberMapper
1
2
3
4
5
6
7
8
9
10
|
package com.test.taewon.model.dao;
public interface MemberMapper {
Boardmember checkMember(Boardmember member);
void registerMember(Boardmember member);
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
1. BoardMapper xml
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
71
|
<?xml version="1.0" encoding="UTF-8"?>
<select id="selectAll" resultType="board">
select * from board
order by bGroup desc, bStep asc
limit #{startList}, #{listSize}
</select>
<select id="getBoardListCnt" resultType="int">
select count(*) listCnt
from board
</select>
<insert id="insert" parameterType="board">
insert into board (bUsername, bTitle, bContent, bDate, bHit, bGroup, bIndent, bStep)
values (#{bUsername}, #{bTitle}, #{bContent}, now(), 0,
(select max(boardId)+1 from board bo), 0, 0)
</insert>
<select id="select" parameterType="board" resultType="Board">
select * from board
where boardId = #{boardId}
</select>
<update id="update" parameterType="board">
update board
set bTitle = #{bTitle}, bContent = #{bContent}
where boardId = #{boardId}
</update>
<delete id="delete" parameterType="board">
delete from board
where boardId = #{boardId}
</delete>
<update id="hit" parameterType="int">
update board
set bHit = bHit +1
where boardId = #{boardId}
</update>
<insert id="reply" parameterType="board">
insert into board(bUsername, bTitle, bContent, bDate, bHit, bGroup, bIndent, bStep)
values(#{bUsername}, #{bTitle}, #{bContent}, now(), 0, #{bGroup}, #{bIndent} + 1, #{bStep} +1)
</insert>
<update id="replyShape" parameterType="board">
update board
set bStep = #{bStep} + 1
where bGroup = #{bGroup} and bStep > #{bStep}
</update>
<select id="search" parameterType="map" resultType="board">
<!-- <bind name="result" value="'%' + #{search} + '%'"/> -->
select * from board
<trim prefix="where" prefixOverrides="and|or">
<if test="type==btitle">
and btitle like concat('%',#{search},'%')
</if>
<if test="type==bcontent">
and bcontent like concat('%',#{search},'%')
</if>
</trim>
<!-- where #{type} like concat('%',#{search},'%') -->
<!-- select("*"); -->
<!-- from("board"); -->
<!-- where("#{type} like '%' #{search} '%'"); -->
</select>
</mapper>
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
2. CommentMapper xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<?xml version="1.0" encoding="UTF-8"?>
<select id="selectAll" parameterType="int" resultType="comment">
select * from comment
where boardId = #{boardId}
order by commentId desc
</select>
<insert id="insert" parameterType="comment">
insert into comment(boardId, username, content, cDate, cGroup, cIndent, cStep, cLike)
values(#{boardId}, #{username}, #{content}, now(), (select max(commentId) from comment co) +1, 0, 0, 0)
</insert>
<delete id="delete" parameterType="int">
delete from comment
where commentId = #{commentId}
</delete>
</mapper>
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
3. MemberMapper xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<?xml version="1.0" encoding="UTF-8"?>
<select id="checkMember" parameterType="Boardmember" resultType="Boardmember">
select * from Boardmember
where username = #{username} and password = #{password}
</select>
<insert id="registerMember" parameterType="Boardmember">
insert into boardmember (username, password, email, gender, birthday, joinDate)
values (#{username}, #{password}, #{email}, #{gender}, #{birthday}, now())
</insert>
</mapper>
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
반응형
'IT > ETC' 카테고리의 다른 글
Controller (1) | 2019.11.14 |
---|---|
Service interface + ServiceImpl class (0) | 2019.11.14 |
Paging (0) | 2019.11.14 |
게시판 DTO (3) | 2019.11.14 |
Caleb Curry's Database design course (0) | 2019.11.08 |