Merge pull request '删除重复的枚举扩展 添加Theme到字典数据库' (#66) from orzsoft_admin/Admin.NET.Pro:template into main
Reviewed-on: http://101.43.53.74:3000/Admin.NET/Admin.NET.Pro/pulls/66
This commit is contained in:
commit
a47ded2605
@ -20,26 +20,3 @@ public class ThemeAttribute : Attribute
|
||||
this.Theme = theme;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ThemeExtend
|
||||
{
|
||||
/// <summary>
|
||||
/// 扩展方法
|
||||
/// </summary>
|
||||
/// <param name="enumValue"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetTheme(this Enum enumValue)
|
||||
{
|
||||
Type type = enumValue.GetType();
|
||||
FieldInfo field = type.GetField(enumValue.ToString());
|
||||
if (field.IsDefined(typeof(ThemeAttribute), true))
|
||||
{
|
||||
var themeAttribute = (ThemeAttribute)field.GetCustomAttribute(typeof(ThemeAttribute));
|
||||
return themeAttribute.Theme;
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -60,6 +60,7 @@ public class EnumToDictJob : IJob
|
||||
dictData.Code = enumData.Name;
|
||||
dictData.OrderNo = enumData.Value + 10;
|
||||
dictData.Name = enumData.Describe;
|
||||
dictData.TagType = enumData.Theme;
|
||||
uSysDictData.Add(dictData);
|
||||
}
|
||||
});
|
||||
@ -113,7 +114,7 @@ public class EnumToDictJob : IJob
|
||||
Code = u.Name,
|
||||
Remark = t2.Remark,
|
||||
OrderNo = u.Value + 10,
|
||||
TagType = "info"
|
||||
TagType = u.Theme ?? "info"
|
||||
}).ToList()
|
||||
}).ToList();
|
||||
var iDictData = new List<SysDictData>();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user