44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
using langguanApi.Extensions.AutoDI;
|
|
using langguanApi.Model;
|
|
using langguanApi.Model.Dto;
|
|
using System.Linq.Expressions;
|
|
|
|
namespace langguanApi.Service
|
|
{
|
|
[ServiceInjection(InjectionType.Transient)]
|
|
public class AlertService : BaseService<Alert>
|
|
{
|
|
public AlertService(IConfiguration config) : base(config, nameof(Device))
|
|
{
|
|
}
|
|
/// <summary>
|
|
/// 新加
|
|
/// </summary>
|
|
/// <param name="input"></param>
|
|
/// <returns></returns>
|
|
public async Task<ApiResult> Add(Alert input)
|
|
{
|
|
if (input != null)
|
|
{
|
|
await base.CreateAsync(input);
|
|
return new ApiResult { code = 0, msg = "" };
|
|
}
|
|
return new ApiResult { code = -1, msg = "" }; ;
|
|
}
|
|
/// <summary>
|
|
/// 分页取数据
|
|
/// </summary>
|
|
/// <param name="input"></param>
|
|
/// <returns></returns>
|
|
public async Task<object> GetPage(reqpage input)
|
|
{
|
|
Expression<Func<Alert, bool>> exp = filter => filter.DeviceMn.Contains(input.key) && filter.IsDelete == false;
|
|
return await base.GetPager(new ReqPaing()
|
|
{
|
|
pageSize = input.pageSize,
|
|
current = input.current
|
|
}, exp);
|
|
}
|
|
}
|
|
}
|