84 lines
2.5 KiB
C#
84 lines
2.5 KiB
C#
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
|
|
{
|
|
/// <summary>
|
|
/// 车间Service业务层处理
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(IPlantWorkshopService), ServiceLifetime = LifeTime.Transient)]
|
|
public class PlantWorkshopService : BaseService<PlantWorkshop>, IPlantWorkshopService
|
|
{
|
|
/// <summary>
|
|
/// 查询车间列表
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public PagedInfo<PlantWorkshopDto> GetList(PlantWorkshopQueryDto parm)
|
|
{
|
|
var predicate = Expressionable.Create<PlantWorkshop>();
|
|
|
|
var response = Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.ToPage<PlantWorkshop, PlantWorkshopDto>(parm);
|
|
|
|
return response;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取详情
|
|
/// </summary>
|
|
/// <param name="WorkshopId"></param>
|
|
/// <returns></returns>
|
|
public PlantWorkshop GetInfo(int WorkshopId)
|
|
{
|
|
var response = Queryable()
|
|
.Where(x => x.WorkshopId == WorkshopId)
|
|
.First();
|
|
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加车间
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public PlantWorkshop AddPlantWorkshop(PlantWorkshop model)
|
|
{
|
|
return Context.Insertable(model).ExecuteReturnEntity();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改车间
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
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);
|
|
}
|
|
|
|
}
|
|
} |