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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?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.TChargingPileMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.chargingPile.api.model.TChargingPile">
        <id column="id" property="id" />
        <result column="code" property="code" />
        <result column="name" property="name" />
        <result column="number" property="number" />
        <result column="type" property="type" />
        <result column="site_id" property="siteId" />
        <result column="partner_id" property="partnerId" />
        <result column="manufacturer_code" property="manufacturerCode" />
        <result column="manufacturer" property="manufacturer" />
        <result column="equipment_type" property="equipmentType" />
        <result column="production_date" property="productionDate" />
        <result column="rated_power" property="ratedPower" />
        <result column="charging_station_number" property="chargingStationNumber" />
        <result column="status" property="status" />
        <result column="create_time" property="createTime" />
        <result column="del_flag" property="delFlag" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, code, `name`, `number`, `type`, site_id, partner_id, manufacturer_code, manufacturer, equipment_type, production_date, rated_power, charging_station_number, status, create_time, del_flag
    </sql>
 
    
    
    <select id="pageChargingPileList" resultType="com.ruoyi.chargingPile.api.dto.PageChargingPileListDTO">
        select
        a.id,
        a.code,
        a.name,
        a.number,
        a.type,
        a.site_id as siteId,
        b.name as siteName,
        a.partner_id as partnerId,
        c.name as partnerName,
        a.manufacturer,
        a.equipment_type as equipmentType,
        a.rated_power as ratedPower
        from t_charging_pile a
        left join t_site b on (a.site_id = b.id)
        left join t_partner c on (a.partner_id = c.id)
        where a.del_flag = 0
        <if test="null != item.siteId">
            and a.site_id = #{item.siteId}
        </if>
        <if test="null != item.name and '' != item.name">
            and a.name like CONCAT('%', #{item.name}, '%')
        </if>
        <if test="null != item.type">
            and a.type = #{item.type}
        </if>
        <if test="null != siteIds">
            and a.site_id in
            <foreach collection="siteIds" item="itemm" index="index" open="(" separator="," close=")">
                #{itemm}
            </foreach>
        </if>
        order by a.create_time desc
    </select>
    
    
    <select id="getChargingPile" resultMap="BaseResultMap">
        select
        a.*,
        b.name as siteName,
        c.name as partnerName
        from t_charging_pile a
        left join t_site b on (a.site_id = b.id)
        left join t_partner c on (a.partner_id = c.id)
        where a.id = #{id}
    </select>
    <select id="getChargingGunList" resultType="com.ruoyi.chargingPile.api.vo.TChargingPileVO">
        select id,code, `name`, `number` from t_charging_pile
        where del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} and site_id = #{siteId}
    </select>
    
    
    
    <select id="getChargingGunMonitoring" resultType="com.ruoyi.chargingPile.dto.ChargingGunMonitoring">
        select
        a.id,
        a.status,
        CONCAT(b.number, a.name) as name,
        a.parking_number as parkingNumber
        from t_charging_gun a
        left join t_charging_pile b on (a.charging_pile_id = b.id)
        where a.del_flag = 0
        <if test="null != siteIds and siteIds.size() > 0">
            and a.site_id in
            <foreach collection="siteIds" item="item" index="index" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        <if test="null != query.status and query.status.size() > 0">
            and a.status in
            <foreach collection="query.status" item="item" index="index" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        <if test="null != query.name and '' != query.name">
            and a.name like CONCAT('%', #{query.name}, '%')
        </if>
    </select>
</mapper>