xuhy
2025-08-26 7112e097c7dd61d49d50b8b05dd6ceadcbcd1b37
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
<?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.order.mapper.ChargeOrderMapper">
 
 
    <select id="getUserPointPageList" resultType="com.ruoyi.order.model.ChargeOrder">
        select * from t_charge_order
        where
            1=1
        <if test="dto.orderNumber != null and dto.orderNumber != ''">
            AND order_number LIKE CONCAT('%', #{dto.orderNumber}, '%')
        </if>
        <if test="dto.phone != null and dto.phone != ''">
            AND phone LIKE CONCAT('%', #{dto.phone}, '%')
        </if>
        <if test="dto.chargingStation != null and dto.chargingStation != ''">
            AND charging_station LIKE CONCAT('%', #{dto.chargingStation}, '%')
        </if>
        <if test="dto.powerStationOperator != null and dto.powerStationOperator != ''">
            AND power_station_operator LIKE CONCAT('%', #{dto.powerStationOperator}, '%')
        </if>
        <if test="dto.terminalCode != null and dto.terminalCode != ''">
            AND terminal_code LIKE CONCAT('%', #{dto.terminalCode}, '%')
        </if>
        <if test="dto.beginTime1 != null and dto.endTime1 != null ">
            AND begin_time between #{dto.beginTime1} and #{dto.endTime1}
        </if>
 
        <if test="dto.beginTime2 != null and dto.endTime2 != null">
            AND end_time between #{dto.beginTime2 } and  #{dto.endTime2  }
        </if>
        <if test="dto.siteId != null">
            AND power_station_id = #{dto.siteId}
        </if>
      order by begin_time DESC
    </select>
    <select id="chargingOrderGroup" resultType="com.ruoyi.common.core.dto.ChargingOrderGroup">
        SELECT SUM(tc.charging_capacity) as  charging_capacity,tc.power_station_id
        FROM t_charge_order tc
        left join `gy_jifenshangcheng_service`.`t_site` ts on tc.power_station_id = ts.id
        <where>
            <if test="chargingPercentProvinceDto.date1 != null">
                AND tc.begin_time &gt;= #{chargingPercentProvinceDto.date1}
            </if>
            <if test="chargingPercentProvinceDto.date2 != null">
                AND tc.begin_time &lt;= #{chargingPercentProvinceDto.date2}
            </if>
            <if test="chargingPercentProvinceDto.provinceCode != null">
                AND ts.province_code = #{chargingPercentProvinceDto.provinceCode}
            </if>
            <if test="chargingPercentProvinceDto.siteIds != null and chargingPercentProvinceDto.siteIds.size() > 0">
                AND power_station_id IN
                <foreach collection="chargingPercentProvinceDto.siteIds" item="siteId" open="(" separator="," close=")">
                    #{siteId}
                </foreach>
            </if>
        </where>
        GROUP BY power_station_id
    </select>
</mapper>