NCCloud系列(一)数据字典

首先作为一个开发者来说。用友的文档真的💩一样差。烂烂烂。差差差。为此个人整理出来一些经验分享给大家。

首先提供一下官方的数据字典:

https://community.yonyou.com/index

登录开发者社区,点击菜单进入数据字典

NCCloudNCCloud系列(一)数据字典插图

https://community.yonyou.com/datadict/datadict-2111jianzhu/index.html

不过这个官方的字典呢,有些字段没有;模版设置后,又不会更新。不过也能起到一个查询参考的作用。为此我提供NCC2111动态查看模版对应的表、字段的SQL

1.1 创建视图


create VIew V_NCC_DatabaseFiledDetail as
SELECT
	defaulttablename+'_'+f.code+'_'+mc.name id,
	mc.name ClassName,
	mc.displayName,
	mc.defaulttablename TableName,
	f.code,
	 STUFF((
        SELECT ',' + ISNULL(f2.label, '') 
        FROM pub_form_property f2
				left join pub_area a2 on f2.areaid=a2.pk_area
				left join md_class mc2 on mc2.id=f2.classID
        WHERE a2.areatype=2
          AND mc2.defaulttablename is not null
          AND f2.metapath IS NOT NULL
					and mc.name=mc2.name
					and mc.defaulttablename=mc2.defaulttablename
					and f.code=f2.code
				group by f2.label
        FOR XML PATH('')), 1, 1, '') AS labels,-- 拼接的label
	 STUFF((
        SELECT ',' + ISNULL(f2.refname, '') 
        FROM pub_form_property f2
				left join pub_area a2 on f2.areaid=a2.pk_area
				left join md_class mc2 on mc2.id=f2.classID
        WHERE a2.areatype=2
          AND mc2.defaulttablename is not null
          AND f2.metapath IS NOT NULL
					and mc.name=mc2.name
					and mc.defaulttablename=mc2.defaulttablename
					and f.code=f2.code
				group by f2.refname
        FOR XML PATH('')), 1, 1, '') AS refnames
FROM
	pub_form_property f 
	left join pub_area a on f.areaid=a.pk_area
	left join pub_page_templet t on a.templetid=pk_page_templet
	left join sm_appregister app on app.code=t.appcode and a.dr=0
	left join md_class mc on mc.id=f.classID
WHERE
	1 = 1 
	and a.areatype=2
	and mc.defaulttablename is not null
	and f.metapath is not null
	--and mc.defaulttablename='ic_saleout_b'
	group by mc.name,mc.displayName,mc.defaulttablename,f.code
	
SELECT
	className,--实体类
	displayname,---实体类名称
	TableName,--物理表名
	code,---字段名
	labels, ---字段描述
	refnames --参照
FROM
	V_NCC_DatabaseFiledDetail 
WHERE
	1 = 1 
	AND TableName='ic_saleout_b' ---表名

实时获取,清晰明了

NCCloudNCCloud系列(一)数据字典插图1

大功告成!