CommentMapper.xml
2.14 KB
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
<?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="com.server.web.common.mapping.CommentMapper" >
    <select id="commentList" resultType="java.util.HashMap">
        SELECT
            t.id,
            t.create_dt AS createDt,
            t.reply_content AS replyContent,
            u.full_name AS fullName,
            u.head_photo AS headPhoto
        FROM
            t_kzy_comment t
        LEFT JOIN t_kzy_user u ON t.user_id = u.id AND t.type = 2
        WHERE
            t.is_delete = 0 AND t.auth_status=2 AND t.type=2
        AND t.relation_id = #{courseId,jdbcType=BIGINT}
        ORDER BY
            t.id ASC
        LIMIT #{start,jdbcType=INTEGER},#{pageSize,jdbcType=INTEGER}
    </select>
    <select id="commentListTotal" resultType="java.lang.Integer">
        SELECT
            count(t.id)
        FROM
            t_kzy_comment t
        LEFT JOIN t_kzy_user u ON t.user_id = u.id AND t.type = 2
        WHERE
            t.is_delete = 0 AND t.auth_status=2 AND t.type=2
        AND t.relation_id = #{courseId,jdbcType=BIGINT}
    </select>
    <select id="informationCommentList" resultType="java.util.HashMap">
        SELECT
            t.id,
            t.create_dt AS createDt,
            t.reply_content AS replyContent,
            u.full_name AS fullName,
            u.head_photo AS headPhoto
        FROM
            t_kzy_comment t
        LEFT JOIN t_kzy_user u ON t.user_id = u.id AND t.type = 1
        WHERE
            t.is_delete = 0 AND t.auth_status=2 AND t.type=1
        AND t.relation_id = #{informationId,jdbcType=BIGINT}
        ORDER BY
            t.id ASC
        LIMIT #{start,jdbcType=INTEGER},#{pageSize,jdbcType=INTEGER}
    </select>
    <select id="informationCommentListTotal" resultType="java.lang.Integer">
        SELECT
            count(t.id)
        FROM
            t_kzy_comment t
        LEFT JOIN t_kzy_user u ON t.user_id = u.id AND t.type = 1
        WHERE
            t.is_delete = 0 AND t.auth_status=2 AND t.type=1
        AND t.relation_id = #{informationId,jdbcType=BIGINT}
    </select>
</mapper>