瀏覽代碼

打卡查询接口 添加店铺评价数量

lutong 1 天之前
父節點
當前提交
68cb01f04b

+ 3 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/StoreClockInVo.java

@@ -45,6 +45,9 @@ public class StoreClockInVo extends StoreClockIn {
     @ApiModelProperty(value = "评论数量")
     private int commentCount;
 
+    @ApiModelProperty(value = "店铺评价条数(common_rating,字段对应库表语义 rating_count;未删除且审核非失败)")
+    private int ratingCount;
+
     @ApiModelProperty(value = "商家评分")
     private double score;
 

+ 11 - 4
alien-entity/src/main/java/shop/alien/mapper/StoreClockInMapper.java

@@ -31,10 +31,17 @@ public interface StoreClockInMapper extends BaseMapper<StoreClockIn> {
             " where uorder.store_id = store.id and uorder.status = '1' and uorder.delete_flag = 0 " +
             ") perCapitaPrice, " +
             "( " +
-            " select ifnull(round(avg(score), 1), 0) " +
-            " from store_evaluation eval " +
-            " where eval.store_id = store.id and eval.delete_flag = 0 " +
-            ") score " +
+            " select ifnull(round(avg(cr_avg.score), 1), 0) " +
+            " from common_rating cr_avg " +
+            " where cr_avg.business_type = 1 and cr_avg.business_id = store.id and cr_avg.delete_flag = 0 " +
+            " and (cr_avg.audit_status is null or cr_avg.audit_status <> 2) " +
+            ") score, " +
+            "( " +
+            " select ifnull(count(1), 0) " +
+            " from common_rating cr_cnt " +
+            " where cr_cnt.business_type = 1 and cr_cnt.business_id = store.id and cr_cnt.delete_flag = 0 " +
+            " and (cr_cnt.audit_status is null or cr_cnt.audit_status <> 2) " +
+            ") rating_count " +
             "from store_clock_in clock " +
             "join life_user user on user.id = clock.user_id " +
             "join store_info store on store.id = clock.store_id " +