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) { PageResult queryChargeOrder = chargeOrderService.QueryChargeOrder(req); return Result>.Success(queryChargeOrder); } /// /// 修改充电订单 /// /// /// [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(true,"更改成功"); } else { return Result.Fail("更改失败"); } } /// /// 充电订单上报云端,入参传 CloudChargeOrder /// /// [HttpGet("UploadCloud/{id}")] public Result UploadCloud(string id) { return chargeOrderService.Upload2Cloud(id); } }