etrade-order-v1.0.14.20240429-fengliang.sql 2.22 KB
USE dili_etrade;
ALTER TABLE `dili_etrade`.`order_goods` 
ADD COLUMN `sales_mode` tinyint UNSIGNED NOT NULL DEFAULT 1 COMMENT '销售类型(1单价,2总价)';

ALTER TABLE `dili_etrade`.`order` 
ADD COLUMN `achieve_type` tinyint NOT NULL DEFAULT 1 COMMENT '下单提货方式(1自提,2配送)';

ALTER TABLE `dili_etrade`.`order` 
ADD COLUMN `achieve_address` varchar(200) NULL COMMENT '订单配送地址' AFTER `achieve_type`,
ADD COLUMN `achieve_state` tinyint NULL COMMENT '配送状态' AFTER `achieve_address`;

ALTER TABLE `dili_etrade`.`ecap_contact_person` 
ADD COLUMN `default_type` tinyint NULL DEFAULT 1 COMMENT '是否默认(1非默认,2默认)' AFTER `version`;

CREATE TABLE `order_delivery` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `order_id` bigint NOT NULL COMMENT '订单主键',
  `order_code` varchar(40) NOT NULL COMMENT '订单编码',
  `market_id` bigint DEFAULT NULL COMMENT '订单市场id',
  `way_state` tinyint NOT NULL COMMENT '订单配送状态(1待配送,2已配送,3配送中)',
  `state` tinyint DEFAULT '1' COMMENT '配送单状态',
  `address` varchar(100) NOT NULL COMMENT '配送地址',
  `way_type` tinyint DEFAULT NULL COMMENT '配送方式',
  `receiver_phone` varchar(25) DEFAULT NULL COMMENT '收货人电话',
  `receiver_name` varchar(50) DEFAULT NULL COMMENT '收货人名称',
  `created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `modified_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `province_id` bigint DEFAULT NULL COMMENT '省id',
  `province_name` varchar(10) DEFAULT NULL COMMENT '省',
  `city_id` bigint DEFAULT NULL COMMENT '城市id',
  `city_name` varchar(30) DEFAULT NULL COMMENT '城市',
  `district_id` bigint DEFAULT NULL COMMENT '区县id',
  `district_name` varchar(30) DEFAULT NULL COMMENT '区县',
  `version` int unsigned DEFAULT '1' COMMENT '乐观锁',
  `modifier_id` bigint DEFAULT NULL COMMENT '更新人id',
  `modifier` varchar(50) DEFAULT NULL COMMENT '更新人名称',
  PRIMARY KEY (`id`),
  UNIQUE KEY `orderCode` (`order_code`,`state`) USING BTREE
) ENGINE = InnoDB COMMENT = '订单配送单';


UPDATE dili_etrade.`order` SET state = 6
WHERE `state` = 3 AND verify_state = 1;