Files
Yi.Admin/Yi.Framework.Net6/Yi.Framework.Service/RABC/LoginLogService.cs

33 lines
1.4 KiB
C#
Raw Normal View History

2022-10-02 14:02:21 +08:00
using SqlSugar;
using System.Collections.Generic;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
2023-01-01 23:06:11 +08:00
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
2022-10-02 14:02:21 +08:00
using Yi.Framework.Repository;
2023-01-01 23:06:11 +08:00
using Yi.Framework.Service.Base;
2022-10-02 14:02:21 +08:00
2023-01-01 23:06:11 +08:00
namespace Yi.Framework.Service.RABC
2022-10-02 14:02:21 +08:00
{
public partial class LoginLogService : BaseService<LoginLogEntity>, ILoginLogService
{
2023-01-01 23:06:11 +08:00
public LoginLogService(IRepository<LoginLogEntity> repository) : base(repository)
{
}
2022-10-02 14:02:21 +08:00
public async Task<PageModel<List<LoginLogEntity>>> SelctPageList(LoginLogEntity loginLog, PageParModel page)
{
RefAsync<int> total = 0;
var data = await _repository._DbQueryable
.WhereIF(!string.IsNullOrEmpty(loginLog.LoginIp), u => u.LoginIp.Contains(loginLog.LoginIp))
.WhereIF(!string.IsNullOrEmpty(loginLog.LoginUser), u => u.LoginUser.Contains(loginLog.LoginUser))
2023-01-01 23:06:11 +08:00
.WhereIF(loginLog.IsDeleted is not null, u => u.IsDeleted == loginLog.IsDeleted)
.WhereIF(page.StartTime is not null && page.EndTime is not null, u => u.CreateTime >= page.StartTime && u.CreateTime <= page.EndTime)
2022-10-03 17:04:59 +08:00
.OrderBy(u => u.CreateTime, OrderByType.Desc)
2022-10-02 14:02:21 +08:00
.ToPageListAsync(page.PageNum, page.PageSize, total);
return new PageModel<List<LoginLogEntity>>(data, total);
}
}
}