|
@@ -473,8 +473,10 @@ namespace GxPress.Service.Implement.Middle
|
|
|
.Where(nameof(Entity.Middle.Middle.IsDelete), false).WhereNotIn(nameof(Entity.Middle.Middle.Id), request.FolderIds);
|
|
|
if (!string.IsNullOrWhiteSpace(request.KeyWord))
|
|
|
query.WhereLike(nameof(Entity.Middle.Middle.FolderName), $"%{request.KeyWord}%");
|
|
|
- if (request.RoleId > 0)
|
|
|
- query.Where(nameof(Entity.Middle.Middle.RoleId), request.RoleId);
|
|
|
+ if (request.TypeId == -AllTypeConst.Note.GetHashCode())
|
|
|
+ query.WhereIn(nameof(Entity.Middle.Middle.RoleId), new List<int> { 1, 3 });
|
|
|
+ else
|
|
|
+ query.Where(nameof(Entity.Middle.Middle.RoleId), 2);
|
|
|
var middles = await _middleRepository.FindAsync(query.OrderByDesc(nameof(Entity.Middle.Middle.IsTop), nameof(Entity.Middle.Middle.Sort), nameof(Entity.Middle.Middle.LastModifiedDate)));
|
|
|
List<MiddleSearchFolderResult> result = new List<MiddleSearchFolderResult>();
|
|
|
foreach (var item in middles)
|
|
@@ -503,6 +505,56 @@ namespace GxPress.Service.Implement.Middle
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 查询文件夹包含父级
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<MiddleSearchFolderByParendIsResult> SearchFolderAndParentIdAsync(MiddleSearchFolderRequest request)
|
|
|
+ {
|
|
|
+ var middle = await _middleRepository.GetMiddleAsync(Q.Where(nameof(Entity.Middle.Middle.Id), request.ParentId));
|
|
|
+ var query = Q.NewQuery();
|
|
|
+ query.Where(nameof(Entity.Middle.Middle.ParentId), request.ParentId)
|
|
|
+ .Where(nameof(Entity.Middle.Middle.AttributeValue), 2)
|
|
|
+ .Where(nameof(Entity.Middle.Middle.FolderType), request.TypeId)
|
|
|
+ .Where(nameof(Entity.Middle.Middle.UserId), request.UserId)
|
|
|
+ .Where(nameof(Entity.Middle.Middle.IsDelete), false).WhereNotIn(nameof(Entity.Middle.Middle.Id), request.FolderIds);
|
|
|
+ if (!string.IsNullOrWhiteSpace(request.KeyWord))
|
|
|
+ query.WhereLike(nameof(Entity.Middle.Middle.FolderName), $"%{request.KeyWord}%");
|
|
|
+ if (request.TypeId == -AllTypeConst.Note.GetHashCode())
|
|
|
+ query.WhereIn(nameof(Entity.Middle.Middle.RoleId), new List<int> { 1, 3 });
|
|
|
+ else
|
|
|
+ query.Where(nameof(Entity.Middle.Middle.RoleId), 2);
|
|
|
+ var middles = await _middleRepository.FindAsync(query.OrderByDesc(nameof(Entity.Middle.Middle.IsTop), nameof(Entity.Middle.Middle.Sort), nameof(Entity.Middle.Middle.LastModifiedDate)));
|
|
|
+ var result = new MiddleSearchFolderByParendIsResult();
|
|
|
+ foreach (var item in middles)
|
|
|
+ {
|
|
|
+ MiddleSearchFolderResult middleSearchFolderResult = new MiddleSearchFolderResult
|
|
|
+ {
|
|
|
+ Name = item.FolderName,
|
|
|
+ Id = item.Id,
|
|
|
+ IsDisable = request.FolderIds.Any(n => n.Equals(item.Id)),
|
|
|
+ RoleId = item.RoleId,
|
|
|
+ IsFolder = await _middleRepository.IsFolderAsync(item.Id),
|
|
|
+ IsTop = item.IsTop
|
|
|
+ };
|
|
|
+ if (item.RoleId == 3)
|
|
|
+ {
|
|
|
+ var sourceId = item.Id;
|
|
|
+ if (item.ParentId != 0)
|
|
|
+ sourceId = item.MiddleSonId;
|
|
|
+ var userMiddles = await _userMiddleService.FindUserMiddlesAsync(item.FolderType, sourceId);
|
|
|
+ // var folderUsers = await _folderUserRepository.GetAllAsync(Q.Where(nameof(FolderUser.MiddleId), item.Id).OrderByDesc(nameof(FolderUser.CreatedDate)).Take(10));
|
|
|
+ middleSearchFolderResult.EnjoyUser = StringUtils.ObjectCollectionToString(userMiddles.Select(n => n.SourceName), "、");
|
|
|
+ }
|
|
|
+ result.Item.Add(middleSearchFolderResult);
|
|
|
+ }
|
|
|
+ result.Id = middle.Id;
|
|
|
+ result.Name = middle.FolderName;
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 修改权限
|
|
|
/// </summary>
|
|
@@ -685,7 +737,7 @@ namespace GxPress.Service.Implement.Middle
|
|
|
RoleId = item.RoleId,
|
|
|
IsFolder = await _middleRepository.IsFolderAsync(item.Id),
|
|
|
IsTop = item.IsTop,
|
|
|
- FileCount = await _middleRepository.CountAsync(Q.Where(nameof(Entity.Middle.Middle.ParentId), item.Id).Where(nameof(Entity.Middle.Middle.IsDelete),false)),
|
|
|
+ FileCount = await _middleRepository.CountAsync(Q.Where(nameof(Entity.Middle.Middle.ParentId), item.Id).Where(nameof(Entity.Middle.Middle.IsDelete), false)),
|
|
|
IsSystemDefault = item.IsSystemDefault
|
|
|
};
|
|
|
if (item.RoleId == 3)
|