using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; using System.Threading.Tasks; using Znyc.Recruitment.Admin.AspNetCore.Controllers; using Znyc.Recruitment.Admin.AspNetCore.Entitys; using Znyc.Recruitment.Admin.AspNetCore.Mvc; using Znyc.Recruitment.Admin.Commons.Entitys; using Znyc.Recruitment.Admin.Security.Dtos; using Znyc.Recruitment.Admin.Security.Entitys; using Znyc.Recruitment.Admin.Security.IServices; namespace Znyc.Recruitment.Admin.WebApi.Controllers { /// /// 角色数据权限接口 /// [ApiController] [Route("api/Security/[controller]")] public class RoleDataController : AreaApiController { /// /// 构造函数 /// /// public RoleDataController(IRoleDataService service) : base(service) { _service = service; } /// /// 新增前处理数据 /// /// protected override void OnBeforeInsert(RoleDataEntity info) { info.Id = 0; } /// /// 在更新数据前对数据的修改操作 /// /// /// protected override void OnBeforeUpdate(RoleDataEntity info) { } /// /// 在软删除数据前对数据的修改操作 /// /// /// protected override void OnBeforeSoftDelete(RoleDataEntity info) { } /// /// 角色可以访问数据 /// /// 角色Id /// [HttpGet("GetAllRoleDataByRoleId")] [FunctionAuthorize("List")] public async Task GetAllRoleDataByRoleId(string roleId) { CommonResult result = new CommonResult(); string where = string.Format("RoleId='{0}'", roleId); List resultlist = new List(); IEnumerable list = await _service.GetListWhereAsync(where); foreach (RoleDataEntity info in list) { resultlist.Add(info.AuthorizeData); } result.ResData = resultlist; result.ErrCode = ErrCode.successCode; return ToJsonContent(result); } } }