|
@@ -825,7 +825,7 @@ namespace GxPress.Service.Implement.Middle
|
|
|
ORDER BY IsSystemDefault DESC,AttributeValue desc , IsTop DESC , Sort DESC , CreatedDate DESC";
|
|
|
var database = new Database(DatabaseType.MySql, ConfigHelper.GetValue("Database:ConnectionString"));
|
|
|
var connection = database.GetConnection();
|
|
|
- var middles =await connection.QueryAsync<Entity.Middle.Middle>(sql);
|
|
|
+ var middles = await connection.QueryAsync<Entity.Middle.Middle>(sql);
|
|
|
// var query = Q.NewQuery();
|
|
|
// if (request.ParentId >= 0)
|
|
|
// query.Where(nameof(Entity.Middle.Middle.ParentId), request.ParentId);
|
|
@@ -874,7 +874,7 @@ namespace GxPress.Service.Implement.Middle
|
|
|
/// </summary>
|
|
|
/// <param name="request"></param>
|
|
|
/// <returns></returns>
|
|
|
- public async Task<List<MiddleSearchFolderResult>> GetLatelyNoteFolderAsync(int userId)
|
|
|
+ public async Task<List<MiddleSearchFolderResult>> GetLatelyTopicFolderAsync(int userId)
|
|
|
{
|
|
|
//获取用户最近发布的话题
|
|
|
var folderIds = await _noteRepository.GetLatelyFolderIdAsync(userId);
|
|
@@ -913,6 +913,49 @@ namespace GxPress.Service.Implement.Middle
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
+ /// <summary>
|
|
|
+ /// 获取笔记最近使用的文件夹
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<List<MiddleSearchFolderResult>> GetLatelyNoteFolderAsync(int userId)
|
|
|
+ {
|
|
|
+ //获取用户最近发布的话题
|
|
|
+ var folderIds = await _noteRepository.GetLatelyFolderIdAsync(userId);
|
|
|
+ var query = Q.NewQuery();
|
|
|
+ query.Where(nameof(Entity.Middle.Middle.AttributeValue), 2)
|
|
|
+ .Where(nameof(Entity.Middle.Middle.FolderType), AllTypeConst.Note.GetHashCode())
|
|
|
+ .Where(nameof(Entity.Middle.Middle.UserId), userId)
|
|
|
+ .Where(nameof(Entity.Middle.Middle.IsDelete), false)
|
|
|
+ .WhereIn(nameof(Entity.Middle.Middle.Id), folderIds);
|
|
|
+ query.WhereIn(nameof(Entity.Middle.Middle.RoleId), new List<int>() { 2 });
|
|
|
+ var middles = await _middleRepository.FindAsync(query.OrderByDesc(nameof(Entity.Middle.Middle.CreatedDate)));
|
|
|
+ List<MiddleSearchFolderResult> result = new List<MiddleSearchFolderResult>();
|
|
|
+ foreach (var item in middles)
|
|
|
+ {
|
|
|
+ MiddleSearchFolderResult middleSearchFolderResult = new MiddleSearchFolderResult
|
|
|
+ {
|
|
|
+ Name = item.FolderName,
|
|
|
+ Id = item.Id,
|
|
|
+ IsDisable = false,
|
|
|
+ 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), "、");
|
|
|
+ //middleSearchFolderResult.EnjoyUser = StringUtils.ObjectCollectionToString(folderUsers.Select(n => n.UserName), "、");
|
|
|
+ }
|
|
|
+ result.Add(middleSearchFolderResult);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
/// <summary> =-
|
|
|
/// 删除全部
|
|
|
/// </summary>
|