using System;
using SqlSugar;
using Infrastructure.Attribute;
using Infrastructure.Extensions;
using ZR.Model;
using ZR.Model.Dto;
using ZR.Repository;
using System.Linq;
using ZR.Model.MES.dev;
using ZR.Model.MES.dev.Dto;
using ZR.Service.MES.dev.IService;
namespace ZR.Service.MES.dev
{
///
/// 设备检查项表单配置表Service业务层处理
///
[AppService(ServiceType = typeof(IDeviceFormConfigService), ServiceLifetime = LifeTime.Transient)]
public class DeviceFormConfigService : BaseService, IDeviceFormConfigService
{
///
/// 查询设备检查项表单配置表列表
///
///
///
public PagedInfo GetList(DeviceFormConfigQueryDto parm)
{
var predicate = Expressionable.Create().And(it => it.FkDeviceInspectId == parm.FkDeviceInspectId);
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage(parm);
return response;
}
///
/// 获取详情
///
///
///
public DeviceFormConfig GetInfo(string Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
///
/// 添加设备检查项表单配置表
///
///
///
public DeviceFormConfig AddDeviceFormConfig(DeviceFormConfig model)
{
model.Id= SnowFlakeSingle.Instance.NextId().ToString();
return Context.Insertable(model).ExecuteReturnEntity();
}
///
/// 修改设备检查项表单配置表
///
///
///
public int UpdateDeviceFormConfig(DeviceFormConfig model)
{
//var response = Update(w => w.Id == model.Id, it => new DeviceFormConfig()
//{
// Type = model.Type,
// Content = model.Content,
// CreatedBy = model.CreatedBy,
// CreatedTime = model.CreatedTime,
// UpdatedBy = model.UpdatedBy,
// UpdatedTime = model.UpdatedTime,
//});
//return response;
return Update(model, true);
}
}
}