李昊 4 jaren geleden
bovenliggende
commit
922b8d14fc
1 gewijzigde bestanden met toevoegingen van 7 en 6 verwijderingen
  1. 7 6
      gx_api/GxPress/Repository/GxPress.Repository.Implement/Note/NoteRepository.cs

+ 7 - 6
gx_api/GxPress/Repository/GxPress.Repository.Implement/Note/NoteRepository.cs

@@ -429,6 +429,7 @@ namespace GxPress.Repository.Implement.Note
         /// <returns></returns>
         public async Task<PagedList<NoteTopicResult>> GetTopicNoteAsync(NoteSearchPageListRequest request)
         {
+             var noteTypeId= GxPress.EnumConst.AllTypeConst.Note.GetHashCode();
             var sql = $@"SELECT 
                                 a.Id,
                                 a.Title,
@@ -444,14 +445,14 @@ namespace GxPress.Repository.Implement.Note
                                     FROM
                                         tede_analyze
                                     WHERE
-                                        TypeValue = 3 AND SourceId = a.Id
+                                        TypeValue ={noteTypeId} AND SourceId = a.Id
                                             AND AnalyzeType = 1) AS PraiseCount,
                                 (SELECT 
                                         COUNT(1)
                                     FROM
                                         tede_analyze
                                     WHERE
-                                        UserId = {request.UserId} AND TypeValue = 3
+                                        UserId = {request.UserId} AND TypeValue ={noteTypeId}
                                             AND SourceId = a.Id
                                             AND AnalyzeType = 1
                                     LIMIT 0 , 1) AS IsPraise,
@@ -460,14 +461,14 @@ namespace GxPress.Repository.Implement.Note
                                     FROM
                                         tede_comment
                                     WHERE
-                                        ArticleId = a.Id AND TypeValue = 3
+                                        ArticleId = a.Id AND TypeValue = {noteTypeId}
                                             AND Pid = 0) AS CommentCount,
                                 (SELECT 
                                         COUNT(1)
                                     FROM
                                         tede_analyze
                                     WHERE
-                                        UserId = {request.UserId} AND TypeValue = 3
+                                        UserId = {request.UserId} AND TypeValue = {noteTypeId}
                                             AND SourceId = a.Id
                                             AND AnalyzeType = 4) AS RetransmissionCount,
                                 (SELECT 
@@ -475,7 +476,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.Id
                                             AND AnalyzeType = 4
                                     LIMIT 0 , 1) AS IsRetransmission,
@@ -484,7 +485,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.Id
                                             AND AnalyzeType = 3
                                     LIMIT 0 , 1) AS IsCollect