create view vi_product as (
SELECT BT.TYPENO           AS TYPENO,
       BT.SORTNO           AS SORTNO,
       BT.TYPENAME         AS TYPENAME,
       BT.ATTRIBUTE2       AS ATTRIBUTE2,
       PSL.PRODUCTID       AS PRODUCTID,
       PSL.VERSIONID       AS VERSIONID,
       PSL.EQUIP_TYPE      AS EQUIP_TYPE,
       PSL.LEASFORM        AS LEASFORM,
       PSL.IS_ALL_DEALER   AS IS_ALL_DEALER,
       PSL.IS_ALL_CAR      AS IS_ALL_CAR,
       DI.ORGID            AS ORGID,
       DI.ID               AS ID,
       DI.DISTRIBUTOR_NAME AS DISTRIBUTOR_NAME,
       LCM.MODELID         AS MODELID,
       LCM.MODELNAME       AS MODELNAME,
       PSL.OPERATIONTYPE   AS OPERATIONTYPE
FROM (((((((
    SELECT APZL.BUSINESS_TYPE.TYPENO           AS TYPENO,
           APZL.BUSINESS_TYPE.SORTNO           AS SORTNO,
           APZL.BUSINESS_TYPE.TYPENAME         AS TYPENAME,
           APZL.BUSINESS_TYPE.TYPESORTNO       AS TYPESORTNO,
           APZL.BUSINESS_TYPE.SUBTYPECODE      AS SUBTYPECODE,
           APZL.BUSINESS_TYPE.INFOSET          AS INFOSET,
           APZL.BUSINESS_TYPE.DISPLAYTEMPLET   AS DISPLAYTEMPLET,
           APZL.BUSINESS_TYPE.ATTRIBUTE1       AS ATTRIBUTE1,
           APZL.BUSINESS_TYPE.ATTRIBUTE2       AS ATTRIBUTE2,
           APZL.BUSINESS_TYPE.ATTRIBUTE3       AS ATTRIBUTE3,
           APZL.BUSINESS_TYPE.ATTRIBUTE4       AS ATTRIBUTE4,
           APZL.BUSINESS_TYPE.ATTRIBUTE5       AS ATTRIBUTE5,
           APZL.BUSINESS_TYPE.ATTRIBUTE6       AS ATTRIBUTE6,
           APZL.BUSINESS_TYPE.ATTRIBUTE7       AS ATTRIBUTE7,
           APZL.BUSINESS_TYPE.ATTRIBUTE8       AS ATTRIBUTE8,
           APZL.BUSINESS_TYPE.ATTRIBUTE9       AS ATTRIBUTE9,
           APZL.BUSINESS_TYPE.ATTRIBUTE10      AS ATTRIBUTE10,
           APZL.BUSINESS_TYPE.REMARK           AS REMARK,
           APZL.BUSINESS_TYPE.APPLYDETAILNO    AS APPLYDETAILNO,
           APZL.BUSINESS_TYPE.APPROVEDETAILNO  AS APPROVEDETAILNO,
           APZL.BUSINESS_TYPE.CONTRACTDETAILNO AS CONTRACTDETAILNO,
           APZL.BUSINESS_TYPE.INPUTUSER        AS INPUTUSER,
           APZL.BUSINESS_TYPE.INPUTORG         AS INPUTORG,
           APZL.BUSINESS_TYPE.INPUTTIME        AS INPUTTIME,
           APZL.BUSINESS_TYPE.UPDATEUSER       AS UPDATEUSER,
           APZL.BUSINESS_TYPE.UPDATETIME       AS UPDATETIME,
           APZL.BUSINESS_TYPE.ATTRIBUTE11      AS ATTRIBUTE11,
           APZL.BUSINESS_TYPE.ATTRIBUTE12      AS ATTRIBUTE12,
           APZL.BUSINESS_TYPE.ATTRIBUTE13      AS ATTRIBUTE13,
           APZL.BUSINESS_TYPE.ATTRIBUTE14      AS ATTRIBUTE14,
           APZL.BUSINESS_TYPE.ATTRIBUTE15      AS ATTRIBUTE15,
           APZL.BUSINESS_TYPE.ATTRIBUTE16      AS ATTRIBUTE16,
           APZL.BUSINESS_TYPE.ATTRIBUTE17      AS ATTRIBUTE17,
           APZL.BUSINESS_TYPE.ATTRIBUTE18      AS ATTRIBUTE18,
           APZL.BUSINESS_TYPE.ATTRIBUTE19      AS ATTRIBUTE19,
           APZL.BUSINESS_TYPE.ATTRIBUTE20      AS ATTRIBUTE20,
           APZL.BUSINESS_TYPE.ATTRIBUTE21      AS ATTRIBUTE21,
           APZL.BUSINESS_TYPE.ATTRIBUTE22      AS ATTRIBUTE22,
           APZL.BUSINESS_TYPE.ATTRIBUTE23      AS ATTRIBUTE23,
           APZL.BUSINESS_TYPE.ATTRIBUTE24      AS ATTRIBUTE24,
           APZL.BUSINESS_TYPE.ATTRIBUTE25      AS ATTRIBUTE25,
           APZL.BUSINESS_TYPE.ISINUSE          AS ISINUSE,
           APZL.BUSINESS_TYPE.OFFSHEETFLAG     AS OFFSHEETFLAG
    FROM APZL.BUSINESS_TYPE
    WHERE ((length(APZL.BUSINESS_TYPE.SORTNO) > 4) AND (APZL.BUSINESS_TYPE.ISINUSE = '1'))
)
) BT LEFT JOIN APZL.PRD_SPECIFIC_LIBRARY PSL ON (((PSL.PRODUCTID = BT.TYPENO) AND (PSL.STATUS = '1') AND
                                                  (date_format(now(), '%Y/%m%d') >= date_format(PSL.EFFECTIVEDATE, '%Y/%m%d'))))) LEFT JOIN APZL.LM_DISTRIBUTOR_TO_PRODUCT LDP ON ((convert(LDP.PRODUCT_ID USING UTF8) = BT.TYPENO))) LEFT JOIN APZL.DISTRIBUTOR_INFO DI ON ((LDP.DISTRIBUTOR_ID = DI.ID))) LEFT JOIN APZL.LM_PRODUCT_CAR LPC ON ((convert(LPC.PRODUCTID USING UTF8) = BT.TYPENO)))
LEFT JOIN APZL.VI_CAR_DATA LCM ON ((LCM.ID = LPC.CARID))));

-- comment on column vi_product.typeno not supported: 类型编号

-- comment on column vi_product.sortno not supported: 排序号

-- comment on column vi_product.typename not supported: 类型名称

-- comment on column vi_product.attribute2 not supported: 主业务品种分类

-- comment on column vi_product.equip_type not supported: 租赁物类型

-- comment on column vi_product.LeasForm not supported: 租赁类型

-- comment on column vi_product.IS_ALL_DEALER not supported: 产品适用所有经销商

-- comment on column vi_product.IS_ALL_CAR not supported: 产品适用所有车辆

-- comment on column vi_product.orgid not supported: 部门编号

-- comment on column vi_product.distributor_name not supported: 经销商名称

-- comment on column vi_product.operationType not supported: 业务模式

