Pu Zhibing
2024-10-16 c4664502dfdaffff555b532e65b51a57ac8b29c2
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
65
66
67
68
69
<?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.ruoyi.chargingPile.mapper.TParkingLotMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.chargingPile.api.model.TParkingLot">
        <id column="id" property="id" />
        <result column="`name`" property="name" />
        <result column="code" property="code" />
        <result column="site_id" property="siteId" />
        <result column="charge_free_duration" property="chargeFreeDuration" />
        <result column="charge_capping" property="chargeCapping" />
        <result column="charge_rate" property="chargeRate" />
        <result column="non_charge_free_duration" property="nonChargeFreeDuration" />
        <result column="non_charge_capping" property="nonChargeCapping" />
        <result column="non_charge_rate" property="nonChargeRate" />
        <result column="remark" property="remark" />
        <result column="create_time" property="createTime" />
        <result column="del_flag" property="delFlag" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, `name`, code, site_id, charge_free_duration, charge_capping, charge_rate, non_charge_free_duration, non_charge_capping, non_charge_rate, remark, create_time, del_flag
    </sql>
    <select id="pageList" resultType="com.ruoyi.chargingPile.api.vo.TParkingLotVO">
        SELECT
        tpl.*, ts.name AS siteName
        FROM t_parking_lot tpl
        LEFT JOIN t_site ts ON tpl.site_id = ts.id
        <where>
            <if test="query.name != null and query.name != ''">
                AND tpl.`name` LIKE concat('%', #{query.name}, '%')
            </if>
            <if test="query.code != null and query.code != ''">
                AND tpl.code LIKE concat('%', #{query.code}, '%')
            </if>
            <if test="query.siteId != null">
                AND tpl.site_id = #{query.siteId}
            </if>
            <if test="null != siteIds and siteIds.size() > 0">
                and tpl.site_id in
                <foreach collection="siteIds" index="index" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
            AND tpl.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()}
        </where>
        ORDER BY tpl.create_time DESC
    </select>
    <select id="getList" resultType="com.ruoyi.chargingPile.api.vo.TParkingLotVO">
        select <include refid="Base_Column_List"></include>
        from t_parking_lot
        <where>
            <if test="name != null and name != ''">
                AND `name` LIKE concat('%',#{name},'%')
            </if>
            <if test="null != siteIds and siteIds.size() > 0">
                and site_id in
                <foreach collection="siteIds" index="index" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
            AND del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()}
        </where>
        ORDER BY create_time DESC
    </select>
 
</mapper>