Files
tnb.server/system/Tnb.Systems/System/DataInterfaceLogService.cs
2024-04-23 10:16:16 +08:00

60 lines
2.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using JNPF.Common.Extension;
using JNPF.Common.Filter;
using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
using JNPF.Systems.Entitys.Dto.DataInterfaceLog;
using JNPF.Systems.Entitys.Permission;
using JNPF.Systems.Entitys.System;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
namespace JNPF.Systems;
/// <summary>
/// 数据接口日志
/// 版 本V3.2
/// 版 权拓通智联科技有限公司http://www.tuotong-tech.com
/// 日 期2021-06-01.
/// </summary>
[ApiDescriptionSettings(Tag = "System", Name = "DataInterfaceLog", Order = 204)]
[Route("api/system/[controller]")]
public class DataInterfaceLogService : IDynamicApiController, ITransient
{
/// <summary>
/// 服务基础仓储.
/// </summary>
private readonly ISqlSugarRepository<DataInterfaceLogEntity> _repository;
/// <summary>
/// 初始化一个<see cref="DataInterfaceLogService"/>类型的新实例.
/// </summary>
public DataInterfaceLogService(
ISqlSugarRepository<DataInterfaceLogEntity> repository)
{
_repository = repository;
}
#region Get
[HttpGet("{id}")]
public async Task<dynamic> GetList(string id, [FromQuery] PageInputBase input)
{
var list = await _repository.AsSugarClient().Queryable<DataInterfaceLogEntity, UserEntity>((a, b) =>
new JoinQueryInfos(JoinType.Left, b.Id == a.UserId))
.Where(a => a.InvokId == id)
.WhereIF(input.keyword.IsNotEmptyOrNull(), a => a.UserId.Contains(input.keyword) || a.InvokIp.Contains(input.keyword)).OrderBy(a => a.InvokTime)
.Select((a, b) => new DataInterfaceLogListOutput
{
id = a.Id,
invokDevice = a.InvokDevice,
invokIp = a.InvokIp,
userId = SqlFunc.MergeString(b.RealName, "/", b.Account),
invokTime = a.InvokTime,
invokType = a.InvokType,
invokWasteTime = a.InvokWasteTime
}).ToPagedListAsync(input.currentPage, input.pageSize);
return PageResult<DataInterfaceLogListOutput>.SqlSugarPageResult(list);
}
#endregion
}