85 lines
2.6 KiB
C#
85 lines
2.6 KiB
C#
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
|
|
{
|
|
/// <summary>
|
|
/// Service业务层处理
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(IMesInterationLogService), ServiceLifetime = LifeTime.Transient)]
|
|
public class MesInterationLogService : BaseService<MesInterationLog>, IMesInterationLogService
|
|
{
|
|
/// <summary>
|
|
/// 查询列表
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public PagedInfo<MesInterationLogDto> GetList(MesInterationLogQueryDto parm)
|
|
{
|
|
var predicate = QueryExp(parm);
|
|
|
|
var response = Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.OrderByDescending(it => it.CreatedTime)
|
|
.ToPage<MesInterationLog, MesInterationLogDto>(parm);
|
|
|
|
return response;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取详情
|
|
/// </summary>
|
|
/// <param name="Id"></param>
|
|
/// <returns></returns>
|
|
public MesInterationLog GetInfo(string Id)
|
|
{
|
|
var response = Queryable()
|
|
.Where(x => x.Id == Id)
|
|
.First();
|
|
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public MesInterationLog AddMesInterationLog(MesInterationLog model)
|
|
{
|
|
return Insertable(model).ExecuteReturnEntity();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public int UpdateMesInterationLog(MesInterationLog model)
|
|
{
|
|
return Update(model, true);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询导出表达式
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
private static Expressionable<MesInterationLog> QueryExp(MesInterationLogQueryDto parm)
|
|
{
|
|
var predicate = Expressionable.Create<MesInterationLog>()
|
|
.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;
|
|
}
|
|
}
|
|
} |