| | |
| | | order by t1.create_time desc |
| | | </select> |
| | | <select id="profitUserPageList" resultType="com.ruoyi.system.vo.UserProfitPageListVo"> |
| | | select * from ( |
| | | select t1.id,t1.code,t1.create_time,t2.name userName,t2.phone,t1.order_price,t1.create_time as createTime |
| | | from t_big_gift_package_order t1 left join t_app_user t2 on t1.app_user_id = t2.id |
| | | where t1.del_flag = 0 and t2.referrer_user_id = #{query.userId} and t2.referrer_status =2 AND t1.status != 6 |
| | | <if test="query.phone != null and query.phone != ''"> |
| | | AND t2.phone = #{query.phone} |
| | | </if> |
| | | <if test="query.code != null and query.code != ''"> |
| | | AND t1.code = #{query.code} |
| | | </if> |
| | | <if test="query.userName != null and query.userName != ''"> |
| | | AND t2.name like concat('%',#{query.userName},'%') |
| | | </if> |
| | | <if test="sTime !=null "> |
| | | AND t1.create_time BETWEEN #{sTime} AND #{eTime} |
| | | </if> |
| | | select t3.*,sum(t4.commission_amount) as selfProfit from ( |
| | | select t1.id,t1.code,t1.create_time,t2.name userName,t2.phone,t1.order_price,t1.create_time as createTime |
| | | from t_big_gift_package_order t1 left join t_app_user t2 on t1.app_user_id = t2.id |
| | | where t1.del_flag = 0 and t2.referrer_user_id = #{query.userId} and t2.referrer_status =2 AND t1.status != 6 |
| | | <if test="query.phone != null and query.phone != ''"> |
| | | AND t2.phone = #{query.phone} |
| | | </if> |
| | | <if test="query.code != null and query.code != ''"> |
| | | AND t1.code = #{query.code} |
| | | </if> |
| | | <if test="query.userName != null and query.userName != ''"> |
| | | AND t2.name like concat('%',#{query.userName},'%') |
| | | </if> |
| | | <if test="sTime !=null "> |
| | | AND t1.create_time BETWEEN #{sTime} AND #{eTime} |
| | | </if> |
| | | |
| | | union all |
| | | union all |
| | | |
| | | select t1.id,t1.code,t1.create_time,t2.name userName,t2.phone,t1.order_price,t1.create_time as createTime |
| | | from t_big_gift_package_order t1 left join t_app_user t2 on t1.app_user_id = t2.id |
| | | where t1.del_flag = 0 and t1.app_user_id = #{query.userId} AND t1.status != 6 |
| | | <if test="query.phone != null and query.phone != ''"> |
| | | AND t2.phone = #{query.phone} |
| | | </if> |
| | | <if test="query.code != null and query.code != ''"> |
| | | AND t1.code = #{query.code} |
| | | </if> |
| | | <if test="query.userName != null and query.userName != ''"> |
| | | AND t2.name like concat('%',#{query.userName},'%') |
| | | </if> |
| | | <if test="sTime !=null "> |
| | | AND t1.create_time BETWEEN #{sTime} AND #{eTime} |
| | | </if> |
| | | ) t3 |
| | | select t1.id,t1.code,t1.create_time,t2.name userName,t2.phone,t1.order_price,t1.create_time as createTime |
| | | from t_big_gift_package_order t1 left join t_app_user t2 on t1.app_user_id = t2.id |
| | | where t1.del_flag = 0 and t1.app_user_id = #{query.userId} AND t1.status != 6 |
| | | <if test="query.phone != null and query.phone != ''"> |
| | | AND t2.phone = #{query.phone} |
| | | </if> |
| | | <if test="query.code != null and query.code != ''"> |
| | | AND t1.code = #{query.code} |
| | | </if> |
| | | <if test="query.userName != null and query.userName != ''"> |
| | | AND t2.name like concat('%',#{query.userName},'%') |
| | | </if> |
| | | <if test="sTime !=null "> |
| | | AND t1.create_time BETWEEN #{sTime} AND #{eTime} |
| | | </if> |
| | | ) t3 left join t_commission_transaction_flow t4 on t3.id =t4.order_id |
| | | where t4.app_user_id =#{query.userId} and t4.commission_amount>0 |
| | | GROUP BY t3.id |
| | | order by t3.createTime desc |
| | | |
| | | </select> |
| | | <select id="profitUserPageListExport" resultType="com.ruoyi.system.vo.UserProfitPageListVo"> |
| | | select * from ( |