feat 档案表下拉列表

This commit is contained in:
cheche
2024-01-08 11:39:14 +08:00
parent 18eda12a29
commit 8028376195
5 changed files with 127 additions and 1 deletions

View File

@@ -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;
}
/// <summary>
@@ -119,6 +122,31 @@ public class GainfoService : IGainfoService
await _gainfoStore.InsertAsync(GainfoStatusEnumType.Working, gainfos);
}
/// <summary>
/// 获取所有字段
/// </summary>
/// <returns></returns>
public List<string> GetAllFields()
{
var entityType = typeof(Gainfofields);
var propertyNames = entityType.GetProperties().Select(p => p.Name).ToList();
return propertyNames;
}
/// <summary>
/// 获取固定字段数据
/// </summary>
/// <param name="fieldName"></param>
/// <returns></returns>
public List<string> GetAllFieldData(string fieldName)
{
var columnData = _dbContext.Queryable<Gainfofields>().Select<string>(fieldName).ToList();
return columnData;
}
//-------------------------------------------help methods ------------------------------------------------