|
@@ -45,7 +45,7 @@ func GetLikeNumCommentByCommunityQuestionIds(communityQuestionIds []uint32) (ite
|
|
|
}
|
|
|
err = global.DEFAULT_MYSQL.Model(YbCommunityQuestionLikeTease{}).
|
|
|
Select("community_question_id, count(1) total").
|
|
|
- Where("community_question_id in (?) AND enabled=1 AND op_type=1", communityQuestionIds).Scan(&items).Error
|
|
|
+ Where("community_question_id in (?) AND enabled=1 AND op_type=1", communityQuestionIds).Group("community_question_id").Scan(&items).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -56,7 +56,7 @@ func GetTeaseNumCommentByCommunityQuestionIds(communityQuestionIds []uint32) (it
|
|
|
}
|
|
|
err = global.DEFAULT_MYSQL.Model(YbCommunityQuestionLikeTease{}).
|
|
|
Select("community_question_id, count(1) total").
|
|
|
- Where("community_question_id in (?) AND enabled=1 AND op_type=2", communityQuestionIds).Scan(&items).Error
|
|
|
+ Where("community_question_id in (?) AND enabled=1 AND op_type=2", communityQuestionIds).Group("community_question_id").Scan(&items).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -66,7 +66,7 @@ func GetByUserIdAndCommunityQuestionIds(userId uint64, communityQuestionIds []ui
|
|
|
return
|
|
|
}
|
|
|
err = global.DEFAULT_MYSQL.
|
|
|
- Where("user_id = ? AND enabled=1 AND community_question_id in (?)", userId, communityQuestionIds).
|
|
|
+ Where("user_id = ? AND enabled=1 AND community_question_id in (?)", userId, communityQuestionIds).Group("community_question_id").
|
|
|
Find(&items).Error
|
|
|
return
|
|
|
}
|