|
|
@@ -429,7 +429,7 @@ public class StoreClockInServiceImpl extends ServiceImpl<StoreClockInMapper, Sto
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public StoreClockInVo getStoreClockInById(Integer id) {
|
|
|
+ public StoreClockInVo getStoreClockInById(Integer id, Integer userId) {
|
|
|
StoreClockIn storeClockIn = storeClockInMapper.selectById(id);
|
|
|
StoreClockInVo storeClockInVo = BeanUtil.copyProperties(storeClockIn, StoreClockInVo.class);
|
|
|
if (null == storeClockIn) {
|
|
|
@@ -458,15 +458,16 @@ public class StoreClockInServiceImpl extends ServiceImpl<StoreClockInMapper, Sto
|
|
|
storeClockInVo.setBusinessClassifyName(storeInfo.getBusinessClassifyName());
|
|
|
// 地址
|
|
|
storeClockInVo.setStoreAddress(storeInfo.getStoreAddress());
|
|
|
- // 是否收藏
|
|
|
- // 查询我的收藏
|
|
|
- LambdaQueryWrapper<LifeCollect> collectWrapper = new LambdaQueryWrapper<>();
|
|
|
- collectWrapper.eq(LifeCollect::getUserId, String.valueOf(storeClockInVo.getUserId()));
|
|
|
- List<LifeCollect> lifeCollectList = lifeCollectMapper.selectList(collectWrapper);
|
|
|
- List<String> collectList = lifeCollectList.stream().map(LifeCollect::getStoreId).collect(Collectors.toList());
|
|
|
+ // 是否收藏 - 使用当前登录用户的ID查询收藏
|
|
|
storeClockInVo.setIsCollect("0");
|
|
|
- if (collectList.contains(storeClockInVo.getStoreId().toString())){
|
|
|
- storeClockInVo.setIsCollect("1");
|
|
|
+ if (userId != null) {
|
|
|
+ LambdaQueryWrapper<LifeCollect> collectWrapper = new LambdaQueryWrapper<>();
|
|
|
+ collectWrapper.eq(LifeCollect::getUserId, String.valueOf(userId));
|
|
|
+ List<LifeCollect> lifeCollectList = lifeCollectMapper.selectList(collectWrapper);
|
|
|
+ List<String> collectList = lifeCollectList.stream().map(LifeCollect::getStoreId).collect(Collectors.toList());
|
|
|
+ if (collectList.contains(storeClockInVo.getStoreId().toString())){
|
|
|
+ storeClockInVo.setIsCollect("1");
|
|
|
+ }
|
|
|
}
|
|
|
return storeClockInVo;
|
|
|
}
|