You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

85 lines
2.9 KiB

using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading.Tasks;
using Znyc.Cloudcar.Admin.AspNetCore.Controllers;
using Znyc.Cloudcar.Admin.AspNetCore.Entitys;
using Znyc.Cloudcar.Admin.AspNetCore.Mvc;
using Znyc.Cloudcar.Admin.Commons.Entitys;
using Znyc.Cloudcar.Admin.Commons.Pages;
using Znyc.Cloudcar.Admin.Security.Dtos;
using Znyc.Cloudcar.Admin.Security.Entitys;
using Znyc.Cloudcar.Admin.Security.IServices;
namespace Znyc.Cloudcar.Admin.WebApi.Controllers
{
/// <summary>
/// 操作日志接口
/// </summary>
[ApiController]
[Route("api/Security/[controller]")]
public class OperationLogsController : AreaApiController<OperationLogsEntity, OperationLogsOutputDto,
OperationLogsInPutDto, IOperationLogsService, long>
{
private readonly IOrganizeService organizeService;
/// <summary>
/// </summary>
/// <param name="service"></param>
/// <param name="_organizeService"></param>
public OperationLogsController(IOperationLogsService service, IOrganizeService _organizeService) : base(service)
{
_service = service;
organizeService = _organizeService;
}
/// <summary>
/// 新增前处理数据
/// </summary>
/// <param name="info"></param>
protected override void OnBeforeInsert(OperationLogsEntity info)
{
info.Id = 0;
info.CreatedTime = DateTime.Now;
info.CreatedUserId = CurrentUser.UserId;
info.IsDeleted = false;
}
/// <summary>
/// 在更新数据前对数据的修改操作
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
protected override void OnBeforeUpdate(OperationLogsEntity info)
{
info.ModifiedUserId = CurrentUser.UserId;
info.ModifiedTime = DateTime.Now;
}
/// <summary>
/// 在软删除数据前对数据的修改操作
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
protected override void OnBeforeSoftDelete(OperationLogsEntity info)
{
info.IsDeleted = true;
}
/// <summary>
/// 异步分页查询
/// </summary>
/// <param name="search"></param>
/// <returns></returns>
[HttpPost("FindWithPagerSearchAsync")]
[FunctionAuthorize("List")]
public async Task<IActionResult> FindWithPagerSearchAsync(SearchOperationLogsModel search)
{
CommonResult<PageResult<OperationLogsOutputDto>> result = new CommonResult<PageResult<OperationLogsOutputDto>>
{
ResData = await _service.FindWithPagerSearchAsync(search),
ErrCode = ErrCode.successCode
};
return ToJsonContent(result);
}
}
}