账单-金币统计-统计-强制使用索引

This commit is contained in:
2025-07-06 16:34:11 +08:00
parent 8ae1b7b6d8
commit 191cffb1d6
4 changed files with 23 additions and 20 deletions

View File

@@ -131,14 +131,14 @@
</select>-->
<select id="statDiamondBillRecord" resultType="com.accompany.sharding.vo.DiamondBillRecordStatVo">
select br.partition_id,
br.obj_type,
select br.obj_type,
br.partition_id,
sum(br.amount) `total_diamond`
from bill_record br
where br.partition_id = #{partitionId}
and br.obj_type in <foreach item="id" index="index" collection="objTypeList" open="(" close=")" separator=",">#{id}</foreach>
and br.create_time >= #{startTime} and br.create_time &lt;= #{endTime}
group by br.partition_id, br.obj_type
from bill_record br force index (idx_obj_type_partition_id_create_time)
where br.obj_type in <foreach item="id" index="index" collection="objTypeList" open="(" close=")" separator=",">#{id}</foreach>
and br.partition_id = #{partitionId}
and br.create_time between #{startTime} and #{endTime}
group by br.obj_type
</select>
</mapper>