lanlingxian_ziranziyuanhegu.../OpenAuth.App/ServiceApp/DroneSsnydManage/DroneSsnyApp.cs

68 lines
2.1 KiB
C#
Raw Normal View History

using OpenAuth.App.BaseApp.Base;
using OpenAuth.Repository.Domain;
using OpenAuth.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenAuth.App.Interface;
using SqlSugar;
using Infrastructure;
namespace OpenAuth.App.ServiceApp.DroneSsnydManage
{
public class DroneSsnyApp : SqlSugarBaseApp<DroneSsnyd, SugarDbContext>
{
2025-05-20 17:20:40 +08:00
public DroneSsnyApp(ISugarUnitOfWork<SugarDbContext> unitWork, ISimpleClient<DroneSsnyd> repository, IAuth auth)
: base(unitWork, repository, auth)
{
}
/// <summary>
2025-05-20 17:20:40 +08:00
/// 到期预警
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
public PageInfo<List<DroneSsnyd>> TimeoutWarning(int pageIndex, int pageSize)
{
int totalCount = 0;
var endTime = DateTime.Now.AddMonths(2);
var list = base.Repository.AsQueryable()
2025-05-20 17:20:40 +08:00
.Where(a => a.end_time <= endTime && a.end_time > DateTime.Now)
.OrderBy(a => a.end_time, OrderByType.Desc)
.ToPageList(pageIndex, pageSize, ref totalCount);
return new PageInfo<List<DroneSsnyd>>
{
Items = list,
Total = totalCount
};
}
/// <summary>
/// 超期报警
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
public PageInfo<List<DroneSsnyd>> TimeOutAlarmList(int pageIndex, int pageSize)
{
int totalCount = 0;
var endTime = DateTime.Now;
var list = base.Repository.AsQueryable()
2025-05-20 17:20:40 +08:00
.Where(a => a.end_time < endTime)
.OrderBy(a => a.end_time, OrderByType.Desc)
.ToPageList(pageIndex, pageSize, ref totalCount);
return new PageInfo<List<DroneSsnyd>>
{
Items = list,
Total = totalCount
};
}
}
2025-05-20 17:20:40 +08:00
}