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

36 lines
1.5 KiB
C#
Raw Normal View History

2022-09-23 18:46:37 +08:00
using SqlSugar;
using System.Collections.Generic;
using System.Threading.Tasks;
2023-01-06 16:32:43 +08:00
using Yi.Framework.Common.Attribute;
2022-09-23 18:46:37 +08:00
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-23 18:46:37 +08:00
using Yi.Framework.Repository;
2023-01-01 23:06:11 +08:00
using Yi.Framework.Service.Base;
2022-09-23 18:46:37 +08:00
2023-01-01 23:06:11 +08:00
namespace Yi.Framework.Service.RABC
2022-09-23 18:46:37 +08:00
{
public partial class ConfigService : BaseService<ConfigEntity>, IConfigService
{
2023-01-01 23:06:11 +08:00
public ConfigService(IRepository<ConfigEntity> repository) : base(repository)
{
}
2023-01-06 16:32:43 +08:00
[Caching(AbsoluteExpiration = 10)]
2022-09-23 18:46:37 +08:00
public async Task<PageModel<List<ConfigEntity>>> SelctPageList(ConfigEntity config, PageParModel page)
{
RefAsync<int> total = 0;
var data = await _repository._DbQueryable
.WhereIF(!string.IsNullOrEmpty(config.ConfigName), u => u.ConfigName.Contains(config.ConfigName))
.WhereIF(!string.IsNullOrEmpty(config.ConfigKey), u => u.ConfigKey.Contains(config.ConfigKey))
2023-01-01 23:06:11 +08:00
.WhereIF(page.StartTime is not null && page.EndTime is not null, u => u.CreateTime >= page.StartTime && u.CreateTime <= page.EndTime)
.WhereIF(config.IsDeleted is not null, u => u.IsDeleted == config.IsDeleted)
2022-09-23 18:46:37 +08:00
.OrderBy(u => u.OrderNum, OrderByType.Desc)
.ToPageListAsync(page.PageNum, page.PageSize, total);
return new PageModel<List<ConfigEntity>>(data, total);
}
}
}