<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="com.ruoyi.order.mapper.TChargingSettlementBillMapper">
|
|
<select id="queryList" resultType="map">
|
select
|
a.*,
|
DATE_FORMAT(a.billing_cycle, '%Y-%m') as billingCycle,
|
DATE_FORMAT(a.create_time, '%Y-%m-%d %H:%i:%s') as createTime
|
from t_charging_settlement_bill a
|
<where>
|
<if test="null != type and 1 == type">
|
and a.site_id = 0
|
</if>
|
<if test="null != type and 2 == type">
|
and a.site_id != 0
|
</if>
|
<if test="null != status">
|
and a.`status` = #{status}
|
</if>
|
<if test="null != statisticalDateType">
|
and a.statistical_date_type = #{statisticalDateType}
|
</if>
|
<if test="null != dateRange and dateRange.size() > 0">
|
and DATE_FORMAT(a.billing_cycle, '%Y-%m') in
|
<foreach collection="dateRange" item="item" index="index" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
<if test="null != siteIds and siteIds.size() > 0">
|
and a.site_id in
|
<foreach collection="siteIds" item="item" index="index" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
</where>
|
order by a.site_id
|
</select>
|
|
|
<select id="queryListSum" resultType="map">
|
select
|
sum(total_electricity) as totalElectricity,
|
sum(funds_received) as fundsReceived,
|
sum(total_amount) as totalAmount,
|
sum(total_electricity_charge) as totalElectricityCharge,
|
sum(total_service_fee) as totalServiceFee,
|
sum(platform_fee) as platformFee,
|
sum(tripartite_commission) as tripartiteCommission,
|
sum(order_number) as orderNumber,
|
sum(coupon_deduction) as couponDeduction
|
from t_charging_settlement_bill
|
<where>
|
<if test="null != type and 1 == type">
|
and site_id = 0
|
</if>
|
<if test="null != type and 2 == type">
|
and site_id != 0
|
</if>
|
<if test="null != status">
|
and `status` = #{status}
|
</if>
|
<if test="null != statisticalDateType">
|
and statistical_date_type = #{statisticalDateType}
|
</if>
|
<if test="null != dateRange and dateRange.size() > 0">
|
and DATE_FORMAT(billing_cycle, '%Y-%m') in
|
<foreach collection="dateRange" item="item" index="index" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
<if test="null != siteIds and siteIds.size() > 0">
|
and site_id in
|
<foreach collection="siteIds" item="item" index="index" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
</where>
|
</select>
|
</mapper>
|