| | |
| | | AND o.code LIKE CONCAT('%',#{data.code},'%') |
| | | </if> |
| | | <if test="data.phone != null and data.phone != ''"> |
| | | AND o.phone LIKE CONCAT('%',#{data.phone},'%') |
| | | AND i.phone LIKE CONCAT('%',#{data.phone},'%') |
| | | </if> |
| | | <if test="data.type != null"> |
| | | AND o.type = #{data.type} |
| | |
| | | <if test="data.isRefund == 1"> |
| | | AND o.refund_status is not null |
| | | </if> |
| | | <if test="data.isRefund == 1"> |
| | | <if test="data.isRefund == 2"> |
| | | AND o.refund_status is null |
| | | </if> |
| | | |
| | |
| | | |
| | | </select> |
| | | <select id="usersDay" resultType="java.util.Map"> |
| | | |
| | | SELECT |
| | | 'today' AS data_type, |
| | | '1' as type, |
| | | DATE_FORMAT( create_time, '%Y-%m-%d %H' ) AS TIME, |
| | | count(DISTINCT app_user_id) AS counts |
| | | FROM |
| | | t_charging_order |
| | | WHERE |
| | | del_flag = 0 |
| | | AND recharge_payment_status = 2 |
| | | AND ISNULL( refund_status ) |
| | | AND DATE ( create_time ) = CURDATE() |
| | | GROUP BY |
| | | TIME |
| | | UNION all |
| | | SELECT |
| | | 'today' AS data_type, |
| | | '2' as type, |
| | | DATE_FORMAT( create_time, '%Y-%m-%d %H' ) AS TIME, |
| | | |
| | | DATE_FORMAT( create_time, '%Y-%m-%d %H' ) AS time, |
| | | count(1) AS counts |
| | | FROM |
| | | charging_pile_account.t_app_user |
| | |
| | | del_flag = 0 |
| | | AND DATE ( create_time ) = CURDATE() |
| | | GROUP BY |
| | | TIME |
| | | time |
| | | </select> |
| | | <select id="usersByQuery" resultType="java.util.Map"> |
| | | |
| | | |
| | | <select id="usersDay1" resultType="java.util.Map"> |
| | | SELECT |
| | | 'today' AS data_type, |
| | | '1' as type, |
| | | DATE_FORMAT( create_time, '%Y-%m-%d' ) AS TIME, |
| | | count(DISTINCT app_user_id) AS counts |
| | | DATE_FORMAT( create_time, '%Y-%m-%d %H' ) AS time, |
| | | count(DISTINCT app_user_id) AS counts |
| | | FROM |
| | | t_charging_order |
| | | WHERE |
| | | del_flag = 0 |
| | | AND recharge_payment_status = 2 |
| | | AND ISNULL( refund_status ) |
| | | <if test="statisticsQueryDto.dayType =1 "> |
| | | AND DATE(create_time) = CURDATE() |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType =2 "> |
| | | AND WEEKOFYEAR(create_time) = WEEKOFYEAR(CURDATE()) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType =3 "> |
| | | AND MONTH(create_time) = MONTH(CURDATE()) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType =4"> |
| | | AND YEAR(create_time) = YEAR(CURDATE()) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType =5"> |
| | | <if test="statisticsQueryDto.startTime != null"> |
| | | AND create_time >= #{statisticsQueryDto.startTime} |
| | | </if> |
| | | <if test="statisticsQueryDto.endTime != null"> |
| | | AND create_time <= #{statisticsQueryDto.endTime} |
| | | </if> |
| | | </if> |
| | | AND DATE ( create_time ) = CURDATE() |
| | | GROUP BY |
| | | TIME |
| | | UNION all |
| | | time |
| | | </select> |
| | | <select id="usersByQuery" resultType="java.util.Map"> |
| | | |
| | | SELECT |
| | | 'today' AS data_type, |
| | | '2' as type, |
| | | DATE_FORMAT( create_time, '%Y-%m-%d' ) AS TIME, |
| | | |
| | | DATE_FORMAT( create_time, '%Y-%m-%d' ) AS time, |
| | | count(1) AS counts |
| | | FROM |
| | | charging_pile_account.t_app_user |
| | |
| | | </if> |
| | | </if> |
| | | GROUP BY |
| | | TIME |
| | | time |
| | | |
| | | |
| | | </select> |
| | | <select id="getUserTagCount" resultType="java.util.Map"> |
| | | SELECT user_tag_id,COUNT(1) as count from ( |
| | | SELECT |
| | | tt.`name`, |
| | | COUNT( 1 ) AS count |
| | | FROM |
| | | ( |
| | | SELECT |
| | | a.app_user_id, |
| | | a.user_tag_id, |
| | | a.create_time |
| | | FROM |
| | | charging_pile_account.t_app_user_tag a |
| | | JOIN ( |
| | | SELECT |
| | | app_user_id, |
| | | MAX(create_time) AS max_create_time |
| | | FROM |
| | | charging_pile_account.t_app_user_tag |
| | | GROUP BY |
| | | app_user_id |
| | | ) b ON a.app_user_id = b.app_user_id AND a.create_time = b.max_create_time |
| | | JOIN ( SELECT app_user_id, MAX( create_time ) AS max_create_time FROM charging_pile_account.t_app_user_tag GROUP BY app_user_id ) b ON a.app_user_id = b.app_user_id |
| | | AND a.create_time = b.max_create_time |
| | | ) o |
| | | GROUP BY o.user_tag_id |
| | | LEFT JOIN `charging_pile_other`.`t_user_tag` tt on o.user_tag_id = tt.id |
| | | GROUP BY |
| | | tt.name |
| | | </select> |
| | | <select id="getVipCount" resultType="java.util.Map"> |
| | | SELECT vip_id,count(1) as Counts |
| | | FROM charging_pile_account.t_app_user |
| | | WHERE del_flag = 0 |
| | | GROUP BY vip_id |
| | | SELECT |
| | | tv.`name`, |
| | | count(1) AS Counts |
| | | FROM |
| | | charging_pile_account.t_app_user ta |
| | | LEFT JOIN `charging_pile_other`.`t_vip` tv on ta.vip_id = tv.id |
| | | WHERE |
| | | ta.del_flag = 0 |
| | | GROUP BY |
| | | tv.`name` |
| | | </select> |
| | | <select id="unitConsumption" resultType="java.util.Map"> |
| | | SELECT |
| | | tc.`name`, |
| | | au.company_id as companyId, |
| | | SUM( co.charging_capacity ) as chargingCapacity |
| | | FROM |
| | | charging_pile_order.t_charging_order co |
| | | LEFT JOIN charging_pile_account.t_app_user au ON co.app_user_id = au.id |
| | | LEFT JOIN `charging_pile_other`.`t_company` tc on au.company_id = tc.id |
| | | |
| | | <where> |
| | | co.del_flag = 0 |
| | | <if test="statisticsQueryDto.dayType == 1"> |
| | |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | au.company_id |
| | | tc.`name`, au.company_id |
| | | </select> |
| | | <select id="carUserMethod" resultType="java.util.Map"> |
| | | SELECT |
| | |
| | | `t_order_evaluate` te |
| | | LEFT JOIN t_charging_order co on te.order_id = co.id |
| | | WHERE |
| | | 1 = 1 |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | AND co.site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | | #{siteId} |
| | | </foreach> |
| | | </if> |
| | | te.del_flag = 0 |
| | | AND te.del_flag = 0 |
| | | |
| | | </select> |
| | | <select id="getLevelEvaluate" resultType="java.util.Map"> |
| | |
| | | source_name as source |
| | | from t_charging_order |
| | | where 1=1 |
| | | del_flag = 0 |
| | | AND del_flag = 0 |
| | | AND recharge_payment_status = 2 |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and site_id IN |
| | |
| | | </if> |
| | | |
| | | |
| | | ), 2) AS total_days,co.charging_gun_id,tc.name,cp.name as siteName |
| | | ), 2) AS percent,co.charging_gun_id,tc.name,cp.name as siteName |
| | | FROM |
| | | `charging_pile_order`.`t_charging_order` co |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id |
| | |
| | | </if> |
| | | |
| | | |
| | | ), 2) AS total_days,co.charging_gun_id,tc.name,cp.name as siteName |
| | | ), 2) AS percent,co.charging_gun_id,tc.name,cp.name as siteName |
| | | FROM |
| | | `charging_pile_order`.`t_charging_order` co |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id |
| | |
| | | )) |
| | | </if> |
| | | |
| | | ), 2) AS total_days,co.charging_gun_id,tc.name,cp.name as name1 |
| | | ), 2) AS percent,co.charging_gun_id,tc.name,cp.name as name1 |
| | | FROM |
| | | `charging_pile_service`.`t_fault_message` co |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id |
| | |
| | | )) |
| | | </if> |
| | | |
| | | ), 2) AS total_days,co.charging_gun_id,tc.name,cp.name as name1 |
| | | ), 2) AS percent,co.charging_gun_id,tc.name,cp.name as name1 |
| | | FROM |
| | | `charging_pile_service`.`t_fault_message` co |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id |
| | |
| | | )) |
| | | </if> |
| | | |
| | | ), 2) AS total_days,co.charging_gun_id,tc.name,cp.name as name1 |
| | | ), 2) AS percent,co.charging_gun_id,tc.name,cp.name as name1 |
| | | FROM |
| | | `charging_pile_service`.`t_fault_message` co |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id |
| | |
| | | )) |
| | | </if> |
| | | |
| | | ), 2) AS total_days,co.charging_gun_id,tc.name,cp.name as name1 |
| | | ), 2) AS percent,co.charging_gun_id,tc.name,cp.name as name1 |
| | | FROM |
| | | `charging_pile_service`.`t_fault_message` co |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id |
| | |
| | | SELECT |
| | | FORMAT((SUM(co.current) / SUM(co.need_elec)), 2) AS percent, |
| | | co.charging_gun_id, |
| | | tc.name, |
| | | cp.name AS gun_name |
| | | tc.name as name, |
| | | cp.name AS siteName |
| | | FROM |
| | | `charging_pile_order`.`t_charging_order` 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 |
| | | <where> |
| | | cp.type = 1 |
| | | <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, |
| | | co.charging_gun_id, |
| | | tc.name as name, |
| | | cp.name AS siteName |
| | | FROM |
| | | `charging_pile_order`.`t_charging_order` 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 |
| | | <where> |
| | | cp.type = 2 |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and co.site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | | #{siteId} |
| | | </foreach> |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 1"> |
| | | AND DATE( co.create_time ) = CURDATE() |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 2"> |
| | | AND WEEKOFYEAR( co.create_time ) = WEEKOFYEAR( CURDATE() ) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 3"> |
| | | AND MONTH( co.create_time ) = MONTH(CURDATE()) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 4"> |
| | | AND YEAR( co.create_time ) = YEAR(CURDATE() ) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 5"> |
| | | <if test="statisticsQueryDto.startTime != null"> |
| | | AND co.create_time >= #{statisticsQueryDto.startTime} |
| | | </if> |
| | | <if test="statisticsQueryDto.endTime != null"> |
| | | AND co.create_time <= #{statisticsQueryDto.endTime} |
| | | </if> |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | tc.name, |
| | | cp.name, |
| | | co.charging_gun_id; |
| | | </select> |
| | | </mapper> |