using System.ComponentModel.DataAnnotations; using Entity.DbModel.Station; using Entity.Dto.Req; using HybirdFrameworkCore.Entity; using Microsoft.AspNetCore.Mvc; using Service.Init; using Service.Station; namespace WebStarter.Controllers; /// /// 电池运营模型 /// [ApiController] [Route("api/[controller]")] public class BatteryOpModelDetailController { private readonly BatteryOpModelDetailService _batteryOpModelDetailService; public BatteryOpModelDetailController(BatteryOpModelDetailService batteryOpModelService) { _batteryOpModelDetailService = batteryOpModelService; } /// /// 获取电池运营模型列表 /// /// /// [HttpPost] [Route("list")] public async Task> BatteryOpModelPageList() { return await _batteryOpModelDetailService.QueryAsync(); } /// /// 增加电池运营模型 /// /// /// [HttpPost] [Route("add")] public async Task> AddBatteryOpModelDetail([FromBody] AddBatteryOpModelDetailReq input) { return await _batteryOpModelDetailService.AddBatteryOpModelDetail(input); } /// /// 更新电池运营模型 /// /// /// [HttpPost] [Route("update")] public async Task> UpdateBatteryOpModelDetail([FromBody] UpdateBatteryOpModelDetailReq batteryOpReq) { var data = await _batteryOpModelDetailService.UpdateBatteryOpModelDetail(batteryOpReq); if (data) return Result.Success(data); else return Result.Fail(data); } /// /// 删除电池运营模型 /// /// /// [HttpPost] [Route("delete")] public async Task> DeleteBatteryOpModel([FromBody] [Required] DeleteBatteryOpModelDetailReq input) { var data = await _batteryOpModelDetailService.DeleteBatteryOpModelDetail(input); if (data) return Result.Success(data); else return Result.Fail(data); } }