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.

94 lines
2.2 KiB

using System.ComponentModel.DataAnnotations;
using Entity.DbModel.Station;
using Entity.DbModel.System.App;
using Entity.Dto.Req;
using HybirdFrameworkCore.Entity;
using Microsoft.AspNetCore.Mvc;
using Service.Station;
namespace WebStarter.Controllers;
/// <summary>
/// 车辆管理
/// </summary>
[ApiController]
[Route("api/[controller]")]
public class VehicleController
{
private readonly VehicleService _vehicleService;
/// <summary>
///
/// </summary>
/// <param name="carTeamService"></param>
public VehicleController(VehicleService vehicleService)
{
_vehicleService = vehicleService;
}
/// <summary>
/// 查询车队分页
/// </summary>
/// <param name="req"> 查询参数</param>
/// <returns></returns>
[HttpPost]
[Route("GetVehiclePage")]
public async Task<PageResult<BaseVehicle>> GetVehiclePage(
[FromBody] PageVehicleReq req)
{
return await _vehicleService.Page(req);
}
/// <summary>
/// 获取所有车队
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("GetVehicleList")]
public Result<List<BaseVehicle>> GetVehicleList()
{
return Result<List<BaseVehicle>>.Success(_vehicleService.GetVehicle());
}
/// <summary>
/// 新增车队
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[Route("add")]
public Result<bool> AddVehicle([FromBody] AddVehicleReq input)
{
return _vehicleService.AddVehicleReq(input);
}
/// <summary>
/// 修改车队
/// </summary>
/// <param name="user"></param>
/// <returns></returns>
[HttpPost]
[Route("UpdateVehicle")]
public async Task<Result<string>> UpdateVehicle([FromBody] UpdateVehicleReq user)
{
return _vehicleService.UpdateVehicle(user);
}
/// <summary>
/// 删除车队
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[Route("delete")]
public async Task<Result<bool>> DeleteVehicle([FromBody] List<long> ids)
{
return _vehicleService.DeleteVehicle(ids);
}
}