code review:会员统计

This commit is contained in:
YunaiV
2023-10-14 01:26:06 +08:00
parent 0eb86ca269
commit 1ac2f2b5c2
24 changed files with 86 additions and 41 deletions

View File

@@ -3,6 +3,7 @@
<mapper namespace="cn.iocoder.yudao.module.statistics.dal.mysql.infra.ApiAccessLogStatisticsMapper">
<select id="selectCountByIp" resultType="java.lang.Integer">
<!-- TODO @疯狂distinct 会不会更合适哈 -->
SELECT COUNT(1)
FROM infra_api_access_log
WHERE create_time BETWEEN #{beginTime} AND #{endTime}
@@ -11,6 +12,7 @@
</select>
<select id="selectCountByUserId" resultType="java.lang.Integer">
<!-- TODO @疯狂distinct 会不会更合适哈 -->
SELECT COUNT(1)
FROM infra_api_access_log
WHERE user_id > 0

View File

@@ -31,6 +31,7 @@
<select id="selectRechargeSummaryGroupByWalletId"
resultType="cn.iocoder.yudao.module.statistics.service.pay.bo.RechargeSummaryRespBO">
<!-- TODO @疯狂:是不是不用 group by而是通过 DISTINCT wallet_id 更合适哈? -->
SELECT COUNT(1) AS rechargeUserCount,
SUM(pay_price) AS rechargePrice
FROM pay_wallet_recharge

View File

@@ -49,7 +49,7 @@
<select id="selectExpensePriceByTimeBetween" resultType="java.lang.Integer">
SELECT -- 支出金额 = 余额支付金额 + 支付佣金金额 + 商品退款金额
SUM(order_wallet_pay_price + brokerage_settlement_price + after_sale_refund_price) AS expensePrice
FROM trade_statistics
FROM trade_statistics
WHERE deleted = FALSE
<if test="beginTime != null">
AND time >= #{beginTime}