UserPlatformServiceImpl.java 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package com.fdkankan.ucenter.service.impl;
  2. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  3. import com.fdkankan.ucenter.entity.UserPlatform;
  4. import com.fdkankan.ucenter.mapper.IUserPlatformMapper;
  5. import com.fdkankan.ucenter.service.IUserPlatformService;
  6. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  7. import org.springframework.stereotype.Service;
  8. import java.util.ArrayList;
  9. import java.util.List;
  10. import java.util.stream.Collectors;
  11. /**
  12. * <p>
  13. * 服务实现类
  14. * </p>
  15. *
  16. * @author
  17. * @since 2024-11-19
  18. */
  19. @Service
  20. public class UserPlatformServiceImpl extends ServiceImpl<IUserPlatformMapper, UserPlatform> implements IUserPlatformService {
  21. @Override
  22. public List<String> getByUserId(Long id) {
  23. LambdaQueryWrapper<UserPlatform> wrapper = new LambdaQueryWrapper<>();
  24. wrapper.eq(UserPlatform::getUserId,id);
  25. List<UserPlatform> list = this.list(wrapper);
  26. if(list.isEmpty()){
  27. return new ArrayList<>();
  28. }
  29. return list.stream().map(UserPlatform::getPlatformKey).collect(Collectors.toList());
  30. }
  31. }