using New_College.IServices; using New_College.Model.Models; using New_College.Services.BASE; using New_College.IRepository.Base; using System.Threading.Tasks; using System.Collections.Generic; using New_College.Model.ViewModels; using OSS.Common.Resp; using System.Text; using System.Data.Entity.SqlServer; using System.Security.Claims; using Microsoft.Extensions.Primitives; namespace New_College.Services { public class T_TbSNeedDataInfoPevServices : BaseServices, IT_TbSNeedDataInfoPevServices { private readonly IBaseRepository _dal; public T_TbSNeedDataInfoPevServices(IBaseRepository dal) { this._dal = dal; base.BaseDal = dal; } /// /// 查询条件 /// /// /// public async Task> GetAIPerview(OneSubmitGoRequest request) { //.And(c => c.Location == request.Location) // .And(c => c.SubjectType == subjecttype) // .AndIF(!string.IsNullOrWhiteSpace(request.Major), c => SqlFunc.Contains(c.MajorName, request.Major)) // .AndIF(!string.IsNullOrWhiteSpace(request.SubjectClaim), c => SqlFunc.Contains(c._23subject, claim[0]) || SqlFunc.Contains(c._23subject, claim[1]) || SqlFunc.Contains(c._23subject, claim[2]) || c._23subject == "不限") // .AndIF(!string.IsNullOrWhiteSpace(request.Province), c => SqlFunc.Contains(request.Province, c.Province)) // .AndIF(request.Syl.HasValue && request.Syl == 1, c => SqlFunc.Contains(c.LnstitutionalLevel, "双一流")) // .AndIF(request._211.HasValue && request._211 == 1, c => SqlFunc.Contains(c.LnstitutionalLevel, "211")) // .AndIF(request._985.HasValue && request._985 == 1, c => SqlFunc.Contains(c.LnstitutionalLevel, "985")) // .AndIF(!string.IsNullOrWhiteSpace(request.Ownership), c => c.Ownership == request.Ownership) // .AndIF(!string.IsNullOrWhiteSpace(request.Nature), c => SqlFunc.ContainsArray(natureNames, c.Nature)) // .AndIF(request.EndScore > request.StartScore, c => SqlFunc.Between(c._23Score, startscore, endscore)) var claim01 = ""; var claim02 = ""; var claim03 = ""; if (!string.IsNullOrWhiteSpace(request.SubjectClaim)) { var claim = request.SubjectClaim.Split(","); claim01 = claim[0]; claim02 = claim[1]; claim03 = claim[2]; } StringBuilder sbsql = new StringBuilder(); sbsql.AppendFormat("SELECT LnstitutionalLevel,UniversityName,Nature,_23SchoolScore from T_TbSNeedDataInfo where Location='{0}' ", request.Location); sbsql.AppendFormat(" and SubjectType='{0}'",request.subjecttype); if (!string.IsNullOrWhiteSpace(request.Major)) { sbsql.AppendFormat(" and MajorName like'%{0}%'", request.Major); } if (!string.IsNullOrWhiteSpace(request.SubjectClaim)) { sbsql.AppendFormat(" and (_23subject like'%{0}%' or _23subject like'%{1}%' or _23subject like'%{2}%' )", claim01, claim02, claim03); } if (!string.IsNullOrWhiteSpace(request.Province)) { sbsql.AppendFormat(" and Province ='{0}'", request.Province); } if (request.Syl.HasValue && request.Syl == 1) { sbsql.Append(" and LnstitutionalLevel like'%双一流%'"); } if (request._211.HasValue && request._211 == 1) { sbsql.Append(" and LnstitutionalLevel like'%211%'"); } if (request._985.HasValue && request._985 == 1) { sbsql.Append(" and LnstitutionalLevel like'%985%'"); } if (!string.IsNullOrWhiteSpace(request.Ownership)) { sbsql.AppendFormat(" and Ownership ='{0}'", request.Ownership); } if (!string.IsNullOrWhiteSpace(request.Nature)) { sbsql.AppendFormat(" and '{0}' like '%Nature%'", request.Nature); } if (request.EndScore > request.StartScore) { int start = request.Score - 60; if (request.BatchName == "普通类二段" || request.BatchName.Contains("专科")) { start = request.Score - 100; } sbsql.AppendFormat(" and (_23Score BETWEEN {0} and {1})", start, request.Score + 15); } if (request.BatchName == "普通类二段" || request.BatchName.Contains("专科")) { sbsql.AppendLine(" or _23Score <=0 and EducationCategory='专科'"); } var list = await _dal.QuerySql(sbsql.ToString()); return list; } } }