ods_extra_ddl.sql
3.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
-- ============================================================================
-- ODS 层补充 DDL — 新增2张维度表
-- 数据库: test_excel
-- ============================================================================
-- ============================================================================
-- 新增1. ods_shop_merchant_director_config — 门店负责人配置表
-- 来源: dj_car_life_shop_merchant_director_config
-- 用途: 区域运营/线上运营/飞行督导等人员维度
-- ============================================================================
DROP TABLE IF EXISTS ods_shop_merchant_director_config;
CREATE TABLE ods_shop_merchant_director_config (
id BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键',
merchant_id BIGINT NOT NULL COMMENT '门店ID',
director_type TINYINT NOT NULL COMMENT '负责人类型: 5=1.1线上运营, 6=1.1飞行督导, 7=2.1线上运营, 8=1.1区域运营, 9=2.1区域运营, 13=2.1飞行督导',
director_user_id VARCHAR(64) DEFAULT NULL COMMENT '负责人用户ID',
director_name VARCHAR(64) DEFAULT NULL COMMENT '负责人姓名',
director_phone VARCHAR(32) DEFAULT NULL COMMENT '负责人手机号',
deleted_flag CHAR(1) DEFAULT 'N' COMMENT '删除标记',
created_date DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
updated_date DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (id),
INDEX idx_merchant_type (merchant_id, director_type),
INDEX idx_director_user (director_user_id),
INDEX idx_director_type (director_type)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='门店负责人配置表-ODS';
-- ============================================================================
-- 新增2. ods_merchant_brand_model — 商户品牌车系配置表
-- 来源: dj_car_life_merchant_brand_model
-- 用途: 品牌/子品牌/车系维度
-- ============================================================================
DROP TABLE IF EXISTS ods_merchant_brand_model;
CREATE TABLE ods_merchant_brand_model (
id BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键',
merchant_id BIGINT NOT NULL COMMENT '商户ID',
merchant_name VARCHAR(128) DEFAULT NULL COMMENT '商户名称',
brand_id INT DEFAULT NULL COMMENT '品牌ID(一级)',
brand_name VARCHAR(64) DEFAULT NULL COMMENT '品牌名称',
child_id INT DEFAULT NULL COMMENT '子品牌ID(二级)',
child_name VARCHAR(64) DEFAULT NULL COMMENT '子品牌名称',
series_id INT DEFAULT NULL COMMENT '车系ID',
series_name VARCHAR(64) DEFAULT NULL COMMENT '车系名称',
model_type INT DEFAULT NULL COMMENT '车型分类: 0=无, 1=资源车, 2=畅销车, 3=普通车, 4=库存车',
deleted_flag CHAR(1) DEFAULT 'N' COMMENT '删除标记',
created_date DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
updated_date DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (id),
INDEX idx_merchant (merchant_id),
INDEX idx_brand (brand_id, child_id),
INDEX idx_series (series_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商户品牌车系配置表-ODS';