From abcdad03b08b80d2f74b765fb09631d6bd003fcc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=B0=8F=E8=82=A5=E7=BE=8A?= <1048382248@qq.com>
Date: Fri, 12 Sep 2025 18:33:51 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E6=9F=A5=E8=AF=A2?=
=?UTF-8?q?=E8=81=8C=E4=BD=8Did?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controllers/StudentController.cs | 44 ++++++++++++++++++-
Learn.Archives.API/appsettings.json | 2 +-
.../Learn.Archives.Core.csproj | 2 +-
.../Model/Dto/UserCenterServiceDto.cs | 32 ++++++++++++++
4 files changed, 76 insertions(+), 4 deletions(-)
diff --git a/Learn.Archives.API/Controllers/StudentController.cs b/Learn.Archives.API/Controllers/StudentController.cs
index c6a5b8c..d74102e 100644
--- a/Learn.Archives.API/Controllers/StudentController.cs
+++ b/Learn.Archives.API/Controllers/StudentController.cs
@@ -10,7 +10,9 @@ using Mapster;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using MiniExcelLibs;
+using SqlSugar;
using System.Diagnostics;
+using System.Linq.Expressions;
using System.Security.Claims;
using System.Text.RegularExpressions;
using UserCenter.Model;
@@ -20,20 +22,22 @@ using UserCenter.Model.Enum;
namespace Learn.Archives.API.Controllers
{
///
- /// 年级控制器
+ /// 学生接口
///
public class StudentController : BackController
{
private readonly IHttpContextAccessor _httpContextAccessor;
readonly Repository baseService;
+ readonly Repository positionService;
readonly UserCenterService _userCenterService;
readonly LiveUserInfo userInfo;
- public StudentController(Repository baseService, LiveUserInfo userInfo, IHttpContextAccessor httpContextAccessor, UserCenterService userCenterService) : base(baseService)
+ public StudentController(Repository baseService, LiveUserInfo userInfo, IHttpContextAccessor httpContextAccessor, UserCenterService userCenterService, Repository positionService) : base(baseService)
{
this.baseService = baseService;
this.userInfo = userInfo;
_httpContextAccessor = httpContextAccessor;
_userCenterService = userCenterService;
+ this.positionService = positionService;
}
[NonAction]
@@ -54,6 +58,42 @@ namespace Learn.Archives.API.Controllers
Oh.ModelError("无效数据");
return await baseService.AsQueryable().FirstAsync(s => s.UserCenterId == uid);
}
+ ///
+ /// 获取职位id
+ /// 调用流程 用户中心->档案系统
+ ///
+ ///
+ [HttpPost]
+ public async Task PosititonIds(PositionIdsReq[] data)
+ {
+ if (data == null || data.Count()==0)
+ Oh.ModelError("无效数据");
+ var query = new Expressionable();
+ foreach (var pos in data)
+ {
+ query = query.Or(q =>
+ q.SchoolId == pos.SchoolId &&
+ q.PositionType == pos.PositionType &&
+ q.GradeLevel == pos.GradeLevel &&
+ q.GraduationYear == pos.GraduationYear &&
+ q.PositionLevel == pos.PositionLevel
+ &&
+ (
+ // PositionLevel == 3:只匹配前三个字段
+ (pos.PositionLevel == 3) ||
+ // PositionLevel == 4:再加上 ClassId
+ (pos.PositionLevel == 4 && q.ClassId == pos.ClassId) ||
+
+ // PositionLevel == 5:再加上 ClassId + SubjectId
+ (pos.PositionLevel == 5 && q.ClassId == pos.ClassId && q.SubjectId == pos.SubjectId)
+ )
+ );
+ }
+ return await positionService.AsQueryable()
+ .Where(query.ToExpression())
+ .Select(p => p.Id).ToArrayAsync();
+ }
+
///
/// 修改用户信息
diff --git a/Learn.Archives.API/appsettings.json b/Learn.Archives.API/appsettings.json
index 76c592f..d3d0c1e 100644
--- a/Learn.Archives.API/appsettings.json
+++ b/Learn.Archives.API/appsettings.json
@@ -14,7 +14,7 @@
"DB": {
"ConnectionString": "AllowLoadLocalInfile=true;Server=58.17.132.2;User ID=marking;Password=qwe123!@#;Port=3306;Database=learn.archives;CharSet=utf8mb4;Port=43306;pooling=true;SslMode=None;",
"SqlType": "MySql",
- "UpdateTable": true
+ "UpdateTable": false
},
"AuthKey": {
"Secret": "9FAB7AC7-F1DB-4C56-B84F-044055A34AF2",
diff --git a/Learn.Archives.Core/Learn.Archives.Core.csproj b/Learn.Archives.Core/Learn.Archives.Core.csproj
index 7f3019b..d41fa79 100644
--- a/Learn.Archives.Core/Learn.Archives.Core.csproj
+++ b/Learn.Archives.Core/Learn.Archives.Core.csproj
@@ -28,6 +28,6 @@
-
+
diff --git a/Learn.Archives.Core/Model/Dto/UserCenterServiceDto.cs b/Learn.Archives.Core/Model/Dto/UserCenterServiceDto.cs
index e1f0b17..1b4b135 100644
--- a/Learn.Archives.Core/Model/Dto/UserCenterServiceDto.cs
+++ b/Learn.Archives.Core/Model/Dto/UserCenterServiceDto.cs
@@ -10,6 +10,38 @@ using UserCenter.Model;
namespace Learn.Archives.Core.Model.Dto
{
+
+
+ public class PositionIdsReq
+ {
+ ///
+ /// 学校编号
+ ///
+ public long SchoolId { get; set; }
+ ///
+ /// 年级
+ ///
+ public string GradeLevel { get; set; }
+ ///
+ /// 毕业届
+ ///
+ public int GraduationYear { get; set; }
+
+ ///
+ /// 班级编号
+ ///
+ public long? ClassId { get; set; }
+
+ ///
+ /// 职级
+ ///
+ public int PositionLevel { get; set; }
+ public int? PositionType { get; set; } = 2;
+ ///
+ /// 科目
+ ///
+ public int? SubjectId { get; set; }
+ }
public class TeacherInfoImportError : TeacherInfoImport
{
///