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.

42 lines
1.3 KiB
C#

using Infrastructure;
using OpenAuth.App.Base;
using OpenAuth.Repository;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenAuth.App.BaseApp.Base;
namespace OpenAuth.App
{
public class TableRecordApp : SqlSugarBaseApp<Repository.Domain.TableRecord, SugarDbContext>
{
public TableRecordApp(ISugarUnitOfWork<SugarDbContext> unitWork,
ISimpleClient<Repository.Domain.TableRecord> repository)
: base(unitWork, repository, null)
{
}
public Response<PageInfo<List<Repository.Domain.TableRecord>>> LoadTableRecordList(string keyword, int pageindex, int pagesize)
{
//定义且实例化分页数据
int totalCount = 0;
//数据查询并返回
var info = this.Repository.AsQueryable()
.WhereIF(!string.IsNullOrEmpty(keyword), t => t.TableName.Contains(keyword))
.ToPageList(pageindex, pagesize, ref totalCount);
return new Response<PageInfo<List<Repository.Domain.TableRecord>>>
{
Result = new PageInfo<List<Repository.Domain.TableRecord>>
{
Items = info,
Total = totalCount
}
};
}
}
}