| | |
| | | sys_vip_info a |
| | | WHERE |
| | | a.recommend_id = #{userId} |
| | | AND a.is_sales = #{isSales} and (a.IS_DELETE is null or a.IS_DELETE = '') |
| | | AND a.is_sales = #{isSales} |
| | | </select> |
| | | |
| | | <select id="findShopSalesmanApplyList" resultType="com.matrix.system.fenxiao.vo.ShopSalesmanApplyVo"> |
| | |
| | | WHERE s.id = a.parent_user_id ) parentUser, |
| | | c.nick_name parentUserNow, |
| | | ( SELECT COUNT(*) FROM sys_vip_info |
| | | WHERE recommend_id = a.user_id AND is_sales != 1 and (IS_DELETE is null or IS_DELETE = '')) lowerLevelNum, |
| | | WHERE recommend_id = a.user_id AND is_sales != 1 ) lowerLevelNum, |
| | | ( SELECT COUNT(*) FROM sys_vip_info |
| | | WHERE recommend_id = a.user_id AND is_sales = 1 and (IS_DELETE is null or IS_DELETE = '')) invitedNum, |
| | | WHERE recommend_id = a.user_id AND is_sales = 1 ) invitedNum, |
| | | ( SELECT IFNULL(sum(IFNULL(amount, 0)), 0) FROM shop_salesman_order |
| | | WHERE order_status = 2 AND sales_user_id = a.user_id ) totalRevenue, |
| | | ( SELECT IFNULL(sum(IFNULL(amount, 0)), 0) FROM shop_salesman_order |
| | |
| | | LEFT JOIN shop_salesman_grade g ON a.grade_id = g.id |
| | | LEFT JOIN sys_vip_info c ON c.id = b.recommend_id |
| | | <where> |
| | | a.company_id=#{record.companyId} and (b.IS_DELETE is null or b.IS_DELETE = '') |
| | | a.company_id=#{record.companyId} |
| | | <if test="record.shenheState != null and record.shenheState != ''"> |
| | | and a.apply_status=#{record.shenheState} |
| | | </if> |
| | |
| | | LEFT JOIN sys_vip_info b ON a.user_id = b.id |
| | | <where> |
| | | a.company_id = #{record.companyId} |
| | | and a.apply_status = #{record.applyStatus} and (b.IS_DELETE is null or b.IS_DELETE = '') |
| | | and a.apply_status = #{record.applyStatus} |
| | | <if test="record.nickName != null and record.nickName != ''"> |
| | | and b.nick_name like concat('%',#{record.nickName},'%') |
| | | </if> |
| | |
| | | <where> |
| | | a.company_id = #{record.companyId} |
| | | and a.is_sales != 1 |
| | | and (a.IS_DELETE is null or a.IS_DELETE = '') |
| | | |
| | | <if test="record.nickName != null and record.nickName != ''"> |
| | | and a.nick_name like concat('%',#{record.nickName},'%') |
| | | </if> |
| | |
| | | ( SELECT count( * ) FROM shop_salesman_order c WHERE c.sales_user_id = #{openId} and revenue_type =1 ) AS salesorderCount, |
| | | ( SELECT count( * ) FROM shop_salesman_order c WHERE c.sales_user_id = #{openId} and revenue_type =2 ) AS invitationOrderCount, |
| | | (select count(*) from sys_vip_info where recommend_id=#{openId} and is_sales=1 |
| | | and (IS_DELETE is null or IS_DELETE = '')) as invitationCount, |
| | | ) as invitationCount, |
| | | (select count(*) from sys_vip_info where recommend_id=#{openId} and is_sales=2 |
| | | and (IS_DELETE is null or IS_DELETE = '')) as customerCount |
| | | ) as customerCount |
| | | from sys_vip_info a where |
| | | a.id=#{id} and (a.IS_DELETE is null or a.IS_DELETE = '') |
| | | a.id=#{id} |
| | | |
| | | </select> |
| | | |
| | |
| | | WHERE s.id = a.parent_user_id ) parentUser, |
| | | ( SELECT COUNT(*) FROM sys_vip_info |
| | | WHERE recommend_id = a.user_id AND is_sales != 1 |
| | | and (IS_DELETE is null or IS_DELETE = '')) lowerLevelNum, |
| | | ) lowerLevelNum, |
| | | ( SELECT COUNT(*) FROM sys_vip_info |
| | | WHERE recommend_id = a.user_id AND is_sales = 1 |
| | | and (IS_DELETE is null or IS_DELETE = '')) invitedNum, |
| | | ) invitedNum, |
| | | ( SELECT IFNULL(sum(IFNULL(amount, 0)), 0) FROM shop_salesman_order |
| | | WHERE order_status = 2 AND sales_user_id = a.user_id ) totalRevenue, |
| | | ( SELECT IFNULL(sum(IFNULL(amount, 0)), 0) FROM shop_salesman_order |
| | |
| | | shop_salesman_apply a |
| | | LEFT JOIN sys_vip_info b ON a.user_id = b.id |
| | | LEFT JOIN shop_salesman_grade g ON a.grade_id = g.id |
| | | where a.id = #{applyId} and (b.IS_DELETE is null or b.IS_DELETE = '') |
| | | where a.id = #{applyId} |
| | | </select> |
| | | |
| | | <select id="findCustomDetail" resultType="com.matrix.system.fenxiao.vo.ShopCustomDetailVo"> |
| | |
| | | <where> |
| | | b.company_id = #{record.companyId} |
| | | AND b.is_sales != 1 |
| | | and b.recommend_id = #{record.userId} and (b.IS_DELETE is null or b.IS_DELETE = '') |
| | | and b.recommend_id = #{record.userId} |
| | | <if test="record.userName != null and record.userName != ''"> |
| | | and b.nick_name like concat('%',#{record.userName},'%') |
| | | </if> |
| | |
| | | a.company_id = #{record.companyId} |
| | | AND b.is_sales = 1 |
| | | and b.recommend_id = #{record.userId} |
| | | and (b.IS_DELETE is null or b.IS_DELETE = '') |
| | | |
| | | and a.apply_status = 2 |
| | | <if test="record.userName != null and record.userName != ''"> |
| | | and b.nick_name like concat('%',#{record.userName},'%') |
| | |
| | | left join shop_order c on a.order_id=c.id |
| | | LEFT JOIN sys_shop_info f on f.id = c.store_id |
| | | <where> |
| | | a.sales_user_id = #{record.userId} and (b.IS_DELETE is null or b.IS_DELETE = '') |
| | | a.sales_user_id = #{record.userId} |
| | | <if test="record.orderType != null and record.orderType != ''"> |
| | | and a.order_status = #{record.orderType} |
| | | </if> |