zhuangpei-mesbackend/ZR.Service/MES/dev/DeviceInspectService.cs
qianhao.xu b59a522e19 提交
2024-05-21 18:58:03 +08:00

88 lines
2.5 KiB
C#

using System;
using SqlSugar;
using Infrastructure.Attribute;
using Infrastructure.Extensions;
using ZR.Model;
using ZR.Repository;
using ZR.Service.Business.IBusinessService;
using System.Linq;
using ZR.Service.MES.dev.IService;
using ZR.Model.MES.dev;
namespace ZR.Service.MES.dev
{
/// <summary>
/// 设备检查项Service业务层处理
/// </summary>
[AppService(ServiceType = typeof(IDeviceInspectService), ServiceLifetime = LifeTime.Transient)]
public class DeviceInspectService : BaseService<DeviceInspect>, IDeviceInspectService
{
/// <summary>
/// 查询设备检查项列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<DeviceInspectDto> GetList(DeviceInspectQueryDto parm)
{
var predicate = Expressionable.Create<DeviceInspect>();
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage<DeviceInspect, DeviceInspectDto>(parm);
return response;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public DeviceInspect GetInfo(int Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
/// <summary>
/// 添加设备检查项
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public DeviceInspect AddDeviceInspect(DeviceInspect model)
{
return Context.Insertable(model).ExecuteReturnEntity();
}
/// <summary>
/// 修改设备检查项
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public int UpdateDeviceInspect(DeviceInspect model)
{
//var response = Update(w => w.Id == model.Id, it => new DeviceInspect()
//{
// Image = model.Image,
// Sort = model.Sort,
// Type = model.Type,
// Remark = model.Remark,
// Status = model.Status,
// Name = model.Name,
// CreatedBy = model.CreatedBy,
// CreatedTime = model.CreatedTime,
// UpdatedBy = model.UpdatedBy,
// UpdatedTime = model.UpdatedTime,
//});
//return response;
return Update(model, true);
}
}
}