using Vo; using Microsoft.AspNetCore.Mvc; using Model; using Services; using Model.Base; using Vo.Admin; using Mapster; using Infrastructure; namespace Controllers.Admin { /// /// Environment)Controller /// // [ApiExplorerSettings(GroupName = "Environment")] public class EnvironmentController : BaseController { /// /// api分组接口 /// private readonly IEnvironmentService _EnvironmentService; public EnvironmentController(IEnvironmentService EnvironmentService) { _EnvironmentService = EnvironmentService; } /// 分页参数 /// /// 列表 /// /// 分页对象 /// 参数请求体 /// 列表 [HttpGet] [Route("/v1/omega_source/Environment/getEnvironmentList")] public IActionResult getEnvironmentList([FromQuery] PagerInfo page, [FromQuery] Model.Environment param) { var response = _EnvironmentService.getEnvironmentList(page, param); return SUCCESS(response); } /// /// 详情 /// /// 参数请求体 /// 详情 [HttpGet] [Route("/v1/omega_source/Environment/getEnvironmentQuery")] public IActionResult getEnvironmentQuery([FromQuery] Model.Environment param) { var response = _EnvironmentService.GetFirst(m => m.id == param.id).Adapt(); return SUCCESS(response); } /// /// 添加 /// /// 参数请求体 /// 添加 [HttpPost] [Route("/v1/omega_source/Environment/addEnvironment")] public IActionResult addEnvironment([FromBody] Model.Environment param) { var modal = param.Adapt().ToCreate(HttpContext); var response = _EnvironmentService.InsertReturnIdentity(modal); return SUCCESS(response); } /// /// 修改 /// /// 参数请求体 /// 修改 [HttpPut] [Route("/v1/omega_source/Environment/updateEnvironment")] public IActionResult updateEnvironment([FromBody] Model.Environment param) { var modal = param.Adapt().ToCreate(HttpContext); var response = _EnvironmentService.Update(modal, true); return SUCCESS(response); } /// /// 删除 /// /// ID /// 删除 [HttpDelete] [Route("/v1/omega_source/Environment/deleteEnvironment/{id}")] public IActionResult deleteEnvironment(int id) { var response = _EnvironmentService.Delete(id); return SUCCESS(response); } } }