From 43af37af88bc2cd29ac63389ea00be95718fe828 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, 15 Aug 2025 19:48:04 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E9=83=A8=E5=88=86?=
=?UTF-8?q?=E8=B4=A6=E5=8F=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controllers/SchoolBusinessController.cs | 60 +++++++++++++++++++
Learn.Archives.Core/Model/SchoolBusiness.cs | 14 +++--
2 files changed, 70 insertions(+), 4 deletions(-)
diff --git a/Learn.Archives.API/Controllers/SchoolBusinessController.cs b/Learn.Archives.API/Controllers/SchoolBusinessController.cs
index e91dee9..fc7fc4f 100644
--- a/Learn.Archives.API/Controllers/SchoolBusinessController.cs
+++ b/Learn.Archives.API/Controllers/SchoolBusinessController.cs
@@ -2,8 +2,10 @@
using Learn.Archives.API.Expand;
using Learn.Archives.Core.Common;
using Learn.Archives.Core.Model;
+using Learn.Archives.Core.Model.Dto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
+using SqlSugar;
using System.Diagnostics;
using System.Security.Claims;
using UserCenter.Model;
@@ -18,5 +20,63 @@ namespace Learn.Archives.API.Controllers
this.baseService = baseService;
}
+ public class QueryPageDto
+ {
+ ///
+ /// 学校id
+ ///
+ public long SchoolId { get; set; }
+ ///
+ /// 年级
+ ///
+ public string? Grade { get; set; }
+ ///
+ /// 赴校人员名称
+ ///
+ public string? UserName { get; set; }
+ ///
+ /// 是否查询完结
+ ///
+ public bool SolutionEnd { get; set; }
+ public DateTime? StartTime { get; set; }
+ public DateTime? EndTime { get; set; }
+
+ ///
+ /// 页面索引
+ ///
+ public int PageIndex { get; set; } = 0;
+ ///
+ /// 页面数量
+ ///
+ public int PageSize { get; set; } = 20;
+
+ }
+
+ public override Task Edit([FromBody] SchoolBusiness model)
+ {
+ if (model.SolutionRecord != null && model.SolutionRecord.SolutionEnd == true)
+ model.SolutionEnd = true;
+ return base.Edit(model);
+ }
+
+ ///
+ /// 查询 赴校列表
+ ///
+ ///
+ [HttpPost]
+ public async Task> QueryPageList(QueryPageDto dto)
+ {
+ RefAsync total = 0;
+ var resData = await baseService.AsQueryable()
+ .WhereIF(dto.SchoolId != 0, s => s.SchoolId == dto.SchoolId)
+ .WhereIF(!string.IsNullOrEmpty(dto.Grade), s => s.Grade == dto.Grade)
+ .WhereIF(dto.SolutionEnd, s => s.SolutionEnd == dto.SolutionEnd)
+ .WhereIF(dto.StartTime != null, s => s.StartTime >= dto.StartTime)
+ .WhereIF(dto.EndTime != null, s => s.StartTime <= dto.EndTime)
+ .WhereIF(!string.IsNullOrEmpty(dto.UserName), s => s.SchoolBusinessUser != null && SqlFunc.JsonLike(s.SchoolBusinessUser, dto.Grade))
+ .OrderByDescending(s=>s.Id)
+ .ToPageListAsync(dto.PageIndex, dto.PageSize, total);
+ return new PageResult() { Data = resData, Total = total };
+ }
}
}
diff --git a/Learn.Archives.Core/Model/SchoolBusiness.cs b/Learn.Archives.Core/Model/SchoolBusiness.cs
index 98f73c6..a851428 100644
--- a/Learn.Archives.Core/Model/SchoolBusiness.cs
+++ b/Learn.Archives.Core/Model/SchoolBusiness.cs
@@ -28,6 +28,11 @@ namespace Learn.Archives.Core.Model
///
public string Grade { get; set; }
///
+ /// 赴校人员 逗号分隔
+ ///
+ [SugarColumn(IsNullable = true, IsJson = true)]
+ public string[]? SchoolBusinessUser { get; set; }
+ ///
/// 赴校时间
///
public DateTime StartTime { get; set; } = DateTime.Now;
@@ -36,10 +41,6 @@ namespace Learn.Archives.Core.Model
///
[SugarColumn(IsNullable = true)]
public string? Remark { get; set; }
- ///
- /// 赴校问题已解决
- ///
- public long SolutionEnd { get; set; }
///
/// 反馈问题
@@ -54,6 +55,11 @@ namespace Learn.Archives.Core.Model
[SugarColumn(IsNullable = true, IsJson = true, ColumnDataType = "text")]
public SolutionRecordDto? SolutionRecord { get; set; }
+ ///
+ /// 赴校问题已解决
+ ///
+ public bool SolutionEnd { get; set; }
+
///
/// 开展座谈