木哥代码。查找枚举中文名称,ID等。只需要改动枚举的名称:'UFIDA.U9.MO.BL.hduzh.BLPackageListBE.PLSourceTypeEnum'
select A.[ID] as [ID], A1.[Code] as [EnumTypeCode], A2.[Name] as [EnumTypeName], A3.[Name] as [Name], A.[Code] as [Code], A.[EValue] as [EValue]
from UBF_Sys_ExtEnumValue as A
left join [UBF_Sys_ExtEnumType] as A1 on (A.[ExtEnumType] = A1.[ID])
left join [UBF_Sys_ExtEnumType_Trl] as A2 on (A2.SysMlFlag = 'zh-CN') and (A1.[ID] = A2.[ID])
left join [UBF_Sys_ExtEnumValue_Trl] as A3 on (A3.SysMlFlag = 'zh-CN') and (A.[ID] = A3.[ID])
where (A1.[Code] = 'UFIDA.U9.MO.BL.hduzh.BLPackageListBE.PLSourceTypeEnum') order by A.[EValue] asc
使用函数改
select dbo.F_GetEnumName('UFIDA.U9.MO.BL.hduzh.BLPackageListBE.PLSourceTypeEnum',1,'zh-CN')
as 来源类别
函数第一个参数为枚举类型,一般可以在classview里查找得到,第二个参数为枚举值,第三个参数为中文。
select dbo.F_GetEnumName('UFIDA.U9.MO.BL.hduzh.BLPackageListBE.PLSourceTypeEnum',PLSrcType, 'zh-CN')
as 来源类别 from MO_BLPackageListHead
在这里PLSrcType是表MO_BLPackageListHead里的一个枚举字段,因为通过同一张表里查询,所以中间参数只需要是表里的一个字段,而不需要嵌套查询,查询结果是查出表里的所有枚举中文名。