using System.ComponentModel.DataAnnotations; using Entity.DbModel.Station; using Entity.Dto.Req; using HybirdFrameworkCore.Entity; using Microsoft.AspNetCore.Mvc; using Service.Station; namespace WebStarter.Controllers; /// /// 换电异常原因配置 /// [ApiController] [Route("api/[controller]")] public class SwapFailReasonConfigController { private readonly SwapFailReasonConfigService _swapFailReasonConfigService; /// /// 换电异常原因配置 /// /// public SwapFailReasonConfigController(SwapFailReasonConfigService swapFailReasonConfig) { _swapFailReasonConfigService = swapFailReasonConfig; } /// /// 换电异常原因配置 /// /// /// [HttpPost] [Route("page")] public async Task>> BatteryOpModelPageList( [FromBody] PageSwapFailReasonConfigReq input) { return Result>.Success(await _swapFailReasonConfigService.Page(input)); } /// /// 获取异常原因列表 /// /// /// [HttpPost] [Route("GetList")] public async Task>> GetList() { return Result>.Success(await _swapFailReasonConfigService.QueryAsync()); } /// /// 添加换电异常原因配置 /// /// /// [HttpPost] [Route("add")] public async Task> Add([FromBody] AddSwapFailReasonConfigReq input) { var data = await _swapFailReasonConfigService.Add(input); return Result.Success(data); } /// /// 修改换电异常原因配置 /// /// /// [HttpPost] [Route("update")] public async Task> Update([FromBody] UpdateSwapFailReasonConfigReq req) { var data = await _swapFailReasonConfigService.Update(req); if (data) return Result.Success(data); else return Result.Fail(data); } /// /// 删除换电异常原因配置 /// /// /// [HttpPost] [Route("delete")] public async Task> Delete([FromBody] [Required] DeleteSwapFailReasonConfigpReq input) { var data = await _swapFailReasonConfigService.Delete(input); if (data) return Result.Success(data); else return Result.Fail(data); } }