diff --git a/New_College.Api/Controllers/Front/LibraryController.cs b/New_College.Api/Controllers/Front/LibraryController.cs
index 9567167..4ffbaf8 100644
--- a/New_College.Api/Controllers/Front/LibraryController.cs
+++ b/New_College.Api/Controllers/Front/LibraryController.cs
@@ -111,7 +111,7 @@ namespace New_College.Api.Controllers.Front
///
///
///
- [HttpGet]
+ [HttpPost]
public async Task>> GetUniversitys([FromQuery] UniversityQuery query)
{
var result = await iD_LongIdMapServices.GetUniversitys(query);
diff --git a/New_College.Model/ViewModels/Query/UniversityQuery.cs b/New_College.Model/ViewModels/Query/UniversityQuery.cs
index 038e771..33244b5 100644
--- a/New_College.Model/ViewModels/Query/UniversityQuery.cs
+++ b/New_College.Model/ViewModels/Query/UniversityQuery.cs
@@ -16,11 +16,11 @@ namespace New_College.Model.ViewModels
///
/// 省市区名称
///
- public string AreaName { get; set; }
+ public List? AreaName { get; set; }
///
/// 办学性质
///
- public int Nature { get; set; }
+ public List? Nature { get; set; }
///
/// 用户id
///
@@ -29,7 +29,7 @@ namespace New_College.Model.ViewModels
///
/// 学校类型
///
- public int Type { get; set; } = -1;
+ public List? Type { get; set; }
///
/// 是否985 0、否,1、是
diff --git a/New_College.Services/D_LongIdMapServices.cs b/New_College.Services/D_LongIdMapServices.cs
index c2a47e2..8c25e9b 100644
--- a/New_College.Services/D_LongIdMapServices.cs
+++ b/New_College.Services/D_LongIdMapServices.cs
@@ -111,29 +111,27 @@ namespace New_College.Services
///
public async Task> GetUniversitys(UniversityQuery query)
{
- var wheres = PredicateBuilder.New();
- wheres = wheres.And(x => x.IsDelete == false);
- if (!string.IsNullOrEmpty(query.AreaName) && query.AreaName != "全国")
- wheres = wheres.And(x => x.Area_Name.Contains(query.AreaName));
- if (query.SubjectLevel > 0)
- wheres = wheres.And(x => x.Subject_Level == query.SubjectLevel);
- if (query.Type >= 0)
- wheres = wheres.And(x => x.Type == query.Type);
- if (query.Nhef >= 0)
- wheres = wheres.And(x => x.Nhef == query.Nhef);
- if (query.Sff >= 0)
- wheres = wheres.And(x => x.Sff == query.Sff);
- if (query.Syl >= 0)
- wheres = wheres.And(x => x.Syl == query.Syl);
- if (!string.IsNullOrWhiteSpace(query.Name))
- wheres = wheres.And(u => u.Name.Contains(query.Name));
- if (query.Nature > 0)
- wheres = wheres.And(x => x.Nature == query.Nature);
- var info = await d_UniversityRepository.QueryPage(wheres, query.PageIndex, query.PageSize, "Rank Asc");
+ Expression> expression = Expressionable.Create()
+ .And(x => x.IsDelete == false)
+ .AndIF(query.AreaName.Any() && !query.AreaName.Contains("全国"), x => SqlFunc.ContainsArray(query.AreaName, x.Area_Name))
+ .AndIF(query.Nature.Any(), x => SqlFunc.ContainsArray(query.Nature, x.Nature))
+ .AndIF(query.Type.Any(), x => SqlFunc.ContainsArray(query.Type, x.Type))
+ .AndIF(query.SubjectLevel > 0, x => x.Subject_Level == query.SubjectLevel)
+ .AndIF(query.Nhef > 0, x => x.Nhef == query.Nhef)
+ .AndIF(query.Sff > 0, x => x.Sff == query.Sff)
+ .AndIF(query.Syl > 0, x => x.Syl == query.Syl)
+ .AndIF(!string.IsNullOrWhiteSpace(query.Name), u => SqlFunc.Contains(query.Name, u.Name))
+ .ToExpression();
+
+ var info = await d_UniversityRepository.QueryPage(expression, query.PageIndex, query.PageSize, "Rank Asc");
if (info.data.Count <= 0)
return new PageModel() { };
- var collectionuniversity = await d_UniversityCollectionRepository.Query(x => x.CustomerId == query.CustomerId && x.IsDelete == false);
+ var collectionuniversity = new List();
+ if (query.CustomerId > 0)
+ {
+ collectionuniversity = await d_UniversityCollectionRepository.Query(x => x.CustomerId == query.CustomerId && x.IsDelete == false);
+ }
List list = new List() { };
info.data = info.data.OrderBy(s => s.Rank).ToList();
foreach (var c in info.data)