You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
2.3 KiB

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;
/// <summary>
/// 电池运营模型
/// </summary>
[ApiController]
[Route("api/[controller]")]
public class BatteryOpModelDetailController
{
private readonly BatteryOpModelDetailService _batteryOpModelDetailService;
public BatteryOpModelDetailController(BatteryOpModelDetailService batteryOpModelService)
{
_batteryOpModelDetailService = batteryOpModelService;
}
/// <summary>
/// 获取电池运营模型列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[Route("list")]
public async Task<List<BatteryOpModelDetail>> BatteryOpModelPageList()
{
return await _batteryOpModelDetailService.QueryAsync();
}
/// <summary>
/// 增加电池运营模型
/// </summary>
/// <param name ="input"></param >
/// <returns></returns >
[HttpPost]
[Route("add")]
public async Task<Result<string>> AddBatteryOpModelDetail([FromBody] AddBatteryOpModelDetailReq input)
{
return await _batteryOpModelDetailService.AddBatteryOpModelDetail(input);
}
/// <summary>
/// 更新电池运营模型
/// </summary>
/// <param name="batteryOp"></param>
/// <returns></returns>
[HttpPost]
[Route("update")]
public async Task<Result<bool>> UpdateBatteryOpModelDetail([FromBody] UpdateBatteryOpModelDetailReq batteryOpReq)
{
var data = await _batteryOpModelDetailService.UpdateBatteryOpModelDetail(batteryOpReq);
if (data)
return Result<bool>.Success(data);
else
return Result<bool>.Fail(data);
}
/// <summary>
/// 删除电池运营模型
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[Route("delete")]
public async Task<Result<bool>> DeleteBatteryOpModel([FromBody] [Required] DeleteBatteryOpModelDetailReq input)
{
var data = await _batteryOpModelDetailService.DeleteBatteryOpModelDetail(input);
if (data)
return Result<bool>.Success(data);
else
return Result<bool>.Fail(data);
}
}