lining 1 год назад
Родитель
Сommit
a8fdb37665

+ 14 - 5
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/UserLoginRecordMapper.xml

@@ -3,11 +3,20 @@
 <mapper namespace="cn.com.ctop.job.bytedance.data.mapper.UserLoginRecordMapper">
 
     <select id="queryUserLoginRecord" resultType="cn.com.ctop.job.bytedance.data.entity.UserLoginRecord">
-        select lulr.uid, lu.open_id , count(1) as login_times
-        from thirtpart.ly_user_login_record lulr
-                 left join thirtpart.ly_user lu on lulr.uid = lu.id
-        where FROM_UNIXTIME(lulr.created_at) >= CURDATE() and lulr.uid not in (select uid from thirtpart.ly_user_black_list)
-        group by uid  HAVING login_times > 500 order by login_times desc;
+        SELECT
+            lulr.uid,
+            lu.open_id,
+            COUNT(1) AS login_times
+        FROM
+            thirtpart.ly_user_login_record lulr
+                LEFT JOIN thirtpart.ly_user lu ON lulr.uid = lu.id
+                LEFT JOIN thirtpart.ly_user_black_list b ON lulr.uid = b.uid
+        WHERE
+            lulr.created_at >= UNIX_TIMESTAMP(CURDATE())
+          AND b.uid IS NULL
+        GROUP BY lulr.uid
+        HAVING login_times > 100
+        ORDER BY login_times DESC
     </select>
 
 </mapper>