using Attribute; using Common; using Dto; using Vo; using Enums; using Filters; using Infrastructure; using Infrastructure.Model; using Mapster; using Microsoft.AspNetCore.Mvc; using Middleware; using Model; using Services; using Model.Base; namespace Controllers { /// /// SysDict)Controller /// // [Route("SysDict")] // [ApiExplorerSettings(GroupName = "SysDict")] public class SysDictController : BaseController { /// /// api分组接口 /// private readonly ISysDictService _SysDictService; public SysDictController(ISysDictService SysDictService) { _SysDictService = SysDictService; } /// /// 字典表列表 /// /// 请求参数 /// 字典表列表 [HttpGet] [Route("/v1/api/SysDict/list")] public IActionResult List([FromQuery] SysDictListDto parm) { var response = _SysDictService.List(parm); return SUCCESS(response); } /// /// 字典表详情 /// /// 请求参数 /// 字典表详情 [HttpGet] [Route("/v1/api/SysDict/query")] public IActionResult Query([FromQuery] SysDictQueryDto parm) { var response = _SysDictService.Queryable() .First(x => x.id == parm.id) .Adapt() ?? new SysDictQueryVo(); return SUCCESS(response); } /// /// 字典表添加 /// /// 请求参数 /// 字典表添加 [HttpPost] [Route("/v1/api/SysDict/add")] public IActionResult Add([FromBody] SysDictAddDto parm) { var modal = parm.Adapt().ToCreate(HttpContext); var response = _SysDictService.Add(modal); return SUCCESS(response); } /// /// 字典表修改 /// /// 请求参数 /// 字典表修改 [HttpPut] [Route("/v1/api/SysDict/update")] public IActionResult Update([FromBody] SysDictUpdateDto parm) { var modal = parm.Adapt().ToUpdate(HttpContext); var response = _SysDictService.Update(modal, true); return SUCCESS(response); } /// /// 字典表删除 /// /// 编号 /// 字典表删除 [HttpDelete] [Route("/v1/api/SysDict/delete/{id}")] public IActionResult Delete(long id) { var response = _SysDictService.Delete(id); return SUCCESS(response); } } }