|
@@ -41,9 +41,10 @@
|
|
FROM kuaishou_reward_base_info
|
|
FROM kuaishou_reward_base_info
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
- <select id="selectKuaishouRewardBaseInfoList" parameterType="com.ruixuan.isc.entity.KuaishouRewardBaseInfo"
|
|
|
|
|
|
+ <select id="selectKuaishouRewardBaseInfoList"
|
|
resultMap="KuaishouRewardBaseInfoResult">
|
|
resultMap="KuaishouRewardBaseInfoResult">
|
|
SELECT t1.id,
|
|
SELECT t1.id,
|
|
|
|
+ t1.promoter_type,
|
|
t1.item_id,
|
|
t1.item_id,
|
|
t1.item_title,
|
|
t1.item_title,
|
|
t1.promoter_id,
|
|
t1.promoter_id,
|
|
@@ -69,14 +70,15 @@
|
|
GROUP BY promoter_id
|
|
GROUP BY promoter_id
|
|
) t3 on t1.promoter_id = t3.promoter_id
|
|
) t3 on t1.promoter_id = t3.promoter_id
|
|
<where>
|
|
<where>
|
|
- <if test="itemId != null ">and t1.item_id = #{itemId}</if>
|
|
|
|
|
|
+ <if test="itemId != null and itemId != '' ">and t1.item_id = #{itemId}</if>
|
|
<if test="itemTitle != null and itemTitle != ''">and t1.item_title = #{itemTitle}</if>
|
|
<if test="itemTitle != null and itemTitle != ''">and t1.item_title = #{itemTitle}</if>
|
|
- <if test="promoterId != null ">and t1.promoter_id = #{promoterId}</if>
|
|
|
|
|
|
+ <if test="promoterId != null and promoterId != '' ">and t1.promoter_id = #{promoterId}</if>
|
|
<if test="promoterName != null and promoterName != ''">and t1.promoter_name like concat('%',
|
|
<if test="promoterName != null and promoterName != ''">and t1.promoter_name like concat('%',
|
|
#{promoterName},
|
|
#{promoterName},
|
|
'%')
|
|
'%')
|
|
</if>
|
|
</if>
|
|
- <if test="statDate != null ">and t1.stat_date = #{statDate}</if>
|
|
|
|
|
|
+ <if test="startDate != null and startDate != ''">and t1.stat_date >= #{startDate}</if>
|
|
|
|
+ <if test="endDate != null and endDate != ''">and t1.stat_date <= #{endDate}</if>
|
|
|
|
|
|
</where>
|
|
</where>
|
|
order by t1.create_time desc
|
|
order by t1.create_time desc
|
|
@@ -129,17 +131,81 @@
|
|
</where>
|
|
</where>
|
|
|
|
|
|
</select>
|
|
</select>
|
|
|
|
+ <select id="getTotalSettlementNum" resultType="java.lang.Long">
|
|
|
|
+ SELECT ifnull(SUM(current_settlement_num), 0) AS totalSettlementNum
|
|
|
|
+ FROM kuaishou_reward_base_info
|
|
|
|
+ WHERE promoter_id = #{promoterId}
|
|
|
|
+ AND item_id = #{itemId}
|
|
|
|
+ </select>
|
|
|
|
+ <select id="getTotalAmount" resultType="java.math.BigDecimal">
|
|
|
|
+ SELECT ifnull(SUM(anchor_amount + reference_amount), 0) AS tatalAmount
|
|
|
|
+ FROM kuaishou_reward_base_info
|
|
|
|
+ WHERE promoter_id = #{promoterId}
|
|
|
|
+ AND item_id = #{itemId}
|
|
|
|
+ </select>
|
|
|
|
+ <select id="totalListInfo" resultMap="KuaishouRewardBaseInfoResult">
|
|
|
|
+
|
|
|
|
+ SELECT * from (
|
|
|
|
+ SELECT t1.id,
|
|
|
|
+ t1.item_id,
|
|
|
|
+ t1.item_title,
|
|
|
|
+ t1.promoter_id,
|
|
|
|
+ t1.promoter_name,
|
|
|
|
+ sum(t1.current_settlement_num) as 'total_settlement_num',
|
|
|
|
+ sum(t1.anchor_amount) as 'anchor_amount',
|
|
|
|
+ sum(t1.reference_amount) as 'reference_amount',
|
|
|
|
+ sum(t1.reference_amount + t1.anchor_amount ) as 'total_amount',
|
|
|
|
+ t2.user_name as 'itemCreateName',
|
|
|
|
+ t3.user_name as 'promoterCreateName',
|
|
|
|
+ max(t1.create_time) as 'createTime'
|
|
|
|
+ FROM kuaishou_reward_base_info t1 LEFT JOIN kuaishou_item_list t2
|
|
|
|
+ on t1.item_id = t2.item_id
|
|
|
|
+ LEFT JOIN (
|
|
|
|
+ SELECT promoter_id as 'promoter_id',
|
|
|
|
+ group_concat(user_name) as 'user_name'
|
|
|
|
+ from kuaishou_promoter WHERE media_id = '2'
|
|
|
|
+ GROUP BY promoter_id
|
|
|
|
+ ) t3 on t1.promoter_id = t3.promoter_id
|
|
|
|
+ <where>
|
|
|
|
+ <if test="itemId != null and itemId != '' ">and t1.item_id = #{itemId}</if>
|
|
|
|
+ <if test="itemTitle != null and itemTitle != ''">and t1.item_title = #{itemTitle}</if>
|
|
|
|
+ <if test="promoterId != null and promoterId != '' ">and t1.promoter_id = #{promoterId}</if>
|
|
|
|
+ <if test="promoterName != null and promoterName != ''">and t1.promoter_name like concat('%',
|
|
|
|
+ #{promoterName},
|
|
|
|
+ '%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="startDate != null and startDate != ''">and t1.stat_date >= #{startDate}</if>
|
|
|
|
+ <if test="endDate != null and endDate != ''">and t1.stat_date <= #{endDate}</if>
|
|
|
|
+ </where>
|
|
|
|
+
|
|
|
|
+ <if test="itemId != null and promoterId != null">
|
|
|
|
+ group by t1.item_id,t1.promoter_id
|
|
|
|
+ </if>
|
|
|
|
+ <if test="itemId == null and promoterId == null">
|
|
|
|
+ group by t1.item_id,t1.promoter_id
|
|
|
|
+ </if>
|
|
|
|
+
|
|
|
|
+ <if test="itemId != null and promoterId == null ">
|
|
|
|
+ group by t1.item_id
|
|
|
|
+ </if>
|
|
|
|
+ <if test="promoterId != null and itemId == null ">
|
|
|
|
+ group by t1.promoter_id
|
|
|
|
+ </if>
|
|
|
|
+
|
|
|
|
+ ) t
|
|
|
|
+ order by t.createTime desc
|
|
|
|
+ </select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertKuaishouRewardBaseInfo" parameterType="com.ruixuan.isc.entity.KuaishouRewardBaseInfo"
|
|
<insert id="insertKuaishouRewardBaseInfo" parameterType="com.ruixuan.isc.entity.KuaishouRewardBaseInfo"
|
|
useGeneratedKeys="true" keyProperty="id">
|
|
useGeneratedKeys="true" keyProperty="id">
|
|
insert into kuaishou_reward_base_info
|
|
insert into kuaishou_reward_base_info
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
+ <if test="promoterType != null">promoter_type,</if>
|
|
<if test="itemId != null">item_id,</if>
|
|
<if test="itemId != null">item_id,</if>
|
|
<if test="itemTitle != null">item_title,</if>
|
|
<if test="itemTitle != null">item_title,</if>
|
|
<if test="promoterId != null">promoter_id,</if>
|
|
<if test="promoterId != null">promoter_id,</if>
|
|
<if test="promoterName != null">promoter_name,</if>
|
|
<if test="promoterName != null">promoter_name,</if>
|
|
-
|
|
|
|
<if test="statDate != null">stat_date,</if>
|
|
<if test="statDate != null">stat_date,</if>
|
|
<if test="currentSettlementNum != null">current_settlement_num,</if>
|
|
<if test="currentSettlementNum != null">current_settlement_num,</if>
|
|
<if test="totalSettlementNum != null">total_settlement_num,</if>
|
|
<if test="totalSettlementNum != null">total_settlement_num,</if>
|
|
@@ -152,11 +218,11 @@
|
|
<if test="updateTime != null">update_time,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
</trim>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
+ <if test="promoterType != null">#{promoterType},</if>
|
|
<if test="itemId != null">#{itemId},</if>
|
|
<if test="itemId != null">#{itemId},</if>
|
|
<if test="itemTitle != null">#{itemTitle},</if>
|
|
<if test="itemTitle != null">#{itemTitle},</if>
|
|
<if test="promoterId != null">#{promoterId},</if>
|
|
<if test="promoterId != null">#{promoterId},</if>
|
|
<if test="promoterName != null">#{promoterName},</if>
|
|
<if test="promoterName != null">#{promoterName},</if>
|
|
-
|
|
|
|
<if test="statDate != null">#{statDate},</if>
|
|
<if test="statDate != null">#{statDate},</if>
|
|
<if test="currentSettlementNum != null">#{currentSettlementNum},</if>
|
|
<if test="currentSettlementNum != null">#{currentSettlementNum},</if>
|
|
<if test="totalSettlementNum != null">#{totalSettlementNum},</if>
|
|
<if test="totalSettlementNum != null">#{totalSettlementNum},</if>
|