LEFT JOIN sys_dict sd ON sd.`VALUE` = o.pay_channel
LEFT JOIN sys_dict sd ON sd.`VALUE` = o.pay_channel
LEFT JOIN youka_users yu ON yu.code = yb.user_code
LEFT JOIN youka_users yu ON yu.code = yb.user_code
WHERE o.del_flag = 0
WHERE o.del_flag = 0
-- AND o.pay_status = 2
<iftest="cardCode != null and cardCode !='' ">
<!--<if test="userCode != null and userCode != '' and code == 'A'">-->
AND o.pay_status = 2
<!--AND yb.user_code IN (SELECT `code` FROM `youka_users` WHERE FIND_IN_SET(( SELECT a.id FROM youka_users a WHERE a.mobile = #{userCode} ), recommended_path );)-->
</if>
<!--</if>-->
<iftest="userCode != null and userCode != ''">
<iftest="userCode != null and userCode != ''">
AND yb.user_code = (SELECT code FROM youka_users y1 WHERE y1.mobile = #{userCode})
AND yb.user_code = (SELECT code FROM youka_users y1 WHERE y1.mobile = #{userCode})
<!--王者用户 获取的是钻石级别用户的所有收益百分比2% -->
<!--<if test='code != null and code != "" and code == "A"'>-->
<!--AND yb.user_code IN (SELECT `code` FROM `youka_users` y1 WHERE y1.recommended_mobile IN (SELECT y2.mobile FROM `youka_users` y2 WHERE y2.recommended_mobile = #{userCode} AND y2.`level` = "B"))-->