using OpenAuth.App.BaseApp.Base; using OpenAuth.Repository.Domain.FireManagement; using OpenAuth.Repository; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using OpenAuth.Repository.Domain; using Microsoft.Extensions.Options; using OpenAuth.App.Common; using OpenAuth.App.Interface; using SqlSugar; using System.Net.WebSockets; using Microsoft.Extensions.Configuration; using Infrastructure; using OpenAuth.App.ServiceApp.FireManagement.Request; using OpenAuth.App.ServiceApp.FmPreventionPlanManage.Request; namespace OpenAuth.App.ServiceApp.FmPreventionPlanManage { public class FmPreventionPlanApp : SqlSugarBaseApp { private ClientWebSocket _socket; private IConfiguration _configuration; public FmPreventionPlanApp(IConfiguration configuration, ISugarUnitOfWork unitWork,ISimpleClient repository, IAuth auth) : base(unitWork, repository, auth) { _auth = auth; _configuration = configuration; } /// /// 分页查询预案列表 /// /// public async Task>>> GetPreventionplanPageList(FmPreventionplanReq req) { using (var db = base.UnitWork.CreateContext()) { RefAsync totalNumber = 0; var infos = await db.FmPreventionplan.AsQueryable() .WhereIF(req.state != null, r => r.Status == req.state) .WhereIF(req.plancategory != null, r => r.PlanCategory == req.plancategory) .WhereIF(req.createtimebegin != null && req.createtimeend != null, r => r.CreateTime >= req.createtimebegin && r.CreateTime <= req.createtimeend) .WhereIF(!string.IsNullOrEmpty(req.name), r => r.PlanName.Contains(req.name)) .WhereIF(!string.IsNullOrEmpty(req.code), r => r.PlanCode.Contains(req.code)) .ToPageListAsync(req.page, req.limit, totalNumber); return new Response>> { Result = new PageInfo> { Items = infos, Total = totalNumber } }; } } /// /// 查询应急预案详情 /// /// /// public async Task> LoadClueInfoById(string id) { using (var db = base.UnitWork.CreateContext()) { var info = await db.FmPreventionplan.AsQueryable() .FirstAsync(r => r.Id == id); return new Response { Result = info }; } } } }