Affiliate功能-数据库表设计更新
This commit is contained in:
36
src/main/resources/mapper/primary/AffiliateIncomeMapper.xml
Normal file
36
src/main/resources/mapper/primary/AffiliateIncomeMapper.xml
Normal 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>
|
||||
16
src/main/resources/mapper/primary/AffiliateMapper.xml
Normal file
16
src/main/resources/mapper/primary/AffiliateMapper.xml
Normal 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>
|
||||
Reference in New Issue
Block a user