gongzuming
2024-08-23 d9fc483d7bf49707a6b35eaa68a20657e02459a9
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
<?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.content.FeedbackMapper">
    <select id="queryPage" resultType="com.mzl.flower.dto.response.content.FeedbackDTO">
        SELECT
        f.*,
        c.`name` AS customerName,
        u.tel AS customerTel
        FROM
        t_feedback f
        LEFT JOIN t_user u ON f.user_id = u.id
        LEFT JOIN t_customer_info c ON f.user_id = c.user_id
        WHERE
        f.deleted = 0
        <if test="dto.id != null and dto.name != 0">
            and f.id = #{dto.id}
        </if>
        <if test="dto.name != null and dto.name != ''">
            and c.name like concat('%', #{dto.name}, '%')
        </if>
        <if test="dto.tel != null and dto.tel != ''">
            and u.tel like concat('%', #{dto.tel}, '%')
        </if>
        <if test="dto.handled != null and dto.handled">
            and f.handled = 1
        </if>
        <if test="dto.handled != null and !dto.handled">
            and f.handled = 0
        </if>
        <if test="dto.userId != null and dto.userId != ''">
            and f.user_id = #{dto.userId}
        </if>
        <if test="dto.createDateBegin!=null ">
            <![CDATA[
               AND t.create_time >= #{dto.createDateBegin}
            ]]>
        </if>
        <if test="dto.createDateEnd!=null ">
            <![CDATA[
               AND t.create_time <= #{dto.createDateEnd}
            ]]>
        </if>
        order by f.create_time desc
    </select>
</mapper>