当前位置: 代码迷 >> 综合 >> 元数据关联的表
  详细解决方案

元数据关联的表

热度:61   发布时间:2023-10-23 06:12:50.0

--元数据所做的工作
发布元数据会导致以下表中产生数据
执行脚本即执行建表语句
下面只介绍发布元数据所产生的数据
--先根据表名查出发布的元数据的组件id ,之后的查询都是通过compentid来查询数据
新开发的模块
还要导出 md_module表数据

假设表名是pt_app_account
select componentid from md_class where defaulttablename='pt_app_account';
 --f1d9ad1e-70ff-428e-a58b-67a0fb8bdbdf
---md_table
 select * from  md_table where id in 
 (select defaulttablename from md_class where id in 
 (select id from md_class where componentid='f1d9ad1e-70ff-428e-a58b-67a0fb8bdbdf'));
---枚举
 select * from  MD_ENUMVALUE where id in 
 (select id from md_class where componentid='f1d9ad1e-70ff-428e-a58b-67a0fb8bdbdf');
----列数据
 select * from  md_column where tableid in 
 (select defaulttablename from md_class where id in 
 (select id from md_class where componentid='f1d9ad1e-70ff-428e-a58b-67a0fb8bdbdf'));
 --主子表关联关系表
 select * from md_db_relation where startattrid in 
 (select id from  md_property where classid in 
 (select id from md_class where componentid='f1d9ad1e-70ff-428e-a58b-67a0fb8bdbdf'));
 --属性表
 select * from  md_property where classid in 
 (select id from md_class where componentid='f1d9ad1e-70ff-428e-a58b-67a0fb8bdbdf'); 
 select * from  md_association where componentid='f1d9ad1e-70ff-428e-a58b-67a0fb8bdbdf';
--
 select * from  MD_ACCESSORPARA where id in 
  (select id from md_class where componentid='f1d9ad1e-70ff-428e-a58b-67a0fb8bdbdf');
---class表
 select * from  md_bizitfmap where classid in 
  (select id from md_class where componentid='f1d9ad1e-70ff-428e-a58b-67a0fb8bdbdf');
 --
select * from  md_ormap where classid in 
 (select id from md_class where componentid='f1d9ad1e-70ff-428e-a58b-67a0fb8bdbdf');
---class表
 select * from  md_class where componentid='f1d9ad1e-70ff-428e-a58b-67a0fb8bdbdf';
---组件
 select * from  md_component where id='f1d9ad1e-70ff-428e-a58b-67a0fb8bdbdf';

---------------------------------
--删除语句
DELETE  from md_class where defaulttablename='so_testprice';
DELETE from  md_table where id in 
 (select defaulttablename from md_class where id in 
 (select id from md_class where componentid='fec27012-126e-4617-b34b-aa69ed3edb58'));

 DELETE from  md_column where tableid in 
 (select defaulttablename from md_class where id in 
 (select id from md_class where componentid='fec27012-126e-4617-b34b-aa69ed3edb58'));
 
  --主子表关联关系表
DELETE from md_db_relation where startattrid in 
 (select id from  md_property where classid in 
 (select id from md_class where componentid='fec27012-126e-4617-b34b-aa69ed3edb58'));
 --属性表
 DELETE from  md_property where classid in 
 (select id from md_class where componentid='fec27012-126e-4617-b34b-aa69ed3edb58'); 
 select * from  md_association where componentid='fec27012-126e-4617-b34b-aa69ed3edb58';
--
DELETE from  MD_ACCESSORPARA where id in 
  (select id from md_class where componentid='fec27012-126e-4617-b34b-aa69ed3edb58');
---class表
 DELETE from  md_bizitfmap where classid in 
  (select id from md_class where componentid='fec27012-126e-4617-b34b-aa69ed3edb58');
 --
DELETE from  md_ormap where classid in 
 (select id from md_class where componentid='fec27012-126e-4617-b34b-aa69ed3edb58');
---class表
 DELETE from  md_class where componentid='fec27012-126e-4617-b34b-aa69ed3edb58';
---组件
DELETE from  md_component where id='fec27012-126e-4617-b34b-aa69ed3edb58';

--------------其他一些关联表
md_accessorpara
MD_PROPERTY
md_bizitfmap
md_association
md_ormap
 

  相关解决方案