ebu_ecology_dev1/sql/youhong.ai/common_view_sql/oracle.sql

80 lines
2.7 KiB
MySQL
Raw Permalink Normal View History

2022-11-23 19:20:03 +08:00
create or replace view workflow_type_info_view as
select wb.id,
wb.workflowname,
wt.typename,
wb.workflowdesc,
(IF(wb.version is null, 1, wb.version)) version
from workflow_base wb
RIGHT JOIN workflow_type wt on wb.workflowtype = wt.id
/
create or replace view workflow_table_view as
select base.id,
base.workflowname,
base.formid,
bill.tablename,
(IF(base.version is null, 1, base.version)) version
from workflow_bill bill
join workflow_base base on base.formid = bill.id
/
create or replace view workflow_detail_table_view as
select (bill.id || '-' || base.id) id,
bill.id bill_id,
base.id workflow_id,
base.workflowname,
base.formid main_formid,
bill.tablename
from workflow_billdetailtable bill
join workflow_base base on base.formid = bill.billid
/
create or replace view workflow_field_table_view as
select wb.id,
wb.fieldname,
(ht.indexdesc || '' || wb.fieldname) indexdesc,
(
case
when wb.detailtable is null then (select distinct tablename from workflow_bill where id = wb.billid)
when wb.detailtable = ''
then (select distinct tablename from workflow_bill where id = wb.billid)
else wb.detailtable
end
) tablename,
billid,
(
case
when wb.detailtable = '' then 'main table'
when wb.detailtable is null then 'main table'
else wb.detailtable end
) showtablename,
(case
when wb.fieldhtmltype = '1' then '单行文本框'
when wb.FIELDHTMLTYPE = '2' then '多行文本框'
when wb.FIELDHTMLTYPE = '3' then '流览框'
when wb.FIELDHTMLTYPE = '4' then 'check框'
when wb.FIELDHTMLTYPE = '5' then '选择框'
else '附件上传' end) fieldhtmltype
from workflow_billfield wb
left join htmllabelindex ht on wb.fieldlabel = ht.id
/
create or replace view mode_bill_info_view as
select bill.id, bill.tablename, hti.indexdesc
from workflow_bill bill
left join htmllabelindex hti on hti.id = bill.namelabel
where bill.id < 0
and bill.tablename like 'uf%'
/
create or replace view workflow_node_info_view as
select distinct nb.id,
nb.nodename,
(case when wb.version is null then 1 else wb.version end) version,
fn.workflowid
from workflow_nodebase nb
left join workflow_flownode fn on nb.id = fn.nodeid
left join workflow_base wb on wb.id = fn.workflowid
/