From 453ee097563df5788f96e102b38249f0ca70d82a Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期二, 14 十月 2025 18:41:54 +0800
Subject: [PATCH] 诊所和供应商首页统计
---
ruoyi-system/src/main/resources/mapper/system/TSysOrderMapper.xml | 67 +++++++++++++++++++++++++++++++++
1 files changed, 67 insertions(+), 0 deletions(-)
diff --git a/ruoyi-system/src/main/resources/mapper/system/TSysOrderMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TSysOrderMapper.xml
index 7a4e3c0..a5c39e3 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TSysOrderMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TSysOrderMapper.xml
@@ -45,5 +45,72 @@
order by t1.create_time desc
</select>
+ <select id="clinicSalesStatisticsCount" resultType="java.lang.Integer">
+ select count(1)
+ from t_sys_order tso
+ left join t_sys_order_goods tsog on tso.id = tsog.order_id
+ left join t_erp_goods teg on tepg.goods_id = teg.id
+ where tso.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+ and tso.clinic_id = #{clinicId}
+ </select>
+ <select id="clinicSalesStatisticsTypeCount" resultType="java.lang.Integer">
+ select count(1)
+ from t_sys_order tso
+ left join t_sys_order_goods tsog on tso.id = tsog.order_id
+ left join t_erp_goods teg on tepg.goods_id = teg.id
+ where tso.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+ and tso.clinic_id = #{clinicId}
+ group by teg.type_id
+ </select>
+ <select id="clinicSalesStatisticsMoney" resultType="java.math.BigDecimal">
+ select sum(total_money) from t_sys_order
+ where disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+ and pay_time between #{startTime} and #{endTime}
+ and clinic_id = #{clinicId}
+ </select>
+ <select id="supplierSalesStatisticsGoodsType"
+ resultType="com.ruoyi.system.vo.ClinicSalesStatisticsGoodsTypeVO">
+ select count(1), tegt.type_name
+ from t_sys_order tso
+ left join t_sys_order_goods tsog on tso.id = tsog.order_id
+ left join t_erp_goods teg on tsog.goods_id = teg.id
+ left join t_erp_goods_type tegt on teg.type_id = tegt.id
+ where tso.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+ and tso.pay_time between #{startTime} and #{endTime}
+ and tso.clinic_id = #{clinicId}
+ group by teg.type_id
+ order by count(1) desc
+ </select>
+ <select id="supplierSalesStatisticsGoodsCount"
+ resultType="com.ruoyi.system.vo.ClinicSalesStatisticsGoodsCountVO">
+ select
+ date_format(t1.pay_time, '%m.%d') as `time`,
+ date_format(t1.pay_time, '%Y-%m-%d') as payTime,
+ sum(t2.purchase_count) as goodsCount
+ from t_sys_order t1
+ left join t_sys_order_goods t2 on t1.id = t2.order_id
+ where t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+ and t1.pay_time between #{startTime} and #{endTime}
+ and t1.clinic_id = #{clinicId}
+ <if test="goodsName != null and goodsName != ''">
+ and t2.goods_name like concat('%',#{goodsName},'%')
+ </if>
+ group by date_format(t1.pay_time, '%m.%d')
+ </select>
+ <select id="supplierSalesStatisticsGoodsCountMonth"
+ resultType="com.ruoyi.system.vo.ClinicSalesStatisticsGoodsCountVO">
+ select
+ date_format(t1.pay_time, '%Y.%m') as `time`,
+ sum(t2.purchase_count) as goodsCount
+ from t_sys_order t1
+ left join t_sys_order_goods t2 on t1.id = t2.order_id
+ where t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+ and t1.pay_time between #{startTime} and #{endTime}
+ and t1.clinic_id = #{clinicId}
+ <if test="goodsName != null and goodsName != ''">
+ and t2.goods_name like concat('%',#{goodsName},'%')
+ </if>
+ group by date_format(t1.pay_time, '%Y.%m')
+ </select>
</mapper>
--
Gitblit v1.7.1