李昊 4 年之前
父節點
當前提交
ef58e30ba9
共有 1 個文件被更改,包括 9 次插入8 次删除
  1. 9 8
      gx_api/GxPress/Repository/GxPress.Repository.Implement/Note/NoteRepository.cs

+ 9 - 8
gx_api/GxPress/Repository/GxPress.Repository.Implement/Note/NoteRepository.cs

@@ -102,15 +102,16 @@ namespace GxPress.Repository.Implement.Note
         public string GetCollectionSql(NoteSearchPageListRequest request)
         {
             string sql = "";
+            var noteTypeId= GxPress.EnumConst.AllTypeConst.Note.GetHashCode();
             if (request.VisitUserId > 0)
             {
                 sql =
-                    $@"SELECT a.*,(SELECT GROUP_CONCAT(SourceName Separator'、') from tede_user_middle where MiddleType=4 and DataSourceId=a.MiddleSonId) as EnjoyUser,(SELECT 
+                    $@"SELECT a.*,(SELECT GROUP_CONCAT(SourceName Separator'、') from tede_user_middle where MiddleType={noteTypeId} and DataSourceId=a.MiddleSonId) as EnjoyUser,(SELECT 
                     COUNT(1)
                 FROM
                     tede_analyze
                 WHERE
-                    UserId = {request.UserId} AND TypeValue = 3
+                    UserId = {request.UserId} AND TypeValue ={noteTypeId}
                         AND SourceId = a.MiddleId
                         AND AnalyzeType = 1) AS PraiseCount,
             (SELECT 
@@ -118,7 +119,7 @@ namespace GxPress.Repository.Implement.Note
                 FROM
                     tede_analyze
                 WHERE
-                    UserId = {request.UserId} AND TypeValue = 3
+                    UserId = {request.UserId} AND TypeValue ={noteTypeId}
                         AND SourceId = a.MiddleId
                         AND AnalyzeType = 1
                 LIMIT 0 , 1) AS IsPraise,
@@ -128,13 +129,13 @@ namespace GxPress.Repository.Implement.Note
                     tede_comment
                 WHERE
                      ArticleId =  a.MiddleId and pid=0
-                        AND TypeValue = 3) AS CommentCount,
+                        AND TypeValue = {noteTypeId}) AS CommentCount,
             (SELECT 
                     COUNT(1)
                 FROM
                     tede_analyze
                 WHERE
-                    UserId = {request.UserId} AND TypeValue = 3
+                    UserId = {request.UserId} AND TypeValue ={noteTypeId}
                         AND SourceId = a.MiddleId
                         AND AnalyzeType = 4) AS RetransmissionCount,
             (SELECT 
@@ -142,7 +143,7 @@ namespace GxPress.Repository.Implement.Note
                 FROM
                     tede_analyze
                 WHERE
-                    UserId = {request.UserId} AND TypeValue = 3
+                    UserId = {request.UserId} AND TypeValue = {noteTypeId}
                         AND SourceId = a.MiddleId
                         AND AnalyzeType = 4
                 LIMIT 0 , 1) AS IsRetransmission,
@@ -151,7 +152,7 @@ namespace GxPress.Repository.Implement.Note
                 FROM
                     tede_analyze
                 WHERE
-                    UserId = {request.UserId} AND TypeValue = 3
+                    UserId = {request.UserId} AND TypeValue = {noteTypeId}
                         AND SourceId = a.MiddleId
                         AND AnalyzeType = 4
                 LIMIT 0 , 1) AS IsCollect,
@@ -160,7 +161,7 @@ namespace GxPress.Repository.Implement.Note
                 FROM
                     tede_analyze
                 WHERE
-                    UserId = {request.UserId} AND TypeValue = 3
+                    UserId = {request.UserId} AND TypeValue = {noteTypeId}
                         AND SourceId = a.MiddleId
                         AND AnalyzeType = 4) AS CollectCount,
             (SELECT