瀏覽代碼

bugfix:修复500报错sql聚合列问题

penghao 9 小時之前
父節點
當前提交
63def20355

+ 6 - 2
alien-entity/src/main/java/shop/alien/mapper/LifeFansMapper.java

@@ -119,8 +119,12 @@ public interface LifeFansMapper extends BaseMapper<LifeFans> {
 //            "left join life_fans fans3 on fans3.fans_id = foll.phoneId and fans3.delete_flag = 0 " +
 //            "${ew.customSqlSegment} ")
     @Select("SELECT " +
-            "foll.*, " +
-            "IF(isnull(fans.id), 0, 1) isFollowThis, " +
+            "MAX(foll.id) id, " +
+            "MAX(foll.name) name, " +
+            "MAX(foll.blurb) blurb, " +
+            "MAX(foll.image) image, " +
+            "foll.phoneId, " +
+            "MAX(IF(isnull(fans.id), 0, 1)) isFollowThis, " +
             "1 AS isFollowMe, " +
             "count(fans2.id) fansNum, " +
             "count(fans3.id) followNum " +

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

@@ -69,9 +69,9 @@ public interface StoreCommentMapper extends BaseMapper<StoreComment> {
      *
      * @param businessType 业务类型
      * @param storeId      门店id
-     * @return List<StoreCommentCountVo>
+     * @return List<StoreCommentVo>
      */
-    @Select("SELECT count( id ) commitCount, business_id as businessId, id FROM store_comment WHERE business_type = #{businessType} " +
+    @Select("SELECT count( id ) commitCount, business_id as businessId FROM store_comment WHERE business_type = #{businessType} " +
             "AND reply_id IS NULL AND (#{storeId} IS NULL OR store_id = #{storeId}) GROUP BY business_id")
     List<StoreCommentVo> getRootCommitCount(@Param("businessType") Integer businessType, @Param("storeId") Integer storeId);
 
@@ -80,9 +80,9 @@ public interface StoreCommentMapper extends BaseMapper<StoreComment> {
      *
      * @param businessType 业务类型
      * @param storeId      门店id
-     * @return List<StoreCommentCountVo>
+     * @return List<StoreCommentVo>
      */
-    @Select("SELECT count( id ) commitCount, reply_id as replyId, id FROM store_comment WHERE business_type = #{businessType} " +
+    @Select("SELECT count( id ) commitCount, reply_id as replyId FROM store_comment WHERE business_type = #{businessType} " +
             "AND reply_id IS NOT NULL AND (#{storeId} IS NULL OR store_id = #{storeId}) GROUP BY reply_id")
     List<StoreCommentVo> getSonCommitCount(@Param("businessType") Integer businessType, @Param("storeId") Integer storeId);