删除重复的枚举扩展

添加Theme到字典数据库
更新字典数据库
This commit is contained in:
Master 2024-07-19 09:32:25 +08:00
parent c556ed05a3
commit 139f000b39
3 changed files with 411 additions and 433 deletions

View File

@ -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;
}
}
}

View File

@ -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>();