无关风月
2024-08-20 9f88b12d16c83963dad8fb8f79d9eeba2c311518
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
<?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.stylefeng.guns.modular.system.dao.FindCommentMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.FindComment">
        <id column="id" property="id" />
        <result column="findId" property="findId" />
        <result column="content" property="content" />
        <result column="pid" property="pid" />
        <result column="userId" property="userId" />
        <result column="replyUserId" property="replyUserId" />
        <result column="insertTime" property="insertTime" />
        <result column="isShow" property="isShow" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, findId, content, pid, userId, replyUserId, insertTime, isShow
    </sql>
    <select id="getCommentTwo" resultType="com.stylefeng.guns.modular.system.vo.CommentVO">
        select t1.id,t1.findId,t1.content,t1.pid,t1.userId,t1.replyUserId,t1.insertTime as insertTime1,t1.isShow,t1.likeCount,t2.id as userId,t2.name as userName,t2.headImg,t3.name as replyUserName,t3.id as replyUserId
        from t_find_comment t1
        left join t_user t2 on t1.userId = t2.id
        left join t_user t3 on t1.replyUserId = t3.id
        where t1.pid = #{id} and t1.isShow = 1
    </select>
    <select id="getCommentOne" resultType="com.stylefeng.guns.modular.system.vo.CommentVO">
        select t1.id,t1.findId,t1.content,t1.pid,t1.userId,t1.replyUserId,t1.insertTime as insertTime1,t1.isShow,t1.likeCount,t2.id as userId,t2.name as userName,t2.headImg
        from t_find_comment t1
        left join t_user t2 on t1.userId = t2.id
        where t1.pid = 0 and t1.isShow = 1 and t1.findId = #{req.id}
        limit #{req.pageNum}, #{req.pageSize}
    </select>
    <select id="getCommentThree" resultType="com.stylefeng.guns.modular.system.vo.CommentVO">
        select t1.id,t1.findId,t1.content,t1.pid,t1.userId,t1.replyUserId,t1.insertTime as insertTime1,t1.isShow,t1.likeCount,t2.id as userId,t2.name as userName,t2.headImg,t3.name as replyUserName,t3.id as replyUserId
        from t_find_comment t1
        left join t_user t2 on t1.userId = t2.id
        left join t_user t3 on t1.replyUserId = t3.id
        where t1.pid = #{req.id} and t1.isShow = 1
    </select>
 
</mapper>