|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- 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;
- /// <summary>
- /// 移动端接口
- /// </summary>
- [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;
- }
-
- /// <summary>
- /// 移动端获取专业系部班级列表
- /// </summary>
- /// <returns></returns>
- public async Task<List<MajorDepPersonSetModel>> 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);
- }
- }
|