From 802837619599e69e7b6c6a43c34321249630534c Mon Sep 17 00:00:00 2001 From: cheche <717840555@qq.com> Date: Mon, 8 Jan 2024 11:39:14 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E6=A1=A3=E6=A1=88=E8=A1=A8=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/GainfosController.cs | 22 ++++++++ .../Organization/Request/GainfoSaveRequest.cs | 19 +++++++ .../Organization/Services/IGainfoService.cs | 4 ++ .../Services/Implements/GainfoService.cs | 30 ++++++++++- Src/Dlhis.Entity/Basic/Entity/Gainfofields.cs | 53 +++++++++++++++++++ 5 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 Src/Dlhis.Entity/Basic/Entity/Gainfofields.cs diff --git a/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs b/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs index 11832763..868b8d77 100644 --- a/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs +++ b/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs @@ -1,6 +1,7 @@ using Dlhis.Basic.Organization.Request; using Dlhis.Basic.Organization.Response; using Dlhis.Basic.Organization.Services; +using Dlhis.Entity.Basic.Entity; using Kurisu.AspNetCore.MVC; using Kurisu.Core.DataAccess.Dto; using Microsoft.AspNetCore.Authorization; @@ -78,5 +79,26 @@ public class GainfosController : ControllerBase { await _gainfoService.OnboardingAsync(request); } + + /// + /// 获取所有字段 + /// + /// + [HttpGet("GetAllFields")] + public List GetAllFields() + { + return _gainfoService.GetAllFields(); + } + + + /// + /// 获取固定字段信息字段 + /// + /// + [HttpGet("GetAllFieldData")] + public List GetAllFieldData(string fieldName) + { + return _gainfoService.GetAllFieldData(fieldName); + } } diff --git a/Src/Dlhis.Basic/Organization/Request/GainfoSaveRequest.cs b/Src/Dlhis.Basic/Organization/Request/GainfoSaveRequest.cs index 0afe1b5d..3bea1e69 100644 --- a/Src/Dlhis.Basic/Organization/Request/GainfoSaveRequest.cs +++ b/Src/Dlhis.Basic/Organization/Request/GainfoSaveRequest.cs @@ -1,5 +1,6 @@ using System.ComponentModel.DataAnnotations; using Dlhis.Entity.Basic.Enums; +using SqlSugar; namespace Dlhis.Basic.Organization.Request; @@ -148,6 +149,24 @@ public class GainfoSaveRequest : IValidatableObject /// public string CarNo { get; set; } + /// + /// 人事范围 + /// + [SugarColumn(ColumnDescription = "人事范围")] + public string Werks { get; set; } + + /// + /// 人员号 + /// + [SugarColumn(ColumnDescription = "人员号")] + public string Pernr { get; set; } + + /// + /// 邮箱 + /// + [SugarColumn(ColumnDescription = "邮箱")] + public string Email { get; set; } + public IEnumerable Validate(ValidationContext validationContext) { if (GainfoStatus.HasValue && GainfoStatus == GainfoStatusEnumType.Leave) diff --git a/Src/Dlhis.Basic/Organization/Services/IGainfoService.cs b/Src/Dlhis.Basic/Organization/Services/IGainfoService.cs index fcbbfaa4..61e44a9d 100644 --- a/Src/Dlhis.Basic/Organization/Services/IGainfoService.cs +++ b/Src/Dlhis.Basic/Organization/Services/IGainfoService.cs @@ -15,4 +15,8 @@ public interface IGainfoService : IScopeDependency Task DimissionAsync(GainfoDImissionRequest request); Task OnboardingAsync(GainfoDImissionRequest request); + + public List GetAllFieldData(string fieldName); + + public List GetAllFields(); } diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs index 8120647e..b0d3f707 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs @@ -6,6 +6,7 @@ using Kurisu.AspNetCore.Utils.Extensions; using Kurisu.Core.DataAccess.Dto; using Kurisu.SqlSugar.Attributes; using Kurisu.SqlSugar.Extensions; +using Kurisu.SqlSugar.Services; using Mapster; namespace Dlhis.Basic.Organization.Services.Implements; @@ -14,10 +15,12 @@ public class GainfoService : IGainfoService { private readonly IGainfoStore _gainfoStore; + private readonly IDbContext _dbContext; - public GainfoService(IGainfoStore gainfoStore) + public GainfoService(IGainfoStore gainfoStore, IDbContext dbContext) { _gainfoStore = gainfoStore; + _dbContext = dbContext; } /// @@ -119,6 +122,31 @@ public class GainfoService : IGainfoService await _gainfoStore.InsertAsync(GainfoStatusEnumType.Working, gainfos); } + /// + /// 获取所有字段 + /// + /// + public List GetAllFields() + { + var entityType = typeof(Gainfofields); + var propertyNames = entityType.GetProperties().Select(p => p.Name).ToList(); + + return propertyNames; + + } + + /// + /// 获取固定字段数据 + /// + /// + /// + public List GetAllFieldData(string fieldName) + { + var columnData = _dbContext.Queryable().Select(fieldName).ToList(); + + return columnData; + } + //-------------------------------------------help methods ------------------------------------------------ diff --git a/Src/Dlhis.Entity/Basic/Entity/Gainfofields.cs b/Src/Dlhis.Entity/Basic/Entity/Gainfofields.cs new file mode 100644 index 00000000..ea202035 --- /dev/null +++ b/Src/Dlhis.Entity/Basic/Entity/Gainfofields.cs @@ -0,0 +1,53 @@ +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 Gainfofields : 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; } + } +}