create view vi_contractinfoallview as SELECT O.ID              AS ID,
       CL2.ITEMNAME      AS CONTRACT_STATUS,
       LUL.CUSTOMER_NAME AS CUSTOMER_NAME,
       LPI.PROJECT_NO    AS PROJECT_NO,
       O.PROJECT_ID      AS PROJECT_ID,
       O.PROJECT_DATE    AS PROJECT_DATE,
       O.PROJECT_NAME    AS PROJECT_NAME,
       O.CONTRACT_NO     AS CONTRACT_NO,
       O.CONTRACT_NUMBER AS CONTRACT_NUMBER,
       O.LEAS_FORM       AS LEAS_FORM,
       LEC.FRAME_NUMBER  AS FRAME_NUMBER,
       CP.MOBILE         AS MOBILE,
       CF.NAME           AS NAME,
       LEC.VNDR_NAME     AS VNDR_NAME,
       LFI.APPLYPAY_DATE AS APPLYPAY_DATE,
       LCC.START_DATE    AS START_DATE,
       CL1.ITEMNAME      AS ITEMNAME,
       O.PRODUCT_ID      AS PRODUCT_ID,
       O.FLOWUNID        AS FLOWUNID,
       UI.USERNAME       AS PROJECT_MANAGENAME
FROM ((((((((((((APZL.LB_CONTRACT_INFO O LEFT JOIN APZL.LB_UNION_LESSEE LUL ON (((LUL.CONTRACT_ID = O.ID) AND (LUL.IS_MAIN = 'Y')))) LEFT JOIN APZL.CUSTOMER_PERSON CP ON ((CP.CUSTOMERID = LUL.CUSTOMER_ID))) LEFT JOIN APZL.LB_PROJECT_INFO LPI ON ((LPI.ID = convert(LUL.PROJECT_ID USING UTF8)))) LEFT JOIN APZL.LB_EQUIPMENT_CAR LEC ON ((LEC.PROJECT_ID = LPI.ID))) LEFT JOIN APZL.CUSTOMER_FAMILY CF ON (((convert(CF.PROJECT_ID USING UTF8) = LPI.ID) AND (CF.PARTNER_ = 'Y')))) LEFT JOIN APZL.LC_CALC_CONDITION LCC ON ((LCC.CONTRACT_ID = LUL.CONTRACT_ID))) LEFT JOIN (
    SELECT APZL.LC_FUND_INCOME.CONTRACT_ID AS CONTRACT_ID, APZL.LC_FUND_INCOME.APPLYPAY_DATE AS APPLYPAY_DATE
    FROM APZL.LC_FUND_INCOME
    WHERE ((APZL.LC_FUND_INCOME.FEE_TYPE = 'feetype10') AND (APZL.LC_FUND_INCOME.SETTLE_METHOD = 'settlemethod11'))
    GROUP BY APZL.LC_FUND_INCOME.CONTRACT_ID
) LFI ON ((LFI.CONTRACT_ID = LUL.CONTRACT_ID))) LEFT JOIN APZL.PRD_SPECIFIC_LIBRARY PSL ON ((LPI.PRODUCT_ID = PSL.PRODUCTID))) LEFT JOIN APZL.CODE_LIBRARY CL1 ON (((convert(CL1.ITEMNO USING UTF8) = PSL.OPERATIONTYPE) AND (CL1.CODENO = 'operationType')))) LEFT JOIN (
    SELECT APZL.BUSINESS_STATUS.CONTRACT_NUMBER AS CONTRACT_NUMBER, max(APZL.BUSINESS_STATUS.BUSINESS_STATUS) AS BUSINESS_STATUS
    FROM APZL.BUSINESS_STATUS
    GROUP BY APZL.BUSINESS_STATUS.CONTRACT_NUMBER
) BS ON ((BS.CONTRACT_NUMBER = O.CONTRACT_NUMBER))) LEFT JOIN APZL.CODE_LIBRARY CL2 ON (((CL2.ITEMNO = BS.BUSINESS_STATUS) AND (CL2.CODENO = 'BusinessStatus'))))
LEFT JOIN APZL.USER_INFO UI ON ((UI.USERID = O.PROJECT_MANAGE)))
WHERE (O.BUSINESSTYPE = '1');

-- comment on column vi_contractinfoallview.ID not supported: 编号

-- comment on column vi_contractinfoallview.CUSTOMER_NAME not supported: 承租人名称

-- comment on column vi_contractinfoallview.PROJECT_NO not supported: 项目编号

-- comment on column vi_contractinfoallview.project_id not supported: 项目编号

-- comment on column vi_contractinfoallview.project_date not supported: 项目日期

-- comment on column vi_contractinfoallview.project_name not supported: 项目名称

-- comment on column vi_contractinfoallview.contract_no not supported: 合同号

-- comment on column vi_contractinfoallview.CONTRACT_NUMBER not supported: 业务合同号

-- comment on column vi_contractinfoallview.leas_form not supported: 业务形式

-- comment on column vi_contractinfoallview.FRAME_NUMBER not supported: 车架号

-- comment on column vi_contractinfoallview.mobile not supported: 手机号

-- comment on column vi_contractinfoallview.NAME not supported: 姓名

-- comment on column vi_contractinfoallview.VNDR_NAME not supported: 供应商

-- comment on column vi_contractinfoallview.APPLYPAY_DATE not supported: 申请支付日期

-- comment on column vi_contractinfoallview.START_DATE not supported: 起租日

-- comment on column vi_contractinfoallview.PRODUCT_ID not supported: 产品ID

-- comment on column vi_contractinfoallview.FLOWUNID not supported: 流程标识

-- comment on column vi_contractinfoallview.project_managename not supported: 用户姓名

