You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

33 lines
907 B

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Wood.Entity;
using Wood.Service.BaseService;
using Wood.Util;
namespace Wood.Service.SystemManage
{
/// <summary>
/// 系统其他接口
/// </summary>
public partial class SystemService : ApiService
{
/// <summary>
/// 获取指定枚举的 key ,value 列表
/// 需要在 Wood.Entity 中定义枚举
/// </summary>
/// <param name="name">枚举名称</param>
/// <returns></returns>
public dynamic GetEnumOptions(string name)
{
var type= Assembly.Load("Wood.Entity").GetTypes()
.Where(it => it.IsEnum && string.Equals(it.Name, name, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault();
if (type != null)
return type.EnumToDictionary().Select(it => new { it.Key,it.Value}).ToList();
return "[]";
}
}
}