From 08b5bab952de67fefb927b35cf7cb6d22ddf5adb Mon Sep 17 00:00:00 2001 From: luodangjia <luodangjia> Date: 星期六, 26 十月 2024 14:04:21 +0800 Subject: [PATCH] merge --- ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml | 111 ++++++++++++++++++++++++++----------------------------- 1 files changed, 53 insertions(+), 58 deletions(-) diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml index 8e66a69..f80bf71 100644 --- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml +++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml @@ -962,7 +962,7 @@ 315360 </if> <if test="statisticsQueryDto.dayType == 5"> - (86400*(SELECT TIMESTAMPDIFF(DAY, #{statisticsQueryDto.startTime}, #{statisticsQueryDto.endTime}) +1 AS days_difference + (864*(SELECT TIMESTAMPDIFF(DAY, #{statisticsQueryDto.startTime}, #{statisticsQueryDto.endTime}) +1 AS days_difference )) </if> @@ -1010,19 +1010,19 @@ SELECT FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.start_time)) / <if test="statisticsQueryDto.dayType == 1"> - 86400 + 864 </if> <if test="statisticsQueryDto.dayType == 2"> - 604800 + 6048 </if> <if test="statisticsQueryDto.dayType == 3"> - 2592000 + 25920 </if> <if test="statisticsQueryDto.dayType == 4"> - 31536000 + 315360 </if> <if test="statisticsQueryDto.dayType == 5"> - (86400*(SELECT TIMESTAMPDIFF(DAY, #{statisticsQueryDto.startTime}, #{statisticsQueryDto.endTime}) +1 AS days_difference + (864*(SELECT TIMESTAMPDIFF(DAY, #{statisticsQueryDto.startTime}, #{statisticsQueryDto.endTime}) +1 AS days_difference )) </if> @@ -1068,29 +1068,28 @@ SELECT FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.down_time)) / <if test="statisticsQueryDto.dayType == 1"> - 86400 + 864 </if> <if test="statisticsQueryDto.dayType == 2"> - 604800 + 6048 </if> <if test="statisticsQueryDto.dayType == 3"> - 2592000 + 25920 </if> <if test="statisticsQueryDto.dayType == 4"> - 31536000 + 315360 </if> <if test="statisticsQueryDto.dayType == 5"> - (86400*(SELECT TIMESTAMPDIFF(DAY, #{statisticsQueryDto.startTime}, #{statisticsQueryDto.endTime}) +1 AS days_difference + (864*(SELECT TIMESTAMPDIFF(DAY, #{statisticsQueryDto.startTime}, #{statisticsQueryDto.endTime}) +1 AS days_difference )) </if> - ), 2) AS percent,co.charging_gun_id,tc.name,cp.name as name1 + ), 2) AS percent,cp.name FROM - `charging_pile_service`.`t_fault_message` co - LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id - LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id + `charging_pile_service`.`t_fault_message` co + LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on co.charging_pile_id = cp.id WHERE - co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 1 and co.status =2 + co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 1 and co.status =2 <if test="siteIds != null and siteIds.size() > 0"> and co.site_id IN <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> @@ -1110,14 +1109,14 @@ AND YEAR( co.create_time ) = YEAR(CURDATE() ) </if> <if test="statisticsQueryDto.dayType == 5"> - <if test="statisticsQueryDto.startTime != null"> + and DATE(co.create_time) >= #{statisticsQueryDto.startTime} - </if> - <if test="statisticsQueryDto.endTime != null"> + + and DATE(co.create_time) <= #{statisticsQueryDto.endTime} - </if> + </if> - GROUP BY tc.name,cp.name,co.charging_gun_id + GROUP BY cp.name </select> @@ -1125,29 +1124,28 @@ SELECT FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.down_time)) / <if test="statisticsQueryDto.dayType == 1"> - 86400 + 864 </if> <if test="statisticsQueryDto.dayType == 2"> - 604800 + 6048 </if> <if test="statisticsQueryDto.dayType == 3"> - 2592000 + 25920 </if> <if test="statisticsQueryDto.dayType == 4"> - 31536000 + 315360 </if> <if test="statisticsQueryDto.dayType == 5"> - (86400*(SELECT TIMESTAMPDIFF(DAY, #{statisticsQueryDto.startTime}, #{statisticsQueryDto.endTime}) +1 AS days_difference + (864*(SELECT TIMESTAMPDIFF(DAY, #{statisticsQueryDto.startTime}, #{statisticsQueryDto.endTime}) +1 AS days_difference )) </if> - ), 2) AS percent,co.charging_gun_id,tc.name,cp.name as name1 + ), 2) AS percent,cp.name FROM `charging_pile_service`.`t_fault_message` co - LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id - LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id + LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on co.charging_pile_id = cp.id WHERE - co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 2 and co.status =2 + co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type in (2,3) and co.status =2 <if test="siteIds != null and siteIds.size() > 0"> and co.site_id IN <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> @@ -1167,14 +1165,13 @@ AND YEAR( co.create_time ) = YEAR(CURDATE() ) </if> <if test="statisticsQueryDto.dayType == 5"> - <if test="statisticsQueryDto.startTime != null"> + and DATE(co.create_time) >= #{statisticsQueryDto.startTime} - </if> - <if test="statisticsQueryDto.endTime != null"> + and DATE(co.create_time) <= #{statisticsQueryDto.endTime} - </if> + </if> - GROUP BY tc.name,cp.name,co.charging_gun_id + GROUP BY cp.name </select> @@ -1182,27 +1179,26 @@ SELECT FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.down_time)) / <if test="statisticsQueryDto.dayType == 1"> - 86400 + 864 </if> <if test="statisticsQueryDto.dayType == 2"> - 604800 + 6048 </if> <if test="statisticsQueryDto.dayType == 3"> - 2592000 + 25920 </if> <if test="statisticsQueryDto.dayType == 4"> - 31536000 + 315360 </if> <if test="statisticsQueryDto.dayType == 5"> - (86400*(SELECT TIMESTAMPDIFF(DAY, #{statisticsQueryDto.startTime}, #{statisticsQueryDto.endTime}) +1 AS days_difference + (864*(SELECT TIMESTAMPDIFF(DAY, #{statisticsQueryDto.startTime}, #{statisticsQueryDto.endTime}) +1 AS days_difference )) </if> - ), 2) AS percent,co.charging_gun_id,tc.name,cp.name as name1 + ), 2) AS percent,cp.name FROM `charging_pile_service`.`t_fault_message` co - LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id - LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id + LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on co.charging_pile_id = cp.id WHERE co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 1 and co.status =1 <if test="siteIds != null and siteIds.size() > 0"> @@ -1231,35 +1227,34 @@ and DATE(co.create_time) <= #{statisticsQueryDto.endTime} </if> </if> - GROUP BY tc.name,cp.name,co.charging_gun_id + GROUP BY cp.name </select> <select id="equipmentMapOut2" resultType="java.util.Map"> SELECT FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.down_time)) / <if test="statisticsQueryDto.dayType == 1"> - 86400 + 864 </if> <if test="statisticsQueryDto.dayType == 2"> - 604800 + 6048 </if> <if test="statisticsQueryDto.dayType == 3"> - 2592000 + 25920 </if> <if test="statisticsQueryDto.dayType == 4"> - 31536000 + 315360 </if> <if test="statisticsQueryDto.dayType == 5"> - (86400*(SELECT TIMESTAMPDIFF(DAY, #{statisticsQueryDto.startTime}, #{statisticsQueryDto.endTime}) +1 AS days_difference + (864*(SELECT TIMESTAMPDIFF(DAY, #{statisticsQueryDto.startTime}, #{statisticsQueryDto.endTime}) +1 AS days_difference )) </if> - ), 2) AS percent,co.charging_gun_id,tc.name,cp.name as name1 + ), 2) AS percent,cp.name FROM `charging_pile_service`.`t_fault_message` co - LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id - LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id + LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on co.charging_pile_id = cp.id WHERE - co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 2 and co.status =1 + co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 1 and co.status =1 <if test="siteIds != null and siteIds.size() > 0"> and co.site_id IN <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> @@ -1286,12 +1281,12 @@ and DATE(co.create_time) <= #{statisticsQueryDto.endTime} </if> </if> - GROUP BY tc.name,cp.name,co.charging_gun_id + GROUP BY cp.name </select> <select id="needElec" resultType="java.util.Map"> SELECT - FORMAT((SUM(co.current) / SUM(co.need_elec)), 2) AS percent, + FORMAT((SUM(co.current)*100 / SUM(co.need_elec)), 2) AS percent, co.charging_gun_id, tc.name as name, cp.name AS siteName @@ -1300,7 +1295,7 @@ LEFT JOIN `charging_pile_service`.`t_charging_gun` tc ON co.charging_gun_id = tc.id LEFT JOIN `charging_pile_service`.`t_charging_pile` cp ON tc.charging_pile_id = cp.id <where> - cp.type = 1 and co.need_elec != 0 + tc.type = 4 and co.need_elec != 0 <if test="siteIds != null and siteIds.size() > 0"> and co.site_id IN <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> @@ -1485,7 +1480,7 @@ </select> <select id="needElec1" resultType="java.util.Map"> SELECT - FORMAT((SUM(co.current) / SUM(co.need_elec)), 2) AS percent, + FORMAT((SUM(co.current)*100 / SUM(co.need_elec)), 2) AS percent, co.charging_gun_id, tc.name as name, cp.name AS siteName @@ -1494,7 +1489,7 @@ LEFT JOIN `charging_pile_service`.`t_charging_gun` tc ON co.charging_gun_id = tc.id LEFT JOIN `charging_pile_service`.`t_charging_pile` cp ON tc.charging_pile_id = cp.id <where> - cp.type = 2 + tc.type in (2,3) <if test="siteIds != null and siteIds.size() > 0"> and co.site_id IN <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> -- Gitblit v1.7.1