<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="com.ruoyi.order.mapper.TAccountSettlementStatementMapper">
|
|
<sql id="statementWhere">
|
<where>
|
<if test="req.type != null and req.type == 1">
|
AND site_id = 0
|
</if>
|
<if test="req.type != null and req.type == 2">
|
AND site_id > 0
|
</if>
|
<if test="req.state != null">
|
AND status = #{req.state}
|
</if>
|
AND account_type = 3
|
<if test="req.uid != null and req.uid != ''">
|
AND id = #{req.uid}
|
</if>
|
<if test="startCycle != null">
|
AND billing_cycle >= #{startCycle}
|
</if>
|
<if test="endCycle != null">
|
AND billing_cycle < #{endCycle}
|
</if>
|
AND site_id IN
|
<foreach collection="siteIds" open="(" close=")" separator="," item="siteId">
|
#{siteId}
|
</foreach>
|
</where>
|
</sql>
|
|
<select id="selectStatementPage" resultType="com.ruoyi.order.api.model.TAccountSettlementStatement">
|
SELECT id, site_id, billing_cycle, status, code, account_type,
|
recharge_amount, refund_amount, platform_fee,
|
tripartite_commission, recorded_amount,
|
platform_income, partner_income, create_time
|
FROM t_account_settlement_statement
|
<include refid="statementWhere"/>
|
ORDER BY billing_cycle DESC, account_type ASC, site_id ASC
|
</select>
|
|
<select id="selectStatementSummary" resultType="com.ruoyi.order.api.vo.AccountListVO">
|
SELECT COUNT(*) AS billCount,
|
COALESCE(SUM(recorded_amount), 0) AS totalAmount,
|
COALESCE(SUM(recharge_amount), 0) AS paymentAmount,
|
COALESCE(SUM(refund_amount), 0) AS refundAmount,
|
COALESCE(SUM(platform_fee), 0) AS commissionAmount,
|
COALESCE(SUM(tripartite_commission), 0) AS sharingAmount,
|
COALESCE(SUM(platform_income), 0) AS platformIncome,
|
COALESCE(SUM(partner_income), 0) AS partnerIncome
|
FROM t_account_settlement_statement
|
<include refid="statementWhere"/>
|
</select>
|
|
</mapper>
|