姜友瑶
2022-05-23 ea865027c9e115057644f59747f3bed2a8a963e6
zq-erp/src/main/resources/mybatis/mapper/fenxiao/ShopSalesmanApplyDao.xml
@@ -55,7 +55,7 @@
         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">
@@ -68,9 +68,9 @@
      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
@@ -85,7 +85,7 @@
      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>
@@ -110,7 +110,7 @@
      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>
@@ -132,7 +132,7 @@
      <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>
@@ -187,11 +187,11 @@
   ( 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>
@@ -206,10 +206,10 @@
      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
@@ -221,7 +221,7 @@
      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">
@@ -235,7 +235,7 @@
      <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>
@@ -259,7 +259,7 @@
         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},'%')
@@ -289,7 +289,7 @@
      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>