|
@@ -455,6 +455,7 @@ namespace GxPress.Repository.Implement
|
|
|
}
|
|
|
public string AssembleSql(TopicPageSearchRequest request)
|
|
|
{
|
|
|
+ var topicTypeValue=GxPress.EnumConst.AllTypeConst.Topic.GetHashCode();
|
|
|
var sql = $@"SELECT
|
|
|
a.*,
|
|
|
(SELECT
|
|
@@ -468,7 +469,7 @@ namespace GxPress.Repository.Implement
|
|
|
FROM
|
|
|
tede_analyze
|
|
|
WHERE
|
|
|
- TypeValue = 3
|
|
|
+ TypeValue = {topicTypeValue}
|
|
|
AND SourceId = a.Id
|
|
|
AND AnalyzeType = 1) AS PraiseCount,
|
|
|
(SELECT
|
|
@@ -476,7 +477,7 @@ namespace GxPress.Repository.Implement
|
|
|
FROM
|
|
|
tede_analyze
|
|
|
WHERE
|
|
|
- UserId = {request.UserId} AND TypeValue = 3
|
|
|
+ UserId = {request.UserId} AND TypeValue = {topicTypeValue}
|
|
|
AND SourceId = a.Id
|
|
|
AND AnalyzeType = 1
|
|
|
LIMIT 0 , 1) AS IsPraise,
|
|
@@ -485,14 +486,14 @@ namespace GxPress.Repository.Implement
|
|
|
FROM
|
|
|
tede_comment
|
|
|
WHERE
|
|
|
- ArticleId = a.Id AND TypeValue = 3
|
|
|
+ ArticleId = a.Id AND TypeValue = {topicTypeValue}
|
|
|
AND Pid = 0) AS CommentCount,
|
|
|
(SELECT
|
|
|
COUNT(1)
|
|
|
FROM
|
|
|
tede_analyze
|
|
|
WHERE
|
|
|
- UserId = {request.UserId} AND TypeValue = 3
|
|
|
+ UserId = {request.UserId} AND TypeValue = {topicTypeValue}
|
|
|
AND SourceId = a.Id
|
|
|
AND AnalyzeType = 4) AS RetransmissionCount,
|
|
|
(SELECT
|
|
@@ -500,7 +501,7 @@ namespace GxPress.Repository.Implement
|
|
|
FROM
|
|
|
tede_analyze
|
|
|
WHERE
|
|
|
- UserId = {request.UserId} AND TypeValue = 3
|
|
|
+ UserId = {request.UserId} AND TypeValue = {topicTypeValue}
|
|
|
AND SourceId = a.Id
|
|
|
AND AnalyzeType = 4
|
|
|
LIMIT 0 , 1) AS IsRetransmission,
|
|
@@ -509,7 +510,7 @@ namespace GxPress.Repository.Implement
|
|
|
FROM
|
|
|
tede_analyze
|
|
|
WHERE
|
|
|
- UserId = {request.UserId} AND TypeValue = 3
|
|
|
+ UserId = {request.UserId} AND TypeValue = {topicTypeValue}
|
|
|
AND SourceId = a.Id
|
|
|
AND AnalyzeType = 3
|
|
|
LIMIT 0 , 1) AS IsCollect,
|