44323
2024-04-23 16b704d18a875d1fb63827aaa507790ba2bef5be
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
<?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.FindReportMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.FindReport">
        <id column="id" property="id" />
        <result column="userId" property="userId" />
        <result column="reported" property="reported" />
        <result column="findId" property="findId" />
        <result column="commentId" property="commentId" />
        <result column="state" property="state" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, userId, reported, findId, commentId, state
    </sql>
    <select id="selectReport" resultType="com.stylefeng.guns.modular.system.vo.FindReportVO">
        select t1.*,t3.name as reportUsername,t2.name as userName,t4.title,t2.phone
        from t_find_report t1
        left join t_user t2 on t1.userId = t2.id
        left join t_user t3 on t1.reported = t3.id
        left join t_find t4 on t1.findId = t4.id
        <where>
            <if test="req.userName != null and req.userName != ''">
                AND t2.name LIKE concat('%',#{req.userName},'%')
            </if>
            <if test="req.reportUserName != null and req.reportUserName != ''">
                AND t3.name LIKE concat('%',#{req.reportUsername},'%')
            </if>
            <if test="req.phone != null and req.phone != ''">
                AND t2.phone LIKE concat('%',#{req.phone},'%')
            </if>
            <if test="req.title != null and req.title != ''">
                AND t4.title LIKE concat('%',#{req.title},'%')
            </if>
            <if test="req.state != null and req.state ==1 ">
                AND (t1.state = 2 or t1.state = 3 or t1.state = 4)
            </if>
            <if test="req.state != null and req.state ==2 ">
                AND t1.state = 1
            </if>
            and t4.isDelete = 0
        </where>
        order by t1.state asc, t1.insertTime desc
 
 
    </select>
 
</mapper>