using Entity.Api.Req;
using Entity.Api.Resp;
using HybirdFrameworkCore.Entity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Localization;
using Service.Station;
namespace WebStarter.Controllers;
///
/// 换电状态订单信息
///
[ApiController]
[Route("api/[controller]")]
public class SwapOrderStepController : ControllerBase
{
private readonly SwapOrderStepService swapOrderStepService;
private readonly IStringLocalizer _localizer;
public SwapOrderStepController(IStringLocalizer localizer,SwapOrderStepService swapOrderStepService)
{
_localizer = localizer;
this.swapOrderStepService = swapOrderStepService;
}
///
/// 查询换电状态订单信息
///
/// 查询参数
///
[HttpPost]
[Route("QuerySwapOrderStep")]
public Result> QuerySwapOrderStep([FromBody] QuerySwapOrderStepReq swapOrderStepReq)
{
PageResult pageResult = swapOrderStepService.QueryEqmFaultInfo(swapOrderStepReq);
if (pageResult.Rows.Count > 0)
{
foreach (var order in pageResult.Rows)
{
order.StepName = _localizer[order.StepName];
}
}
return Result>.Success(pageResult);
}
///
/// 删除换电状态订单信息
///
/// 自增id数组
///
[HttpPost]
[Route("RemoveSwapOrderStep")]
public Result RemoveSwapOrderStep([FromBody] int[] ids)
{
if (swapOrderStepService.DeleteByIds(ids))
{
return Result.Success(true,"删除成功");
}
else
{
return Result.Fail("删除失败");
}
}
}