using EntrustSettle.Common;
using EntrustSettle.Controllers;
using EntrustSettle.IServices;
using EntrustSettle.Model;
using EntrustSettle.Model.Dtos;
using Mapster;
using Microsoft.AspNetCore.Mvc;
namespace EntrustSettle.Api.Controllers
{
///
/// 发票
///
public class InvoiceController : BaseApiController
{
private readonly IInvoiceApplyService invoiceApplyService;
public InvoiceController(IInvoiceApplyService invoiceApplyService)
{
this.invoiceApplyService = invoiceApplyService;
}
///
/// 获取当前登陆人最后一次使用的开票信息
///
///
[HttpGet]
public async Task> GetLastInfo()
{
var invoiceApply = await invoiceApplyService.AsQueryable().Where(x => x.CreateId == App.User.ID).OrderByDescending(x => x.Id).FirstAsync();
if (invoiceApply == null)
{
return Success(null);
}
var result = invoiceApply.Adapt();
return Success(result);
}
}
}