diff --git a/ZR.Admin.WebApi/Controllers/CommonController.cs b/ZR.Admin.WebApi/Controllers/CommonController.cs index 6e387fd..650e2b3 100644 --- a/ZR.Admin.WebApi/Controllers/CommonController.cs +++ b/ZR.Admin.WebApi/Controllers/CommonController.cs @@ -25,25 +25,27 @@ namespace ZR.Admin.WebApi.Controllers private IWebHostEnvironment WebHostEnvironment; private ISysFileService SysFileService; private readonly IStringLocalizer _localizer; - + public readonly ISysDeptService _deptService; /// - /// + /// CommonController 构造函数 /// /// /// /// /// + /// public CommonController( IStringLocalizer stringLocalizer, IOptions options, IWebHostEnvironment webHostEnvironment, - ISysFileService fileService) + ISysFileService fileService, + ISysDeptService deptService) { WebHostEnvironment = webHostEnvironment; SysFileService = fileService; OptionsSetting = options.Value; _localizer = stringLocalizer; - + _deptService = deptService; } /// @@ -212,7 +214,14 @@ namespace ZR.Admin.WebApi.Controllers public async Task GetConfig() { var file = await SysFileService.AsQueryable().Where(x => x.ClassifyType == "watermark").FirstAsync(); - return SUCCESS(new { logo = file?.AccessUrl ?? "" }); + var topDept = await _deptService.AsQueryable().Where(it => it.ParentId == 0 && it.DelFlag == 0 && it.Status == 0).FirstAsync(); + List deptList = new List(); + if (topDept != null) + { + var children = await _deptService.AsQueryable().Where(it => it.ParentId == topDept.DeptId && it.DelFlag == 0 && it.Status == 0).Select(it => it.DeptName).ToListAsync(); + deptList = children; + } + return SUCCESS(new { logo = file?.AccessUrl ?? "", deptList }); } }