李昊 %!s(int64=4) %!d(string=hai) anos
pai
achega
82b3c0b84f

+ 14 - 2
gx_api/GxPress/Repository/GxPress.Repository.Implement/TopicRepository.cs

@@ -360,8 +360,20 @@ namespace GxPress.Repository.Implement
                                 tede_group b ON a.GroupId = b.id
                                     INNER JOIN
                                 tede_user c ON a.UserId = c.Id
-                            WHERE
-                                a.GroupId > 0";
+                            WHERE 1=1 ";
+            if (request.TopicGroupIds.Count > 0)
+            {
+                var groupStr = "(";
+                foreach (var item in request.TopicGroupIds)
+                {
+                    groupStr += "{item},";
+                }
+                groupStr = groupStr.Remove(groupStr.Length - 1, 1);
+                groupStr += ")";
+                sql += $@" and a.GroupId IN {groupStr}";
+            }
+            else
+                sql += $@" and a.GroupId > 0";
             if (request.IsAdmin)
             {
                 sql += $@" AND a.UserId={request.UserId}";