平安校园
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

53 lines
2.1 KiB

  1. using SafeCampus.Application.Services.Business.DepartmentService;
  2. using SafeCampus.Application.Services.Business.MajorService;
  3. using SafeCampus.Application.Services.Business.PersonSetInfoService;
  4. using SafeCampus.Web.Core.Controllers.Application.Business.Dto;
  5. namespace SafeCampus.Web.Core.Controllers.Application.Business;
  6. /// <summary>
  7. /// 移动端接口
  8. /// </summary>
  9. [ApiDescriptionSettings(ApiGroupConsts.SYSTEM_Business, Order = 81, Tag = "移动端接口")]
  10. [Route("/business/mobile")]
  11. [RolePermission]
  12. public class MobileController
  13. {
  14. private readonly IDepartmentService _departmentService;
  15. private readonly IMajorService _majorService;
  16. private readonly IPersonSetInfoService _personSetInfoService;
  17. public MobileController(IDepartmentService departmentService, IMajorService majorService, IPersonSetInfoService personSetInfoService)
  18. {
  19. _departmentService = departmentService;
  20. _majorService = majorService;
  21. _personSetInfoService = personSetInfoService;
  22. }
  23. /// <summary>
  24. /// 移动端获取专业系部班级列表
  25. /// </summary>
  26. /// <returns></returns>
  27. public async Task<List<MajorDepPersonSetModel>> GetMajorDep()
  28. {
  29. var dep = await _departmentService.GetNoPageList(new DepartmentSearch());
  30. var major = await _majorService.GetNoPageList(new MajorSearch());
  31. var set = await _personSetInfoService.GetPageList(null, null);
  32. var list = dep.Select(item => new MajorDepPersonSetModel
  33. {
  34. Label = item.Name,
  35. Value = item.Id,
  36. Children = major.Where(x => x.DepId == item.Id)
  37. .Select(x => new MajorDepPersonSetModel
  38. {
  39. Label = x.Name,
  40. Value = x.Id,
  41. Children = set.Where(xx => xx.MajorId == x.Id)
  42. .Select(xxx => new MajorDepPersonSetModel { Label = xxx.PersonSetName, Value = xxx.PersonSetId })
  43. .ToList()
  44. })
  45. .ToList(),
  46. })
  47. .ToList();
  48. return await Task.FromResult(list);
  49. }
  50. }