陶杰
2024-08-22 ee9032d9baf5f33e376d2d2699136e0a7b26bec7
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
55
56
57
58
59
60
61
62
63
64
<?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.supplier.SupplierMapper">
 
 
    <select id="querySupplier" resultType="com.mzl.flower.dto.response.supplier.SupplierDTO">
        SELECT
            t.*,
            s.name as stationName,
            st.`name` as typeName
        FROM
            t_supplier_info t
                LEFT JOIN t_station s ON t.station_id = s.id
                LEFT JOIN t_supplier_type st ON t.type_id = st.id
        WHERE t.deleted = 0
        <if test="dto.name!=null and dto.name!=''">
            AND t.name LIKE CONCAT('%',#{dto.name}, '%')
        </if>
        <if test="dto.status!=null and dto.status!=''">
            AND t.status = #{dto.status}
        </if>
        <if test="dto.tel!=null and dto.tel!=''">
            AND t.contact_tel LIKE CONCAT('%',#{dto.tel}, '%')
        </if>
        <if test="dto.stationId!=null and dto.stationId!=''">
            AND t.station_id = #{dto.stationId}
        </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 t.create_time desc
    </select>
    <select id="findSupplierDetail" resultType="com.mzl.flower.dto.response.supplier.SupplierDTO"
            parameterType="java.lang.Long">
        SELECT
            t.*,
            s.name as stationName,
            st.`name` as typeName
        FROM
            t_supplier_info t
                LEFT JOIN t_station s ON t.station_id = s.id
                LEFT JOIN t_supplier_type st ON t.type_id = st.id
        WHERE t.id=#{id}
    </select>
    <select id="getCurrentSupplier" resultType="com.mzl.flower.dto.response.supplier.SupplierDTO"
            parameterType="java.lang.String">
        SELECT
            t.*,
            s.name as stationName,
            st.`name` as typeName
        FROM
            t_supplier_info t
                LEFT JOIN t_station s ON t.station_id = s.id
                LEFT JOIN t_supplier_type st ON t.type_id = st.id
        WHERE t.user_Id=#{userId}
    </select>
</mapper>