From 65a38045be412336090a2380a57a5e1e654af911 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?old=E6=98=93?= <156663459@qq.com>
Date: Thu, 12 Oct 2023 11:24:26 +0800
Subject: [PATCH] feat:bug fixed
---
.../Front/FrontSelectionController.cs | 42 +++++++++++++++++--
New_College.Api/New_College.xml | 6 +++
.../ViewModels/MajorClassListDto.cs | 15 +++++++
3 files changed, 60 insertions(+), 3 deletions(-)
create mode 100644 New_College.Model/ViewModels/MajorClassListDto.cs
diff --git a/New_College.Api/Controllers/Front/FrontSelectionController.cs b/New_College.Api/Controllers/Front/FrontSelectionController.cs
index 198ce63..b5eebc3 100644
--- a/New_College.Api/Controllers/Front/FrontSelectionController.cs
+++ b/New_College.Api/Controllers/Front/FrontSelectionController.cs
@@ -27,13 +27,47 @@ namespace New_College.Api.Controllers.Front
public class FrontSelectionController : ControllerBase
{
private readonly ISubjectSelectionServices _selectionServices;
- public FrontSelectionController(ISubjectSelectionServices subjectSelection)
+ private readonly ID_MajorClassServices _MajorClassServices;
+ private readonly ID_MajorCategoryServices _MajorCategoryServices;
+ private readonly ID_MajorServices _MajorServices;
+ public FrontSelectionController(ISubjectSelectionServices subjectSelection, ID_MajorClassServices majorClassServices, ID_MajorCategoryServices majorCategoryServices, ID_MajorServices majorServices)
{
this._selectionServices = subjectSelection;
+ _MajorClassServices = majorClassServices;
+ _MajorCategoryServices = majorCategoryServices;
+ _MajorServices = majorServices;
}
+
+ ///
+ /// 获取专业类别
+ ///
+ ///
+ [HttpGet]
+ [Route("GetMajorClassList")]
+ public async Task>> GetMajorClassList()
+ {
+ var roottrees = new List();
+ var categoryids = (await _MajorCategoryServices.Query(c => c.Type == 1)).Select(c => c.Id);
+ var majorlist = await _MajorClassServices.Query(c => SqlFunc.ContainsArray(categoryids.ToList(), c.TradeId));
+ roottrees = majorlist.Select(c => new uniMajorInfoResult() { FirstName = c.Name, RootId = c.Id }).ToList();
+ var majoritems = await _MajorServices.Query(c => c.IsDelete == false && SqlFunc.ContainsArray(roottrees.Select(c => c.RootId).ToList(), c.CategoryClass_Id));
+ roottrees.ForEach(a =>
+ {
+ a.SecondInfo = majoritems.Where(c => c.CategoryClass_Id == a.RootId).Select(t => new uniMajorSecond() { MajorName = t.MajorName, SecondId = t.Id }).ToList();
+ });
+ return new MessageModel>()
+ {
+ response = roottrees,
+ };
+
+ }
+
+
+
+
///
/// 根据院校和专业名称查询选科组合情况
///
@@ -44,11 +78,13 @@ namespace New_College.Api.Controllers.Front
{
try
{
+ request.PageSize = 50;
+
Expression> exp = Expressionable.Create() //创建表达式
.AndIF(!string.IsNullOrEmpty(request.UniversityName), w => SqlFunc.ContainsArray(JsonConvert.DeserializeObject>(request.UniversityName), w.UniversityName))
.AndIF(!string.IsNullOrEmpty(request.MajorName), w => SqlFunc.ContainsArray(JsonConvert.DeserializeObject>(request.MajorName), w.MajorName))
- .AndIF(!string.IsNullOrWhiteSpace(request.Location), w => w.Equals(request.Location))
- .AndIF(request.Years > 0, w => w.Year == request.Years)
+ .AndIF(!string.IsNullOrWhiteSpace(request.Location), w => w.Province== request.Location)
+ .AndIF(request.Years > 0, w => w.AcademicYear == request.Years.ToString())
.ToExpression();//注意 这一句 不能少
var subjectlist = await _selectionServices.QueryPage(exp, request.PageIndex, request.PageSize);
diff --git a/New_College.Api/New_College.xml b/New_College.Api/New_College.xml
index 928417a..e26d636 100644
--- a/New_College.Api/New_College.xml
+++ b/New_College.Api/New_College.xml
@@ -238,6 +238,12 @@
新高考选科
+
+
+ 获取专业类别
+
+
+
根据院校和专业名称查询选科组合情况
diff --git a/New_College.Model/ViewModels/MajorClassListDto.cs b/New_College.Model/ViewModels/MajorClassListDto.cs
new file mode 100644
index 0000000..270b776
--- /dev/null
+++ b/New_College.Model/ViewModels/MajorClassListDto.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace New_College.Model.ViewModels
+{
+ public class MajorClassListDto
+ {
+ public int Id { get; set; }
+
+ public string Name { get; set; }
+
+
+ }
+}