fix 档案类型修正

This commit is contained in:
cheche
2024-01-09 11:25:05 +08:00
parent 25bdd1edf8
commit 2e6c30e305
7 changed files with 125 additions and 84 deletions

View File

@@ -78,26 +78,5 @@ public class GainfosController : ControllerBase
{
await _gainfoService.OnboardingAsync(request);
}
/// <summary>
/// 获取档案下拉表的所有字段
/// </summary>
/// <returns></returns>
[HttpGet("GetAllFields")]
public List<string> GetAllFields()
{
return _gainfoService.GetAllFields();
}
/// <summary>
/// 获取档案下拉表的固定字段的数据
/// </summary>
/// <param name="fieldName"></param>
/// <returns></returns>
[HttpGet("GetAllFieldData")]
public List<string> GetColumnData(string fieldName)
{
return _gainfoService.GetColumnData(fieldName);
}
}

View File

@@ -16,9 +16,4 @@ public interface IGainfoService : IScopeDependency
Task DimissionAsync(GainfoDImissionRequest request);
Task OnboardingAsync(GainfoDImissionRequest request);
public List<string> GetAllFields();
public List<string> GetColumnData(string columnName);
}

View File

@@ -22,30 +22,6 @@ public class GainfoService : IGainfoService
_dbContext = dbContext;
}
/// <summary>
/// 获取档案下拉表的所有字段
/// </summary>
/// <returns></returns>
public List<string> GetAllFields()
{
var entityType = typeof(GainfofieldsEntity);
var propertyNames = entityType.GetProperties().Select(p => p.Name).ToList();
return propertyNames;
}
/// <summary>
/// 获取档案下拉表的固定字段的数据
/// </summary>
/// <param name="columnName"></param>
/// <returns></returns>
public List<string> GetColumnData(string columnName)
{
// 动态获取表的某一列数据
var columnData = _dbContext.Queryable<GainfofieldsEntity>().Select<string>(columnName).ToList();
return columnData;
}
/// <summary>
/// 档案分页
/// </summary>

View File

@@ -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;
}
/// <summary>
/// 获取所有枚举
/// </summary>
@@ -46,4 +57,28 @@ public class EnumsController : ControllerBase
};
});
}
/// <summary>
/// 获取所有类型
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
public object GetTypes(string code)
{
var types = _dbContext.Queryable<GainfoTypeEntity>().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()
};
}
}

View File

@@ -0,0 +1,42 @@
using SqlSugar;
namespace Dlhis.Common.Response
{
public class GainfoTypeResponse
{
/// <summary>
/// id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 类型
/// </summary>
public string Type { get; set; }
/// <summary>
/// 档案号
/// </summary>
public string Code { get; set; }
/// <summary>
/// 中文描述
/// </summary>
public string Descript { get; set; }
/// <summary>
/// 英文描述
/// </summary>
public string DescriptEn { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 排序
/// </summary>
public string Sort { get; set; }
}
}

View File

@@ -0,0 +1,48 @@
using SqlSugar;
namespace Dlhis.Entity.Basic.Entity
{
/// <summary>
/// 用户档案类型表
/// </summary>
[SugarTable(TableName = "GainfoType", TableDescription = "用户档案类型表")]
public class GainfoTypeEntity : SugarBaseEntity
{
/// <summary>
/// 类型
/// </summary>
[SugarColumn(ColumnDescription = "类型")]
public string Type { get; set; }
/// <summary>
/// 档案号
/// </summary>
[SugarColumn(ColumnDescription = "档案号")]
public string Code { get; set; }
/// <summary>
/// 中文描述
/// </summary>
[SugarColumn(ColumnDescription = "中文描述")]
public string Descript { get; set; }
/// <summary>
/// 英文描述
/// </summary>
[SugarColumn(ColumnDescription = "英文描述")]
public string DescriptEn { get; set; }
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnDescription = "备注")]
public string Remark { get; set; }
/// <summary>
/// 排序
/// </summary>
[SugarColumn(ColumnDescription = "排序")]
public string Sort { get; set; }
}
}

View File

@@ -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
{
/// <summary>
/// 档案下拉字段表
/// </summary>
[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; }
}
}