|
@@ -208,6 +208,137 @@ namespace GxPress.Repository.Implement
|
|
return resultData;
|
|
return resultData;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <summary>
|
|
|
|
+ ///最新 小组话题分页列表 匿名用户登录获取
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="request"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ public async Task<PagedList<TopicListPageResult>> GetAnonymousGroupTopicPageAsync(TopicDetailListRequest request)
|
|
|
|
+ {
|
|
|
|
+ var topicConst = AllTypeConst.Topic.GetHashCode();
|
|
|
|
+ var result = new PagedList<TopicListPageResult>();
|
|
|
|
+ var sqlStr = @" AND a.GroupId IN (SELECT
|
|
|
|
+ Id
|
|
|
|
+ FROM
|
|
|
|
+ tede_group
|
|
|
|
+ WHERE
|
|
|
|
+ IsShow = 1) ";
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if (!string.IsNullOrEmpty(request.Key))
|
|
|
|
+ {
|
|
|
|
+ sqlStr += $@"AND (a.Title LIKE '%{request.Key}%'
|
|
|
|
+ OR a.Content LIKE '%{request.Key}%')";
|
|
|
|
+ }
|
|
|
|
+ string sql = $@"SELECT
|
|
|
|
+ a.Id,
|
|
|
|
+ a.Title,
|
|
|
|
+ a.UserId,
|
|
|
|
+ a.ReadCount,
|
|
|
|
+ a.CreatedDate,
|
|
|
|
+ a.Content,
|
|
|
|
+ a.GroupId,
|
|
|
|
+ (SELECT
|
|
|
|
+ COUNT(1)
|
|
|
|
+ FROM
|
|
|
|
+ tede_analyze
|
|
|
|
+ WHERE
|
|
|
|
+ TypeValue ={topicConst} AND SourceId = a.Id
|
|
|
|
+ AND AnalyzeType = 1) AS PraiseCount,
|
|
|
|
+ (SELECT
|
|
|
|
+ COUNT(1)
|
|
|
|
+ FROM
|
|
|
|
+ tede_analyze
|
|
|
|
+ WHERE
|
|
|
|
+ UserId ={request.UserId} AND TypeValue = {topicConst}
|
|
|
|
+ AND SourceId = a.Id
|
|
|
|
+ AND AnalyzeType = 1
|
|
|
|
+ LIMIT 0 , 1) AS IsPraise,
|
|
|
|
+ (SELECT
|
|
|
|
+ COUNT(1)
|
|
|
|
+ FROM
|
|
|
|
+ tede_comment
|
|
|
|
+ WHERE
|
|
|
|
+ ArticleId = a.Id AND pid = 0
|
|
|
|
+ AND TypeValue = 1) AS CommentCount,
|
|
|
|
+ (SELECT
|
|
|
|
+ COUNT(1)
|
|
|
|
+ FROM
|
|
|
|
+ tede_analyze
|
|
|
|
+ WHERE
|
|
|
|
+ UserId ={request.UserId} AND TypeValue ={topicConst}
|
|
|
|
+ AND SourceId = a.Id
|
|
|
|
+ AND AnalyzeType = 4) AS RetransmissionCount,
|
|
|
|
+ (SELECT
|
|
|
|
+ COUNT(1)
|
|
|
|
+ FROM
|
|
|
|
+ tede_analyze
|
|
|
|
+ WHERE
|
|
|
|
+ UserId ={request.UserId} AND TypeValue ={topicConst}
|
|
|
|
+ AND SourceId = a.Id
|
|
|
|
+ AND AnalyzeType = 4
|
|
|
|
+ LIMIT 0 , 1) AS IsRetransmission,
|
|
|
|
+ (SELECT
|
|
|
|
+ COUNT(1)
|
|
|
|
+ FROM
|
|
|
|
+ tede_analyze
|
|
|
|
+ WHERE
|
|
|
|
+ UserId ={request.UserId} AND TypeValue = {topicConst}
|
|
|
|
+ AND SourceId = a.Id
|
|
|
|
+ AND AnalyzeType = 4
|
|
|
|
+ LIMIT 0 , 1) AS IsCollect,
|
|
|
|
+ (SELECT
|
|
|
|
+ COUNT(1)
|
|
|
|
+ FROM
|
|
|
|
+ tede_analyze
|
|
|
|
+ WHERE
|
|
|
|
+ UserId ={request.UserId} AND TypeValue = {topicConst}
|
|
|
|
+ AND SourceId = a.Id
|
|
|
|
+ AND AnalyzeType = 4) AS CollectCount,
|
|
|
|
+ b.Name as GroupName,
|
|
|
|
+ c.Name as UserName,
|
|
|
|
+ c.AvatarUrl,
|
|
|
|
+ d.Id as DepartmentId,
|
|
|
|
+ d.Name as DepartmentName
|
|
|
|
+ FROM
|
|
|
|
+ tede_topic a
|
|
|
|
+ INNER JOIN
|
|
|
|
+ tede_group b ON a.GroupId = b.Id
|
|
|
|
+ INNER JOIN
|
|
|
|
+ tede_user c ON c.Id = a.UserId
|
|
|
|
+ INNER JOIN
|
|
|
|
+ tede_department d ON d.Id = c.DepartmentId
|
|
|
|
+ WHERE
|
|
|
|
+ a.GroupId > 0
|
|
|
|
+ {sqlStr}
|
|
|
|
+ ORDER BY a.CreatedDate DESC limit @page,@pageSize";
|
|
|
|
+ string countSql = $@"SELECT
|
|
|
|
+ count(1)
|
|
|
|
+ FROM
|
|
|
|
+ tede_topic a
|
|
|
|
+ INNER JOIN
|
|
|
|
+ tede_group b ON a.GroupId = b.Id
|
|
|
|
+ INNER JOIN
|
|
|
|
+ tede_user c ON c.Id = a.UserId
|
|
|
|
+ WHERE
|
|
|
|
+ a.GroupId > 0
|
|
|
|
+ {sqlStr}
|
|
|
|
+ ORDER BY a.CreatedDate DESC";
|
|
|
|
+ var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
|
|
|
|
+ var database = new Database(databaseType, _connectionString);
|
|
|
|
+ var connection = database.GetConnection();
|
|
|
|
+ result.Items =
|
|
|
|
+ await connection
|
|
|
|
+ .QueryAsync<TopicListPageResult>(sql, new { page = (request.Page - 1) * request.PerPage, pageSize = request.PerPage });
|
|
|
|
+ foreach (var item in result.Items)
|
|
|
|
+ {
|
|
|
|
+ item.AvatarUrl = StringUtils.AddDomainMin(item.AvatarUrl);
|
|
|
|
+ }
|
|
|
|
+ result.Total = await connection.ExecuteScalarAsync<int>(countSql);
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
///最新 小组话题分页列表
|
|
///最新 小组话题分页列表
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <param name="request"></param>
|
|
@@ -366,6 +497,9 @@ namespace GxPress.Repository.Implement
|
|
result.Total = await connection.ExecuteScalarAsync<int>(countSql);
|
|
result.Total = await connection.ExecuteScalarAsync<int>(countSql);
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 获取共享小组
|
|
/// 获取共享小组
|
|
/// </summary>
|
|
/// </summary>
|