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.

76 lines
2.2 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using SlnMesnac.Common;
using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service.LogImpl;
using SlnMesnac.Repository.service.ScanLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* 版权所有 (c) 2024 WenJY 保留所有权利。
* CLR版本4.0.30319.42000
* 机器名称T14-GEN3-7895
* 命名空间SlnMesnac.Business
* 唯一标识9d48fdd1-4ce5-4944-9756-2a814bdd51ff
*
* 创建者WenJY
* 电子邮箱:
* 创建时间2024-10-09 9:53:19
* 版本V1.0.0
* 描述:
*
*--------------------------------------------------------------------
* 修改人:
* 时间:
* 修改说明:
*
* 版本V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace SlnMesnac.Business
{
public class LogInfoBusiness
{
private IBaseLogService logService;
public LogInfoBusiness(IBaseLogService _logService)
{
logService = _logService;
}
/// <summary>
/// 查询日志信息
/// </summary>
/// <param name="logLevel"></param>
/// <param name="beginTime"></param>
/// <param name="endTime"></param>
/// <param name="result"></param>
public void QueryLogInfo(string logLevel, DateTime beginTime, DateTime endTime, out List<BaseLog> result)
{
//var info = scanLogService.Query(x => x.CreateTime >= beginTime && x.CreateTime <= endTime);
Expression<Func<BaseLog, bool>> exp = s1 => true;
if (beginTime != null)
{
exp = exp.And(x => x.CreateTime >= beginTime.Date);
}
if (endTime != null)
{
exp = exp.And(x => x.CreateTime <= endTime.Date);
}
if (!string.IsNullOrEmpty(logLevel) && logLevel != "所有")
{
exp = exp.And(x => x.LogLevel == logLevel);
}
var list = logService.Query(exp);
result = list.OrderByDescending(x => x.CreateTime).ToList();
}
}
}