查询时间段内订单总金额和总用电量V2

This commit is contained in:
2023-08-11 15:59:26 +08:00
parent de21084aec
commit 70dff61eef
10 changed files with 74 additions and 49 deletions

View File

@@ -309,44 +309,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
t2.pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR}
</select>
<select id="getGeneralSituation" resultType="com.jsowell.pile.vo.web.IndexGeneralSituationVO">
SELECT
sum( t3.total_used_electricity ) AS totalChargingDegree,
sum( t3.total_order_amount ) AS totalChargingAmount,
count( DISTINCT t2.order_code ) AS totalChargingQuantity,
count( DISTINCT t1.sn ) AS totalPileQuantity,
t4.totalMemberAmount
FROM
pile_basic_info t1
LEFT JOIN order_basic_info t2 ON t1.sn = t2.pile_sn
LEFT JOIN order_detail t3 ON t2.order_code = t3.order_code
AND t2.order_status = '6'
AND t2.del_flag = '0',
(
SELECT
sum( t2.principal_balance + t2.gift_balance ) AS totalMemberAmount
FROM
member_basic_info t1
JOIN member_wallet_info t2 ON t1.member_id = t2.member_id
AND t1.del_flag = '0'
AND t1.STATUS = '1'
) t4
WHERE
t1.del_flag = '0'
<if test="IndexQueryDTO.stationId != null and IndexQueryDTO.stationId != ''">
and t1.station_id = #{IndexQueryDTO.stationId,jdbcType=VARCHAR}
</if>
<!-- 数据范围过滤 -->
<if test="IndexQueryDTO.stationIdList != null and IndexQueryDTO.stationIdList.size() != 0">
and t1.station_id in
<foreach collection="IndexQueryDTO.stationIdList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
group by t4.totalMemberAmount
</select>
<select id="getPileInfoByMemberId" resultType="com.jsowell.pile.vo.uniapp.PersonalPileInfoVO">
SELECT
t1.pile_sn as pileSn,