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; } + /// /// 开展座谈