123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- 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
- {
- /// <summary>
- /// SysDict)Controller
- /// </summary>
- // [Route("SysDict")]
- // [ApiExplorerSettings(GroupName = "SysDict")]
- public class SysDictController : BaseController
- {
- /// <summary>
- /// api分组接口
- /// </summary>
- private readonly ISysDictService _SysDictService;
- public SysDictController(ISysDictService SysDictService)
- {
- _SysDictService = SysDictService;
- }
- /// <summary>
- /// 字典表列表
- /// </summary>
- /// <param name="parm">请求参数</param>
- /// <returns>字典表列表</returns>
- [HttpGet]
- [Route("/v1/api/SysDict/list")]
- public IActionResult List([FromQuery] SysDictListDto parm)
- {
- var response = _SysDictService.List(parm);
- return SUCCESS(response);
- }
- /// <summary>
- /// 字典表详情
- /// </summary>
- /// <param name="parm">请求参数</param>
- /// <returns>字典表详情</returns>
- [HttpGet]
- [Route("/v1/api/SysDict/query")]
- public IActionResult Query([FromQuery] SysDictQueryDto parm)
- {
- var response = _SysDictService.Queryable()
- .First(x => x.id == parm.id)
- .Adapt<SysDictQueryVo>() ?? new SysDictQueryVo();
- return SUCCESS(response);
- }
- /// <summary>
- /// 字典表添加
- /// </summary>
- /// <param name="parm">请求参数</param>
- /// <returns>字典表添加</returns>
- [HttpPost]
- [Route("/v1/api/SysDict/add")]
- public IActionResult Add([FromBody] SysDictAddDto parm)
- {
- var modal = parm.Adapt<SysDict>().ToCreate(HttpContext);
- var response = _SysDictService.Add(modal);
- return SUCCESS(response);
- }
- /// <summary>
- /// 字典表修改
- /// </summary>
- /// <param name="parm">请求参数</param>
- /// <returns>字典表修改</returns>
- [HttpPut]
- [Route("/v1/api/SysDict/update")]
- public IActionResult Update([FromBody] SysDictUpdateDto parm)
- {
- var modal = parm.Adapt<SysDict>().ToUpdate(HttpContext);
- var response = _SysDictService.Update(modal, true);
- return SUCCESS(response);
- }
- /// <summary>
- /// 字典表删除
- /// </summary>
- /// <param name="Id">编号</param>
- /// <returns>字典表删除</returns>
- [HttpDelete]
- [Route("/v1/api/SysDict/delete/{id}")]
- public IActionResult Delete(long id)
- {
- var response = _SysDictService.Delete(id);
- return SUCCESS(response);
- }
- }
- }
|