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

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

@@ -157,8 +157,8 @@ namespace GxPress.Repository.Implement.Note
             var noteTypeId = request.TypeValue == 0 ? AllTypeConst.Note.GetHashCode() : AllTypeConst.TopicNote.GetHashCode();
             if (request.VisitUserId > 0)
             {
-                 sql =
-                    $@"SELECT  a.Id,a.MiddleId,a.RoleId,a.ParentId,a.AttributeValue,a.UserId,
+                sql =
+                   $@"SELECT  a.Id,a.MiddleId,a.RoleId,a.ParentId,a.AttributeValue,a.UserId,
                       a.CreatedDate,a.IsTop,a.FolderName,a.FolderType,
                     (SELECT GROUP_CONCAT(SourceName Separator'、') from tede_user_middle where MiddleType={noteTypeId} 
                     and DataSourceId=a.MiddleSonId) as EnjoyUser,
@@ -275,6 +275,8 @@ namespace GxPress.Repository.Implement.Note
                     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))
                     sql += $@" and a.ParentId={request.FolderId}  AND(b.Title LIKE '%{request.SearchKey}%' OR a.FolderName LIKE '%{request.SearchKey}%' or b.Content LIKE '%{request.SearchKey}%')";
+                else
+                    sql += $" and a.ParentId={request.FolderId}";
                 sql +=
                     $@" ORDER BY a.IsSystemDefault desc,a.AttributeValue desc,a.IsTop DESC,a.Sort DESC , a.LastModifiedDate DESC";
                 if (request.Page > 0)
@@ -408,8 +410,8 @@ namespace GxPress.Repository.Implement.Note
 
             if (request.VisitUserId > 0)
             {
-               sql =
-                    $@"SELECT  count(1)
+                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