|
@@ -296,7 +296,7 @@ namespace GxPress.Repository.Implement
|
|
|
connection.Dispose();
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public async Task<PagedList<TopicListPageResult>> GetTopicByGroupAsync(TopicPageSearchRequest request)
|
|
|
{
|
|
|
var sql = $@"SELECT
|
|
@@ -361,13 +361,20 @@ namespace GxPress.Repository.Implement
|
|
|
INNER JOIN
|
|
|
tede_user c ON a.UserId = c.Id
|
|
|
WHERE
|
|
|
- a.GroupId > 0
|
|
|
- AND b.Id IN (SELECT
|
|
|
+ a.GroupId > 0";
|
|
|
+ if (request.IsAdmin)
|
|
|
+ {
|
|
|
+ sql += $@" AND a.UserId={request.UserId}";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sql += $@" AND b.Id IN (SELECT
|
|
|
GroupId
|
|
|
FROM
|
|
|
tede_group_user
|
|
|
WHERE
|
|
|
UserId = {request.UserId})";
|
|
|
+ }
|
|
|
if (!string.IsNullOrWhiteSpace(request.Keyword))
|
|
|
{
|
|
|
sql += $@" AND (c.Name LIKE '%{request.Keyword}%'
|
|
@@ -399,13 +406,20 @@ namespace GxPress.Repository.Implement
|
|
|
INNER JOIN
|
|
|
tede_user c ON a.UserId = c.Id
|
|
|
WHERE
|
|
|
- a.GroupId > 0
|
|
|
- AND b.Id IN (SELECT
|
|
|
+ a.GroupId > 0";
|
|
|
+ if (request.IsAdmin)
|
|
|
+ {
|
|
|
+ sql += $@" AND a.UserId={request.UserId}";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sql += $@" AND b.Id IN (SELECT
|
|
|
GroupId
|
|
|
FROM
|
|
|
tede_group_user
|
|
|
WHERE
|
|
|
UserId = {request.UserId})";
|
|
|
+ }
|
|
|
if (!string.IsNullOrWhiteSpace(request.Keyword))
|
|
|
{
|
|
|
sql += $@" AND (c.Name LIKE '%{request.Keyword}%'
|