From 74e332504d98caaf8fab951d7d24be762b169f49 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期三, 25 三月 2026 14:15:14 +0800
Subject: [PATCH] 销售金额
---
jyz-base-start/src/main/resources/xml/OilRecordMapper.xml | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 54 insertions(+), 2 deletions(-)
diff --git a/jyz-base-start/src/main/resources/xml/OilRecordMapper.xml b/jyz-base-start/src/main/resources/xml/OilRecordMapper.xml
index 9de9e24..65a05ef 100644
--- a/jyz-base-start/src/main/resources/xml/OilRecordMapper.xml
+++ b/jyz-base-start/src/main/resources/xml/OilRecordMapper.xml
@@ -52,7 +52,7 @@
select
oil_position oilPosition, count(1) oilCount, sum(oil_volume) OilVolume
from t_oil_record
- where org_code =#{orgCode}
+ where org_code like concat(#{orgCode}, '%')
<if test="dateMonth != null and dateMonth != ''">and DATE_FORMAT(start_time, '%Y-%m')=#{dateMonth}</if>
GROUP BY oil_position
</select>
@@ -120,7 +120,8 @@
count(if(behavior=1,1,null)) oilCount,
sum(oil_volume) oilVolume,
sum(spand_time) sumSpand,
- count(DISTINCT if(behavior=1, r.license_num, null)) onceOilCount
+ count(DISTINCT if(behavior=1, r.license_num, null)) onceOilCount,
+ sum(if(behavior=1, total_amount, 0)) totalAmount
from t_oil_record r
join (
select sum(car_count) carCount from t_traffic_flow
@@ -268,4 +269,55 @@
GROUP BY model_code
) f on m.model_code = f.model_code
</select>
+
+ <select id="statFanByOilType" resultType="com.tievd.jyz.entity.vo.StatDataTableVo" parameterType="com.tievd.jyz.entity.vo.DataStatisReqVo">
+ select
+ count(if(behavior=1,1,null)) oilCount,
+ sum(oil_volume) oilVolume,
+ sum(if(behavior=1, total_amount, 0)) totalAmount,
+ oil_type oilType
+ from t_oil_record
+ <include refid="statRecordCondition" />
+ and oil_type is not null and oil_type != ''
+ GROUP BY oil_type
+ </select>
+
+ <select id="getVehicleFrequencyBeforeActivity" resultType="java.util.Map">
+ SELECT
+ COUNT(DISTINCT license_num) as totalVehicles,
+ COUNT(*) as totalOilRecords,
+ AVG(oil_volume) as avgOilVolume,
+ SUM(oil_volume) as totalOilVolume
+ FROM t_oil_record
+ WHERE start_time < #{startTime}
+ <foreach collection="orgCodes" item="orgCode" open="AND (" separator=" OR " close=")">
+ org_code LIKE concat(#{orgCode}, '%')
+ </foreach>
+ </select>
+
+ <select id="getVehicleFrequencyDuringActivity" resultType="java.util.Map">
+ SELECT
+ COUNT(DISTINCT license_num) as totalVehicles,
+ COUNT(*) as totalOilRecords,
+ AVG(oil_volume) as avgOilVolume,
+ SUM(oil_volume) as totalOilVolume
+ FROM t_oil_record
+ WHERE start_time >= #{startTime} AND start_time <= #{endTime}
+ <foreach collection="orgCodes" item="orgCode" open="AND (" separator=" OR " close=")">
+ org_code LIKE concat(#{orgCode}, '%')
+ </foreach>
+ </select>
+
+ <select id="getVehicleFrequencyAfterActivity" resultType="java.util.Map">
+ SELECT
+ COUNT(DISTINCT license_num) as totalVehicles,
+ COUNT(*) as totalOilRecords,
+ AVG(oil_volume) as avgOilVolume,
+ SUM(oil_volume) as totalOilVolume
+ FROM t_oil_record
+ WHERE start_time > #{endTime}
+ <foreach collection="orgCodes" item="orgCode" open="AND (" separator=" OR " close=")">
+ org_code LIKE concat(#{orgCode}, '%')
+ </foreach>
+ </select>
</mapper>
--
Gitblit v1.8.0