| | |
| | | 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> |
| | | |
| | |
| | | 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> |
| | | |
| | |
| | | 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=")"> |
| | |
| | | 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> |
| | |
| | | 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=")"> |
| | |
| | | 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> |
| | |
| | | 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"> |
| | |
| | | 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=")"> |
| | |
| | | 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 |
| | |
| | | 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=")"> |
| | |
| | | </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 |
| | |
| | | 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=")"> |