部门交易金额

This commit is contained in:
2026-06-19 21:13:56 +08:00
parent ce72d87d12
commit df823119ed
5 changed files with 394 additions and 0 deletions

View File

@@ -85,4 +85,37 @@
)
</select>
<select id="selectSumTotalMoneyByBuyerIdsAndTimeRange" resultType="java.math.BigDecimal">
SELECT COALESCE(SUM(o.total_money), 0)
FROM lb_order_row o
WHERE o.tenant_id = #{tenantId}
AND o.buyer_id IN
<foreach collection="buyerIds" item="buyerId" open="(" separator="," close=")">
#{buyerId}
</foreach>
<if test="buyStartTime != null and buyStartTime != ''">
AND o.buy_time &gt;= #{buyStartTime}
</if>
<if test="buyEndTime != null and buyEndTime != ''">
AND o.buy_time &lt;= #{buyEndTime}
</if>
</select>
<select id="selectSumTotalMoneyGroupByBuyerIds" resultType="map">
SELECT o.buyer_id AS buyerId, COALESCE(SUM(o.total_money), 0) AS totalMoney
FROM lb_order_row o
WHERE o.tenant_id = #{tenantId}
AND o.buyer_id IN
<foreach collection="buyerIds" item="buyerId" open="(" separator="," close=")">
#{buyerId}
</foreach>
<if test="buyStartTime != null and buyStartTime != ''">
AND o.buy_time &gt;= #{buyStartTime}
</if>
<if test="buyEndTime != null and buyEndTime != ''">
AND o.buy_time &lt;= #{buyEndTime}
</if>
GROUP BY o.buyer_id
</select>
</mapper>