45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
|
|
using langguanApi.Model;
|
|||
|
|
using langguanApi.Service;
|
|||
|
|
using Microsoft.AspNetCore.Http;
|
|||
|
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
|
using System.IO;
|
|||
|
|
|
|||
|
|
namespace langguanApi.Controllers
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 台账相关接口
|
|||
|
|
/// </summary>
|
|||
|
|
[Route("api/[controller]")]
|
|||
|
|
[ApiController]
|
|||
|
|
public class LedgerController : ControllerBase
|
|||
|
|
{
|
|||
|
|
private readonly LedgerService _ledgerService;
|
|||
|
|
public LedgerController(LedgerService ledgerService)
|
|||
|
|
{
|
|||
|
|
_ledgerService = ledgerService;
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// Get all ledgers
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpGet("list")]
|
|||
|
|
public async Task<IActionResult> list([FromQuery]reqpage input)
|
|||
|
|
{
|
|||
|
|
var result = await _ledgerService.GetPage(input);
|
|||
|
|
return Ok(result);
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// Export all ledgers
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="start"></param>
|
|||
|
|
/// <param name="end"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpGet("export")]
|
|||
|
|
public async Task<IActionResult> Export(DateTime start, DateTime end)
|
|||
|
|
{
|
|||
|
|
var result = await _ledgerService.Export(start, end);
|
|||
|
|
return File(result, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "台账.xlsx");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|