83 lines
2.6 KiB
C#
83 lines
2.6 KiB
C#
using System;
|
|
using SqlSugar;
|
|
using Infrastructure.Attribute;
|
|
using Infrastructure.Extensions;
|
|
using DOAN.Model;
|
|
using DOAN.Model.Dto;
|
|
|
|
using DOAN.Repository;
|
|
using DOAN.Model.MES.dev.Dto;
|
|
using DOAN.Model.MES.dev;
|
|
using System.Linq;
|
|
using DOAN.Service.MES.dev.IService;
|
|
|
|
namespace DOAN.Service.MES.dev
|
|
{
|
|
/// <summary>
|
|
/// 备品备件分类Service业务层处理
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(IDevicePartsCategoriesService), ServiceLifetime = LifeTime.Transient)]
|
|
public class DevicePartsCategoriesService : BaseService<DevicePartsCategories>, IDevicePartsCategoriesService
|
|
{
|
|
/// <summary>
|
|
/// 查询备品备件分类列表
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public PagedInfo<DevicePartsCategoriesDto> GetList(DevicePartsCategoriesQueryDto parm)
|
|
{
|
|
var predicate = Expressionable.Create<DevicePartsCategories>()
|
|
.AndIF(!string.IsNullOrEmpty(parm.CategoryName),it=>it.CategoryName.Contains(parm.CategoryName))
|
|
;
|
|
|
|
var response = Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.ToPage<DevicePartsCategories, DevicePartsCategoriesDto>(parm);
|
|
|
|
return response;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取详情
|
|
/// </summary>
|
|
/// <param name="CategoryId"></param>
|
|
/// <returns></returns>
|
|
public DevicePartsCategories GetInfo(int CategoryId)
|
|
{
|
|
var response = Queryable()
|
|
.Where(x => x.CategoryId == CategoryId)
|
|
.First();
|
|
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加备品备件分类
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public DevicePartsCategories AddDevicePartsCategories(DevicePartsCategories model)
|
|
{
|
|
return Context.Insertable(model).ExecuteReturnEntity();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改备品备件分类
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public int UpdateDevicePartsCategories(DevicePartsCategories model)
|
|
{
|
|
//var response = Update(w => w.CategoryId == model.CategoryId, it => new DevicePartsCategories()
|
|
//{
|
|
// CategoryName = model.CategoryName,
|
|
// CreatedAt = model.CreatedAt,
|
|
// UpdatedAt = model.UpdatedAt,
|
|
//});
|
|
//return response;
|
|
return Update(model, true);
|
|
}
|
|
|
|
}
|
|
} |