82 lines
2.6 KiB
C#
82 lines
2.6 KiB
C#
using New_College.IServices;
|
|
using New_College.Model;
|
|
using New_College.Model.Models;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System;
|
|
using System.Linq.Expressions;
|
|
using System.Threading.Tasks;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using SqlSugar;
|
|
|
|
namespace New_College.Api.Controllers
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
/// 院校投档线
|
|
/// </summary>
|
|
[Route("api/[controller]/[action]")]
|
|
[ApiController]
|
|
[Authorize]
|
|
public class QualificationLineController : ControllerBase
|
|
{
|
|
/// <summary>
|
|
/// 服务器接口,因为是模板生成,所以首字母是大写的,自己可以重构下
|
|
/// </summary>
|
|
private readonly ID_QualificationLineServices _d_QualificationLineServices;
|
|
|
|
public QualificationLineController(ID_QualificationLineServices D_QualificationLineServices)
|
|
{
|
|
_d_QualificationLineServices = D_QualificationLineServices;
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 获取院校各年份省控线
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public async Task<MessageModel<List<QualificationLineResponse>>> Get([FromQuery] QualificationLineRequest request)
|
|
{
|
|
if (request.Uid <= 0)
|
|
{
|
|
return new MessageModel<List<QualificationLineResponse>>()
|
|
{
|
|
success = false,
|
|
msg = "uid必传"
|
|
|
|
};
|
|
}
|
|
|
|
Expression<Func<D_QualificationLine, bool>> expression = Expressionable.Create<D_QualificationLine>()
|
|
.And(c => c.UId == request.Uid)
|
|
.AndIF(!string.IsNullOrWhiteSpace(request.BatchName), c => c.BatchName == request.BatchName)
|
|
.AndIF(request.Year.HasValue && request.Year > 0, c => c.Years == request.Year)
|
|
.ToExpression();
|
|
var response = (await _d_QualificationLineServices.Query(expression))
|
|
.Select(c => new QualificationLineResponse()
|
|
{
|
|
BatchName = c.BatchName,
|
|
UId = request.Uid,
|
|
LowScore = c.LowScore,
|
|
LowScoreRank = c.LowScoreRank,
|
|
ProvinceScore = c.ProvinceScore,
|
|
RecruitType = c.RecruitType,
|
|
Years = c.Years,
|
|
}).ToList();
|
|
return new MessageModel<List<QualificationLineResponse>>()
|
|
{
|
|
msg = "获取成功",
|
|
success = true,
|
|
response = response
|
|
};
|
|
}
|
|
|
|
|
|
|
|
}
|
|
} |