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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
| <?xml version="1.0" encoding="UTF-8"?>
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
| <mapper namespace="cn.lili.modules.lmk.mapper.VideoCommentMapper">
|
| <!-- 通用查询映射结果 -->
| <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.VideoCommentVO">
| <id column="id" property="id"/>
| <result column="video_id" property="videoId" />
| <result column="comment_content" property="commentContent" />
| <result column="reply_id" property="replyId" />
| <result column="reply_user_id" property="replyUserId" />
| <result column="reply_user_nickname" property="replyUserNickname" />
| <result column="reply_user_avatar" property="replyUserAvatar" />
| <result column="master_comment_id" property="masterCommentId" />
| <result column="status" property="status" />
| <result column="create_by" property="userId" />
| <result column="user_nickname" property="userNickname" />
| <result column="user_avatar" property="userAvatar" />
| <result column="create_time" property="createTime" />
| <result column="replyTotalCount" property="replyTotalCount" />
| </resultMap>
|
|
|
|
|
|
|
| <select id="getById" resultMap="BaseResultMap">
| SELECT
| LVC.video_id,
| LVC.comment_content,
| LVC.reply_id,
| LVC.reply_user_id,
| LVC.reply_user_nickname,
| LVC.master_comment_id,
| LVC.status,
| LVC.id,
| LVC.create_by,
| LVC.user_nickname,
| LVC.user_avatar,
| LVC.create_time
| FROM
| lmk_video_comment LVC
| WHERE
| LVC.id = #{id} AND LVC.delete_flag = 0
| </select>
|
|
| <select id="getPage" resultMap="BaseResultMap">
| SELECT
| LVC.video_id,
| LVC.comment_content,
| LVC.reply_id,
| LVC.reply_user_id,
| LVC.reply_user_nickname,
| LVC.master_comment_id,
| LVC.status,
| LVC.id,
| LVC.create_by,
| LVC.user_nickname,
| LVC.user_avatar,
| LVC.create_time
| FROM
| lmk_video_comment LVC
| WHERE
| LVC.delete_flag = 0
| </select>
|
|
| <select id="masterCommentPage" resultMap="BaseResultMap">
| SELECT
| LVC.video_id,
| LVC.comment_content,
| LVC.reply_id,
| LVC.reply_user_id,
| LVC.reply_user_nickname,
| LVC.reply_user_avatar,
| LVC.master_comment_id,
| LVC.status,
| LVC.id,
| LVC.create_by,
| LVC.user_nickname,
| LVC.user_avatar,
| LVC.create_time,
| COUNT(replies.id) as replyTotalCount
| FROM
| lmk_video_comment LVC
| LEFT JOIN
| lmk_video_comment replies ON replies.master_comment_id = LVC.id
| AND replies.status = 'normal'
| AND replies.delete_flag = 0
| WHERE
| LVC.master_comment_id IS NULL
| AND LVC.video_id = #{query.videoId}
| AND LVC.status = 'normal'
| AND LVC.delete_flag = 0
| GROUP BY
| LVC.id, LVC.video_id, LVC.comment_content, LVC.reply_id,
| LVC.reply_user_id, LVC.reply_user_nickname, LVC.master_comment_id,
| LVC.status, LVC.create_by, LVC.user_nickname, LVC.user_avatar, LVC.create_time
| ORDER BY
| LVC.create_time DESC
| </select>
|
| <select id="replyCommentPage" resultMap="BaseResultMap">
| SELECT
| LVC.video_id,
| LVC.comment_content,
| LVC.reply_id,
| LVC.reply_user_id,
| LVC.reply_user_nickname,
| LVC.reply_user_avatar,
| LVC.master_comment_id,
| LVC.status,
| LVC.id,
| LVC.create_by,
| LVC.user_nickname,
| LVC.user_avatar,
| LVC.create_time,
| 0 as replyTotalCount
| FROM
| lmk_video_comment LVC
| WHERE
| LVC.video_id = #{query.videoId}
| AND LVC.master_comment_id = #{query.masterCommentId}
| AND LVC.status = 'normal'
| AND LVC.delete_flag = 0
| ORDER BY
| LVC.create_time ASC
| </select>
|
| <select id="countNumGroupByVideo" resultType="cn.lili.modules.lmk.domain.vo.CollectTypeNumVO">
| SELECT
| video_id as id,
| COUNT(*) as countNum
| FROM
| lmk_video_comment
| WHERE
| delete_flag = 0 AND status = 'normal'
| GROUP BY
| video_id
| </select>
|
| </mapper>
|
|