1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- using Admin.Core.Common.Input;
- using Admin.Core.Common.Output;
- using Admin.Core.Model.Admin;
- using Admin.Core.Service.Admin.Role;
- using Admin.Core.Service.Admin.Role.Input;
- using Microsoft.AspNetCore.Mvc;
- using System.Threading.Tasks;
- namespace Admin.Core.Controllers.Admin
- {
- /// <summary>
- /// 角色管理
- /// </summary>
- public class RoleController : AreaController
- {
- private readonly IRoleService _roleService;
- public RoleController(IRoleService roleService)
- {
- _roleService = roleService;
- }
- /// <summary>
- /// 查询单条角色
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- [HttpGet]
- public async Task<IResponseOutput> Get(long id)
- {
- return await _roleService.GetAsync(id);
- }
- /// <summary>
- /// 查询分页角色
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- [HttpPost]
- public async Task<IResponseOutput> GetPage(PageInput<RoleEntity> model)
- {
- return await _roleService.PageAsync(model);
- }
- /// <summary>
- /// 新增角色
- /// </summary>
- /// <param name="input"></param>
- /// <returns></returns>
- [HttpPost]
- public async Task<IResponseOutput> Add(RoleAddInput input)
- {
- return await _roleService.AddAsync(input);
- }
- /// <summary>
- /// 修改角色
- /// </summary>
- /// <param name="input"></param>
- /// <returns></returns>
- [HttpPut]
- public async Task<IResponseOutput> Update(RoleUpdateInput input)
- {
- return await _roleService.UpdateAsync(input);
- }
- /// <summary>
- /// 删除角色
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- [HttpDelete]
- public async Task<IResponseOutput> SoftDelete(long id)
- {
- return await _roleService.SoftDeleteAsync(id);
- }
- /// <summary>
- /// 批量删除角色
- /// </summary>
- /// <param name="ids"></param>
- /// <returns></returns>
- [HttpPut]
- public async Task<IResponseOutput> BatchSoftDelete(long[] ids)
- {
- return await _roleService.BatchSoftDeleteAsync(ids);
- }
- }
- }
|