feat: 修复当前用户数据
This commit is contained in:
@@ -8,9 +8,9 @@ namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss
|
|||||||
public class DiscussGetListOutputDto : EntityDto<Guid>
|
public class DiscussGetListOutputDto : EntityDto<Guid>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <20>Ƿ<EFBFBD><C7B7>ѵ<EFBFBD><D1B5><EFBFBD>
|
/// <20>Ƿ<EFBFBD><C7B7>ѵ<EFBFBD><D1B5>ޣ<EFBFBD>Ĭ<EFBFBD><EFBFBD>δ<EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsAgree { get; set; }
|
public bool IsAgree { get; set; } = false;
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public string Types { get; set; }
|
public string Types { get; set; }
|
||||||
public string? Introduction { get; set; }
|
public string? Introduction { get; set; }
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using Volo.Abp.Application.Dtos;
|
||||||
using Volo.Abp.Domain.Repositories;
|
using Volo.Abp.Domain.Repositories;
|
||||||
using Yi.Framework.Bbs.Application.Contracts.Dtos.Banner;
|
using Yi.Framework.Bbs.Application.Contracts.Dtos.Banner;
|
||||||
using Yi.Framework.Bbs.Application.Contracts.IServices;
|
using Yi.Framework.Bbs.Application.Contracts.IServices;
|
||||||
using Yi.Framework.Bbs.Domain.Entities;
|
using Yi.Framework.Bbs.Domain.Entities;
|
||||||
using Yi.Framework.Ddd.Application;
|
using Yi.Framework.Ddd.Application;
|
||||||
|
using Yi.Framework.SqlSugarCore.Abstractions;
|
||||||
|
|
||||||
namespace Yi.Framework.Bbs.Application.Services
|
namespace Yi.Framework.Bbs.Application.Services
|
||||||
{
|
{
|
||||||
@@ -12,8 +15,18 @@ namespace Yi.Framework.Bbs.Application.Services
|
|||||||
public class BannerService : YiCrudAppService<BannerEntity, BannerGetOutputDto, BannerGetListOutputDto, Guid, BannerGetListInputVo, BannerCreateInputVo, BannerUpdateInputVo>,
|
public class BannerService : YiCrudAppService<BannerEntity, BannerGetOutputDto, BannerGetListOutputDto, Guid, BannerGetListInputVo, BannerCreateInputVo, BannerUpdateInputVo>,
|
||||||
IBannerService
|
IBannerService
|
||||||
{
|
{
|
||||||
public BannerService(IRepository<BannerEntity, Guid> repository) : base(repository)
|
private ISqlSugarRepository<BannerEntity, Guid> _repository;
|
||||||
|
public BannerService(ISqlSugarRepository<BannerEntity, Guid> repository) : base(repository)
|
||||||
{
|
{
|
||||||
|
_repository= repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task<PagedResultDto<BannerGetListOutputDto>> GetListAsync(BannerGetListInputVo input)
|
||||||
|
{
|
||||||
|
RefAsync<int> total = 0;
|
||||||
|
var entities = await _repository._DbQueryable.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name!))
|
||||||
|
.ToPageListAsync(input.SkipCount, input.MaxResultCount, total);
|
||||||
|
return new PagedResultDto<BannerGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
|
using System.Linq;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Volo.Abp;
|
using Volo.Abp;
|
||||||
using Volo.Abp.Application.Dtos;
|
using Volo.Abp.Application.Dtos;
|
||||||
using Volo.Abp.EventBus.Local;
|
using Volo.Abp.EventBus.Local;
|
||||||
|
using Volo.Abp.Users;
|
||||||
using Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss;
|
using Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss;
|
||||||
using Yi.Framework.Bbs.Application.Contracts.IServices;
|
using Yi.Framework.Bbs.Application.Contracts.IServices;
|
||||||
using Yi.Framework.Bbs.Domain.Entities;
|
using Yi.Framework.Bbs.Domain.Entities;
|
||||||
@@ -86,7 +88,7 @@ namespace Yi.Framework.Bbs.Application.Services
|
|||||||
.Select((discuss, user) => new DiscussGetListOutputDto
|
.Select((discuss, user) => new DiscussGetListOutputDto
|
||||||
{
|
{
|
||||||
Id = discuss.Id,
|
Id = discuss.Id,
|
||||||
IsAgree = SqlFunc.Subqueryable<AgreeEntity>().Where(x => x.CreatorId == CurrentUser.Id && x.DiscussId == discuss.Id).Any(),
|
IsAgree = SqlFunc.Subqueryable<AgreeEntity>().WhereIF(CurrentUser.Id != null, x => x.CreatorId == CurrentUser.Id && x.DiscussId == discuss.Id).Any(),
|
||||||
|
|
||||||
User = new UserGetListOutputDto() { Id = user.Id, UserName = user.UserName, Nick = user.Nick, Icon = user.Icon }
|
User = new UserGetListOutputDto() { Id = user.Id, UserName = user.UserName, Nick = user.Nick, Icon = user.Icon }
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Reference in New Issue
Block a user