Affiliate功能-数据库表设计更新

This commit is contained in:
2024-12-18 11:53:41 +08:00
parent bf8af41f3f
commit 7d8f047087
16 changed files with 338 additions and 72 deletions

View File

@@ -0,0 +1,36 @@
<?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.ai.da.mapper.primary.AffiliateIncomeMapper">
<select id="getPersonalMonthlyIncome" resultType="java.util.Map">
SELECT
DATE_FORMAT(payment_time, '%m') as yearMonth,
SUM(commission) AS totalCommission
FROM
t_affiliate_income
WHERE
YEAR(payment_time) = #{year}
and affiliate_account_id = #{affiliateAccountId}
GROUP BY
yearMonth
ORDER BY
yearMonth
</select>
<select id="getMonthlyAffiliateIncome" resultType="java.util.Map">
SELECT
DATE_FORMAT(payment_time, '%m') as yearMonth,
SUM(amount) AS totalAmount,
SUM(commission) AS totalCommission
FROM
t_affiliate_income
WHERE
YEAR(payment_time) = #{year}
and MONTH(payment_time) = #{month}
GROUP BY
yearMonth
ORDER BY
yearMonth
</select>
</mapper>

View File

@@ -0,0 +1,16 @@
<?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.ai.da.mapper.primary.AffiliateMapper">
<select id="getMonthlyApprovedAffiliate" resultType="java.util.Map">
SELECT
count(*) AS count
FROM
t_affiliate
WHERE
YEAR ( create_time ) = #{year}
AND MONTH ( create_time ) = #{month}
AND status = 'Active'
</select>
</mapper>