create view vi_flow_monitoring as SELECT O.OBJECTNO                                                                                                   AS OBJECTNO,
       FB.FLOW_KEY                                                                                                  AS FLOW_KEY,
       (CASE WHEN (FB.FLOW_NAME = '网银收款') THEN concat(FB.PROJ_NAME, '-', LET.CLIENT_ACCOUNT) ELSE FB.PROJ_NAME END) AS PROJ_NAME,
       FB.FLOW_NAME                                                                                                 AS FLOW_NAME,
       O.PHASENAME                                                                                                  AS PHASENAME,
       FT.USERNAME                                                                                                  AS USERNAME,
       FT.BEGINTIME                                                                                                 AS BEGINTIME,
       FT.ENDTIME                                                                                                   AS ENDTIME,
       O.OBJECTTYPE                                                                                                 AS OBJECTTYPE,
       O.PHASETYPE                                                                                                  AS PHASETYPE,
       O.APPLYTYPE                                                                                                  AS APPLYTYPE,
       O.FLOWNO                                                                                                     AS FLOWNO,
       O.FLOWNAME                                                                                                   AS FLOWNAME,
       O.PHASENO                                                                                                    AS PHASENO,
       FB.FLOW_UNID                                                                                                 AS FLOW_UNID,
       FB.PROJ_ID                                                                                                   AS PROJ_ID,
       FB.CONTRACT_ID                                                                                               AS CONTRACT_ID,
       FT.SERIALNO                                                                                                  AS SERIALNO,
       FT.RELATIVESERIALNO                                                                                          AS RELATIVESERIALNO,
       FT.USERID                                                                                                    AS USERID
FROM (((APZL.FLOW_OBJECT O LEFT JOIN APZL.FLOW_BUSSINESS_OBJECT FB ON ((O.OBJECTNO = FB.FLOW_UNID))) LEFT JOIN APZL.FLOW_TASK FT ON (((FT.OBJECTNO = O.OBJECTNO) AND (FT.PHASENO = O.PHASENO))))
LEFT JOIN (
    SELECT max(APZL.LC_EBANK_TEMP.CLIENT_ACCOUNT) AS CLIENT_ACCOUNT, APZL.LC_EBANK_TEMP.FLOWUNID AS FLOWUNID
    FROM APZL.LC_EBANK_TEMP
    GROUP BY APZL.LC_EBANK_TEMP.FLOWUNID
) LET ON ((LET.FLOWUNID = O.OBJECTNO)))
WHERE (isnull(FT.ENDTIME) OR (FT.PHASENO = '1000') OR (FT.PHASENO = '8000'));

-- comment on column vi_flow_monitoring.OBJECTNO not supported: 对象编号

-- comment on column vi_flow_monitoring.FLOW_KEY not supported: 项目/合同号

-- comment on column vi_flow_monitoring.FLOW_NAME not supported: 流程名称

-- comment on column vi_flow_monitoring.PHASENAME not supported: 当前阶段名称

-- comment on column vi_flow_monitoring.USERNAME not supported: 承办人姓名

-- comment on column vi_flow_monitoring.BEGINTIME not supported: 开始执行时间

-- comment on column vi_flow_monitoring.ENDTIME not supported: 完成执行时间

-- comment on column vi_flow_monitoring.OBJECTTYPE not supported: 对象类型

-- comment on column vi_flow_monitoring.PHASETYPE not supported: 阶段类型

-- comment on column vi_flow_monitoring.APPLYTYPE not supported: 申请类型

-- comment on column vi_flow_monitoring.FLOWNO not supported: 当前流程号

-- comment on column vi_flow_monitoring.FLOWNAME not supported: 当前流程名称

-- comment on column vi_flow_monitoring.PHASENO not supported: 当前阶段号

-- comment on column vi_flow_monitoring.flow_unid not supported: 流程编号

-- comment on column vi_flow_monitoring.proj_id not supported: 项目编号

-- comment on column vi_flow_monitoring.contract_id not supported: 合同编号

-- comment on column vi_flow_monitoring.SERIALNO not supported: 流水号

-- comment on column vi_flow_monitoring.RELATIVESERIALNO not supported: 上一流水号

-- comment on column vi_flow_monitoring.USERID not supported: 承办人编号

