Преглед изворни кода

商铺详情反馈评价数量

lutong пре 3 месеци
родитељ
комит
0dd06e1d7b

+ 3 - 2
alien-entity/src/main/java/shop/alien/entity/store/vo/StoreMainInfoVo.java

@@ -1,7 +1,5 @@
 package shop.alien.entity.store.vo;
 
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -120,4 +118,7 @@ public class StoreMainInfoVo extends StoreInfo {
     @ApiModelProperty(value = "其他资质证明图片列表")
     private List<StoreImg> otherQualificationImages;
 
+    @ApiModelProperty(value = "评价数量")
+    private Integer ratingCount;
+
 }

+ 11 - 0
alien-store/src/main/java/shop/alien/store/service/impl/StoreInfoServiceImpl.java

@@ -128,6 +128,8 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
 
     private final StoreCommentMapper storeCommentMapper;
 
+    private final CommonRatingMapper commonRatingMapper;
+
     private final StoreInfoDraftMapper storeInfoDraftMapper;
 
     private final LifeNoticeMapper lifeNoticeMapper;
@@ -330,6 +332,15 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
         } else {
             storeMainInfoVo.setDistance2(0);
         }
+
+        // 统计评价数量(common_rating 表,业务类型1=商铺评价)
+        LambdaQueryWrapper<CommonRating> ratingWrapper = new LambdaQueryWrapper<>();
+        ratingWrapper.eq(CommonRating::getBusinessType, 1); // 业务类型:1-商铺评价
+        ratingWrapper.eq(CommonRating::getBusinessId, id); // 门店ID
+        ratingWrapper.eq(CommonRating::getDeleteFlag, 0); // 未删除
+        Integer ratingCountLong = commonRatingMapper.selectCount(ratingWrapper);
+        storeMainInfoVo.setRatingCount(ratingCountLong != null ? ratingCountLong.intValue() : 0);
+
         return storeMainInfoVo;
     }