init 项目代码初始化
This commit is contained in:
36
Src/Dlhis.Canteen/Order/Controllers/OrdersController.cs
Normal file
36
Src/Dlhis.Canteen/Order/Controllers/OrdersController.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Dlhis.Canteen.Order.Request;
|
||||
using Dlhis.Canteen.Order.Response;
|
||||
using Dlhis.Canteen.Order.Services;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 订单
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class OrdersController : ControllerBase
|
||||
{
|
||||
private readonly IOrderService _orderService;
|
||||
|
||||
public OrdersController(IOrderService orderService)
|
||||
{
|
||||
_orderService = orderService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 订单分页
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<Pagination<OrderResponse>> GetPageAsync([FromQuery] OrderPageRequest request)
|
||||
{
|
||||
return await _orderService.GetPageAsync(request);
|
||||
}
|
||||
}
|
||||
}
|
||||
7
Src/Dlhis.Canteen/Order/Request/OrderPageRequest.cs
Normal file
7
Src/Dlhis.Canteen/Order/Request/OrderPageRequest.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Request;
|
||||
|
||||
public class OrderPageRequest : PageDto
|
||||
{
|
||||
}
|
||||
5
Src/Dlhis.Canteen/Order/Response/OrderResponse.cs
Normal file
5
Src/Dlhis.Canteen/Order/Response/OrderResponse.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
namespace Dlhis.Canteen.Order.Response;
|
||||
|
||||
public class OrderResponse
|
||||
{
|
||||
}
|
||||
11
Src/Dlhis.Canteen/Order/Services/IOrderService.cs
Normal file
11
Src/Dlhis.Canteen/Order/Services/IOrderService.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using Dlhis.Canteen.Order.Request;
|
||||
using Dlhis.Canteen.Order.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Services
|
||||
{
|
||||
public interface IOrderService
|
||||
{
|
||||
Task<Pagination<OrderResponse>> GetPageAsync(OrderPageRequest request);
|
||||
}
|
||||
}
|
||||
27
Src/Dlhis.Canteen/Order/Services/Implements/OrderService.cs
Normal file
27
Src/Dlhis.Canteen/Order/Services/Implements/OrderService.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Dlhis.Canteen.Order.Request;
|
||||
using Dlhis.Canteen.Order.Response;
|
||||
using Dlhis.Entity.Canteen.Entities;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Services.Implements;
|
||||
|
||||
public class OrderService : IOrderService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
|
||||
public OrderService(IDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public async Task<Pagination<OrderResponse>> GetPageAsync(OrderPageRequest request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<CanteenOrderEntity>()
|
||||
.Select<OrderResponse>()
|
||||
.ToPageListAsync(request);
|
||||
|
||||
return page;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user