drop table if exists deBusinessOrder1000_current;
create table deBusinessOrder1000_current(
                                            id	bigint  default 0,
                                            orderName	varchar(50) default '',
                                            orderCode	varchar(100) default '',
                                            orderStatus	int default 0,
                                            orderSequence	bigint  default 0,
                                            incomePlatformId	bigint  default 0,
                                            incomePlatformName	varchar(50) default '',
                                            incomePlatformOrderCode	varchar(100) default '',
                                            incomePlatformOrderTime	datetime default NOW(),
                                            incomePlatformOrderTimeLong	bigint  default 0,
                                            suggestDeliverTime	datetime default NOW(),
                                            suggestDeliverTimeLong	bigint  default 0,
                                            idStore	bigint  default 0,
                                            storeName	varchar(50) default '',
                                            deliverFee	decimal(18,4) default 0,
                                            deliverDistance	decimal(18,4) default 0,
                                            deliverAddressAll	varchar(500) default '',
                                            outGoingPlatformId	bigint  default 0,
                                            outGoingPlatformName	varchar(50) default '',
                                            voidFlagIn	int default 0,
                                            voidFlagOut	int default 0,
                                            createBy	bigint  default 0,
                                            createTime	datetime default NOW(),
                                            createTimeLong	bigint  default 0,
                                            updateBy	bigint  default 0,
                                            updateTime	datetime default NOW(),
                                            updateTimeLong	bigint  default 0,
                                            primary key (id)
)
    ENGINE = INNODB
    AUTO_INCREMENT = 1
    DEFAULT CHARSET = utf8
    COMMENT = '';

