1、新增账户资金统计、账户数量统计;2、管理端各项统计增加忽略组织标记;

This commit is contained in:
gaoqr
2025-09-30 16:44:29 +08:00
parent 23bc07160d
commit c292cde4f8
15 changed files with 427 additions and 8 deletions
@@ -26,4 +26,32 @@
select sum(price) from pay_order
where status = '${@com.cf.imes.module.system.enums.pay.PayOrderStatusEnum@SUCCESS.status}' and deleted = false
</select>
<sql id="dateCreate">
<if test="req.unit != null and req.unit == @com.cf.imes.framework.common.enums.OrderStatisticsUnit@QUARTER.getValue()">
,CONCAT(YEAR(o.notify_time), '-', QUARTER(o.notify_time)) as date
</if>
<if test="req.unit != null and req.unit == @com.cf.imes.framework.common.enums.OrderStatisticsUnit@MONTH.getValue()">
,CONCAT(YEAR(o.notify_time), '-', MONTH(o.notify_time)) as date
</if>
<if test="req.unit != null and req.unit == @com.cf.imes.framework.common.enums.OrderStatisticsUnit@WEEK.getValue()">
,CONCAT(YEAR(o.notify_time), '-', MONTH(o.notify_time), '-', FLOOR((DayOfMonth(o.notify_time)-1)/7)+1) AS
date
</if>
<if test="req.unit != null and req.unit == @com.cf.imes.framework.common.enums.OrderStatisticsUnit@DAY.getValue()">
,CONCAT(YEAR(o.notify_time), '-', MONTH(o.notify_time), '-', DAY(o.notify_time)) as date
</if>
</sql>
<select id="getRechargeGroupStatistics"
resultType="com.cf.imes.module.system.dal.dataobject.funds.statistics.FundsTradeTypeGroupStatisticsDO">
select sum(o.price) as amount
<include refid="dateCreate"/>
from pay_order o
where o.deleted = false
and o.status = '${@com.cf.imes.module.system.enums.pay.PayOrderStatusEnum@SUCCESS.status}'
and o.trade_type = '${@com.cf.imes.module.system.enums.pay.TradeTypeEnum@RECHARGE.code}'
and o.notify_time between #{req.createTime[0]} and #{req.createTime[1]}
group by date;
</select>
</mapper>
@@ -76,4 +76,30 @@
from purchase_record
where deleted = false;
</select>
<sql id="dateCreate">
<if test="req.unit != null and req.unit == @com.cf.imes.framework.common.enums.OrderStatisticsUnit@QUARTER.getValue()">
,CONCAT(YEAR(o.create_time), '-', QUARTER(o.create_time)) as date
</if>
<if test="req.unit != null and req.unit == @com.cf.imes.framework.common.enums.OrderStatisticsUnit@MONTH.getValue()">
,CONCAT(YEAR(o.create_time), '-', MONTH(o.create_time)) as date
</if>
<if test="req.unit != null and req.unit == @com.cf.imes.framework.common.enums.OrderStatisticsUnit@WEEK.getValue()">
,CONCAT(YEAR(o.create_time), '-', MONTH(o.create_time), '-', FLOOR((DayOfMonth(o.create_time)-1)/7)+1) AS
date
</if>
<if test="req.unit != null and req.unit == @com.cf.imes.framework.common.enums.OrderStatisticsUnit@DAY.getValue()">
,CONCAT(YEAR(o.create_time), '-', MONTH(o.create_time), '-', DAY(o.create_time)) as date
</if>
</sql>
<select id="getPurchaseGroupStatistics"
resultType="com.cf.imes.module.system.dal.dataobject.funds.statistics.FundsTradeTypeGroupStatisticsDO">
select sum(o.total_amount - o.gift_money_spent) as amount
<include refid="dateCreate"/>
from purchase_record o
where o.deleted = false and o.initial != true
and o.create_time between #{req.createTime[0]} and #{req.createTime[1]}
group by date;
</select>
</mapper>
@@ -53,4 +53,56 @@
</select>
<sql id="dateUpdate">
<if test="req.unit != null and req.unit == @com.cf.imes.framework.common.enums.OrderStatisticsUnit@QUARTER.getValue()">
,CONCAT(YEAR(o.update_time), '-', QUARTER(o.update_time)) as date
</if>
<if test="req.unit != null and req.unit == @com.cf.imes.framework.common.enums.OrderStatisticsUnit@MONTH.getValue()">
,CONCAT(YEAR(o.update_time), '-', MONTH(o.update_time)) as date
</if>
<if test="req.unit != null and req.unit == @com.cf.imes.framework.common.enums.OrderStatisticsUnit@WEEK.getValue()">
,CONCAT(YEAR(o.update_time), '-', MONTH(o.update_time), '-', FLOOR((DayOfMonth(o.update_time)-1)/7)+1) AS date
</if>
<if test="req.unit != null and req.unit == @com.cf.imes.framework.common.enums.OrderStatisticsUnit@DAY.getValue()">
,CONCAT(YEAR(o.update_time), '-', MONTH(o.update_time), '-', DAY(o.update_time)) as date
</if>
</sql>
<sql id="dateCreate">
<if test="req.unit != null and req.unit == @com.cf.imes.framework.common.enums.OrderStatisticsUnit@QUARTER.getValue()">
,CONCAT(YEAR(o.create_time), '-', QUARTER(o.create_time)) as date
</if>
<if test="req.unit != null and req.unit == @com.cf.imes.framework.common.enums.OrderStatisticsUnit@MONTH.getValue()">
,CONCAT(YEAR(o.create_time), '-', MONTH(o.create_time)) as date
</if>
<if test="req.unit != null and req.unit == @com.cf.imes.framework.common.enums.OrderStatisticsUnit@WEEK.getValue()">
,CONCAT(YEAR(o.create_time), '-', MONTH(o.create_time), '-', FLOOR((DayOfMonth(o.create_time)-1)/7)+1) AS
date
</if>
<if test="req.unit != null and req.unit == @com.cf.imes.framework.common.enums.OrderStatisticsUnit@DAY.getValue()">
,CONCAT(YEAR(o.create_time), '-', MONTH(o.create_time), '-', DAY(o.create_time)) as date
</if>
</sql>
<select id="selectUserStatusGroupStatistics"
resultType="com.cf.imes.module.system.dal.dataobject.user.UserStatusGroupStatisticsDO">
select count(o.id) as userCount
<if test="deleted">
<include refid="dateUpdate"/>
</if>
<if test="!deleted">
<include refid="dateCreate"/>
</if>
from system_users o
where
<if test="deleted">
o.update_time between #{req.createTime[0]} and #{req.createTime[1]}
</if>
<if test="!deleted">
o.create_time between #{req.createTime[0]} and #{req.createTime[1]}
</if>
and o.deleted = #{deleted}
group by date;
</select>
</mapper>