diff --git a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/impl/AppUserServiceImpl.java b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/impl/AppUserServiceImpl.java index 5ea8294..d3a1e3b 100644 --- a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/impl/AppUserServiceImpl.java +++ b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/impl/AppUserServiceImpl.java @@ -296,19 +296,23 @@ public class AppUserServiceImpl implements IAppUserService { companylList.sort(Comparator.comparingLong(AppUserDataVo::getFansNum).reversed()); // 好友的好友 - List friendIds = appUserFriendMapper.selectByFriendId(ids); - entity.setFriendIds(friendIds); - entity.setCompanyName(null); - List friendList = appUserMapper.selectList(entity); - if (friendList == null || friendList.size() == 0) { + List friendList = null; + if (ids == null || ids.size() == 0) { friendList = new ArrayList<>(); + } else { + List friendIds = appUserFriendMapper.selectByFriendId(ids); + entity.setFriendIds(friendIds); + entity.setCompanyName(null); + friendList = appUserMapper.selectList(entity); + if (friendList == null || friendList.size() == 0) { + friendList = new ArrayList<>(); + } + Collections.shuffle(friendList); + if (friendList.size() > limit) { + friendList = friendList.subList(0, limit); + } + friendList.sort(Comparator.comparingLong(AppUserDataVo::getFansNum).reversed()); } - Collections.shuffle(friendList); - if (friendList.size() > limit) { - friendList = friendList.subList(0, limit); - } - friendList.sort(Comparator.comparingLong(AppUserDataVo::getFansNum).reversed()); - appUserNetVo.setFriendUserList(friendList); appUserNetVo.setSchoolUserList(schoolList); appUserNetVo.setCompanyUserList(companylList);