You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

118 lines
7.1 KiB

-- ----------------------------
-- 1、数据权限表
-- ----------------------------
drop table if exists dhc_data_auth;
create table dhc_data_auth (
data_auth_id bigint NOT NULL auto_increment COMMENT '数据权限ID',
user_id bigint(20) NOT NULL comment '用户ID',
dept_id bigint(20) NOT NULL comment '部门ID',
dept_all_id varchar(1000) NOT NULL comment '部门树ID',
dept_all_Name varchar(1000) NOT NULL comment '部门树名称',
auth_node varchar(32) NOT NULL comment '权限控制点',
product_line_code varchar(32) NOT NULL comment '产品线编码',
area_type varchar(32) default '' NOT NULL comment '区域类型',
primary key (data_auth_id)
) engine=innodb auto_increment=1 comment = '数据权限表';
-- ----------------------------
-- 2、数据权限明细表
-- ----------------------------
drop table if exists dhc_data_auth_datail;
create table dhc_data_auth_detail (
data_auth_id bigint NOT NULL COMMENT '数据权限ID',
detail_type char(1) NOT NULL comment '类型(0区域 1.客户)',
detail_code varchar(32) NOT NULL comment '权限明细编码',
detail_name varchar(64) NOT NULL comment '权限明细名称',
primary key (data_auth_id, detail_type, detail_code)
) engine=innodb auto_increment=1 comment = '数据权限明细表';
-- ----------------------------
-- 3、产品线-区域类型-区域层级关系表
-- ----------------------------
drop table if exists dhc_product_line_area;
create table dhc_product_line_area (
product_line_code varchar(32) NOT NULL COMMENT '产品线编码',
area_type varchar(32) NOT NULL comment '区域类型',
area_level varchar(32) NOT NULL comment '区域层级',
primary key (product_line_code,area_type,area_level)
) engine=innodb auto_increment=1 comment = '产品线-区域类型-区域层级关系表';
-- ----------------------------
-- 4、区域表
-- ----------------------------
drop table if exists dhc_area;
create table dhc_area (
area_id bigint(20) not null auto_increment comment '区域id',
parent_id bigint(20) default 0 comment '父区域id',
area_code varchar(32) default '' comment '区域编码',
area_name varchar(64) default '' comment '区域名称',
product_line_code varchar(32) default '' comment '产品线编码',
area_type varchar(32) default '' comment '区域类型',
area_level varchar(32) default '' comment '区域层级',
order_num int(4) default 0 comment '显示顺序',
area_desc varchar(512) default '' comment '区域说明',
status char(1) default '0' comment '区域状态(0正常 1停用)',
del_flag char(1) default '0' comment '删除标志(0代表存在 1代表删除)',
create_by varchar(64) default '' comment '创建者',
create_time datetime comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime comment '更新时间',
primary key (area_id)
) engine=innodb auto_increment=1 comment = '区域表';
-- ----------------------------
-- 5、国家表
-- ----------------------------
drop table if exists dhc_country;
create table dhc_country (
country_id bigint(20) not null auto_increment comment '国家id',
country_code varchar(32) default '' comment '国家编码',
country_name varchar(64) default '' comment '国家名称',
area_id_large bigint(20) comment '销售大区id',
area_name_large varchar(64) default '' comment '销售大区名称',
area_id_small bigint(20) comment '销售小区id',
area_name_small varchar(64) default '' comment '销售小区名称',
del_flag char(1) default '0' comment '删除标志(0代表存在 1代表删除)',
create_by varchar(64) default '' comment '创建者',
create_time datetime comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime comment '更新时间',
primary key (country_id)
) engine=innodb auto_increment=1 comment = '国家表';
-- ----------------------------
-- 6、生产基地与产品线关系表
-- ----------------------------
drop table if exists dhc_production_base_line;
create table dhc_production_base_line (
product_line_code varchar(32) NOT NULL comment '产品线编码',
production_base_code varchar(32) NOT NULL comment '生成基地编码',
primary key (product_line_code,production_base_code)
) engine=innodb auto_increment=1 comment = '生产基地与产品线关系表';
-- ----------------------------
-- 7、品牌表
-- ----------------------------
drop table if exists dhc_brand;
create table dhc_brand (
brand_id bigint(20) not null auto_increment comment '品牌id',
brand_code varchar(32) default '' comment '品牌编码',
brand_name varchar(64) default '' comment '品牌名称',
del_flag char(1) default '0' comment '删除标志(0代表存在 1代表删除)',
create_by varchar(64) default '' comment '创建者',
create_time datetime comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime comment '更新时间',
primary key (brand_id)
) engine=innodb auto_increment=1 comment = '品牌表';
-- ----------------------------
-- 8、供应商信息表
-- ----------------------------
drop table if exists dhc_supplier;
create table dhc_supplier (
supplier_id bigint(20) not null auto_increment comment '供应商id',
supplier_code varchar(32) default '' comment '供应商编码',
supplier_name varchar(64) default '' comment '供应商名称',
del_flag char(1) default '0' comment '删除标志(0代表存在 1代表删除)',
create_by varchar(64) default '' comment '创建者',
create_time datetime comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime comment '更新时间',
primary key (supplier_id)
) engine=innodb auto_increment=1 comment = '供应商信息表';