using System;
using SqlSugar;
using Infrastructure.Attribute;
using Infrastructure.Extensions;
using DOAN.Model;
using DOAN.Model.Dto;
using DOAN.Model.MES.base_;
using DOAN.Model.MES.base_.Dto;
using DOAN.Repository;
using DOAN.Service.MES.base_.IService;
using System.Linq;
using Microsoft.IdentityModel.Tokens;
using Mapster;
using System.Xml.Linq;
using static Org.BouncyCastle.Crypto.Engines.SM2Engine;
using Infrastructure.Model;
using Aliyun.OSS;
namespace DOAN.Service.MES.base_
{
///
/// Service业务层处理
///
[AppService(ServiceType = typeof(IBaseGroupService), ServiceLifetime = LifeTime.Transient)]
public class BaseGroupService : BaseService, IBaseGroupService
{
///
/// 查询列表
///
///
///
public PagedInfo GetList(BaseGroupQueryDto parm)
{
var predicate = Expressionable.Create()
.AndIF(!string.IsNullOrEmpty(parm.GroupName),it=>it.GroupName.Contains(parm.GroupName))
.AndIF(!string.IsNullOrEmpty(parm.GroupLeader),it=>it.GroupName.Contains(parm.GroupLeader))
;
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage(parm);
return response;
}
///
/// 获取详情
///
///
///
public BaseGroup GetInfo(int Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
///
/// 添加
///
///
///
public BaseGroup AddBaseGroup(BaseGroup model)
{
return Context.Insertable(model).ExecuteReturnEntity();
}
///
/// 修改
///
///
///
public int UpdateBaseGroup(BaseGroup model)
{
//var response = Update(w => w.Id == model.Id, it => new BaseGroup()
//{
// GroupName = model.GroupName,
// GroupType = model.GroupType,
// GroupLeader = model.GroupLeader,
// Status = model.Status,
// Remark = model.Remark,
// CreatedTime = model.CreatedTime,
// CreatedBy = model.CreatedBy,
// UpdatedTime = model.UpdatedTime,
// UpdatedBy = model.UpdatedBy,
//});
//return response;
return Update(model, true);
}
}
}