using SafeCampus.Application.Services.Business.DepartmentService;
using SafeCampus.Application.Services.Business.MajorService;
using SafeCampus.Application.Services.Business.PersonSetInfoService;
using SafeCampus.Web.Core.Controllers.Application.Business.Dto;
namespace SafeCampus.Web.Core.Controllers.Application.Business;
///
/// 移动端接口
///
[ApiDescriptionSettings(ApiGroupConsts.SYSTEM_Business, Order = 81, Tag = "移动端接口")]
[Route("/business/mobile")]
[RolePermission]
public class MobileController
{
private readonly IDepartmentService _departmentService;
private readonly IMajorService _majorService;
private readonly IPersonSetInfoService _personSetInfoService;
public MobileController(IDepartmentService departmentService, IMajorService majorService, IPersonSetInfoService personSetInfoService)
{
_departmentService = departmentService;
_majorService = majorService;
_personSetInfoService = personSetInfoService;
}
///
/// 移动端获取专业系部班级列表
///
///
public async Task> GetMajorDep()
{
var dep = await _departmentService.GetNoPageList(new DepartmentSearch());
var major = await _majorService.GetNoPageList(new MajorSearch());
var set = await _personSetInfoService.GetPageList(null, null);
var list = dep.Select(item => new MajorDepPersonSetModel
{
Label = item.Name,
Value = item.Id,
Children = major.Where(x => x.DepId == item.Id)
.Select(x => new MajorDepPersonSetModel
{
Label = x.Name,
Value = x.Id,
Children = set.Where(xx => xx.MajorId == x.Id)
.Select(xxx => new MajorDepPersonSetModel { Label = xxx.PersonSetName, Value = xxx.PersonSetId })
.ToList()
})
.ToList(),
})
.ToList();
return await Task.FromResult(list);
}
}