|
@@ -357,13 +357,13 @@ public class SecondGoodsServiceImpl extends ServiceImpl<SecondGoodsMapper, Secon
|
|
|
// 判空
|
|
|
if (CollectionUtil.isNotEmpty(searchGoodsList.getRecords())) {
|
|
|
// 批量设置商品图片信息
|
|
|
- batchSetGoodsImages(searchGoodsList);
|
|
|
+// batchSetGoodsImages(searchGoodsList);
|
|
|
// 批量设置用户信息
|
|
|
batchSetUserInfo(searchGoodsList);
|
|
|
// 批量设置收藏状态
|
|
|
- batchSetCollectStatus(searchGoodsList, userId);
|
|
|
+ batchSetCollectStatus(searchGoodsList,secondGoodsVo.getUserPhone(), userId);
|
|
|
// 批量设置点赞状态
|
|
|
- batchSetLikeStatus(searchGoodsList, userId);
|
|
|
+ batchSetLikeStatus(searchGoodsList,secondGoodsVo.getUserPhone(), userId);
|
|
|
}
|
|
|
return searchGoodsList;
|
|
|
}
|
|
@@ -372,11 +372,9 @@ public class SecondGoodsServiceImpl extends ServiceImpl<SecondGoodsMapper, Secon
|
|
|
* 批量设置收藏状态
|
|
|
* @param searchGoodsList 搜索结果列表
|
|
|
* @param userId 用户ID(登录用户)
|
|
|
+ * @param phone 手机号
|
|
|
*/
|
|
|
- private void batchSetLikeStatus(IPage<SecondGoodsVo> searchGoodsList, Integer userId) {
|
|
|
- // 获取用户信息
|
|
|
- LifeUser lifeUser = lifeUserMapper.selectById(userId);
|
|
|
- String phone = lifeUser.getUserPhone();
|
|
|
+ private void batchSetLikeStatus(IPage<SecondGoodsVo> searchGoodsList, String phone, Integer userId) {
|
|
|
// 批量设置点赞状态
|
|
|
searchGoodsList.getRecords().forEach(goods -> {
|
|
|
if (userId != null) {
|
|
@@ -396,18 +394,16 @@ public class SecondGoodsServiceImpl extends ServiceImpl<SecondGoodsMapper, Secon
|
|
|
* 批量设置收藏状态
|
|
|
* @param searchGoodsList 搜索结果列表
|
|
|
* @param userId 用户ID(登录用户)
|
|
|
+ * @param phone 手机号
|
|
|
*/
|
|
|
- private void batchSetCollectStatus(IPage<SecondGoodsVo> searchGoodsList, Integer userId) {
|
|
|
- // 获取用户信息
|
|
|
- LifeUser lifeUser = lifeUserMapper.selectById(userId);
|
|
|
- String phone = lifeUser.getUserPhone();
|
|
|
+ private void batchSetCollectStatus(IPage<SecondGoodsVo> searchGoodsList,String phone, Integer userId) {
|
|
|
// 批量设置收藏状态
|
|
|
searchGoodsList.getRecords().forEach(goods -> {
|
|
|
if (userId != null) {
|
|
|
LambdaUpdateWrapper<LifeCollect> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
updateWrapper.eq(LifeCollect::getUserId, "user_"+phone)
|
|
|
- // TODo 商品ID
|
|
|
- .eq(LifeCollect::getGoodsId, goods.getId());
|
|
|
+ .eq(LifeCollect::getBusinessType, 1)
|
|
|
+ .eq(LifeCollect::getBusinessId, goods.getId());
|
|
|
if (lifeCollectMapper.selectCount(updateWrapper) > 0) {
|
|
|
goods.setCollectStatus(1);
|
|
|
}
|