|
@@ -189,7 +189,7 @@
|
|
|
|
|
|
|
|
<select id="stationStat" resultMap="StationStatMap" parameterType="com.kym.entity.admin.queryParams.StatQueryParam">
|
|
<select id="stationStat" resultMap="StationStatMap" parameterType="com.kym.entity.admin.queryParams.StatQueryParam">
|
|
|
SELECT
|
|
SELECT
|
|
|
- <if test="params.stationIds != null and params.stationId != ''">
|
|
|
|
|
|
|
+ <if test="params.stationIds != null and params.stationIds.size() > 0">
|
|
|
t1.station_id,
|
|
t1.station_id,
|
|
|
</if>
|
|
</if>
|
|
|
<if test="params.type == null or params.type == 'day'">
|
|
<if test="params.type == null or params.type == 'day'">
|
|
@@ -207,24 +207,33 @@
|
|
|
(SUM(t1.service_money) - SUM(t1.service_money_discount)) pay_service_amount
|
|
(SUM(t1.service_money) - SUM(t1.service_money_discount)) pay_service_amount
|
|
|
FROM
|
|
FROM
|
|
|
(SELECT
|
|
(SELECT
|
|
|
- *
|
|
|
|
|
|
|
+ id, station_id, start_time, total_power, total_money, elec_money, service_money, service_money_discount
|
|
|
FROM
|
|
FROM
|
|
|
t_charge_order
|
|
t_charge_order
|
|
|
<where>
|
|
<where>
|
|
|
<if test="params.stationId != null and params.stationId != ''">
|
|
<if test="params.stationId != null and params.stationId != ''">
|
|
|
and station_id = #{params.stationId}
|
|
and station_id = #{params.stationId}
|
|
|
</if>
|
|
</if>
|
|
|
- </where>
|
|
|
|
|
- ) t1
|
|
|
|
|
- GROUP BY stat_time
|
|
|
|
|
- <trim prefix="having" suffixOverrides="and">
|
|
|
|
|
|
|
+ <if test="params.stationIds != null and params.stationIds.size() > 0">
|
|
|
|
|
+ and station_id IN
|
|
|
|
|
+ <foreach collection="params.stationIds" item="stationId" index="index" open="(" close=")" separator=",">
|
|
|
|
|
+ #{stationId}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <!-- 时间条件下推子查询,避免全表聚合 -->
|
|
|
<if test="params.startTime != null">
|
|
<if test="params.startTime != null">
|
|
|
- stat_time >= #{params.startTime} and
|
|
|
|
|
|
|
+ and start_time >= #{params.startTime}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="params.endTime != null">
|
|
<if test="params.endTime != null">
|
|
|
- stat_time <= #{params.endTime} and
|
|
|
|
|
|
|
+ and start_time < DATE_ADD(#{params.endTime}, INTERVAL 1 DAY)
|
|
|
</if>
|
|
</if>
|
|
|
- </trim>
|
|
|
|
|
|
|
+ </where>
|
|
|
|
|
+ ) t1
|
|
|
|
|
+ GROUP BY
|
|
|
|
|
+ <if test="params.stationIds != null and params.stationIds.size() > 0">
|
|
|
|
|
+ t1.station_id,
|
|
|
|
|
+ </if>
|
|
|
|
|
+ stat_time
|
|
|
order by stat_time desc
|
|
order by stat_time desc
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|