From 2e6c30e305777d662ccbe8fa00f20715f2992db3 Mon Sep 17 00:00:00 2001 From: cheche <717840555@qq.com> Date: Tue, 9 Jan 2024 11:25:05 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E6=A1=A3=E6=A1=88=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= 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 ---------- .../EnumSetting/EnumsController.cs | 35 ++++++++++++++ .../Response/GainfoTypeResponse.cs | 42 ++++++++++++++++ .../Basic/Entity/GainfoTypeEntity.cs | 48 +++++++++++++++++++ .../Basic/Entity/GainfofieldsEntity.cs | 34 ------------- 7 files changed, 125 insertions(+), 84 deletions(-) create mode 100644 Src/Dlhis.Common/Response/GainfoTypeResponse.cs create mode 100644 Src/Dlhis.Entity/Basic/Entity/GainfoTypeEntity.cs delete 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 00e20db7..93590dd6 100644 --- a/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs +++ b/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs @@ -78,26 +78,5 @@ 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 fed6c692..43fbd0f8 100644 --- a/Src/Dlhis.Basic/Organization/Services/IGainfoService.cs +++ b/Src/Dlhis.Basic/Organization/Services/IGainfoService.cs @@ -16,9 +16,4 @@ 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 582f40ce..97404be6 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs @@ -22,30 +22,6 @@ 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.Common/EnumSetting/EnumsController.cs b/Src/Dlhis.Common/EnumSetting/EnumsController.cs index bd342d06..fde75e29 100644 --- a/Src/Dlhis.Common/EnumSetting/EnumsController.cs +++ b/Src/Dlhis.Common/EnumSetting/EnumsController.cs @@ -1,5 +1,8 @@ using System.Reflection; +using Dlhis.Common.Response; +using Dlhis.Entity.Basic.Entity; using Kurisu.AspNetCore.Utils.Extensions; +using Kurisu.SqlSugar.Services; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -13,6 +16,14 @@ namespace Dlhis.Common.EnumSetting; [ApiController] public class EnumsController : ControllerBase { + + private readonly IDbContext _dbContext; + + public EnumsController(IDbContext dbContext) + { + _dbContext = dbContext; + } + /// /// 获取所有枚举 /// @@ -46,4 +57,28 @@ public class EnumsController : ControllerBase }; }); } + /// + /// 获取所有类型 + /// + /// + /// + public object GetTypes(string code) + { + var types = _dbContext.Queryable().Where(x => x.Code == code).ToList(); + + return new + { + Code = code, + Data = types.Select(x => new GainfoTypeResponse + { + Id = x.Id, + Type = x.Type, + Code = x.Code, + Descript = x.Descript, + DescriptEn = x.DescriptEn, + Remark = x.Remark, + Sort = x.Sort, + }).ToList() + }; + } } diff --git a/Src/Dlhis.Common/Response/GainfoTypeResponse.cs b/Src/Dlhis.Common/Response/GainfoTypeResponse.cs new file mode 100644 index 00000000..f5056e9b --- /dev/null +++ b/Src/Dlhis.Common/Response/GainfoTypeResponse.cs @@ -0,0 +1,42 @@ +using SqlSugar; + +namespace Dlhis.Common.Response +{ + public class GainfoTypeResponse + { + /// + /// id + /// + public long Id { get; set; } + + /// + /// 类型 + /// + public string Type { get; set; } + + /// + /// 档案号 + /// + public string Code { get; set; } + + /// + /// 中文描述 + /// + public string Descript { get; set; } + + /// + /// 英文描述 + /// + public string DescriptEn { get; set; } + + /// + /// 备注 + /// + public string Remark { get; set; } + + /// + /// 排序 + /// + public string Sort { get; set; } + } +} diff --git a/Src/Dlhis.Entity/Basic/Entity/GainfoTypeEntity.cs b/Src/Dlhis.Entity/Basic/Entity/GainfoTypeEntity.cs new file mode 100644 index 00000000..f8d96789 --- /dev/null +++ b/Src/Dlhis.Entity/Basic/Entity/GainfoTypeEntity.cs @@ -0,0 +1,48 @@ +using SqlSugar; + +namespace Dlhis.Entity.Basic.Entity +{ + /// + /// 用户档案类型表 + /// + [SugarTable(TableName = "GainfoType", TableDescription = "用户档案类型表")] + public class GainfoTypeEntity : SugarBaseEntity + { + /// + /// 类型 + /// + [SugarColumn(ColumnDescription = "类型")] + public string Type { get; set; } + + /// + /// 档案号 + /// + [SugarColumn(ColumnDescription = "档案号")] + public string Code { get; set; } + + /// + /// 中文描述 + /// + [SugarColumn(ColumnDescription = "中文描述")] + public string Descript { get; set; } + + /// + /// 英文描述 + /// + [SugarColumn(ColumnDescription = "英文描述")] + public string DescriptEn { get; set; } + + /// + /// 备注 + /// + [SugarColumn(ColumnDescription = "备注")] + public string Remark { get; set; } + + /// + /// 排序 + /// + [SugarColumn(ColumnDescription = "排序")] + public string Sort { get; set; } + + } +} diff --git a/Src/Dlhis.Entity/Basic/Entity/GainfofieldsEntity.cs b/Src/Dlhis.Entity/Basic/Entity/GainfofieldsEntity.cs deleted file mode 100644 index 50bd103d..00000000 --- a/Src/Dlhis.Entity/Basic/Entity/GainfofieldsEntity.cs +++ /dev/null @@ -1,34 +0,0 @@ -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; } - } -}