From 403ae1921b5e821ea427020d4906d5e2cb493f8c Mon Sep 17 00:00:00 2001 From: fei550 <1420031550@qq.com> Date: Wed, 28 Jan 2026 15:18:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E5=91=98=E6=9F=A5=E8=AF=A2=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=94=B9=E7=94=A8=E9=A1=B9=E7=9B=AE=E4=BB=A3=E5=8F=B7?= =?UTF-8?q?=E4=BD=9C=E4=B8=BA=E5=BF=85=E5=A1=AB=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 ProjectPersonInput/Output 和 PersonInOutRecordInput 模型中添加 ProjectCode 属性 - GetProjectPerson 和 GetPersonInOutRecord 接口必填参数改为 ProjectCode - APIPersonService 添加项目代号过滤逻辑和查询结果输出 --- SGGL/BLL/API/APIPersonService.cs | 16 +++++++++++++--- SGGL/FineUIPro.Web/FineUIPro.Web.csproj | 2 +- SGGL/Model/HSSE/PersonInOutRecordInput.cs | 4 ++++ SGGL/Model/HSSE/ProjectPersonInput.cs | 4 ++++ SGGL/Model/HSSE/ProjectPersonOutput.cs | 4 ++++ SGGL/WebAPI/Controllers/PersonController.cs | 12 ++++++------ 6 files changed, 32 insertions(+), 10 deletions(-) diff --git a/SGGL/BLL/API/APIPersonService.cs b/SGGL/BLL/API/APIPersonService.cs index 51e9c7c8..85751fe7 100644 --- a/SGGL/BLL/API/APIPersonService.cs +++ b/SGGL/BLL/API/APIPersonService.cs @@ -320,7 +320,11 @@ namespace BLL { query = query.Where(x => x.ProjectName.Contains(filter.ProjectName)); } - + // 项目代号过滤(模糊查询) + if (!string.IsNullOrEmpty(filter.ProjectCode)) + { + query = query.Where(x => x.ProjectCode.Contains(filter.ProjectCode)); + } // 人员ID过滤 if (!string.IsNullOrEmpty(filter.PersonId)) { @@ -384,6 +388,7 @@ namespace BLL IdentityCard = x.IdentityCard, ProjectId = x.ProjectId, ProjectName = x.ProjectName, + ProjectCode= x.ProjectCode, UnitId = x.UnitId, UnitName = x.UnitName, TeamGroupName = x.TeamGroupName, @@ -1112,7 +1117,7 @@ namespace BLL var query = from x in db.SitePerson_PersonInOut join y in db.SitePerson_Person on x.PersonId equals y.PersonId join z in db.Base_Project on x.ProjectId equals z.ProjectId - where x.ChangeTime >= filter.StartTime && x.ChangeTime <= filter.EndTime && z.ProjectName.Contains(filter.ProjectName) + where x.ChangeTime >= filter.StartTime && x.ChangeTime <= filter.EndTime && z.ProjectCode.Contains(filter.ProjectCode) select new Model.PersonInOutItem { PersonId = x.PersonId, @@ -1130,7 +1135,12 @@ namespace BLL // 添加过滤条件 if (filter != null) - { + { + // 项目名称过滤(模糊查询) + if (!string.IsNullOrEmpty(filter.ProjectName)) + { + query = query.Where(x => x.ProjectName.Contains(filter.ProjectName)); + } // 单位名称过滤(模糊查询) if (!string.IsNullOrEmpty(filter.UnitName)) { diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index 939f1c0c..3933756b 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -16910,7 +16910,7 @@ - + diff --git a/SGGL/Model/HSSE/PersonInOutRecordInput.cs b/SGGL/Model/HSSE/PersonInOutRecordInput.cs index 12287848..ebd12ce5 100644 --- a/SGGL/Model/HSSE/PersonInOutRecordInput.cs +++ b/SGGL/Model/HSSE/PersonInOutRecordInput.cs @@ -16,6 +16,10 @@ namespace Model /// public string ProjectName { get; set; } /// + /// 项目代号 + /// + public string ProjectCode { get; set; } + /// /// 单位名称 /// public string UnitName { get; set; } diff --git a/SGGL/Model/HSSE/ProjectPersonInput.cs b/SGGL/Model/HSSE/ProjectPersonInput.cs index e594b832..3b9bae68 100644 --- a/SGGL/Model/HSSE/ProjectPersonInput.cs +++ b/SGGL/Model/HSSE/ProjectPersonInput.cs @@ -40,6 +40,10 @@ namespace Model /// public string ProjectName { get; set; } /// + /// 项目代号 + /// + public string ProjectCode { get; set; } + /// /// 单位名称 /// public string UnitName { get; set; } diff --git a/SGGL/Model/HSSE/ProjectPersonOutput.cs b/SGGL/Model/HSSE/ProjectPersonOutput.cs index b0fb4ebd..91142e9a 100644 --- a/SGGL/Model/HSSE/ProjectPersonOutput.cs +++ b/SGGL/Model/HSSE/ProjectPersonOutput.cs @@ -42,6 +42,10 @@ namespace Model /// public string ProjectName { get; set; } /// + /// 项目代号 + /// + public string ProjectCode { get; set; } + /// /// 单位ID /// public string UnitId { get; set; } diff --git a/SGGL/WebAPI/Controllers/PersonController.cs b/SGGL/WebAPI/Controllers/PersonController.cs index c534b96a..a1a049cc 100644 --- a/SGGL/WebAPI/Controllers/PersonController.cs +++ b/SGGL/WebAPI/Controllers/PersonController.cs @@ -102,7 +102,7 @@ namespace WebAPI.Controllers /// /// 根据条件获取项目人员信息(支持分页和过滤) /// - /// 查询过滤条件(ProjectName为必填参数) + /// 查询过滤条件(ProjectCode为必填参数) /// 每页条数 /// 页码(从1开始) /// 是否返回全部数据 @@ -112,11 +112,11 @@ namespace WebAPI.Controllers var responeData = new Model.ResponeData(); try { - // 验证必填参数 ProjectName - if (filter == null || string.IsNullOrEmpty(filter.ProjectName)) + // 验证必填参数 ProjectCode + if (filter == null || string.IsNullOrEmpty(filter.ProjectCode)) { responeData.code = 0; - responeData.message = "ProjectName为必填参数!"; + responeData.message = "ProjectCode为必填参数!"; return responeData; } @@ -1072,10 +1072,10 @@ namespace WebAPI.Controllers responeData.message = "StartTime不能大于EndTime!"; return responeData; } - if (filter == null || string.IsNullOrEmpty(filter.ProjectName)) + if (filter == null || string.IsNullOrEmpty(filter.ProjectCode)) { responeData.code = 0; - responeData.message = "ProjectName为必填参数!"; + responeData.message = "ProjectCode为必填参数!"; return responeData; }