增加查询数据
parent
a4710466e5
commit
8da2c4bc7a
|
|
@ -646,5 +646,6 @@ namespace New_College.Api.Controllers.Front
|
|||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ using System.Collections.Generic;
|
|||
using Microsoft.Graph;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using SqlSugar;
|
||||
using New_College.Common.Helper;
|
||||
using NPOI.OpenXmlFormats.Spreadsheet;
|
||||
|
||||
namespace New_College.Api.Controllers
|
||||
{
|
||||
|
|
@ -22,10 +25,11 @@ namespace New_College.Api.Controllers
|
|||
public class UniversityRankController : ControllerBase
|
||||
{
|
||||
private readonly ID_UniversityRankRepository _UniversityRankRepository;
|
||||
public UniversityRankController(ID_UniversityRankRepository d_UniversityRankRepository)
|
||||
private readonly ID_UniversityServices _UniversityServices;
|
||||
public UniversityRankController(ID_UniversityRankRepository d_UniversityRankRepository, ID_UniversityServices universityServices)
|
||||
{
|
||||
_UniversityRankRepository = d_UniversityRankRepository;
|
||||
|
||||
_UniversityServices = universityServices;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -63,5 +67,35 @@ namespace New_College.Api.Controllers
|
|||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取院校下拉接口
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<MessageModel<dynamic>> GetUniversitySelect()
|
||||
{
|
||||
|
||||
var query = (await _UniversityServices.Query(e => e.IsDelete == false)).Select(c => new UniversityTreeDto { id = c.Id, name = c.Name.Trim(), url = c.Logo, checkd = false, FirstWord = GetFirstLetterHelper.GetFirstLetterOfChinese(c.Name) }).ToList();
|
||||
var str = "ABCDEFGHJKLMNOPQRSTWXYZ";
|
||||
var list = new List<dynamic>();
|
||||
|
||||
for (int i = 0; i < str.Length; i++)
|
||||
{
|
||||
if (query.Any(e => e.FirstWord == str[i].ToString()))
|
||||
{
|
||||
list.Add(query.Where(e => e.FirstWord == str[i].ToString()).ToList());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return new MessageModel<dynamic>()
|
||||
{
|
||||
response = list,
|
||||
success = true,
|
||||
msg = "ok"
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1106,6 +1106,12 @@
|
|||
<param name="single"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:New_College.Api.Controllers.UniversityRankController.GetUniversitySelect">
|
||||
<summary>
|
||||
获取院校下拉接口
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:New_College.Api.Controllers.XETongController">
|
||||
<summary>
|
||||
小鹅通
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
using hyjiacan.py4n;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace New_College.Common.Helper
|
||||
{
|
||||
public static class GetFirstLetterHelper
|
||||
{
|
||||
|
||||
|
||||
public static string GetFirstLetterOfChinese(string chinese)
|
||||
{ // 设置拼音输出格式
|
||||
PinyinFormat format = PinyinFormat.WITHOUT_TONE | PinyinFormat.LOWERCASE | PinyinFormat.WITH_U_UNICODE;
|
||||
if (string.IsNullOrWhiteSpace(chinese))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
char china = chinese.Trim()[0];
|
||||
// 取指定汉字的唯一或者第一个拼音
|
||||
var pinyin =Pinyin4Net.GetFirstPinyin(china, format);
|
||||
if (pinyin != null && pinyin.Length > 0)
|
||||
{
|
||||
return pinyin[0].ToString().ToUpper(); // 取首字母并转为大写
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -13,6 +13,7 @@
|
|||
<PackageReference Include="Aliyun.OSS.SDK.NetCore" Version="2.10.0" />
|
||||
<PackageReference Include="DingtalkChatbotSdk" Version="1.0.1" />
|
||||
<PackageReference Include="DinkToPdf.Standard" Version="1.1.0" />
|
||||
<PackageReference Include="hyjiacan.pinyin4net" Version="4.1.1" />
|
||||
<PackageReference Include="log4net" Version="2.0.15" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ namespace New_College.Model.ViewModels
|
|||
|
||||
public class uniMajorSelect
|
||||
{
|
||||
public int pid { get; set; }
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Code { get; set; }
|
||||
|
|
@ -42,6 +43,7 @@ namespace New_College.Model.ViewModels
|
|||
public string MajorName { get; set; }
|
||||
public int MajorNum { get; set; }
|
||||
|
||||
public List<uniMajorSelect> majorSelects { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,4 +28,16 @@ namespace New_College.Model
|
|||
}
|
||||
|
||||
|
||||
public class UniversityTreeDto
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string url { get; set; }
|
||||
public bool checkd { get; set; }
|
||||
|
||||
|
||||
public string FirstWord { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ namespace New_College.Services
|
|||
.ToExpression();
|
||||
var majorcategories = (await d_MajorCategoryRepository.Query(x => x.Type == query.SchoolLevel && x.IsDelete == false)).Select(x => new uniMajorSelect() { Id = x.Id, Name = x.Name }); ;
|
||||
var majorclasses = (await d_MajorClassRepository.Query(x => x.IsDelete == false)).Select(x => new uniMajorClassSelect() { Id = x.Id, Name = x.Name, TradeId = x.TradeId });
|
||||
var majorinfo = (await d_MajorRepository.Query(expression)).Select(s => new uniMajorSelect() { Id = s.CategoryClass_Id, Name = s.Name }).ToList();
|
||||
var majorinfo = (await d_MajorRepository.Query(expression)).Select(s => new uniMajorSelect() { pid = s.CategoryClass_Id, Id = s.Id, Name = s.Name }).ToList();
|
||||
List<uniMajorInfoResult> list = new List<uniMajorInfoResult>() { };
|
||||
foreach (var item in majorcategories)
|
||||
{
|
||||
|
|
@ -216,7 +216,9 @@ namespace New_College.Services
|
|||
{
|
||||
MajorName = s.Name,
|
||||
SecondId = s.Id,
|
||||
MajorNum = majorinfo.Count(x => x.Name != s.Name && x.Id == s.Id),
|
||||
MajorNum = majorinfo.Count(x => x.Name != s.Name && x.pid == s.Id),
|
||||
majorSelects = majorinfo.Where(x => x.Name != s.Name && x.pid == s.Id).ToList()
|
||||
|
||||
}).ToList();
|
||||
|
||||
if (scond.Count() > 0)
|
||||
|
|
|
|||
Loading…
Reference in New Issue