50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
using Infrastructure.Attribute;
|
|
using JinianNet.JNTemplate;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using SqlSugar;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using ZR.Model.mes.md;
|
|
using ZR.Service.mes.md.IService;
|
|
|
|
namespace ZR.Service.mes.md
|
|
{
|
|
[AppService(ServiceType = typeof(IMdDeviceService), ServiceLifetime = LifeTime.Transient)]
|
|
public class MdDeviceService :BaseService<MdDevice>, IMdDeviceService
|
|
{
|
|
public int AddDevice(MdDevice workshop)
|
|
{
|
|
|
|
return Insert(workshop);
|
|
}
|
|
|
|
public int deleteDevice(int[] ids)
|
|
{
|
|
return Delete(ids);
|
|
}
|
|
|
|
|
|
|
|
public (int, List<MdDevice>) GetAll(string deviceCode, string deviceName, int pageNum, int pageSize)
|
|
{
|
|
int totalNum = 0;
|
|
var predicate = Expressionable.Create<MdDevice>()
|
|
.AndIF(!string.IsNullOrEmpty(deviceCode), it => it.DeviceCode.Contains(deviceCode))
|
|
.AndIF(!string.IsNullOrEmpty(deviceName), it => it.DeviceName.Contains(deviceName))
|
|
.ToExpression();
|
|
List<MdDevice> data = Context.Queryable<MdDevice>().Where(predicate).ToPageList(pageNum, pageSize, ref totalNum);
|
|
return (totalNum, data);
|
|
}
|
|
|
|
public int UpdateDevice(MdDevice workshop)
|
|
{
|
|
return Update(workshop, true);
|
|
}
|
|
|
|
|
|
}
|
|
}
|