using Infrastructure.Attribute; using Infrastructure.Extensions; using DOAN.Model.PBL.Dto; using DOAN.Model.PBL; using DOAN.Repository; using DOAN.Service.PBL.IPBLService; using SqlSugar.SplitTableExtensions; namespace DOAN.Service.PBL { /// /// Service业务层处理 /// [AppService(ServiceType = typeof(IMesInterationLogService), ServiceLifetime = LifeTime.Transient)] public class MesInterationLogService : BaseService, IMesInterationLogService { /// /// 查询列表 /// /// /// public PagedInfo GetList(MesInterationLogQueryDto parm) { var predicate = QueryExp(parm); var response = Queryable() .Where(predicate.ToExpression()) .OrderByDescending(it => it.CreatedTime) .ToPage(parm); return response; } /// /// 获取详情 /// /// /// public MesInterationLog GetInfo(string Id) { var response = Queryable() .Where(x => x.Id == Id) .First(); return response; } /// /// 添加 /// /// /// public MesInterationLog AddMesInterationLog(MesInterationLog model) { return Insertable(model).ExecuteReturnEntity(); } /// /// 修改 /// /// /// public int UpdateMesInterationLog(MesInterationLog model) { return Update(model, true); } /// /// 查询导出表达式 /// /// /// private static Expressionable QueryExp(MesInterationLogQueryDto parm) { var predicate = Expressionable.Create() .AndIF(!string.IsNullOrEmpty(parm.Workorder),it=>it.Workorder.Contains(parm.Workorder)) .AndIF(parm.TimeRange[0]>DateTime.MinValue, it => it.CreatedTime >=parm.TimeRange[0]) .AndIF(parm.TimeRange[1]>DateTime.MinValue, it => it.CreatedTime <=parm.TimeRange[1].Value.Add(new TimeSpan(23, 59, 59))) ; return predicate; } } }