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.

83 lines
2.4 KiB

using System.ComponentModel.DataAnnotations;
using Entity.Base;
using Entity.DbModel.Station;
using Entity.DbModel.System;
using Entity.Dto.Req;
using HybirdFrameworkCore.Entity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Service.Station;
namespace WebStarter.Controllers.System;
/// <summary>
/// 电池运营模型
/// </summary>
[ApiController]
[Route("api/[controller]")]
public class BatteryOpModelController
{
private readonly BatteryOpModelService _batteryOpModelService;
public BatteryOpModelController(BatteryOpModelService batteryOpModelService)
{
_batteryOpModelService = batteryOpModelService;
}
/// <summary>
/// 获取电池运营模型分页列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[Route("page")]
public async Task<Result<PageResult<BatteryOpModel>>> BatteryOpModelPageList([FromBody] PageBatteryOpReq input)
{
return Result<PageResult<BatteryOpModel>>.Success(await _batteryOpModelService.Page(input));
}
/// <summary>
/// 增加电池运营模型
/// </summary>
/// <param name ="input"></param >
/// <returns></returns >
[HttpPost]
[Route("add")]
public async Task<Result<string>> AddBatteryOpModel([FromBody] AddBatteryOpReq input)
{
var data = await _batteryOpModelService.AddBatteryOpModel(input);
return Result<string>.Success(data);
}
/// <summary>
/// 更新电池运营模型
/// </summary>
/// <param name="batteryOp"></param>
/// <returns></returns>
[HttpPost]
[Route("update")]
public async Task<Result<bool>> UpdateBatteryOpModel([FromBody] UpdateBatteryOpReq batteryOpReq)
{
var data = await _batteryOpModelService.UpdateBatteryOpModel(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] DeleteBatteryOpReq input)
{
var data = await _batteryOpModelService.DeleteBatteryOpModel(input);
if (data)
return Result<bool>.Success(data);
else
return Result<bool>.Fail(data);
}
}