From 25bdd1edf8019b9324cb12ddd218908fcc0b30a1 Mon Sep 17 00:00:00 2001 From: cheche <717840555@qq.com> Date: Tue, 9 Jan 2024 09:47:55 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E6=A1=A3=E6=A1=88=E8=A1=A8=E5=9B=BA?= =?UTF-8?q?=E5=AE=9A=E5=AD=97=E6=AE=B5=E4=B8=8B=E6=8B=89=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=8F=8A=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/GainfosController.cs | 21 ++++++++++++ .../Organization/Services/IGainfoService.cs | 5 +++ .../Services/Implements/GainfoService.cs | 24 +++++++++++++ .../Basic/Entity/GainfofieldsEntity.cs | 34 +++++++++++++++++++ Src/Dlhis.ScheduledTask/Job/SyncOrgInfoJob.cs | 3 +- 5 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 Src/Dlhis.Entity/Basic/Entity/GainfofieldsEntity.cs diff --git a/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs b/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs index 93590dd6..00e20db7 100644 --- a/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs +++ b/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs @@ -78,5 +78,26 @@ public class GainfosController : ControllerBase { await _gainfoService.OnboardingAsync(request); } + + /// + /// 获取档案下拉表的所有字段 + /// + /// + [HttpGet("GetAllFields")] + public List GetAllFields() + { + return _gainfoService.GetAllFields(); + } + + /// + /// 获取档案下拉表的固定字段的数据 + /// + /// + /// + [HttpGet("GetAllFieldData")] + public List GetColumnData(string fieldName) + { + return _gainfoService.GetColumnData(fieldName); + } } diff --git a/Src/Dlhis.Basic/Organization/Services/IGainfoService.cs b/Src/Dlhis.Basic/Organization/Services/IGainfoService.cs index 43fbd0f8..fed6c692 100644 --- a/Src/Dlhis.Basic/Organization/Services/IGainfoService.cs +++ b/Src/Dlhis.Basic/Organization/Services/IGainfoService.cs @@ -16,4 +16,9 @@ public interface IGainfoService : IScopeDependency Task DimissionAsync(GainfoDImissionRequest request); Task OnboardingAsync(GainfoDImissionRequest request); + + public List GetAllFields(); + + public List GetColumnData(string columnName); + } diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs index 97404be6..582f40ce 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs @@ -22,6 +22,30 @@ public class GainfoService : IGainfoService _dbContext = dbContext; } + /// + /// 获取档案下拉表的所有字段 + /// + /// + public List GetAllFields() + { + var entityType = typeof(GainfofieldsEntity); + var propertyNames = entityType.GetProperties().Select(p => p.Name).ToList(); + + return propertyNames; + } + /// + /// 获取档案下拉表的固定字段的数据 + /// + /// + /// + public List GetColumnData(string columnName) + { + // 动态获取表的某一列数据 + var columnData = _dbContext.Queryable().Select(columnName).ToList(); + + return columnData; + } + /// /// 档案分页 /// diff --git a/Src/Dlhis.Entity/Basic/Entity/GainfofieldsEntity.cs b/Src/Dlhis.Entity/Basic/Entity/GainfofieldsEntity.cs new file mode 100644 index 00000000..50bd103d --- /dev/null +++ b/Src/Dlhis.Entity/Basic/Entity/GainfofieldsEntity.cs @@ -0,0 +1,34 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Dlhis.Entity.Basic.Entity +{ + /// + /// 档案下拉字段表 + /// + [SugarTable(TableName = "Gainfofields", TableDescription = "档案下拉字段表")] + public class GainfofieldsEntity : SugarBaseEntity + { + [SugarColumn(ColumnDescription = "人员类型")] + public string Class { get; set; } + + [SugarColumn(ColumnDescription = "国家代码")] + public string Country { get; set; } + + [SugarColumn(ColumnDescription = "证件类型")] + public string Idcls { get; set; } + + [SugarColumn(ColumnDescription = "身份证籍贯区")] + public string Native { get; set; } + + [SugarColumn(ColumnDescription = "部门编码")] + public string Appellation { get; set; } + + [SugarColumn(ColumnDescription = "民族代码")] + public string Nation { get; set; } + } +} diff --git a/Src/Dlhis.ScheduledTask/Job/SyncOrgInfoJob.cs b/Src/Dlhis.ScheduledTask/Job/SyncOrgInfoJob.cs index 49b6c85b..3eeb7635 100644 --- a/Src/Dlhis.ScheduledTask/Job/SyncOrgInfoJob.cs +++ b/Src/Dlhis.ScheduledTask/Job/SyncOrgInfoJob.cs @@ -1,5 +1,4 @@ -using Dlhis.Entity.Basic.Entity; -using Dlhis.ScheduledTask.Comparers; +using Dlhis.ScheduledTask.Comparers; using Dlhis.ScheduledTask.Entities; using Kurisu.SqlSugar.Services; using Mapster;