| | |
| | | select t1.*, |
| | | IFNULL(t1.whitelist_electric_refund_amount, 0) + IFNULL(t1.whitelist_service_refund_amount, 0) as whitelistRefundAmount |
| | | from t_charging_order t1 |
| | | <if test="req.phone != null and req.phone != ''"> |
| | | inner join `charging_pile_account`.`t_app_user` app_user on app_user.id = t1.app_user_id |
| | | </if> |
| | | where t1.del_flag = 0 |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t1.code LIKE CONCAT('%',#{req.code},'%') |
| | |
| | | <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="req.phone != null and req.phone != ''"> |
| | | and app_user.phone LIKE CONCAT('%',#{req.phone},'%') |
| | | </if> |
| | | <if test="null != req.siteIds and req.siteIds.size()>0"> |
| | | and t1.site_id in |
| | |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="req.phone != null and req.phone != ''"> |
| | | and app_user.phone LIKE CONCAT('%',#{req.phone},'%') |
| | | </if> |
| | | <if test="null != req.siteIds and req.siteIds.size()>0"> |
| | | and b.site_id in |
| | | <foreach collection="req.siteIds" item="item" index="index" separator="," open="(" close=")"> |
| | |
| | | MAX(IFNULL(b.third_pay_amount, CASE WHEN b.pay_method = 3 THEN IFNULL(b.payment_amount, IFNULL(b.recharge_amount, 0)) ELSE 0 END) - IFNULL(b.third_refund_amount, CASE WHEN b.pay_method = 3 THEN IFNULL(b.refund_amount, 0) ELSE 0 END)) as thirdNetAmount |
| | | from `charging_pile_order`.t_charging_order b |
| | | left join `charging_pile_order`.t_charging_order_accounting_strategy a on a.charging_order_id = b.id |
| | | <if test="req.phone != null and req.phone != ''"> |
| | | inner join `charging_pile_account`.`t_app_user` app_user on app_user.id = b.app_user_id |
| | | </if> |
| | | <include refid="ChargingOrderSummaryWhere"/> |
| | | group by b.id,b.end_time,b.start_time,b.order_source |
| | | ) as aa |
| | |
| | | sum(a.period_electric_price + (CASE WHEN b.order_source = 1 THEN a.period_service_price ELSE a.period_service_price * 0.8 END)) as income |
| | | from `charging_pile_order`.t_charging_order_accounting_strategy a |
| | | left join `charging_pile_order`.t_charging_order b on (a.charging_order_id = b.id) |
| | | <if test="req.phone != null and req.phone != ''"> |
| | | inner join `charging_pile_account`.`t_app_user` app_user on app_user.id = b.app_user_id |
| | | </if> |
| | | <include refid="ChargingOrderSummaryWhere"/> |
| | | group by b.id,time |
| | | ) as aa |
| | |
| | | b.whitelist_service_refund_amount, |
| | | IFNULL(b.third_pay_amount, CASE WHEN b.pay_method = 3 THEN IFNULL(b.payment_amount, IFNULL(b.recharge_amount, 0)) ELSE 0 END) - IFNULL(b.third_refund_amount, CASE WHEN b.pay_method = 3 THEN IFNULL(b.refund_amount, 0) ELSE 0 END) as thirdNetAmount |
| | | from `charging_pile_order`.t_charging_order b |
| | | <if test="req.phone != null and req.phone != ''"> |
| | | inner join `charging_pile_account`.`t_app_user` app_user on app_user.id = b.app_user_id |
| | | </if> |
| | | <include refid="ChargingOrderSummaryWhere"/> |
| | | ) as aa |
| | | </select> |
| | |
| | | <select id="chargingOrderSummaryOrderIds" resultType="java.lang.Long"> |
| | | select b.id |
| | | from `charging_pile_order`.t_charging_order b |
| | | <if test="req.phone != null and req.phone != ''"> |
| | | inner join `charging_pile_account`.`t_app_user` app_user on app_user.id = b.app_user_id |
| | | </if> |
| | | <include refid="ChargingOrderSummaryWhere"/> |
| | | </select> |
| | | |