using System; using SqlSugar; using Infrastructure.Attribute; using Infrastructure.Extensions; using DOAN.Model; using DOAN.Model.Dto; using DOAN.Model.Business; using DOAN.Repository; using DOAN.Service.Business.IBusinessService; using System.Linq; namespace DOAN.Service.Business { /// /// 车间Service业务层处理 /// [AppService(ServiceType = typeof(IPlantWorkshopService), ServiceLifetime = LifeTime.Transient)] public class PlantWorkshopService : BaseService, IPlantWorkshopService { /// /// 查询车间列表 /// /// /// public PagedInfo GetList(PlantWorkshopQueryDto parm) { var predicate = Expressionable.Create(); var response = Queryable() .Where(predicate.ToExpression()) .ToPage(parm); return response; } /// /// 获取详情 /// /// /// public PlantWorkshop GetInfo(int WorkshopId) { var response = Queryable() .Where(x => x.WorkshopId == WorkshopId) .First(); return response; } /// /// 添加车间 /// /// /// public PlantWorkshop AddPlantWorkshop(PlantWorkshop model) { return Context.Insertable(model).ExecuteReturnEntity(); } /// /// 修改车间 /// /// /// public int UpdatePlantWorkshop(PlantWorkshop model) { //var response = Update(w => w.WorkshopId == model.WorkshopId, it => new PlantWorkshop() //{ // FkSiteCode = model.FkSiteCode, // WorkshopName = model.WorkshopName, // Description = model.Description, // Status = model.Status, // CreatedBy = model.CreatedBy, // CreatedTime = model.CreatedTime, // UpdatedBy = model.UpdatedBy, // UpdatedTime = model.UpdatedTime, //}); //return response; return Update(model, true); } } }