From 84061f991490bb301a5e9d788de719992694376a Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Sun, 7 Apr 2024 14:32:36 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91=E9=A9=BE?= =?UTF-8?q?=E9=A9=B6=E8=88=B1=E6=8E=A5=E5=8F=A3=EF=BC=9A=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E7=BB=9F=E8=AE=A1=E6=8E=A5=E5=8F=A3=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/Echarts/StudentEchartsApi.cs | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Echarts/StudentEchartsApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Echarts/StudentEchartsApi.cs index 7415b03b5..d60ba6ccc 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Echarts/StudentEchartsApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Echarts/StudentEchartsApi.cs @@ -20,6 +20,7 @@ namespace Learun.Application.WebApi.Modules.Echarts private StuEncourgementIBLL stuEncourgementIBLL = new StuEncourgementBLL(); private StuTransferInfoIBLL stuTransferInfoIBLL = new StuTransferInfoBLL(); private StuGraduateStatisticIBLL stuGraduateStatisticIBLL = new StuGraduateStatisticBLL(); + private CdMajorIBLL cdMajorIBLL = new CdMajorBLL(); public StudentEchartsApi() : base("/api/studentEcharts/") { @@ -39,6 +40,8 @@ namespace Learun.Application.WebApi.Modules.Echarts Get["/stuMapEchart"] = stuMapEchart; Get["/stuGradeSelect"] = stuGradeSelect; Get["/stuClassSelect"] = stuClassSelect; + Get["/majorSelect"] = majorSelect; + Get["/stuClassEchart"] = stuClassEchart; } @@ -395,6 +398,52 @@ namespace Learun.Application.WebApi.Modules.Echarts return Res(res.OrderBy(x => x.value)); } + /// + /// 专业下拉框 + /// + /// + /// + public Response majorSelect(dynamic _) + { + var res = new List(); + var stuList = cdMajorIBLL.GetAllList().Where(x => x.MajorNo != null && x.MajorNo.Length > 0).GroupBy(x => x.MajorNo).Select(x => new SelectModel() + { + value = x.Key, + label = x.FirstOrDefault().MajorName + }).OrderBy(x => x.value); + res.Add(new SelectModel() { value = "", label = "全校" }); + res.AddRange(stuList); + + return Res(res.OrderBy(x => x.value)); + } + + /// + /// 学生班级信息统计 + /// + /// + /// + public Response stuClassEchart(dynamic _) + { + var param = this.GetReq(); + var res = new List(); + var stuList = classInfoIBLL.GetAllClass().Where(x => x.ClassNo != null && x.ClassNo.Length > 0); + if (!string.IsNullOrEmpty(param.MajorNo)) + { + stuList = stuList.Where(x => x.MajorNo == param.MajorNo); + } + var groupList = stuList.GroupBy(x => x.ClassNo).Select(x => new TableModelOfClass() + { + classno = x.Key, + classname = x.FirstOrDefault().ClassName, + man = stuInfoBasicIBLL.GetStuInfoByClassNo(x.Key).Where(y => y.GenderNo == true).Count(), + woman = stuInfoBasicIBLL.GetStuInfoByClassNo(x.Key).Where(y => y.GenderNo == false).Count(), + total = stuInfoBasicIBLL.GetStuInfoByClassNo(x.Key).Count() + }).OrderBy(x => x.classno); + res.AddRange(groupList); + + return Res(res); + } + @@ -472,6 +521,25 @@ namespace Learun.Application.WebApi.Modules.Echarts public string ClassNo { get; set; } } + /// + /// 班级信息统计数据 + /// + public class TableModelOfClass + { + public string classno { get; set; } + public string classname { get; set; } + public int man { get; set; } + public int woman { get; set; } + public int total { get; set; } + } + /// + /// 班级信息统计的传参 + /// + public class ClassParam + { + public string MajorNo { get; set; } + } +