Bladeren bron

1、调整nickname问题处理

yys 5 uur geleden
bovenliggende
commit
d885d5c610
1 gewijzigde bestanden met toevoegingen van 13 en 11 verwijderingen
  1. 13 11
      fs-service/src/main/resources/mapper/live/LiveWatchUserMapper.xml

+ 13 - 11
fs-service/src/main/resources/mapper/live/LiveWatchUserMapper.xml

@@ -230,21 +230,23 @@
     </select>
 
     <select id="selectLiveWatchAndRegisterUser" resultType="com.fs.live.domain.LiveWatchUser">
-        select a.*,fu.nickname as nick_name from (
-            select lws.* from live_watch_user lws 
-            where live_id=#{params.liveId} and online = 0
-            <if test="params.liveFlag != null "> and live_flag = #{params.liveFlag}</if>
-            <if test="params.replayFlag != null "> and replay_flag = #{params.replayFlag}</if>
-            and user_id in (
-                select user_id from live_lottery_registration 
-                where live_id = #{params.liveId} and lottery_id=#{params.lotteryId} 
-                and registration_id >= (SELECT FLOOR(RAND() * (SELECT MAX(registration_id) FROM live_lottery_registration)))
-            )
+        select a.*,
+        COALESCE(fu.nickname, fu.nick_name) as nick_name
+        from (
+        select lws.* from live_watch_user lws
+        where live_id=#{params.liveId} and online = 0
+        <if test="params.liveFlag != null "> and live_flag = #{params.liveFlag}</if>
+        <if test="params.replayFlag != null "> and replay_flag = #{params.replayFlag}</if>
+        and user_id in (
+        select user_id from live_lottery_registration
+        where live_id = #{params.liveId} and lottery_id=#{params.lotteryId}
+        and registration_id >= (SELECT FLOOR(RAND() * (SELECT MAX(registration_id) FROM live_lottery_registration)))
+        )
         ) a left join fs_user fu on fu.user_id = a.user_id
     </select>
 
     <select id="selectUserByLiveIdAndUserId" resultType="com.fs.live.domain.LiveWatchUser">
-        select * from live_watch_user 
+        select * from live_watch_user
         where live_id = #{params.liveId} and user_id = #{params.userId}
         <if test="params.liveFlag != null "> and live_flag = #{params.liveFlag}</if>
         <if test="params.replayFlag != null "> and replay_flag = #{params.replayFlag}</if>