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.

37 lines
1.1 KiB
C#

using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service.@base;
using SlnMesnac.Repository.service.ScanLog;
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Repository.service.LogImpl
{
public class BaseLogServiceImpl : BaseServiceImpl<BaseLog>, IBaseLogService
{
public BaseLogServiceImpl(Repository<BaseLog> rep) : base(rep)
{
}
public void CreatTable()
{
_rep.Context.CodeFirst.InitTables<BaseLog>();
}
public Page<BaseLog> QueryPage(int pageIndex, int pageSize)
{
int totalCount = 0;
var list = _rep.Context.Queryable<BaseLog>().OrderByDescending(x => x.CreateTime)
.ToPageList(pageIndex, pageSize, ref totalCount);
Page<BaseLog> page = new Page<BaseLog>();
page.Data = list;
page.PageIndex = pageIndex;
page.PageSize = pageSize;
page.TotalCount = totalCount;
page.TotalPage = (int)Math.Ceiling(totalCount / (double)pageSize);
return page;
}
}
}