星空|SQL|元数据|业务对象查询相关SQL
查询某业务对象的子孙对象
-- 向下递归查询业务对象
WITH CTE_OBJECT_DOWN
AS
(
SELECT 1 AS LEV,OL.FNAME,OE.FSUPPLIERNAME 开发商标识,OE.* FROM T_META_OBJECTTYPE OE
LEFT JOIN T_META_OBJECTTYPE_L OL ON OE.FID = OL.FID AND OL.FLOCALEID = 2052
WHERE OE.FID = 'PUR_MRB'
UNION ALL
SELECT CT.LEV + 1 AS LEV,OL.FNAME,OE.FSUPPLIERNAME 开发商标识,OE.* FROM T_META_OBJECTTYPE OE
JOIN T_META_OBJECTTYPE_L OL ON OE.FID = OL.FID AND OL.FLOCALEID = 2052
JOIN CTE_OBJECT_DOWN CT ON CT.FID = OE.FBASEOBJECTID
)
SELECT * FROM CTE_OBJECT_DOWN
;
应用场景
看到某标准单据下面没扩展,想要增加一个二开扩展,这时需要先用FORMID查一下子孙对象,确认下是不是真的不存在扩展,否则可能会造成同级扩展。
如果SQL查到有扩展,但是协同看不到,需要协同引入一下。
如果SQL查到有扩展,但是协同看不到,需要协同引入一下。
查询某业务对象的父级对象
-- 向上递归查询业务对象
WITH CTE_OBJECT_UP
AS
(
SELECT 0 AS LEV,OL.FNAME,OE.FSUPPLIERNAME 开发商标识,OE.* FROM T_META_OBJECTTYPE OE
LEFT JOIN T_META_OBJECTTYPE_L OL ON OE.FID = OL.FID AND OL.FLOCALEID = 2052
WHERE OE.FID = 'RHTW_PLM_WF_BOMBill'
UNION ALL
SELECT CT.LEV - 1 AS LEV,OL.FNAME,OE.FSUPPLIERNAME 开发商标识,OE.* FROM T_META_OBJECTTYPE OE
JOIN T_META_OBJECTTYPE_L OL ON OE.FID = OL.FID AND OL.FLOCALEID = 2052
JOIN CTE_OBJECT_UP CT ON CT.FBASEOBJECTID = OE.FID
)
SELECT * FROM CTE_OBJECT_UP;
-- 根据名称查询业务对象
SELECT OL.FNAME, OT.*
FROM T_META_OBJECTTYPE OT
LEFT JOIN T_META_OBJECTTYPE_L OL ON OT.FID = OL.FID AND OL.FLOCALEID = 2052
--WHERE OL.FNAME LIKE '%采购订单%'
WHERE OT.FID = 'QDPM_HTXX'
星空|SQL|元数据|业务对象查询相关SQL
查询某业务对象的子孙对象 -- 向下递归查询业务对象WITH CTE_OBJECT_DOWN AS ( SELECT 1 AS LEV,OL.FNAME,OE.FSUPPLIERNAME 开发商...
点击下载文档
本文2024-09-16 18:26:50发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-22198.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章