cloudroam
2025-06-04 ed0dc655e6732f15d30f399c0d460ad7b9fe42da
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">
        fs_comment.id, fs_comment.parent_id, fs_comment.content, fs_comment.film_id, fs_comment.`state`, fs_comment.deleted,
        fs_comment.create_by, fs_comment.create_time, fs_comment.update_time
    </sql>
 
    <select id="selectLatestComments" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from fs_comment left join fs_article on fs_comment.film_id = fs_article.id
        where fs_comment.deleted = 0
        and fs_comment.state = 1
        and fs_article.state = 1
        and fs_article.deleted = 0
        order by fs_comment.id desc
    </select>
 
    <select id="getAllArticleComment" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from fs_comment left join fs_article on fs_comment.film_id = fs_article.id
        where fs_comment.deleted = 0
        and fs_comment.state = 1
        and fs_article.state = 1
        and fs_comment.create_time between #{startTime} and #{endTime}
        and fs_comment.parent_id = 0
    </select>
 
    <select id="getAllCommentReply" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from fs_comment left join fs_article on fs_comment.film_id = fs_article.id
        where fs_comment.deleted = 0
        and fs_comment.state = 1
        and fs_article.state = 1
        and fs_comment.create_time between #{startTime} and #{endTime}
        and fs_comment.parent_id != 0
    </select>
 
</mapper>