Files
kunshan-bzfm-mes-backend/DOAN.Service/MES/Device/DeviceFormConfigService.cs
2024-12-10 14:34:13 +08:00

85 lines
2.6 KiB
C#

using System;
using SqlSugar;
using Infrastructure.Attribute;
using Infrastructure.Extensions;
using DOAN.Model;
using DOAN.Model.Dto;
using DOAN.Repository;
using System.Linq;
using DOAN.Model.MES.dev;
using DOAN.Model.MES.dev.Dto;
using DOAN.Service.MES.dev.IService;
namespace DOAN.Service.MES.dev
{
/// <summary>
/// 设备检查项表单配置表Service业务层处理
/// </summary>
[AppService(ServiceType = typeof(IDeviceFormConfigService), ServiceLifetime = LifeTime.Transient)]
public class DeviceFormConfigService : BaseService<DeviceFormConfig>, IDeviceFormConfigService
{
/// <summary>
/// 查询设备检查项表单配置表列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<DeviceFormConfigDto> GetList(DeviceFormConfigQueryDto parm)
{
var predicate = Expressionable.Create<DeviceFormConfig>().And(it => it.FkDeviceInspectId == parm.FkDeviceInspectId);
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage<DeviceFormConfig, DeviceFormConfigDto>(parm);
return response;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public DeviceFormConfig GetInfo(string Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
/// <summary>
/// 添加设备检查项表单配置表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public DeviceFormConfig AddDeviceFormConfig(DeviceFormConfig model)
{
model.Id= SnowFlakeSingle.Instance.NextId().ToString();
return Context.Insertable(model).ExecuteReturnEntity();
}
/// <summary>
/// 修改设备检查项表单配置表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
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);
}
}
}