Commit f7178a23 by chenxi

上线SQL提交

1 parent 66c41ee7
### 陈希 -----------------start------------------- ### 陈希 -----------------start-------------------
-- auto-generated definition
drop table if exists dj_car_life_product_template;
create table dj_car_life_product_template
(
id int auto_increment comment '主键ID'
primary key,
product_name varchar(255) null comment '产品名称',
product_code varchar(255) null comment '产品编码',
price_unit_type tinyint(1) null comment '计价单位类型 1-把、2-本、3-对、4-个、5-根、6-盒、7-件、8-卷、9-块、10-辆、11-米、12-克、13-升、14-双、15-台、16-套、17-条、18-桶、19-位、20-页、21-张',
price_unit_name varchar(100) null comment '计价单位名称',
created_by varchar(64) not null comment '创建人',
created_date datetime default CURRENT_TIMESTAMP not null comment '创建时间',
updated_by varchar(64) not null comment '修改人',
updated_date datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '修改时间',
deleted_flag char default 'N' not null comment '删除标识(D:已删除;N:未删除)'
)
comment '产品清单表' charset = utf8
row_format = DYNAMIC;
drop table if exists dj_car_life_goods_provider;
-- auto-generated definition
create table dj_car_life_goods_provider
(
id int auto_increment comment '主键ID'
primary key,
provider_name varchar(255) not null comment '供应商名称',
address varchar(64) null comment '供应商地址',
contact_name varchar(255) null comment '联系人',
contact_phone varchar(255) null comment '联系电话',
created_by varchar(64) not null comment '创建人',
created_date datetime default CURRENT_TIMESTAMP not null comment '创建时间',
updated_by varchar(64) not null comment '修改人',
updated_date datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '修改时间',
deleted_flag char default 'N' not null comment '删除标识(D:已删除;N:未删除)'
)
comment '产品供应商表' charset = utf8
row_format = DYNAMIC;
alter table dj_car_life_goods_info
add column provider_id int null comment '供应商id 对应dj_car_life_goods_provider表主键' after scrm_service_code;
alter table dj_car_life_upgrade_goods
add column on_shelf_status int not null default 1 comment '产品可用状态(0-不可上架为商品 1-可上架为商品)' after dj_cost;
alter table dj_car_life_upgrade_goods
modify column on_shelf_status int not null default 1 comment '产品可用状态(0-不可上架为商品 1-可上架为商品)' after dj_cost;
alter table dj_car_life_upgrade_goods
add column product_template_id int null default null comment '产品清单id' after commodity_code;
alter table dj_car_life_upgrade_goods
modify applicable_area varchar(100) null comment '适用区域(26年5月已废弃)改为适用dj_car_life_upgrade_goods_area表';
alter table dj_car_life_upgrade_goods
add column customer_label varchar(255) null default null comment '客户标签' after applicable_area;
alter table dj_car_life_upgrade_goods
add column supply_source varchar(255) null default null comment '供应来源(1-原厂、2-集采、3-店采)' after customer_label;
alter table dj_car_life_upgrade_goods
add column remark varchar(255) null default null comment '备注' after supply_source;
-- 新增适用区域
drop table if exists dj_car_life_upgrade_goods_area;
CREATE TABLE dj_car_life_upgrade_goods_area (
id int auto_increment PRIMARY KEY COMMENT '主键ID',
upgrade_goods_id int NOT NULL COMMENT '产品id(dj_smartcarlife.dj_car_life_upgrade_goods.id)',
province_code varchar(20) not NULL COMMENT '省区域编码(冗余这个字段,-1表示全国)',
province_name varchar(255) not NULL COMMENT '省区域名称',
city_code varchar(20) not NULL COMMENT '市区域编码(-1表示全国)',
city_name varchar(255) not NULL COMMENT '市区域名称',
created_by varchar(255) not null comment '创建人',
created_date datetime default CURRENT_TIMESTAMP not null comment '创建时间',
updated_by varchar(255) not null comment '修改人',
updated_date datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '修改时间',
deleted_flag char default 'N' not null comment '删除标识(D:已删除;N:未删除)',
KEY idx_upgrade_goods_id(upgrade_goods_id),
KEY idx_city_code(city_code)
) COMMENT '产品适用区域关联表' CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
drop table if exists dj_car_life_merchant_goods_area;
CREATE TABLE dj_car_life_merchant_goods_area (
id int auto_increment PRIMARY KEY COMMENT '主键ID',
merchant_goods_id int NOT NULL COMMENT '上架商品id(dj_smartcarlife.dj_car_life_merchant_goods_info.id)',
province_code varchar(20) not NULL COMMENT '省区域编码(冗余这个字段,-1表示全国)',
province_name varchar(255) not NULL COMMENT '省区域名称',
city_code varchar(20) not NULL COMMENT '市区域编码(-1表示全国)',
city_name varchar(255) not NULL COMMENT '市区域名称',
created_by varchar(255) not null comment '创建人',
created_date datetime default CURRENT_TIMESTAMP not null comment '创建时间',
updated_by varchar(255) not null comment '修改人',
updated_date datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '修改时间',
deleted_flag char default 'N' not null comment '删除标识(D:已删除;N:未删除)',
KEY idx_merchant_goods_id(merchant_goods_id),
KEY idx_city_code(city_code)
) COMMENT '上架商品适用区域关联表' CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
drop table if exists dj_car_life_merchant_package_area;
CREATE TABLE dj_car_life_merchant_package_area (
id int auto_increment PRIMARY KEY COMMENT '主键ID',
package_code varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '套餐编码(dj_smartcarlife.dj_car_life_merchant_package_goods_info.package_code)',
province_code varchar(20) not NULL COMMENT '省区域编码(冗余这个字段,-1表示全国)',
province_name varchar(255) not NULL COMMENT '省区域名称',
city_code varchar(20) not NULL COMMENT '市区域编码(-1表示全国)',
city_name varchar(255) not NULL COMMENT '市区域名称',
created_by varchar(255) not null comment '创建人',
created_date datetime default CURRENT_TIMESTAMP not null comment '创建时间',
updated_by varchar(255) not null comment '修改人',
updated_date datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '修改时间',
deleted_flag char default 'N' not null comment '删除标识(D:已删除;N:未删除)',
KEY idx_package_code(package_code),
KEY idx_city_code(city_code)
) COMMENT '套餐适用区域关联表' CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
### 陈希 -----------------end--------------------- ### 陈希 -----------------end---------------------
### 立明 -----------------start------------------- ### 立明 -----------------start-------------------
......
### 陈希 -----------------start------------------- ### 陈希 -----------------start-------------------
-- 历史数据都刷为 1,新增延保商品刷为0
update dj_car_life_upgrade_goods
set on_shelf_status = 1
where id > 0;
insert into dj_car_life_goods_provider(provider_name, created_by, created_date, updated_by, updated_date, deleted_flag) values ('无', 'system', now(), 'system', now(), 'N');
INSERT INTO `dj_car_life_product_template` ( `product_name`, `product_code`, `price_unit_type`, `price_unit_name`, `created_by`, `created_date`, `updated_by`, `updated_date`, `deleted_flag`)
select distinct upgrade_goods_name,type,null,null,'system',NOW(),'system',NOW(),'N' from dj_car_life_upgrade_goods where deleted_flag='N' and upgrade_goods_name is not null and type is not null
and upgrade_goods_name !='' and type!='' and product_template_id is null;
update dj_car_life_upgrade_goods a,dj_car_life_product_template b set a.product_template_id=b.id where a.deleted_flag='N'
and upgrade_goods_name is not null and type is not null
and upgrade_goods_name !='' and type!='' and product_template_id is null and a.upgrade_goods_name=b.product_name and a.type=b.product_code;
### 陈希 -----------------end--------------------- ### 陈希 -----------------end---------------------
### 立明 -----------------start------------------- ### 立明 -----------------start-------------------
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!