Files
Yi.Admin/Yi.Framework.Net6/Yi.Framework.Service/RABC/PostService.cs

34 lines
1.2 KiB
C#
Raw Normal View History

2022-09-13 17:05:53 +08:00
using SqlSugar;
using System.Collections.Generic;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
2023-01-01 23:06:11 +08:00
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
2022-09-13 17:05:53 +08:00
using Yi.Framework.Repository;
2023-01-01 23:06:11 +08:00
using Yi.Framework.Service.Base;
2022-09-13 17:05:53 +08:00
2023-01-01 23:06:11 +08:00
namespace Yi.Framework.Service.RABC
2022-09-13 17:05:53 +08:00
{
public partial class PostService : BaseService<PostEntity>, IPostService
{
2023-01-01 23:06:11 +08:00
public PostService(IRepository<PostEntity> repository) : base(repository)
{
}
2022-09-13 17:05:53 +08:00
public async Task<PageModel<List<PostEntity>>> SelctPageList(PostEntity post, PageParModel page)
{
RefAsync<int> total = 0;
var data = await _repository._DbQueryable
.WhereIF(!string.IsNullOrEmpty(post.PostName), u => u.PostName.Contains(post.PostName))
.WhereIF(!string.IsNullOrEmpty(post.PostCode), u => u.PostCode.Contains(post.PostCode))
2023-01-01 23:06:11 +08:00
.WhereIF(post.IsDeleted is not null, u => u.IsDeleted == post.IsDeleted)
2022-09-13 17:05:53 +08:00
.OrderBy(u => u.OrderNum, OrderByType.Desc)
.ToPageListAsync(page.PageNum, page.PageSize, total);
return new PageModel<List<PostEntity>>(data, total);
}
}
}