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