|  | @@ -4,34 +4,34 @@
 | 
	
		
			
				|  |  |          "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
	
		
			
				|  |  |  <mapper namespace="com.ruixuan.isc.mapper.SupplyChainMapper">
 | 
	
		
			
				|  |  |      <insert id="bindUser">
 | 
	
		
			
				|  |  | -        insert into kuaishou_item_bind_user(item_id, user_id, user_name)
 | 
	
		
			
				|  |  | -            value
 | 
	
		
			
				|  |  | +        INSERT INTO kuaishou_item_bind_user(item_id, user_id, user_name)
 | 
	
		
			
				|  |  | +            VALUE
 | 
	
		
			
				|  |  |              (#{itemId},#{userId},#{nikeName})
 | 
	
		
			
				|  |  |      </insert>
 | 
	
		
			
				|  |  |      <update id="updateOrder">
 | 
	
		
			
				|  |  | -        update kuaishou_supply_chain
 | 
	
		
			
				|  |  | -        set order_status = #{cpsOrderStatus}
 | 
	
		
			
				|  |  | -        where oid = #{oid}
 | 
	
		
			
				|  |  | +        UPDATE kuaishou_supply_chain
 | 
	
		
			
				|  |  | +        SET order_status = #{cpsOrderStatus}
 | 
	
		
			
				|  |  | +        WHERE oid = #{oid}
 | 
	
		
			
				|  |  |      </update>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <update id="updateOrderRegimentalSettleAmount">
 | 
	
		
			
				|  |  | -        update kuaishou_supply_chain
 | 
	
		
			
				|  |  | -        set order_status                   = #{cpsOrderStatus},
 | 
	
		
			
				|  |  | +        UPDATE kuaishou_supply_chain
 | 
	
		
			
				|  |  | +        SET order_status                   = #{cpsOrderStatus},
 | 
	
		
			
				|  |  |              total_regimental_settle_amount = regimental_promotion_amount
 | 
	
		
			
				|  |  | -        where oid = #{oid}
 | 
	
		
			
				|  |  | +        WHERE oid = #{oid}
 | 
	
		
			
				|  |  |      </update>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <update id="updateItem">
 | 
	
		
			
				|  |  | -        update kuaishou_item_list
 | 
	
		
			
				|  |  | -        set activity_item_status = #{status}
 | 
	
		
			
				|  |  | -        where item_id = #{itemId}
 | 
	
		
			
				|  |  | +        UPDATE kuaishou_item_list
 | 
	
		
			
				|  |  | +        SET activity_item_status = #{status}
 | 
	
		
			
				|  |  | +        WHERE item_id = #{itemId}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      </update>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <delete id="unbindUser" parameterType="java.lang.Long">
 | 
	
		
			
				|  |  | -        delete
 | 
	
		
			
				|  |  | -        from kuaishou_item_bind_user
 | 
	
		
			
				|  |  | -        where item_id = #{itemId}
 | 
	
		
			
				|  |  | +        DELETE
 | 
	
		
			
				|  |  | +        FROM kuaishou_item_bind_user
 | 
	
		
			
				|  |  | +        WHERE item_id = #{itemId}
 | 
	
		
			
				|  |  |      </delete>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -985,25 +985,22 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |      <select id="getSupplyChainUserList" resultType="com.alibaba.fastjson.JSONObject">
 | 
	
		
			
				|  |  | -        select *
 | 
	
		
			
				|  |  | -        from (select t3.user_id as 'userId',
 | 
	
		
			
				|  |  | -                     t3.nick_name as 'nickMame',
 | 
	
		
			
				|  |  | -                     t1.role_name as 'roleName',
 | 
	
		
			
				|  |  | -                     t3.status,
 | 
	
		
			
				|  |  | +        SELECT *
 | 
	
		
			
				|  |  | +        FROM (SELECT t3.user_id AS 'userId', t3.nick_name AS 'nickMame', t1.role_name AS 'roleName', t3.status,
 | 
	
		
			
				|  |  |                       t3.create_time
 | 
	
		
			
				|  |  | -              from sys_role t1
 | 
	
		
			
				|  |  | -                       left join sys_user_role t2 on t1.role_id = t2.role_id
 | 
	
		
			
				|  |  | -                       left join sys_user t3 on t2.user_id = t3.user_id
 | 
	
		
			
				|  |  | -              where t1.role_key in (
 | 
	
		
			
				|  |  | +              FROM sys_role t1
 | 
	
		
			
				|  |  | +                       LEFT JOIN sys_user_role t2 ON t1.role_id = t2.role_id
 | 
	
		
			
				|  |  | +                       LEFT JOIN sys_user t3 ON t2.user_id = t3.user_id
 | 
	
		
			
				|  |  | +              WHERE t1.role_key IN (
 | 
	
		
			
				|  |  |                                      'association',
 | 
	
		
			
				|  |  |                                      'associationManager',
 | 
	
		
			
				|  |  |                                      'bd',
 | 
	
		
			
				|  |  |                                      'bdManager'
 | 
	
		
			
				|  |  |                    )
 | 
	
		
			
				|  |  | -                and t3.status = 0
 | 
	
		
			
				|  |  | -              group by t3.user_id) t
 | 
	
		
			
				|  |  | -        where t.userId is not null
 | 
	
		
			
				|  |  | -        order by t.create_time desc
 | 
	
		
			
				|  |  | +                AND t3.status = 0
 | 
	
		
			
				|  |  | +              GROUP BY t3.user_id) t
 | 
	
		
			
				|  |  | +        WHERE t.userId IS NOT NULL
 | 
	
		
			
				|  |  | +        ORDER BY t.create_time DESC
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |      <select id="adminReportList" resultType="com.alibaba.fastjson.JSONObject">
 | 
	
		
			
				|  |  |          select *
 | 
	
	
		
			
				|  | @@ -1245,11 +1242,11 @@
 | 
	
		
			
				|  |  |          order by FROM_UNIXTIME(t.order_create_time / 1000, '%y-%m-%d') asc
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |      <select id="itemBindSummary" resultType="com.alibaba.fastjson.JSONObject">
 | 
	
		
			
				|  |  | -        select count(t1.item_id) as 'itemTotal', sum(case when t2.item_id is not null then 1 else 0 end) as 'claimCount', sum(case when t2.item_id is null then 1 else 0 end) as 'unClaimCount'
 | 
	
		
			
				|  |  | -        from kuaishou_item_info t1
 | 
	
		
			
				|  |  | -                 left join kuaishou_item_bind_user t2
 | 
	
		
			
				|  |  | -                           on t1.item_id = t2.item_id
 | 
	
		
			
				|  |  | -        where 1 = 1
 | 
	
		
			
				|  |  | +        SELECT COUNT(t1.item_id) AS 'itemTotal', SUM(CASE WHEN t2.item_id IS NOT NULL THEN 1 ELSE 0 END) AS 'claimCount', SUM(CASE WHEN t2.item_id IS NULL THEN 1 ELSE 0 END) AS 'unClaimCount'
 | 
	
		
			
				|  |  | +        FROM kuaishou_item_info t1
 | 
	
		
			
				|  |  | +                 LEFT JOIN kuaishou_item_bind_user t2
 | 
	
		
			
				|  |  | +                           ON t1.item_id = t2.item_id
 | 
	
		
			
				|  |  | +        WHERE 1 = 1
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |      <select id="userItemTotal" resultType="com.alibaba.fastjson.JSONObject">
 | 
	
		
			
				|  |  |          SELECT count(t2.oid) AS 'orderNum',
 | 
	
	
		
			
				|  | @@ -1443,9 +1440,9 @@
 | 
	
		
			
				|  |  |          order by t.orderNum desc
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |      <select id="getCookie" resultType="java.lang.String">
 | 
	
		
			
				|  |  | -        select cookie
 | 
	
		
			
				|  |  | -        from kuaishou_supply_chain_cookie
 | 
	
		
			
				|  |  | -        where id = #{regId} limit 1
 | 
	
		
			
				|  |  | +        SELECT cookie
 | 
	
		
			
				|  |  | +        FROM kuaishou_supply_chain_cookie
 | 
	
		
			
				|  |  | +        WHERE id = #{regId} limit 1
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <select id="selectOrderInfo" resultType="com.alibaba.fastjson.JSONObject">
 | 
	
	
		
			
				|  | @@ -2141,9 +2138,9 @@
 | 
	
		
			
				|  |  |          GROUP BY promoter_id
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |      <select id="getUserName" resultType="java.lang.String" parameterType="java.lang.Long">
 | 
	
		
			
				|  |  | -        select group_concat(user_name) as 'userName'
 | 
	
		
			
				|  |  | -        from kuaishou_promoter
 | 
	
		
			
				|  |  | -        where promoter_id = #{promoterId}
 | 
	
		
			
				|  |  | +        SELECT group_concat(user_name) AS 'userName'
 | 
	
		
			
				|  |  | +        FROM kuaishou_promoter
 | 
	
		
			
				|  |  | +        WHERE promoter_id = #{promoterId}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |      <select id="exportBdReportList" resultType="com.alibaba.fastjson.JSONObject">
 | 
	
	
		
			
				|  | @@ -2281,17 +2278,17 @@
 | 
	
		
			
				|  |  |          order by t.orderNum desc
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |      <select id="getSupplyChainCourtshipUserList" resultType="com.alibaba.fastjson.JSONObject">
 | 
	
		
			
				|  |  | -        select t3.user_id as 'userId', t3.nick_name as 'nickMame', t1.role_name as 'roleName', t3.status
 | 
	
		
			
				|  |  | -        from sys_role t1
 | 
	
		
			
				|  |  | -                 left join sys_user_role t2 on t1.role_id = t2.role_id
 | 
	
		
			
				|  |  | -                 left join sys_user t3 on t2.user_id = t3.user_id
 | 
	
		
			
				|  |  | -        where t1.role_key in (
 | 
	
		
			
				|  |  | +        SELECT t3.user_id AS 'userId', t3.nick_name AS 'nickMame', t1.role_name AS 'roleName', t3.status
 | 
	
		
			
				|  |  | +        FROM sys_role t1
 | 
	
		
			
				|  |  | +                 LEFT JOIN sys_user_role t2 ON t1.role_id = t2.role_id
 | 
	
		
			
				|  |  | +                 LEFT JOIN sys_user t3 ON t2.user_id = t3.user_id
 | 
	
		
			
				|  |  | +        WHERE t1.role_key IN (
 | 
	
		
			
				|  |  |                                'courtship',
 | 
	
		
			
				|  |  |                                'courtshipManager'
 | 
	
		
			
				|  |  |              )
 | 
	
		
			
				|  |  | -          and t3.status = 0
 | 
	
		
			
				|  |  | -        group by t3.user_id
 | 
	
		
			
				|  |  | -        order by t3.create_time asc
 | 
	
		
			
				|  |  | +          AND t3.status = 0
 | 
	
		
			
				|  |  | +        GROUP BY t3.user_id
 | 
	
		
			
				|  |  | +        ORDER BY t3.create_time ASC
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |      <select id="adminReportListByBind" resultType="com.alibaba.fastjson.JSONObject">
 | 
	
		
			
				|  |  |          select * from (
 | 
	
	
		
			
				|  | @@ -2887,56 +2884,56 @@
 | 
	
		
			
				|  |  |          </foreach>
 | 
	
		
			
				|  |  |      </update>
 | 
	
		
			
				|  |  |      <update id="updateRuiXuanOrderRegimentalSettleAmount">
 | 
	
		
			
				|  |  | -        update ruixuan.kuaishou_supply_chain
 | 
	
		
			
				|  |  | -        set order_status                   = #{cpsOrderStatus},
 | 
	
		
			
				|  |  | +        UPDATE ruixuan.kuaishou_supply_chain
 | 
	
		
			
				|  |  | +        SET order_status                   = #{cpsOrderStatus},
 | 
	
		
			
				|  |  |              total_regimental_settle_amount = regimental_promotion_amount
 | 
	
		
			
				|  |  | -        where oid = #{oid}
 | 
	
		
			
				|  |  | +        WHERE oid = #{oid}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      </update>
 | 
	
		
			
				|  |  |      <update id="updateMgsOrderRegimentalSettleAmount">
 | 
	
		
			
				|  |  | -        update miaogousi.kuaishou_supply_chain
 | 
	
		
			
				|  |  | -        set order_status                   = #{cpsOrderStatus},
 | 
	
		
			
				|  |  | +        UPDATE miaogousi.kuaishou_supply_chain
 | 
	
		
			
				|  |  | +        SET order_status                   = #{cpsOrderStatus},
 | 
	
		
			
				|  |  |              total_regimental_settle_amount = regimental_promotion_amount
 | 
	
		
			
				|  |  | -        where oid = #{oid}
 | 
	
		
			
				|  |  | +        WHERE oid = #{oid}
 | 
	
		
			
				|  |  |      </update>
 | 
	
		
			
				|  |  |      <update id="updateRocketOrderRegimentalSettleAmount">
 | 
	
		
			
				|  |  | -        update rocket.kuaishou_supply_chain
 | 
	
		
			
				|  |  | -        set order_status                   = #{cpsOrderStatus},
 | 
	
		
			
				|  |  | +        UPDATE rocket.kuaishou_supply_chain
 | 
	
		
			
				|  |  | +        SET order_status                   = #{cpsOrderStatus},
 | 
	
		
			
				|  |  |              total_regimental_settle_amount = regimental_promotion_amount
 | 
	
		
			
				|  |  | -        where oid = #{oid}
 | 
	
		
			
				|  |  | +        WHERE oid = #{oid}
 | 
	
		
			
				|  |  |      </update>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <update id="updateYufuOrderRegimentalSettleAmount">
 | 
	
		
			
				|  |  | -        update yufu.kuaishou_supply_chain
 | 
	
		
			
				|  |  | -        set order_status                   = #{cpsOrderStatus},
 | 
	
		
			
				|  |  | +        UPDATE yufu.kuaishou_supply_chain
 | 
	
		
			
				|  |  | +        SET order_status                   = #{cpsOrderStatus},
 | 
	
		
			
				|  |  |              total_regimental_settle_amount = regimental_promotion_amount
 | 
	
		
			
				|  |  | -        where oid = #{oid}
 | 
	
		
			
				|  |  | +        WHERE oid = #{oid}
 | 
	
		
			
				|  |  |      </update>
 | 
	
		
			
				|  |  |      <update id="updateRuixuanOrder">
 | 
	
		
			
				|  |  | -        update ruixuan.kuaishou_supply_chain
 | 
	
		
			
				|  |  | -        set order_status = #{cpsOrderStatus}
 | 
	
		
			
				|  |  | -        where oid = #{oid}
 | 
	
		
			
				|  |  | +        UPDATE ruixuan.kuaishou_supply_chain
 | 
	
		
			
				|  |  | +        SET order_status = #{cpsOrderStatus}
 | 
	
		
			
				|  |  | +        WHERE oid = #{oid}
 | 
	
		
			
				|  |  |      </update>
 | 
	
		
			
				|  |  |      <update id="updateMgsOrder">
 | 
	
		
			
				|  |  | -        update miaogousi.kuaishou_supply_chain
 | 
	
		
			
				|  |  | -        set order_status = #{cpsOrderStatus}
 | 
	
		
			
				|  |  | -        where oid = #{oid}
 | 
	
		
			
				|  |  | +        UPDATE miaogousi.kuaishou_supply_chain
 | 
	
		
			
				|  |  | +        SET order_status = #{cpsOrderStatus}
 | 
	
		
			
				|  |  | +        WHERE oid = #{oid}
 | 
	
		
			
				|  |  |      </update>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <update id="updateRocketOrder">
 | 
	
		
			
				|  |  | -        update rocket.kuaishou_supply_chain
 | 
	
		
			
				|  |  | -        set order_status = #{cpsOrderStatus}
 | 
	
		
			
				|  |  | -        where oid = #{oid}
 | 
	
		
			
				|  |  | +        UPDATE rocket.kuaishou_supply_chain
 | 
	
		
			
				|  |  | +        SET order_status = #{cpsOrderStatus}
 | 
	
		
			
				|  |  | +        WHERE oid = #{oid}
 | 
	
		
			
				|  |  |      </update>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <update id="updateYufuOrder">
 | 
	
		
			
				|  |  | -        update yufu.kuaishou_supply_chain
 | 
	
		
			
				|  |  | -        set order_status = #{cpsOrderStatus}
 | 
	
		
			
				|  |  | -        where oid = #{oid}
 | 
	
		
			
				|  |  | +        UPDATE yufu.kuaishou_supply_chain
 | 
	
		
			
				|  |  | +        SET order_status = #{cpsOrderStatus}
 | 
	
		
			
				|  |  | +        WHERE oid = #{oid}
 | 
	
		
			
				|  |  |      </update>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <select id="getBytedanceOrderHourDataList" resultType="com.alibaba.fastjson.JSONObject">
 | 
	
		
			
				|  |  | -        SELECT pay_success_time_hour as 'hour', IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END), 0) AS 'validOrderNum', IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END), 0) AS 'baseAmount'
 | 
	
		
			
				|  |  | +        SELECT pay_success_time_hour AS 'hour', IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END), 0) AS 'validOrderNum', IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END), 0) AS 'baseAmount'
 | 
	
		
			
				|  |  |          FROM bytedance_order_list
 | 
	
		
			
				|  |  |          WHERE pay_success_time = #{date}
 | 
	
		
			
				|  |  |          GROUP BY pay_success_time_hour
 | 
	
	
		
			
				|  | @@ -2944,9 +2941,9 @@
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <select id="getKuaishouOrderHourDataList" resultType="com.alibaba.fastjson.JSONObject">
 | 
	
		
			
				|  |  | -        SELECT stat_hour as 'hour', IFNULL(SUM(CASE WHEN order_status != 80 THEN 1 ELSE 0 END), 0) AS 'validOrderNum', IFNULL(SUM(CASE WHEN order_status != 80 THEN order_amount ELSE 0 END), 0) as 'baseAmount'
 | 
	
		
			
				|  |  | +        SELECT stat_hour AS 'hour', IFNULL(SUM(CASE WHEN order_status != 80 THEN 1 ELSE 0 END), 0) AS 'validOrderNum', IFNULL(SUM(CASE WHEN order_status != 80 THEN order_amount ELSE 0 END), 0) AS 'baseAmount'
 | 
	
		
			
				|  |  |          FROM kuaishou_supply_chain
 | 
	
		
			
				|  |  | -        where stat_date = #{date}
 | 
	
		
			
				|  |  | +        WHERE stat_date = #{date}
 | 
	
		
			
				|  |  |          GROUP BY stat_hour
 | 
	
		
			
				|  |  |          ORDER BY stat_hour
 | 
	
		
			
				|  |  |      </select>
 | 
	
	
		
			
				|  | @@ -3209,15 +3206,147 @@
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <select id="getPromoterId" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.lang.Long">
 | 
	
		
			
				|  |  | -        select tag, proportion
 | 
	
		
			
				|  |  | -        from promoter_tag
 | 
	
		
			
				|  |  | -        where promoter_id = #{promoterId}
 | 
	
		
			
				|  |  | -        order by tag_oid_num desc limit 5
 | 
	
		
			
				|  |  | +        SELECT tag, proportion
 | 
	
		
			
				|  |  | +        FROM promoter_tag
 | 
	
		
			
				|  |  | +        WHERE promoter_id = #{promoterId}
 | 
	
		
			
				|  |  | +        ORDER BY tag_oid_num DESC limit 5
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +    <select id="shopList" resultType="com.alibaba.fastjson.JSONObject">
 | 
	
		
			
				|  |  | +        select t2.seller_name as 'sellerName', t1.*
 | 
	
		
			
				|  |  | +        from (select seller_id as 'sellerId',
 | 
	
		
			
				|  |  | +        count(oid) as 'orderNum',
 | 
	
		
			
				|  |  | +        round(sum(case when order_status != 80 then pay_amount else 0 end) / 100,
 | 
	
		
			
				|  |  | +        2) as 'payAmount',
 | 
	
		
			
				|  |  | +        round(regimental_promotion_rate / 10, 2) as 'regimentalPromotionRate',
 | 
	
		
			
				|  |  | +        sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
 | 
	
		
			
				|  |  | +        round(sum(case when order_status != 80 then 1 else 0 end) / count(oid) * 100,
 | 
	
		
			
				|  |  | +        2) as 'validRadio',
 | 
	
		
			
				|  |  | +        sum(case when send_status = 1 then 1 else 0 end) as 'deliveryNum',
 | 
	
		
			
				|  |  | +        round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case
 | 
	
		
			
				|  |  | +        when order_status != 80
 | 
	
		
			
				|  |  | +        then 1
 | 
	
		
			
				|  |  | +        else 0 end) * 100,
 | 
	
		
			
				|  |  | +        2) as 'shippingGreen',
 | 
	
		
			
				|  |  | +        sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
 | 
	
		
			
				|  |  | +        sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
 | 
	
		
			
				|  |  | +        round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case
 | 
	
		
			
				|  |  | +        when send_status = 1
 | 
	
		
			
				|  |  | +        then 1
 | 
	
		
			
				|  |  | +        else 0 end) * 100,
 | 
	
		
			
				|  |  | +        2) as 'deliveryRadio'
 | 
	
		
			
				|  |  | +        from kuaishou_supply_chain
 | 
	
		
			
				|  |  | +        where 1 = 1
 | 
	
		
			
				|  |  | +        <if test="start != null and start != ''">
 | 
	
		
			
				|  |  | +            and stat_date >= #{start}
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test="end != null and end != ''">
 | 
	
		
			
				|  |  | +            and stat_date <= #{end}
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test="sellerId != null and sellerId != ''">
 | 
	
		
			
				|  |  | +            and seller_id = #{sellerId}
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test='itemIds != null and itemIds.size() > 0'>
 | 
	
		
			
				|  |  | +            and item_id in
 | 
	
		
			
				|  |  | +            <foreach collection="itemIds" item="item" separator=","
 | 
	
		
			
				|  |  | +                     open="(" close=")">
 | 
	
		
			
				|  |  | +                #{item}
 | 
	
		
			
				|  |  | +            </foreach>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        group by seller_id) t1
 | 
	
		
			
				|  |  | +        left join kuaishou_seller_info t2
 | 
	
		
			
				|  |  | +        on t1.sellerId = t2.seller_id
 | 
	
		
			
				|  |  | +        order by ${fieId} ${sort}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +    <select id="shopDetail" resultType="com.alibaba.fastjson.JSONObject">
 | 
	
		
			
				|  |  | +        SELECT t1.*,
 | 
	
		
			
				|  |  | +        t2.ccr_value as 'ccrValue',
 | 
	
		
			
				|  |  | +        (case
 | 
	
		
			
				|  |  | +        when t2.ccr_value = '-' or t2.ccr_value is null
 | 
	
		
			
				|  |  | +        then 0
 | 
	
		
			
				|  |  | +        else replace( t2.ccr_value,'%','')
 | 
	
		
			
				|  |  | +        end
 | 
	
		
			
				|  |  | +        ) as 'ccrInt',
 | 
	
		
			
				|  |  | +        t3.userName
 | 
	
		
			
				|  |  | +        from (
 | 
	
		
			
				|  |  | +        select item_id as 'itemId',
 | 
	
		
			
				|  |  | +        item_title as 'itemTitle',
 | 
	
		
			
				|  |  | +        image_url as 'imageUrl',
 | 
	
		
			
				|  |  | +        round(reserve_price / 100 , 2) as 'reservePrice',
 | 
	
		
			
				|  |  | +        count(oid) as 'orderNum',
 | 
	
		
			
				|  |  | +        round(sum(case when order_status != 80 then pay_amount else 0 end) / 100,
 | 
	
		
			
				|  |  | +        2) as 'payAmount',
 | 
	
		
			
				|  |  | +        round(regimental_promotion_rate / 10, 2) as 'regimentalPromotionRate',
 | 
	
		
			
				|  |  | +        sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
 | 
	
		
			
				|  |  | +        round(sum(case when order_status != 80 then 1 else 0 end) / count(oid) * 100,
 | 
	
		
			
				|  |  | +        2) as 'validRadio',
 | 
	
		
			
				|  |  | +        sum(case when send_status = 1 then 1 else 0 end) as 'deliveryNum',
 | 
	
		
			
				|  |  | +        round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case
 | 
	
		
			
				|  |  | +        when order_status != 80
 | 
	
		
			
				|  |  | +        then 1
 | 
	
		
			
				|  |  | +        else 0 end) * 100,
 | 
	
		
			
				|  |  | +        2) as 'shippingGreen',
 | 
	
		
			
				|  |  | +        sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
 | 
	
		
			
				|  |  | +        sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
 | 
	
		
			
				|  |  | +        round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case
 | 
	
		
			
				|  |  | +        when send_status = 1
 | 
	
		
			
				|  |  | +        then 1
 | 
	
		
			
				|  |  | +        else 0 end) * 100,
 | 
	
		
			
				|  |  | +        2) as 'deliveryRadio'
 | 
	
		
			
				|  |  | +        from kuaishou_supply_chain
 | 
	
		
			
				|  |  | +        where 1 = 1
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        <if test="start != null and start != ''">
 | 
	
		
			
				|  |  | +            and stat_date >= #{start}
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test="end != null and end != ''">
 | 
	
		
			
				|  |  | +            and stat_date <= #{end}
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test="sellerId != null and sellerId != ''">
 | 
	
		
			
				|  |  | +            and seller_id = #{sellerId}
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test="itemId != null and itemId != ''">
 | 
	
		
			
				|  |  | +            and item_id = #{itemId}
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test="itemTitle != null and itemTitle != ''">
 | 
	
		
			
				|  |  | +            and item_title like concat(concat('%',#{itemTitle}),'%')
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test='itemIds != null and itemIds.size() > 0'>
 | 
	
		
			
				|  |  | +            and item_id in
 | 
	
		
			
				|  |  | +            <foreach collection="itemIds" item="item" separator=","
 | 
	
		
			
				|  |  | +                     open="(" close=")">
 | 
	
		
			
				|  |  | +                #{item}
 | 
	
		
			
				|  |  | +            </foreach>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        group by item_id) t1 left join kuaishou_item_ccr_info t2
 | 
	
		
			
				|  |  | +        on t1.itemId = t2.item_id
 | 
	
		
			
				|  |  | +        LEFT JOIN (select item_id as 'itemId',user_name as 'userName' from kuaishou_item_list WHERE media_id = 2 group
 | 
	
		
			
				|  |  | +        by item_id) t3
 | 
	
		
			
				|  |  | +        on t1.itemId = t3.itemId
 | 
	
		
			
				|  |  | +        order by t1.orderNum desc
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +    <select id="getItemIdsByUserId" resultType="java.lang.Long" parameterType="java.lang.Long">
 | 
	
		
			
				|  |  | +        SELECT item_id
 | 
	
		
			
				|  |  | +        FROM kuaishou_item_list
 | 
	
		
			
				|  |  | +        WHERE user_id = #{userId}
 | 
	
		
			
				|  |  | +        GROUP BY item_id
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +    <select id="getItemIdsByDeptId" resultType="java.lang.Long" parameterType="java.lang.Long">
 | 
	
		
			
				|  |  | +        SELECT item_id
 | 
	
		
			
				|  |  | +        FROM kuaishou_item_list
 | 
	
		
			
				|  |  | +        WHERE user_id IN (SELECT sys_user.user_id
 | 
	
		
			
				|  |  | +                          FROM sys_user
 | 
	
		
			
				|  |  | +                          WHERE dept_id = #{deptId})
 | 
	
		
			
				|  |  | +        GROUP BY item_id
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <update id="updateKuaiShouActivityOpenItemList">
 | 
	
		
			
				|  |  | -        update ruixuan.kuaishou_activity_open_item_list
 | 
	
		
			
				|  |  | -        set shop_star            = #{shopStar},
 | 
	
		
			
				|  |  | +        UPDATE ruixuan.kuaishou_activity_open_item_list
 | 
	
		
			
				|  |  | +        SET shop_star            = #{shopStar},
 | 
	
		
			
				|  |  |              mall_logistics_score = #{mallLogisticsScore},
 | 
	
		
			
				|  |  |              shop_score           = #{shopScore},
 | 
	
		
			
				|  |  |              mall_service_score   = #{mallServiceScore},
 | 
	
	
		
			
				|  | @@ -3229,8 +3358,8 @@
 | 
	
		
			
				|  |  |      </update>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <update id="updateMgsKuaiShouActivityOpenItemList">
 | 
	
		
			
				|  |  | -        update miaogousi.kuaishou_activity_open_item_list
 | 
	
		
			
				|  |  | -        set shop_star            = #{shopStar},
 | 
	
		
			
				|  |  | +        UPDATE miaogousi.kuaishou_activity_open_item_list
 | 
	
		
			
				|  |  | +        SET shop_star            = #{shopStar},
 | 
	
		
			
				|  |  |              mall_logistics_score = #{mallLogisticsScore},
 | 
	
		
			
				|  |  |              shop_score           = #{shopScore},
 | 
	
		
			
				|  |  |              mall_service_score   = #{mallServiceScore},
 | 
	
	
		
			
				|  | @@ -3255,8 +3384,8 @@
 | 
	
		
			
				|  |  |      </update>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <update id="updateYufuKuaiShouActivityOpenItemList">
 | 
	
		
			
				|  |  | -        update yufu.kuaishou_activity_open_item_list
 | 
	
		
			
				|  |  | -        set shop_star            = #{shopStar},
 | 
	
		
			
				|  |  | +        UPDATE yufu.kuaishou_activity_open_item_list
 | 
	
		
			
				|  |  | +        SET shop_star            = #{shopStar},
 | 
	
		
			
				|  |  |              mall_logistics_score = #{mallLogisticsScore},
 | 
	
		
			
				|  |  |              shop_score           = #{shopScore},
 | 
	
		
			
				|  |  |              mall_service_score   = #{mallServiceScore},
 |