CREATE ALGORITHM=UNDEFINED DEFINER=`ordertest`@`%` SQL SECURITY DEFINER VIEW `view_dzorder_excel` AS

select `a`.`id` AS `id`,`b`.`id` AS `dz_order_id`,`a`.`id` AS `good_id`,'' AS `goodno`,`a`.`price` AS `price`,`a`.`quantity` AS `total`,`a`.`price` AS `unit_price`,'' AS `optionname`,`a`.`goods_params` AS `unit`,`a`.`goods_name` AS `other_field1`,`b`.`dispatchprice` AS `dispatch_price`,(`a`.`quantity` * `a`.`price`) AS `total_price`,'' AS `tax_code`,'' AS `fiscal_code`,`b`.`finishtime` AS `finishtime`,`b`.`createtime` AS `createtime`,`b`.`merch_name` AS `merch_name`,`b`.`ordersn` AS `ordersn`,`c`.`taxpayersIDcode` AS `taxpayersIDcode`,`b`.`address_mobile` AS `address_mobile`,`b`.`invoiceAccount` AS `invoiceAccount`,`b`.`remark` AS `remark`,`c`.`invoiceType` AS `invoiceType`,`b`.`taxCode` AS `taxCode`,`b`.`paytype` AS `paytype`,`b`.`status` AS `status`,`b`.`realname_id` AS `realname_id`,`b`.`dispatchprice` AS `dispatchprice`,`b`.`price` AS `order_price`,`c`.`enterprise_id` AS `enterprise_id`,`d`.`purchase_virt_name` AS `enterprise_name`,`d`.`purchase_virt_name` AS `companyname`,`c`.`dz_sn` AS `dz_sn`,`c`.`dz_status` AS `dz_status`,`c`.`dz_invstatus` AS `dz_invstatus`,`d`.`purchase_user_name` AS `realname` from ((((`unified_order_goods` `a` left join `dz_order` `b` on((`a`.`sn` = `b`.`ordersn`))) left join `dz_main` `c` on((`b`.`dz_id` = `c`.`id`))) left join `sys_enterprise` `e` on((`e`.`enterprise_id` = `c`.`enterprise_id`))) left join `unified_order` `d` on((`a`.`sn` = `d`.`sn`)))