You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using SlnMesnac.Model.domain;
|
|
|
|
using SlnMesnac.Repository.service.@base;
|
|
|
|
|
|
|
|
namespace SlnMesnac.Repository.service.ScanLog
|
|
|
|
{
|
|
|
|
public class ScanLogServiceImpl:BaseServiceImpl<ScanLogModel>,IScanLogService
|
|
|
|
{
|
|
|
|
public ScanLogServiceImpl(Repository<ScanLogModel> rep) : base(rep)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public void CreatTable()
|
|
|
|
{
|
|
|
|
_rep.Context.CodeFirst.InitTables<ScanLogModel>();
|
|
|
|
List<ScanLogModel> ls = new List<ScanLogModel>();
|
|
|
|
for (int i = 0; i < 100; i++)
|
|
|
|
{
|
|
|
|
ls.Add(new ScanLogModel()
|
|
|
|
{
|
|
|
|
CreateTime = DateTime.Now,
|
|
|
|
DataType = 1,
|
|
|
|
Rfid = "12",
|
|
|
|
Code = "21",
|
|
|
|
Ocr = "2",
|
|
|
|
Url="badi.com"
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
this.Insert(ls);
|
|
|
|
}
|
|
|
|
|
|
|
|
public Page<ScanLogModel> QueryPage(int pageIndex, int pageSize)
|
|
|
|
{
|
|
|
|
int totalCount = 0;
|
|
|
|
var list= _rep.Context.Queryable<ScanLogModel>().OrderByDescending(x => x.CreateTime)
|
|
|
|
.ToPageList(pageIndex, pageSize, ref totalCount);
|
|
|
|
Page<ScanLogModel> page = new Page<ScanLogModel>();
|
|
|
|
page.Data=list;
|
|
|
|
page.PageIndex = pageIndex;
|
|
|
|
page.PageSize = pageSize;
|
|
|
|
page.TotalCount = totalCount;
|
|
|
|
page.TotalPage = (int)Math.Ceiling(totalCount / (double)pageSize);
|
|
|
|
return page;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|