-- ----------------------------
-- Table structure for eoorderstep1000_current
-- ----------------------------
DROP TABLE IF EXISTS `deorderstep1000_current`;
CREATE TABLE `deorderstep1000_current`  (
                                            `id` bigint(20) NOT NULL AUTO_INCREMENT,
                                            `idOrder` bigint(20) NULL DEFAULT 0,
                                            `idWorkMan` bigint(20) NULL DEFAULT 0,
                                            `workMan` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
                                            `workTime` datetime NULL DEFAULT CURRENT_TIMESTAMP,
                                            `workMemo` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
                                            `workExplain` varchar(6000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
                                            `orderYear` int(11) NULL DEFAULT 0,
                                            PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

drop table if exists tbPlatformInfo1000;
create table tbPlatformInfo1000(
                                   id	bigint  default 0,
                                   platformName	varchar(50) default '',
                                   platformType	int default 0,
                                   requireListSerial	varchar(100) default '',
                                   voidFlag	int default 0,
                                   createBy	bigint  default 0,
                                   createTime	datetime default NOW(),
                                   createTimeLong	bigint  default 0,
                                   updateBy	bigint  default 0,
                                   updateTime	datetime default NOW(),
                                   updateTimeLong	bigint  default 0,
                                   primary key (id)
)
    ENGINE = INNODB
    AUTO_INCREMENT = 1
    DEFAULT CHARSET = utf8
    COMMENT = '';

drop table if exists tbPlatformRequire1000;
create table tbPlatformRequire1000(
                                      id	bigint  default 0,
                                      requireName	varchar(50) default '',
                                      requireCode	varchar(100) default '',
                                      valueType	int default 0,
                                      voidFlag	int default 0,
                                      createBy	bigint  default 0,
                                      createTime	datetime default NOW(),
                                      createTimeLong	bigint  default 0,
                                      updateBy	bigint  default 0,
                                      updateTime	datetime default NOW(),
                                      updateTimeLong	bigint  default 0,
                                      primary key (id)
)
    ENGINE = INNODB
    AUTO_INCREMENT = 1
    DEFAULT CHARSET = utf8
    COMMENT = '';

drop table if exists tbStoreBrand1000;
create table tbStoreBrand1000(
                                 id	bigint  default 0,
                                 brandName	varchar(50) default '',
                                 brandLogoUrl	varchar(100) default '',
                                 startingPrice	decimal(18,4) default 0,
                                 packagingFee	decimal(18,4) default 0,
                                 brandMemo	varchar(2000) default '',
                                 voidFlag	int default 0,
                                 createBy	bigint  default 0,
                                 createTime	datetime default NOW(),
                                 createTimeLong	bigint  default 0,
                                 updateBy	bigint  default 0,
                                 updateTime	datetime default NOW(),
                                 updateTimeLong	bigint  default 0,
                                 primary key (id)
)
    ENGINE = INNODB
    AUTO_INCREMENT = 1
    DEFAULT CHARSET = utf8
    COMMENT = '';


drop table if exists tbStoreInfo1000;
create table tbStoreInfo1000(
                                id	bigint  default 0,
                                storeName	varchar(50) default '',
                                idBrand	bigint  default 0,
                                brandName	varchar(50) default '',
                                idStoreType	bigint  default 0,
                                deliverSettleKind	int default 0,
                                storeCodeInput	varchar(100) default '',
                                storeProvince	varchar(50) default '',
                                storeCity	varchar(50) default '',
                                storeDistrict	varchar(100) default '',
                                storeAddress	varchar(500) default '',
                                contractPhone	varchar(100) default '',
                                storeBossId	bigint  default 0,
                                companyLicenseNo	varchar(100) default '',
                                companyLicensePicUrl	varchar(100) default '',
                                legalPersonIdNo	varchar(100) default '',
                                legalPersonName	varchar(50) default '',
                                voidFlag	int default 0,
                                enableInvoice	int default 0,
                                createBy	bigint  default 0,
                                createTime	datetime default NOW(),
                                createTimeLong	bigint  default 0,
                                updateBy	bigint  default 0,
                                updateTime	datetime default NOW(),
                                updateTimeLong	bigint  default 0,
                                primary key (id)
)
    ENGINE = INNODB
    AUTO_INCREMENT = 1
    DEFAULT CHARSET = utf8
    COMMENT = '';


drop table if exists tbStorePlatform1000;
create table tbStorePlatform1000(
                                    id	bigint  default 0,
                                    idStore	bigint  default 0,
                                    idPlatformInfo	bigint  default 0,
                                    platformName	varchar(50) default '',
                                    platformType	int default 0,
                                    enableStatue	int default 0,
                                    createBy	bigint  default 0,
                                    createTime	datetime default NOW(),
                                    createTimeLong	bigint  default 0,
                                    updateBy	bigint  default 0,
                                    updateTime	datetime default NOW(),
                                    updateTimeLong	bigint  default 0,
                                    primary key (id)
)
    ENGINE = INNODB
    AUTO_INCREMENT = 1
    DEFAULT CHARSET = utf8
    COMMENT = '';


drop table if exists tbStorePlatformRequire1000;
create table tbStorePlatformRequire1000(
                                           id	bigint  default 0,
                                           idStore	bigint  default 0,
                                           idStorePlatform	bigint  default 0,
                                           idPlatformRequire	bigint  default 0,
                                           platformRequireCode	varchar(100) default '',
                                           platformRequireName	varchar(50) default '',
                                           itemValue	varchar(100) default '',
                                           createBy	bigint  default 0,
                                           createTime	datetime default NOW(),
                                           createTimeLong	bigint  default 0,
                                           updateBy	bigint  default 0,
                                           updateTime	datetime default NOW(),
                                           updateTimeLong	bigint  default 0,
                                           primary key (id)
)
    ENGINE = INNODB
    AUTO_INCREMENT = 1
    DEFAULT CHARSET = utf8
    COMMENT = '';

drop table if exists tbStoreInvoiceInfo1000;
create table tbStoreInvoiceInfo1000(
                                               id	bigint  default 0,
                                               idStore	bigint  default 0,
                                               taxIdNo	varchar(100) default '',
                                               companyName	varchar(50) default '',
                                               defaultTaxItemName	varchar(50) default '',
                                               defaultTaxItemCode	varchar(100) default '',
                                               taxRate	decimal(18,4) default 0,
                                               createBy	bigint  default 0,
                                               createTime	datetime default NOW(),
                                               createTimeLong	bigint  default 0,
                                               updateBy	bigint  default 0,
                                               updateTime	datetime default NOW(),
                                               updateTimeLong	bigint  default 0,
                                               primary key (id)
)
    ENGINE = INNODB
    AUTO_INCREMENT = 1
    DEFAULT CHARSET = utf8
    COMMENT = '';


ALTER TABLE `tbplatforminfo1000`
    ADD COLUMN `platformCode` varchar(50) NULL AFTER `id`;



drop table if exists deOrderFinances1000_current;
create table deOrderFinances1000_current(
                                            id	bigint  default 0,
                                            idOrder	bigint  default 0,
                                            orderMoney	decimal(18,4) default 0,
                                            deliverFee	decimal(18,4) default 0,
                                            orderPlatformSubsidy	decimal(18,4) default 0,
                                            storeDiscount	decimal(18,4) default 0,
                                            customerPaid	decimal(18,4) default 0,
                                            platformServiceFee	decimal(18,4) default 0,
                                            storeRealCollection	decimal(18,4) default 0,
                                            createBy	bigint  default 0,
                                            createTime	datetime default NOW(),
                                            createTimeLong	bigint  default 0,
                                            updateBy	bigint  default 0,
                                            updateTime	datetime default NOW(),
                                            updateTimeLong	bigint  default 0,
                                            primary key (id)
)
    ENGINE = INNODB
    AUTO_INCREMENT = 1
    DEFAULT CHARSET = utf8
    COMMENT = '';


drop table if exists deOrderDeliveryInfo1000_currnet;
create table deOrderDeliveryInfo1000_currnet(
                                                id	bigint  default 0,
                                                idOrder	bigint  default 0,
                                                deliverProvince	varchar(50) default '',
                                                deliverCity	varchar(50) default '',
                                                deliverDistract	varchar(100) default '',
                                                deliverAddress	varchar(500) default '',
                                                geoLocationSerial	varchar(100) default '',
                                                receiveMan	varchar(100) default '',
                                                contractPhone	varchar(100) default '',
                                                deliverTimeliness	int default 0,
                                                bookingDeliverTime	datetime default NOW(),
                                                customerInvoiceInfo	varchar(100) default '',
                                                customerMemo	varchar(2000) default '',
                                                createBy	bigint  default 0,
                                                createTime	datetime default NOW(),
                                                createTimeLong	bigint  default 0,
                                                updateBy	bigint  default 0,
                                                updateTime	datetime default NOW(),
                                                updateTimeLong	bigint  default 0,
                                                primary key (id)
)
    ENGINE = INNODB
    AUTO_INCREMENT = 1
    DEFAULT CHARSET = utf8
    COMMENT = '';


drop table if exists deOrderDetailItem1000_current;
create table deOrderDetailItem1000_current(
                                              id	bigint  default 0,
                                              idOrder	bigint  default 0,
                                              itemName	varchar(50) default '',
                                              itemPrice	decimal(18,4) default 0,
                                              itemCount	int default 0,
                                              itemMoney	decimal(18,4) default 0,
                                              createBy	bigint  default 0,
                                              createTime	datetime default NOW(),
                                              createTimeLong	bigint  default 0,
                                              updateBy	bigint  default 0,
                                              updateTime	datetime default NOW(),
                                              updateTimeLong	bigint  default 0,
                                              primary key (id)
)
    ENGINE = INNODB
    AUTO_INCREMENT = 1
    DEFAULT CHARSET = utf8
    COMMENT = '';


CREATE OR REPLACE ALGORITHM = UNDEFINED DEFINER = `dbadmin`@`%` SQL SECURITY DEFINER VIEW `v_debusinessorder1000` AS select `debusinessorder1000_current`.`id` AS `id`,`debusinessorder1000_current`.`orderCode` AS `orderCode` from `debusinessorder1000_current` ;
CREATE OR REPLACE ALGORITHM = UNDEFINED DEFINER = `dbadmin`@`%` SQL SECURITY DEFINER VIEW `v_deorderfinances1000` AS select `deorderfinances1000_current`.`id` AS `id` from `deorderfinances1000_current` ;
CREATE OR REPLACE ALGORITHM = UNDEFINED DEFINER = `dbadmin`@`%` SQL SECURITY DEFINER VIEW `v_deorderdetailitem1000` AS  select `deorderdetailitem1000_current`.`id` AS `id` from `deorderdetailitem1000_current`;
CREATE OR REPLACE ALGORITHM = UNDEFINED DEFINER = `dbadmin`@`%` SQL SECURITY DEFINER VIEW `v_deorderdeliveryinfo1000` AS  select `deorderdeliveryinfo1000_currnet`.`id` AS `id` from `deorderdeliveryinfo1000_currnet`;


ALTER TABLE `tbstoreplatform1000`
    ADD COLUMN `platformStoreId` varchar(255) NULL AFTER `idStore`;

ALTER TABLE `deorderdeliveryinfo1000_currnet`
    ADD COLUMN `bookingDeliverTimeLong` bigint(20) NULL AFTER `bookingDeliverTime`;

ALTER TABLE `deorderfinances1000_current`
    ADD COLUMN `omeServiceFee` decimal(18, 4) NULL AFTER `storeRealCollection`;

drop table if exists deOrderRefundRequest1000_current;
create table deOrderRefundRequest1000_current(
                                                 id	bigint  default 0,
                                                 idOrder	bigint  default 0,
                                                 idStore	bigint  default 0,
                                                 outPlatformStoreId	varchar(100) default '',
                                                 idStorePlatform	bigint  default 0,
                                                 platformCode	varchar(100) default '',
                                                 platformType	int default 0,
                                                 platformName	varchar(50) default '',
                                                 outAfterSaleId	varchar(100) default '',
                                                 requestStatus	int default 0,
                                                 userRefundMemo	varchar(2000) default '',
                                                 refundType	int default 0,
                                                 deliveryFee	int default 0,
                                                 refundFee	int default 0,
                                                 refundProdCount	int default 0,
                                                 refundProductsDetail	varchar(100) default '',
                                                 createBy	bigint  default 0,
                                                 createTime	datetime default NOW(),
                                                 createTimeLong	bigint  default 0,
                                                 updateBy	bigint  default 0,
                                                 updateTime	datetime default NOW(),
                                                 updateTimeLong	bigint  default 0,
                                                 primary key (id)
)
    ENGINE = INNODB
    AUTO_INCREMENT = 1
    DEFAULT CHARSET = utf8
    COMMENT = '';


drop table if exists deOrderAfterSaleBill1000_current;
create table deOrderAfterSaleBill1000_current(
                                                 id	bigint  default 0,
                                                 idOrder	bigint  default 0,
                                                 idStore	bigint  default 0,
                                                 outPlatformStoreId	varchar(100) default '',
                                                 idStorePlatform	bigint  default 0,
                                                 platformCode	varchar(100) default '',
                                                 platformType	int default 0,
                                                 platformName	varchar(50) default '',
                                                 outAfterSaleId	varchar(100) default '',
                                                 applySource	varchar(100) default '',
                                                 billCode	varchar(100) default '',
                                                 userRefundAmount	int default 0,
                                                 totalUserRefundAmount	int default 0,
                                                 prodCountAfterRefund	int default 0,
                                                 productsRemainDetail	varchar(100) default '',
                                                 productsRefundDetail	varchar(100) default '',
                                                 createBy	bigint  default 0,
                                                 createTime	datetime default NOW(),
                                                 createTimeLong	bigint  default 0,
                                                 updateBy	bigint  default 0,
                                                 updateTime	datetime default NOW(),
                                                 updateTimeLong	bigint  default 0,
                                                 primary key (id)
)
    ENGINE = INNODB
    AUTO_INCREMENT = 1
    DEFAULT CHARSET = utf8
    COMMENT = '';

CREATE OR REPLACE ALGORITHM = UNDEFINED DEFINER = `dbadmin`@`%` SQL SECURITY DEFINER VIEW `v_deorderaftersalebill1000` AS SELECT
                                                                                                                                              `deorderaftersalebill1000_current`.`id` AS `id`,
                                                                                                                                              `deorderaftersalebill1000_current`.`billCode` AS `billCode`
                                                                                                                                          FROM
                                                                                                                                              `deorderaftersalebill1000_current`;
CREATE OR REPLACE ALGORITHM = UNDEFINED DEFINER = `dbadmin`@`%` SQL SECURITY DEFINER VIEW `v_deorderrefundrequest1000` AS  select `deorderrefundrequest1000_current`.`id` AS `id` from `deorderrefundrequest1000_current`;

ALTER TABLE `deorderdetailitem1000_current`
    ADD COLUMN `itemDetail` varchar(2000) NULL AFTER `itemMoney`;







