Security/Yuebon.Security.Services/LogService.cs

(开头部分) 6KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。


using System.Security.Claims;
using Yuebon.Commons.Helpers;
using Yuebon.Commons.Log;

namespace Yuebon.Security.Services;

/// <summary>
/// 
/// </summary>
public class LogService : BaseService<Log, LogOutputDto>, ILogService
{
    /// <summary>
    /// 
    /// </summary>
    /// <param name="logRepository"></param>
    public LogService(ILogRepository logRepository)
    {
        repository= logRepository;
    }

    public async void AddAsync(Log entity)
    {
       await repository.InsertAsync(entity);
    }
    /// <summary>
    /// 根据条件查询数据库,并返回对象集合(用于分页数据显示)
    /// </summary>
    /// <param name="search">查询的条件</param>
    /// <returns>指定对象的集合</returns>
    public async Task<PageResult<LogOutputDto>> FindWithPagerSearchAsync(SearchLogModel search)
    {
        bool order = search.Order == "asc" ? false : true;
        string where = GetDataPrivilege(false);
        if (!string.IsNullOrEmpty(search.CreatorTime1))
        {
            where += " and CreatorTime >='"+ search.CreatorTime1.ToDateTime()+ "'";
        }
        if (!string.IsNullOrEmpty(search.CreatorTime2))
        {
            where += " and CreatorTime <='" + search.CreatorTime2.ToDateTime() + "'";
        }
        if (!string.IsNullOrEmpty(search.Filter.IPAddress))
        {
            where += string.Format(" and IPAddress = '{0}'", search.Filter.IPAddress);
        };
        if (!string.IsNullOrEmpty(search.Filter.Account))
        {
            where += string.Format(" and Account = '{0}'", search.Filter.Account);
        };
        PagerInfo pagerInfo = new PagerInfo
        {
            CurrenetPageIndex = search.CurrenetPageIndex,
            PageSize = search.PageSize
        };
        List<Log> list = await repository.FindWithPagerAsync(where, pagerInfo, search.Sort, order);
        PageResult<LogOutputDto> pageResult = new PageResult<LogOutputDto>
        {
            CurrentPage = pagerInfo.CurrenetPageIndex,
            Items = list.MapTo<LogOutputDto>(),
后面还有 111 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。