Files
shgx_tz_mes_backend_sync/ZR.Service/mes/andon/AndonAlarmContactService.cs
quowingwang 9439286219 andon项目
2025-12-10 13:55:42 +08:00

83 lines
2.6 KiB
C#

using Infrastructure.Attribute;
using SqlSugar;
using ZR.Model;
using ZR.Model.MES.andon;
using ZR.Model.MES.andon.Dto;
using ZR.Repository;
using ZR.Service.mes.andon.Iservice;
namespace ZR.Service.mes.andon
{
/// <summary>
/// 报警联系人表Service业务层处理
/// </summary>
[AppService(ServiceType = typeof(IAndonAlarmContactService), ServiceLifetime = LifeTime.Transient)]
public class AndonAlarmContactService : BaseService<AndonAlarmContact>, IAndonAlarmContactService
{
/// <summary>
/// 查询报警联系人表列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<AndonAlarmContactDto> GetList(AndonAlarmContactQueryDto parm)
{
var predicate = Expressionable.Create<AndonAlarmContact>();
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage<AndonAlarmContact, AndonAlarmContactDto>(parm);
return response;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public AndonAlarmContact GetInfo(int Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
/// <summary>
/// 添加报警联系人表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public AndonAlarmContact AddAndonAlarmContact(AndonAlarmContact model)
{
return Context.Insertable(model).ExecuteReturnEntity();
}
/// <summary>
/// 修改报警联系人表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public int UpdateAndonAlarmContact(AndonAlarmContact model)
{
//var response = Update(w => w.Id == model.Id, it => new AndonAlarmContact()
//{
// UserName = model.UserName,
// Position = model.Position,
// Role = model.Role,
// ManagerName = model.ManagerName,
// Phone = model.Phone,
// LineCode = model.LineCode,
// CreatedBy = model.CreatedBy,
// CreatedTime = model.CreatedTime,
// UpdatedBy = model.UpdatedBy,
// UpdatedTime = model.UpdatedTime,
//});
//return response;
return Update(model, true);
}
}
}