48 lines
1.5 KiB
C#
48 lines
1.5 KiB
C#
using Infrastructure.Attribute;
|
|
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(IMdWorkstationService), ServiceLifetime = LifeTime.Transient)]
|
|
public class MdWorkstationService : BaseService<MdWorkstation>, IMdWorkstationService
|
|
{
|
|
public int AddWorkshop(MdWorkstation workshop)
|
|
{
|
|
return Add(workshop);
|
|
|
|
|
|
}
|
|
|
|
public int deleteWorkshop(int[] ids)
|
|
{
|
|
return Delete(ids);
|
|
}
|
|
|
|
public (int, List<MdWorkstation>) GetAll(string StationCode, string StationName, int pageNum, int pageSize)
|
|
{
|
|
int totalNum = 0;
|
|
var predicate = Expressionable.Create<MdWorkstation>()
|
|
.AndIF(!string.IsNullOrEmpty(StationCode), it => it.StationCode.Contains(StationCode))
|
|
.AndIF(!string.IsNullOrEmpty(StationName), it => it.StationName.Contains(StationName))
|
|
.ToExpression();
|
|
List<MdWorkstation> data = Context.Queryable<MdWorkstation>().Where(predicate).ToPageList(pageNum, pageSize, ref totalNum);
|
|
return (totalNum, data);
|
|
}
|
|
|
|
public int UpdateWorkshop(MdWorkstation workshop)
|
|
{
|
|
return Update(workshop, true);
|
|
}
|
|
|
|
|
|
}
|
|
}
|