无关风月
2025-05-08 9486766c806fe1d9e082b2fd02ea1cc558f1b443
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
<?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.dsh.course.mapper.GateMapper">
 
    <select id="listAll" resultType="java.util.Map">
        select t1.id as id,t1.name as name,t1.device as device,t2.type,t1.storeId,
        t2.name as storeName,t3.name as siteName
        from t_gate t1
        left join t_store t2 on t2.id = t1.storeId
        left join t_site t3  on t3.id = t1.siteId
        left join t_operator t4 on t4.id = t1.operatorId
        where 1=1 and t1.isDelete = 0
        <if test="name != null and name!=''">
            and t1.name like CONCAT('%',#{name},'%')
        </if>
        <if test="device != null and device!=''">
            and t1.device like CONCAT('%',#{device},'%')
        </if>
        <if test="operatorName != null and operatorName!=''">
            and t4.name like CONCAT('%',#{operatorName},'%')
        </if>
        <if test="storeName != null and storeName!=''">
            and t2.name like CONCAT('%',#{storeName},'%')
        </if>
        <if test="storeIds != null and storeIds.size()>0">
            AND t1.storeId IN
            <foreach collection="storeIds" separator="," item="id" open="(" close=")">
                #{id}
            </foreach>
        </if>
    </select>
</mapper>