45 lines
1.5 KiB
C#
45 lines
1.5 KiB
C#
using Dlhis.Entity.Basic.Entity;
|
|
using Dlhis.Entity.Common.Entities;
|
|
using Kurisu.AspNetCore.DataAccess.Dto;
|
|
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
|
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
|
using Kurisu.AspNetCore.Utils.Extensions;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace Dlhis.Basic.Common.BusinessEvents;
|
|
|
|
|
|
[Authorize]
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
public class UserBusinessEventController : ControllerBase
|
|
{
|
|
private readonly IDbContext _dbContext;
|
|
|
|
public UserBusinessEventController(IDbContext dbContext)
|
|
{
|
|
_dbContext = dbContext;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取用户业务事件分页数据
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("page")]
|
|
public async Task<Pagination<UserBusinessEventResponse>> GetUserBusinessEventPageAsync([FromQuery] UserBusinessEventPageRequest request)
|
|
{
|
|
return await _dbContext.Queryable<UserBusinessEventEntity>()
|
|
.LeftJoin<GainfoEntity>((x, ga) => x.UserCode == ga.Code)
|
|
.WhereIF(request.Search.IsPresent(), (x, ga) => x.UserCode == request.Search || ga.Name.Contains(request.Search))
|
|
.Select((x, ga) => new UserBusinessEventResponse
|
|
{
|
|
UserCode = x.UserCode,
|
|
EventType = x.EventType,
|
|
UserName = ga.Name,
|
|
Content = x.Content
|
|
})
|
|
.ToPageListAsync(request);
|
|
}
|
|
}
|