20230201_145_upperpc/InSituLaboratory.Service/LogService.cs

37 lines
1.1 KiB
C#
Raw Normal View History

using InSituLaboratory.Entities;
using InSituLaboratory.Entities.Sensor;
using InSituLaboratory.IService;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace InSituLaboratory.Service
{
public class LogService : BaseService, ILogService
{
public LogService(DbContext context) : base(context)
{
}
/// <summary>
/// 获取数据--分页 按时间倒序排序
/// </summary>
/// <param name="key"></param>
/// <param name="pageSize"></param>
/// <param name="pageIndex"></param>
/// <param name="totalCount"></param>
/// <returns></returns>
public IEnumerable<LogModel> GetLogData(string key, int pageSize, int pageIndex, out int totalCount)
{
var pResult = this.QueryPage<LogModel, string>(m => string.IsNullOrEmpty(key) || m.CreateTime.ToString().Contains(key), pageSize, pageIndex, order => order.CreateTime.ToString(), false);
totalCount = pResult.TotalCount;
return pResult.DataList;
}
}
}