cloudroam
2025-06-05 f7bb788026db3bb43e1156ce71b82ecaf8e75c32
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
<?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.mzl.flower.mapper.film.CommentPoExMapper">
    <resultMap id="BaseResultMap" type="com.mzl.flower.entity.film.CommentPo">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="parent_id" jdbcType="INTEGER" property="parentId"/>
        <result column="content" jdbcType="VARCHAR" property="content"/>
        <result column="film_id" jdbcType="INTEGER" property="filmId"/>
        <result column="state" jdbcType="BIT" property="state"/>
        <result column="deleted" jdbcType="BIT" property="deleted"/>
        <result column="create_by" jdbcType="BIGINT" property="createBy"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
    </resultMap>
 
    <sql id="Base_Column_List">
        film_comments.id, film_comments.parent_id, film_comments.content, film_comments.film_id, film_comments.`state`, film_comments.deleted,
        film_comments.create_by, film_comments.create_time, film_comments.update_time
    </sql>
 
    <select id="selectLatestComments" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from film_comments left join film_works on film_comments.film_id = film_works.id  and film_works.status = 'published'
        and film_works.deleted = 0
        where film_comments.deleted = 0
        and film_comments.state = 1
 
        order by film_comments.id desc
    </select>
 
    <select id="getAllArticleComment" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from film_comments left join fs_article on film_comments.film_id = fs_article.id
        where film_comments.deleted = 0
        and film_comments.state = 1
        and fs_article.state = 1
        and film_comments.create_time between #{startTime} and #{endTime}
        and film_comments.parent_id = 0
    </select>
 
    <select id="getAllCommentReply" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from film_comments left join fs_article on film_comments.film_id = fs_article.id
        where film_comments.deleted = 0
        and film_comments.state = 1
        and fs_article.state = 1
        and film_comments.create_time between #{startTime} and #{endTime}
        and film_comments.parent_id != 0
    </select>
 
</mapper>