Procházet zdrojové kódy

mapper方法名重复导致错误,修改方法名称

zhangchen před 3 měsíci
rodič
revize
9684864f84

+ 1 - 1
alien-entity/src/main/java/shop/alien/mapper/StoreCommentMapper.java

@@ -129,7 +129,7 @@ public interface StoreCommentMapper extends BaseMapper<StoreComment> {
             "WHERE " +
             "business_type = 5 " +
             "AND delete_flag = 0 " +
-            "AND reply_id IS NULL" +
+            "AND reply_id IS NULL " +
             "AND store_id = #{storeId}")
     Map<String, String> getCommentCountAndScoreInfo(@Param("storeId") Integer storeId);
 

+ 2 - 2
alien-store/src/main/java/shop/alien/store/service/impl/StoreCommentServiceImpl.java

@@ -575,9 +575,9 @@ public class StoreCommentServiceImpl extends ServiceImpl<StoreCommentMapper, Sto
             storeComment.setCreatedUserId(storeComment.getUserId());
 
             int i = this.save(storeComment) ? 0 : 1;
-
             Map<String, String> commentCountAndScore = storeCommentMapper.getCommentCountAndScoreInfo(storeId);
-            double total = StringUtils.isNotEmpty(commentCountAndScore.get("total")) ? Double.parseDouble(commentCountAndScore.get("total")) : 0;
+            String totalStr = String.valueOf(commentCountAndScore.get("total"));
+            double total = StringUtils.isNotEmpty(totalStr) ? Double.parseDouble(totalStr) : 0;
             double scoreAvg = StringUtils.isNotEmpty(commentCountAndScore.get("score")) ? Double.parseDouble(commentCountAndScore.get("score")) / total : 0;
             double tasteScore = StringUtils.isNotEmpty(commentCountAndScore.get("tasteScore")) ? Double.parseDouble(commentCountAndScore.get("tasteScore")) / total : 0;
             double enScore = StringUtils.isNotEmpty(commentCountAndScore.get("enScore")) ? Double.parseDouble(commentCountAndScore.get("enScore")) / total : 0;