76 lines
2.9 KiB
C#
76 lines
2.9 KiB
C#
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<FmPreventionplan, SugarDbContext>
|
|
{
|
|
|
|
private ClientWebSocket _socket;
|
|
private IConfiguration _configuration;
|
|
|
|
public FmPreventionPlanApp(IConfiguration configuration, ISugarUnitOfWork<SugarDbContext> unitWork,ISimpleClient<FmPreventionplan> repository, IAuth auth) : base(unitWork, repository, auth)
|
|
{
|
|
_auth = auth;
|
|
_configuration = configuration;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 分页查询预案列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public async Task<Response<PageInfo<List<FmPreventionplan>>>> GetPreventionplanPageList(FmPreventionplanReq req)
|
|
{
|
|
using (var db = base.UnitWork.CreateContext())
|
|
{
|
|
RefAsync<int> 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<PageInfo<List<FmPreventionplan>>>
|
|
{
|
|
Result = new PageInfo<List<FmPreventionplan>> { Items = infos, Total = totalNumber }
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 查询应急预案详情
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
public async Task<Response<FmPreventionplan>> LoadClueInfoById(string id)
|
|
{
|
|
using (var db = base.UnitWork.CreateContext())
|
|
{
|
|
var info = await db.FmPreventionplan.AsQueryable()
|
|
.FirstAsync(r => r.Id == id);
|
|
return new Response<FmPreventionplan> { Result = info };
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|