账单-金币统计-统计-sql优化

This commit is contained in:
khalil
2025-07-04 16:53:25 +08:00
parent cd57a6164a
commit 1837b5bee5

View File

@@ -120,15 +120,14 @@
</select>
<select id="statDiamondBillRecord" resultType="com.accompany.sharding.vo.DiamondBillRecordStatVo">
select u.partition_id,
select br.partition_id,
br.obj_type,
sum(br.amount) `total_diamond`
from bill_record br
inner join users u on br.uid = u.uid
and u.partition_id in <foreach item="id" index="index" collection="partitionIds" open="(" close=")" separator=",">#{id}</foreach>
where br.partition_id in <foreach item="id" index="index" collection="partitionIds" open="(" close=")" separator=",">#{id}</foreach>
and br.create_time >= #{startTime} and br.create_time &lt;= #{endTime}
and br.currency = 1
group by u.partition_id, br.obj_type
group by br.partition_id, br.obj_type
</select>
</mapper>