Ver Fonte

根据权限表,卡控根据账户搜索,用户名搜索,剔除USERID搜索

fangqing há 6 meses atrás
pai
commit
ac8a3b21e9

+ 18 - 2
ruoyi-generator/src/main/resources/mapper/community/CommunityUserInfoMapper.xml

@@ -12,11 +12,27 @@
         (select count(1) as articleCount from community_article d where d.user_id = a.user_id) as articleCount
         from sys_user a
         left join community_user_info b on a.user_id = b.user_id
+        left join community_user_privacy c on a.user_id  = c.user_id
         <if test="searchValue != null and searchValue != ''">
             <where>
-                a.nick_name like concat('%', #{searchValue}, '%')
-                or b.user_id like concat('%', #{searchValue}, '%')
+                IFNULL(c.is_accounts,0)= 0 and a.user_name like concat('%', #{searchValue}, '%')
             </where>
         </if>
+        union all
+        select
+        b.id as id,
+        a.nick_name as nickName,
+        a.avatar as avatar,
+        (select count(1) as fansCount from community_user_like c where c.like_user_id = a.user_id) as fansCount,
+        (select count(1) as articleCount from community_article d where d.user_id = a.user_id) as articleCount
+        from sys_user a
+        left join community_user_info b on a.user_id = b.user_id
+        left join community_user_privacy c on a.user_id  = c.user_id
+        <if test="searchValue != null and searchValue != ''">
+            <where>
+                IFNULL(c.is_names,0)  = 0 and  a.nick_name like concat('%', #{searchValue}, '%')
+            </where>
+        </if>
+
     </select>
 </mapper>