李昊 4 years ago
parent
commit
eb3a947a65

+ 4 - 3
gx_api/GxPress/Repository/GxPress.Repository.Implement/Note/NoteRepository.cs

@@ -296,12 +296,13 @@ namespace GxPress.Repository.Implement.Note
         /// <returns></returns>
         /// <returns></returns>
         public string GetCollectionSqlCount(NoteSearchPageListRequest request)
         public string GetCollectionSqlCount(NoteSearchPageListRequest request)
         {
         {
+               var noteTypeId = request.TypeValue == 0 ? AllTypeConst.Note.GetHashCode() : AllTypeConst.TopicNote.GetHashCode();
             string sql = "";
             string sql = "";
 
 
             if (request.VisitUserId > 0)
             if (request.VisitUserId > 0)
             {
             {
                 sql =
                 sql =
-                    $@"SELECT  count(1) FROM tede_middle a LEFT JOIN tede_note b ON a.MiddleId = b.Id WHERE a.UserId = {request.VisitUserId} AND a.FolderType = 4 AND a.IsDelete = 0";
+                    $@"SELECT  count(1) FROM tede_middle a LEFT JOIN tede_note b ON a.MiddleId = b.Id WHERE a.UserId = {request.VisitUserId} AND a.FolderType = {noteTypeId} AND a.IsDelete = 0";
                 if (request.FolderId == 0)
                 if (request.FolderId == 0)
                     sql += @" AND(a.RoleId = 1 OR a.RoleId = 3) AND a.ParentId = 0";
                     sql += @" AND(a.RoleId = 1 OR a.RoleId = 3) AND a.ParentId = 0";
                 else
                 else
@@ -309,7 +310,7 @@ namespace GxPress.Repository.Implement.Note
                 if (!string.IsNullOrEmpty(request.SearchKey))
                 if (!string.IsNullOrEmpty(request.SearchKey))
                     sql += $@" AND(b.Title LIKE '%{request.SearchKey}%' OR a.FolderName LIKE '%{request.SearchKey}%' or b.Content LIKE '%{request.SearchKey}%' or b.UserId in (select Id from tede_user where name like '%{request.SearchKey}%'))";
                     sql += $@" AND(b.Title LIKE '%{request.SearchKey}%' OR a.FolderName LIKE '%{request.SearchKey}%' or b.Content LIKE '%{request.SearchKey}%' or b.UserId in (select Id from tede_user where name like '%{request.SearchKey}%'))";
                 sql +=
                 sql +=
-                    $@" OR a.id IN(SELECT MiddleId FROM tede_folder_user WHERE UserId = {request.UserId}) AND a.FolderType = 4 AND a.UserId = {request.VisitUserId}";
+                    $@" OR a.id IN(SELECT MiddleId FROM tede_folder_user WHERE UserId = {request.UserId}) AND a.FolderType = {noteTypeId} AND a.UserId = {request.VisitUserId}";
                 if (request.FolderId == 0 && !string.IsNullOrEmpty(request.SearchKey))
                 if (request.FolderId == 0 && !string.IsNullOrEmpty(request.SearchKey))
                     sql += $@"  AND(b.Title LIKE '%{request.SearchKey}%' OR a.FolderName LIKE '%{request.SearchKey}%' or b.Content LIKE '%{request.SearchKey}%' or b.UserId in (select Id from tede_user where name like '%{request.SearchKey}%'))";
                     sql += $@"  AND(b.Title LIKE '%{request.SearchKey}%' OR a.FolderName LIKE '%{request.SearchKey}%' or b.Content LIKE '%{request.SearchKey}%' or b.UserId in (select Id from tede_user where name like '%{request.SearchKey}%'))";
                 else if (!string.IsNullOrEmpty(request.SearchKey))
                 else if (!string.IsNullOrEmpty(request.SearchKey))
@@ -320,7 +321,7 @@ namespace GxPress.Repository.Implement.Note
             else
             else
             {
             {
                 sql =
                 sql =
-                    $@"SELECT  count(1) FROM tede_middle a LEFT JOIN tede_note b ON a.MiddleId = b.Id left join tede_user c on c.Id=b.UserId left join tede_department d on d.Id=c.DepartmentId WHERE a.UserId = {request.UserId} AND a.FolderType = 4 AND a.IsDelete = 0";
+                    $@"SELECT  count(1) FROM tede_middle a LEFT JOIN tede_note b ON a.MiddleId = b.Id left join tede_user c on c.Id=b.UserId left join tede_department d on d.Id=c.DepartmentId WHERE a.UserId = {request.UserId} AND a.FolderType ={noteTypeId} AND a.IsDelete = 0";
                 if (request.TypeValue == 0)
                 if (request.TypeValue == 0)
                     sql += " and  (a.RoleId in(2) or a.AttributeValue=1)";
                     sql += " and  (a.RoleId in(2) or a.AttributeValue=1)";
                 else
                 else

+ 1 - 1
gx_api/GxPress/Service/GxPress.Service.Implement/Note/NoteService.cs

@@ -122,7 +122,7 @@ namespace GxPress.Service.Implement.Note
                     {
                     {
                         FolderId = request.FolderId,
                         FolderId = request.FolderId,
                         MiddleId = noteId,
                         MiddleId = noteId,
-                        FolderType = AllTypeConst.Note.GetHashCode(),
+                        FolderType = request.IsTopic ? AllTypeConst.TopicNote.GetHashCode() : AllTypeConst.Note.GetHashCode(),
                         UserId = request.UserId,
                         UserId = request.UserId,
                         MiddleSonId = 0,
                         MiddleSonId = 0,
                         AttributeValue = 1,
                         AttributeValue = 1,