This commit is contained in:
77
2024-04-23 00:11:58 +08:00
parent 03057f7541
commit 139ca18eb3
4 changed files with 13 additions and 0 deletions

View File

@@ -17,6 +17,8 @@ public class HomeUserVo {
private String usercode; private String usercode;
@Schema(description = "用户头像") @Schema(description = "用户头像")
private String avatar; private String avatar;
@Schema(description = "是否关注")
private Boolean star = false;
@Schema(description = "相册") @Schema(description = "相册")
private List<String> userPictureList; private List<String> userPictureList;
@Schema(description = "自我描述") @Schema(description = "自我描述")

View File

@@ -20,4 +20,6 @@ public interface UserStarService extends IService<UserStar> {
void starUpdate(UserStarReq req); void starUpdate(UserStarReq req);
Page<UserStarListVo> pageApp(PageQuery pageQuery, UserStarQuery query); Page<UserStarListVo> pageApp(PageQuery pageQuery, UserStarQuery query);
boolean existsStar(Long userId, Long starUserId);
} }

View File

@@ -80,6 +80,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements Use
private RedissonClient redissonClient; private RedissonClient redissonClient;
@Autowired @Autowired
private AreaCodeService areaCodeService; private AreaCodeService areaCodeService;
@Autowired
private UserStarService userStarService;
@Override @Override
public MinUser getMinUserById(Long userId){ public MinUser getMinUserById(Long userId){
@@ -126,6 +128,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements Use
if(userId.equals(currentUserId)){ if(userId.equals(currentUserId)){
return result; return result;
} }
boolean star = userStarService.existsStar(currentUserId, userId);
result.setStar(star);
UserStatus userStatus = userStatusService.getByUserId(userId); UserStatus userStatus = userStatusService.getByUserId(userId);
boolean showAvatar = this.showAvatar(LoginHelper.getUserId(), userStatus.getShowAvatar()); boolean showAvatar = this.showAvatar(LoginHelper.getUserId(), userStatus.getShowAvatar());
if(!showAvatar){ if(!showAvatar){

View File

@@ -70,4 +70,9 @@ public class UserStarServiceImpl extends ServiceImpl<UserStarMapper,UserStar> im
throw new ServiceException("参数异常"); throw new ServiceException("参数异常");
} }
} }
@Override
public boolean existsStar(Long userId, Long starUserId) {
return this.exists(Wrappers.lambdaQuery(UserStar.class).eq(UserStar::getUserId, userId).eq(UserStar::getStarUserId, starUserId));
}
} }