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 { /// /// SysDictItem)Controller /// // [Route("SysDictItem")] // [ApiExplorerSettings(GroupName = "SysDictItem")] public class SysDictItemController : BaseController { /// /// api分组接口 /// private readonly ISysDictItemService _SysDictItemService; public SysDictItemController(ISysDictItemService SysDictItemService) { _SysDictItemService = SysDictItemService; } /// /// 字典项列表 /// /// 请求参数 /// 字典项列表 [HttpGet] [Route("/v1/api/SysDictItem/list")] public IActionResult List([FromQuery] SysDictItemListDto parm) { var response = _SysDictItemService.List(parm); return SUCCESS(response); } /// /// 字典项详情 /// /// 请求参数 /// 字典项详情 [HttpGet] [Route("/v1/api/SysDictItem/query")] public IActionResult Query([FromQuery] SysDictItemQueryDto parm) { var response = _SysDictItemService.Queryable() .First(x => x.id == parm.id) .Adapt() ?? new SysDictItemQueryVo(); return SUCCESS(response); } /// /// 字典项添加 /// /// 请求参数 /// 字典项添加 [HttpPost] [Route("/v1/api/SysDictItem/add")] public IActionResult Add([FromBody] SysDictItemAddDto parm) { var modal = parm.Adapt().ToCreate(HttpContext); var response = _SysDictItemService.Add(modal); return SUCCESS(response); } /// /// 字典项修改 /// /// 请求参数 /// 字典项修改 [HttpPut] [Route("/v1/api/SysDictItem/update")] public IActionResult Update([FromBody] SysDictItemUpdateDto parm) { var modal = parm.Adapt().ToUpdate(HttpContext); var response = _SysDictItemService.Update(modal, true); return SUCCESS(response); } /// /// 字典项删除 /// /// 编号 /// 字典项删除 [HttpDelete] [Route("/v1/api/SysDictItem/delete/{id}")] public IActionResult Delete(long id) { var response = _SysDictItemService.Delete(id); return SUCCESS(response); } } }