using Infrastructure.Attribute; using SqlSugar; using ZR.Model.mes.md; using ZR.Service.mes.md.IService; namespace ZR.Service.mes.md { [AppService(ServiceType = typeof(IMdWorkstationService), ServiceLifetime = LifeTime.Transient)] public class MdWorkstationService : BaseService, IMdWorkstationService { public int AddWorkshop(MdWorkstation workshop) { return Add(workshop); } public int deleteWorkshop(int[] ids) { return Delete(ids); } public (int, List) GetAll(string StationCode, string StationName, int pageNum, int pageSize) { int totalNum = 0; var predicate = Expressionable.Create() .AndIF(!string.IsNullOrEmpty(StationCode), it => it.StationCode.Contains(StationCode)) .AndIF(!string.IsNullOrEmpty(StationName), it => it.StationName.Contains(StationName)) .ToExpression(); List data = Context.Queryable().Includes(x => x.Workline).Where(predicate).ToPageList(pageNum, pageSize, ref totalNum); return (totalNum, data); } public int UpdateWorkshop(MdWorkstation workshop) { return Update(workshop, true); } public List GetworkLineList() { return Context.Queryable().ToList(); } } }