TestResut2Res

dep_yangw
我叫锄头 11 months ago
parent 10100bfd55
commit 12e1777f47

@ -1,4 +1,7 @@
namespace ProductionSystem_Model.ViewModel.Request
using System;
using System.Collections.Generic;
namespace ProductionSystem_Model.ViewModel.Request
{
public class QueryResultVM : BaseQuery
{
@ -6,4 +9,21 @@
public string ProductCode { get; set; }
}
public class TestResut2Vm : BaseQuery
{
public string ProductType { get; set; }
public string ProductCode { get; set; }
public string BeginTime { get; set; }
public string EndTime { get; set; }
}
}

@ -1,5 +1,9 @@
using ProductionSystem_Log;
using ProductionSystem_Model.DbModel;
using ProductionSystem_Model.ViewModel.Request;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
@ -37,5 +41,39 @@ namespace ProductionSystem_Service
{
return db.Queryable<T_Result2>().Where(m => m.ProductType == productType && m.ProductBarcode == productBarcode).First();
}
public TestResut2Res Query(TestResut2Vm vm)
{
int totalRecord = 0;
var iq= db.Queryable<T_Result2>().
WhereIF(!string.IsNullOrEmpty(vm.ProductType), x => x.ProductType == vm.ProductType)
.WhereIF(!string.IsNullOrEmpty(vm.ProductCode),x=>x.ProductBarcode == vm.ProductCode)
.WhereIF(!string.IsNullOrEmpty(vm.BeginTime),x=>x.CreateTime>=Convert.ToDateTime(vm.BeginTime))
.WhereIF(!string.IsNullOrEmpty(vm.EndTime),xy=> xy.CreateTime <= Convert.ToDateTime(vm.EndTime))
.ToPageList(vm.PageIndex,vm.PageSize, ref totalRecord);
int totalPage = (totalRecord + vm.PageSize - 1) / vm.PageSize;
TestResut2Res testResut2Res = new TestResut2Res();
testResut2Res.Total= totalPage;
testResut2Res.Data = iq;
testResut2Res.Next = totalPage > vm.PageIndex;
return testResut2Res;
}
}
public class TestResut2Res
{
public int Total { get; set; }
public bool Next { get; set; }
public List<T_Result2> Data
{ get; set; }
}
}

Loading…
Cancel
Save