using Vo;
using Microsoft.AspNetCore.Mvc;
using Model;
using Services;
using Model.Base;
using Vo.Admin;
using Mapster;
using Infrastructure;
namespace Controllers.Admin
{
///
/// PriCondition)Controller
///
// [ApiExplorerSettings(GroupName = "PriCondition")]
public class PriConditionController : BaseController
{
///
/// api分组接口
///
private readonly IPriConditionService _PriConditionService;
public PriConditionController(IPriConditionService PriConditionService)
{
_PriConditionService = PriConditionService;
}
/// 分页参数
///
/// 列表
///
/// 分页对象
/// 参数请求体
/// 列表
[HttpGet]
[Route("/v1/pri/PriCondition/getPriConditionList")]
public IActionResult getPriConditionList([FromQuery] PagerInfo page, [FromQuery] PriCondition param)
{
var response = _PriConditionService.getPriConditionList(page, param);
return SUCCESS(response);
}
///
/// 详情
///
/// 参数请求体
/// 详情
[HttpGet]
[Route("/v1/pri/PriCondition/getPriConditionQuery")]
public IActionResult getPriConditionQuery([FromQuery] PriCondition param)
{
var response = _PriConditionService.GetFirst(m => m.id == param.id).Adapt();
return SUCCESS(response);
}
///
/// 添加
///
/// 参数请求体
/// 添加
[HttpPost]
[Route("/v1/pri/PriCondition/addPriCondition")]
public IActionResult addPriCondition([FromBody] PriCondition param)
{
var modal = param.Adapt().ToCreate(HttpContext);
var response = _PriConditionService.Add(modal);
return SUCCESS(response);
}
///
/// 修改
///
/// 参数请求体
/// 修改
[HttpPut]
[Route("/v1/pri/PriCondition/updatePriCondition")]
public IActionResult updatePriCondition([FromBody] PriCondition param)
{
var modal = param.Adapt().ToCreate(HttpContext);
var response = _PriConditionService.Update(modal);
return SUCCESS(response);
}
///
/// 删除
///
/// ID
/// 删除
[HttpDelete]
[Route("/v1/pri/PriCondition/deletePriCondition/{id}")]
public IActionResult deletePriCondition(int id)
{
var response = _PriConditionService.Delete(id);
return SUCCESS(response);
}
}
}