|
@@ -296,12 +296,13 @@ namespace GxPress.Repository.Implement.Note
|
|
|
/// <returns></returns>
|
|
|
public string GetCollectionSqlCount(NoteSearchPageListRequest request)
|
|
|
{
|
|
|
+ var noteTypeId = request.TypeValue == 0 ? AllTypeConst.Note.GetHashCode() : AllTypeConst.TopicNote.GetHashCode();
|
|
|
string sql = "";
|
|
|
|
|
|
if (request.VisitUserId > 0)
|
|
|
{
|
|
|
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)
|
|
|
sql += @" AND(a.RoleId = 1 OR a.RoleId = 3) AND a.ParentId = 0";
|
|
|
else
|
|
@@ -309,7 +310,7 @@ namespace GxPress.Repository.Implement.Note
|
|
|
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 +=
|
|
|
- $@" 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))
|
|
|
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))
|
|
@@ -320,7 +321,7 @@ namespace GxPress.Repository.Implement.Note
|
|
|
else
|
|
|
{
|
|
|
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)
|
|
|
sql += " and (a.RoleId in(2) or a.AttributeValue=1)";
|
|
|
else
|