添加数据库常用视图
parent
8c0dbedc02
commit
7f6a01cb01
76
常用信息.md
76
常用信息.md
|
@ -120,9 +120,12 @@ mysqldump -uroot -p'passowrd' --single-transaction -R -E --databases ecology_dev
|
||||||
|
|
||||||
**mysql常用视图**
|
**mysql常用视图**
|
||||||
|
|
||||||
```mysql
|
```sql
|
||||||
# 流程类型视图,可用于数据集成或流览按钮
|
#
|
||||||
create or replace view workflow_type_info_view as
|
流程类型视图
|
||||||
|
,可用于数据集成或流览按钮
|
||||||
|
create
|
||||||
|
or replace view workflow_type_info_view as
|
||||||
select wb.id,
|
select wb.id,
|
||||||
wb.workflowname,
|
wb.workflowname,
|
||||||
wt.typename,
|
wt.typename,
|
||||||
|
@ -131,8 +134,12 @@ select wb.id,
|
||||||
from workflow_base wb
|
from workflow_base wb
|
||||||
RIGHT JOIN workflow_type wt on wb.workflowtype = wt.id;
|
RIGHT JOIN workflow_type wt on wb.workflowtype = wt.id;
|
||||||
|
|
||||||
# 流程表单视图,用于流览按钮或数据集成,配置流程类型表可以用字段联动获取流程表表名
|
#
|
||||||
create or replace view workflow_table_view as
|
流程表单视图
|
||||||
|
,用于流览按钮或数据集成
|
||||||
|
,配置流程类型表可以用字段联动获取流程表表名
|
||||||
|
create
|
||||||
|
or replace view workflow_table_view as
|
||||||
select base.id,
|
select base.id,
|
||||||
base.workflowname,
|
base.workflowname,
|
||||||
base.formid,
|
base.formid,
|
||||||
|
@ -141,8 +148,12 @@ select base.id,
|
||||||
from workflow_bill bill
|
from workflow_bill bill
|
||||||
join workflow_base base on base.formid = bill.id;
|
join workflow_base base on base.formid = bill.id;
|
||||||
|
|
||||||
# 流程明细表信息,可用流程主表查询对应的明细表信息,用于流览框
|
#
|
||||||
create or replace view workflow_detail_table_view as
|
流程明细表信息
|
||||||
|
,可用流程主表查询对应的明细表信息
|
||||||
|
,用于流览框
|
||||||
|
create
|
||||||
|
or replace view workflow_detail_table_view as
|
||||||
select CONCAT(bill.id, '-', base.id) id,
|
select CONCAT(bill.id, '-', base.id) id,
|
||||||
bill.id bill_id,
|
bill.id bill_id,
|
||||||
base.id workflow_id,
|
base.id workflow_id,
|
||||||
|
@ -152,8 +163,11 @@ select CONCAT(bill.id, '-', base.id) id,
|
||||||
from workflow_billdetailtable bill
|
from workflow_billdetailtable bill
|
||||||
join workflow_base base on base.formid = bill.billid;
|
join workflow_base base on base.formid = bill.billid;
|
||||||
|
|
||||||
# 流程和建模字段视图,更具流程和建模的billid可以查询流程和建模中的字段信息
|
#
|
||||||
create or replace view workflow_field_table_view as
|
流程和建模字段视图
|
||||||
|
,更具流程和建模的billid可以查询流程和建模中的字段信息
|
||||||
|
create
|
||||||
|
or replace view workflow_field_table_view as
|
||||||
select wb.id,
|
select wb.id,
|
||||||
wb.fieldname,
|
wb.fieldname,
|
||||||
concat(ht.indexdesc, ':', wb.fieldname) indexdesc,
|
concat(ht.indexdesc, ':', wb.fieldname) indexdesc,
|
||||||
|
@ -182,16 +196,20 @@ select wb.id,
|
||||||
from workflow_billfield wb
|
from workflow_billfield wb
|
||||||
left join htmllabelindex ht on wb.fieldlabel = ht.id;
|
left join htmllabelindex ht on wb.fieldlabel = ht.id;
|
||||||
|
|
||||||
# 建模表信息视图
|
#
|
||||||
create or replace view mode_bill_info_view as
|
建模表信息视图
|
||||||
|
create
|
||||||
|
or replace view mode_bill_info_view as
|
||||||
select bill.id, bill.tablename, hti.indexdesc
|
select bill.id, bill.tablename, hti.indexdesc
|
||||||
from workflow_bill bill
|
from workflow_bill bill
|
||||||
left join htmllabelindex hti on hti.id = bill.namelabel
|
left join htmllabelindex hti on hti.id = bill.namelabel
|
||||||
where bill.id < 0
|
where bill.id < 0
|
||||||
and bill.tablename like 'uf%';
|
and bill.tablename like 'uf%';
|
||||||
|
|
||||||
# 流程节点信息视图
|
#
|
||||||
create or replace view workflow_node_info_view as
|
流程节点信息视图
|
||||||
|
create
|
||||||
|
or replace view workflow_node_info_view as
|
||||||
select distinct nb.id,
|
select distinct nb.id,
|
||||||
nb.nodename,
|
nb.nodename,
|
||||||
(case when wb.version is null then 1 else wb.version end) version,
|
(case when wb.version is null then 1 else wb.version end) version,
|
||||||
|
@ -204,8 +222,9 @@ from workflow_nodebase nb
|
||||||
|
|
||||||
**oracle常用视图,与mysql对应**
|
**oracle常用视图,与mysql对应**
|
||||||
|
|
||||||
```oracle
|
```sql
|
||||||
create or replace view workflow_type_info_view as
|
create
|
||||||
|
or replace view workflow_type_info_view as
|
||||||
select wb.id,
|
select wb.id,
|
||||||
wb.workflowname,
|
wb.workflowname,
|
||||||
wt.typename,
|
wt.typename,
|
||||||
|
@ -213,9 +232,10 @@ select wb.id,
|
||||||
(IF(wb.version is null, 1, wb.version)) version
|
(IF(wb.version is null, 1, wb.version)) version
|
||||||
from workflow_base wb
|
from workflow_base wb
|
||||||
RIGHT JOIN workflow_type wt on wb.workflowtype = wt.id
|
RIGHT JOIN workflow_type wt on wb.workflowtype = wt.id
|
||||||
/
|
/
|
||||||
|
|
||||||
create or replace view workflow_table_view as
|
create
|
||||||
|
or replace view workflow_table_view as
|
||||||
select base.id,
|
select base.id,
|
||||||
base.workflowname,
|
base.workflowname,
|
||||||
base.formid,
|
base.formid,
|
||||||
|
@ -223,9 +243,10 @@ select base.id,
|
||||||
(IF(base.version is null, 1, base.version)) version
|
(IF(base.version is null, 1, base.version)) version
|
||||||
from workflow_bill bill
|
from workflow_bill bill
|
||||||
join workflow_base base on base.formid = bill.id
|
join workflow_base base on base.formid = bill.id
|
||||||
/
|
/
|
||||||
|
|
||||||
create or replace view workflow_detail_table_view as
|
create
|
||||||
|
or replace view workflow_detail_table_view as
|
||||||
select (bill.id || '-' || base.id) id,
|
select (bill.id || '-' || base.id) id,
|
||||||
bill.id bill_id,
|
bill.id bill_id,
|
||||||
base.id workflow_id,
|
base.id workflow_id,
|
||||||
|
@ -234,10 +255,11 @@ select (bill.id || '-' || base.id) id,
|
||||||
bill.tablename
|
bill.tablename
|
||||||
from workflow_billdetailtable bill
|
from workflow_billdetailtable bill
|
||||||
join workflow_base base on base.formid = bill.billid
|
join workflow_base base on base.formid = bill.billid
|
||||||
/
|
/
|
||||||
|
|
||||||
|
|
||||||
create or replace view workflow_field_table_view as
|
create
|
||||||
|
or replace view workflow_field_table_view as
|
||||||
select wb.id,
|
select wb.id,
|
||||||
wb.fieldname,
|
wb.fieldname,
|
||||||
(ht.indexdesc || ':' || wb.fieldname) indexdesc,
|
(ht.indexdesc || ':' || wb.fieldname) indexdesc,
|
||||||
|
@ -265,17 +287,19 @@ select wb.id,
|
||||||
else '附件上传' end) fieldhtmltype
|
else '附件上传' end) fieldhtmltype
|
||||||
from workflow_billfield wb
|
from workflow_billfield wb
|
||||||
left join htmllabelindex ht on wb.fieldlabel = ht.id
|
left join htmllabelindex ht on wb.fieldlabel = ht.id
|
||||||
/
|
/
|
||||||
|
|
||||||
create or replace view mode_bill_info_view as
|
create
|
||||||
|
or replace view mode_bill_info_view as
|
||||||
select bill.id, bill.tablename, hti.indexdesc
|
select bill.id, bill.tablename, hti.indexdesc
|
||||||
from workflow_bill bill
|
from workflow_bill bill
|
||||||
left join htmllabelindex hti on hti.id = bill.namelabel
|
left join htmllabelindex hti on hti.id = bill.namelabel
|
||||||
where bill.id < 0
|
where bill.id < 0
|
||||||
and bill.tablename like 'uf%'
|
and bill.tablename like 'uf%'
|
||||||
/
|
/
|
||||||
|
|
||||||
create or replace view workflow_node_info_view as
|
create
|
||||||
|
or replace view workflow_node_info_view as
|
||||||
select distinct nb.id,
|
select distinct nb.id,
|
||||||
nb.nodename,
|
nb.nodename,
|
||||||
(case when wb.version is null then 1 else wb.version end) version,
|
(case when wb.version is null then 1 else wb.version end) version,
|
||||||
|
@ -283,7 +307,7 @@ select distinct nb.id,
|
||||||
from workflow_nodebase nb
|
from workflow_nodebase nb
|
||||||
left join workflow_flownode fn on nb.id = fn.nodeid
|
left join workflow_flownode fn on nb.id = fn.nodeid
|
||||||
left join workflow_base wb on wb.id = fn.workflowid
|
left join workflow_base wb on wb.id = fn.workflowid
|
||||||
/
|
/
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue