using AutoMapper;
using Entity.Api.Req;
using Entity.Api.Resp;
using Entity.DbModel.Station;
using HybirdFrameworkCore.Entity;
using Microsoft.AspNetCore.Mvc;
using Service.Station;
namespace WebStarter.Controllers;
///
/// 充电订单
///
[ApiController]
[Route("api/[controller]")]
public class ChargeOrderController : ControllerBase
{
private readonly ChargeOrderService chargeOrderService;
public ChargeOrderController(ChargeOrderService chargeOrderService)
{
this.chargeOrderService = chargeOrderService;
}
///
/// 查询分页数据
///
///
[HttpPost("QueryPage")]
public async Task>> QueryPage([FromBody] QueryChargeOrderReq req)
{
return Result>.Success(chargeOrderService.QueryChargeOrder(req));
}
///
/// 修改充电订单
///
///
///
[HttpPost("Modify")]
public async Task> Modify([FromBody] ModifyChargeOrderReq req)
{
//映射数据
var config = new MapperConfiguration(cfg => cfg.CreateMap().ReverseMap());
IMapper mapper = config.CreateMapper();
ChargeOrder chargeOrder = mapper.Map(req);
if (chargeOrderService.Update(chargeOrder))
{
return Result.Success("更改成功");
}
else
{
return Result.Fail("更改失败");
}
}
///
/// 充电订单上报云端
///
///
[HttpGet("UploadCloud/{id}")]
public async Task> UploadCloud(long id)
{
return Result.Success(null);
}
}