From c2d306899260b289dadc93494cd66640dceb3b98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?old=E6=98=93?= <156663459@qq.com> Date: Wed, 6 Dec 2023 17:06:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=A2=9E=E5=8A=A0=E6=8E=92=E5=90=8D?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Front/UniversityRankController.cs | 67 +++++++++++++++++++ New_College.Api/New_College.Model.xml | 5 ++ New_College.Api/New_College.xml | 12 ++++ .../ViewModels/SingleUniversityView.cs | 31 +++++++++ .../D_PlanMajorDescServices.cs | 2 +- 5 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 New_College.Api/Controllers/Front/UniversityRankController.cs create mode 100644 New_College.Model/ViewModels/SingleUniversityView.cs diff --git a/New_College.Api/Controllers/Front/UniversityRankController.cs b/New_College.Api/Controllers/Front/UniversityRankController.cs new file mode 100644 index 0000000..4285c1b --- /dev/null +++ b/New_College.Api/Controllers/Front/UniversityRankController.cs @@ -0,0 +1,67 @@ +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using New_College.IRepository; +using New_College.IServices; +using New_College.Model.ViewModels; +using New_College.Model; +using System.Threading.Tasks; +using AutoMapper.Configuration.Conventions; +using System.Collections.Generic; +using Microsoft.Graph; +using System; +using System.Linq; + +namespace New_College.Api.Controllers +{ + + /// + /// 学校排名 + /// + [Route("api/front/[controller]/[action]")] + [ApiController] + public class UniversityRankController : ControllerBase + { + private readonly ID_UniversityRankRepository _UniversityRankRepository; + public UniversityRankController(ID_UniversityRankRepository d_UniversityRankRepository) + { + _UniversityRankRepository = d_UniversityRankRepository; + + } + + + /// + /// 获取学校各类型排名情况 + /// + /// + /// + [HttpGet] + public async Task>> Single([FromQuery] SingleUniversityRequestView single) + { + if (string.IsNullOrWhiteSpace(single.UniversityName)) + { + return new MessageModel> () + { + msg = "fail", + success = false, + status = 200 + }; + } + string years = DateTime.Now.Year.ToString(); + var query = await _UniversityRankRepository.Query(c => c.Year == years && c.UniversityName == single.UniversityName); + return new MessageModel> () + { + response = query.Select(c => new SingleUniversityResponseView() + { + Rank = c.Rank.ToString(), + Type = c.UniversityType + }).ToList(), + status = 200, + success = true, + msg = "ok" + }; + // return await iD_LongIdMapServices.GetRequestEnrollmentinproductionDetailResult(query); + } + + + } +} diff --git a/New_College.Api/New_College.Model.xml b/New_College.Api/New_College.Model.xml index 2aa7458..aa51698 100644 --- a/New_College.Api/New_College.Model.xml +++ b/New_College.Api/New_College.Model.xml @@ -7135,5 +7135,10 @@ 0文理分科 1 3+3 2 3+1+3 + + + + + diff --git a/New_College.Api/New_College.xml b/New_College.Api/New_College.xml index 859d863..cb81286 100644 --- a/New_College.Api/New_College.xml +++ b/New_College.Api/New_College.xml @@ -990,6 +990,18 @@ + + + 学校排名 + + + + + 获取学校各类型排名情况 + + + + 省市区操作类 diff --git a/New_College.Model/ViewModels/SingleUniversityView.cs b/New_College.Model/ViewModels/SingleUniversityView.cs new file mode 100644 index 0000000..1d9135b --- /dev/null +++ b/New_College.Model/ViewModels/SingleUniversityView.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace New_College.Model +{ + public class SingleUniversityRequestView + { + public string UniversityName { get; set; } + + } + + + + + /// + /// + /// + public class SingleUniversityResponseView + { + + public int Type { get; set; } + + public string Rank { get; set; } + + } + + +} diff --git a/New_College.Services/D_PlanMajorDescServices.cs b/New_College.Services/D_PlanMajorDescServices.cs index b8067f3..3684e92 100644 --- a/New_College.Services/D_PlanMajorDescServices.cs +++ b/New_College.Services/D_PlanMajorDescServices.cs @@ -194,7 +194,7 @@ namespace New_College.Services .AndIF(!string.IsNullOrWhiteSpace(request.SubjectClaim), c => SqlFunc.Contains(c.SelectSubject, claim[0]) || SqlFunc.Contains(c.SelectSubject, claim[1]) || SqlFunc.Contains(c.SelectSubject, claim[2])) .AndIF(!string.IsNullOrWhiteSpace(request.Major), c => SqlFunc.Contains(c.Major, request.Major)) .AndIF(!string.IsNullOrWhiteSpace(request.BatchName), c => c.BatchName.Equals(request.BatchName)) - .AndIF(!string.IsNullOrWhiteSpace(request.Province), c => SqlFunc.Contains(c.AreaName, request.Province)) + .AndIF(!string.IsNullOrWhiteSpace(request.Province), c => SqlFunc.Contains(request.Province,c.AreaName)) .And(c => c.Years == request.Year) .AndIF(!string.IsNullOrWhiteSpace(request.SchoolType), c => c.SchoolType == request.SchoolType) .AndIF(request.Score > 0, c => SqlFunc.Between(c.LowScore, request.Score - 15, request.Score + 15))