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.
1775 lines
80 KiB
1775 lines
80 KiB
/*==============================================================*/
|
|
/* DBMS name: MySQL 5.0 */
|
|
/* Created on: 2018-5-29 23:17:54 */
|
|
/*==============================================================*/
|
|
|
|
|
|
drop index Association_1_FK2 on Association_1;
|
|
|
|
drop index Association_1_FK on Association_1;
|
|
|
|
drop table if exists Association_1;
|
|
|
|
drop index 流水与推荐记录的关系_FK on account_flow;
|
|
|
|
drop index 账户与账户流水关系_FK on account_flow;
|
|
|
|
drop table if exists account_flow;
|
|
|
|
drop index 用户与用户帐号关系_FK on account_info;
|
|
|
|
drop table if exists account_info;
|
|
|
|
drop index 客户与地址关系_FK on address;
|
|
|
|
drop table if exists address;
|
|
|
|
drop index 用户与管理员帐号关系_FK on admin_info;
|
|
|
|
drop table if exists admin_info;
|
|
|
|
drop index 商户与商户预约池记录_FK on book;
|
|
|
|
drop index 保洁师排班与预约池关系_FK on book;
|
|
|
|
drop table if exists book;
|
|
|
|
drop index 保洁师与客户预约订单关系_FK on book_detail;
|
|
|
|
drop index 服务卡与预约订单关系_FK on book_detail;
|
|
|
|
drop table if exists book_detail;
|
|
|
|
drop index 预约订单与预约订单操作日志_FK on book_log;
|
|
|
|
drop table if exists book_log;
|
|
|
|
drop index merchant_has_cleaner_ditstrict_FK on cleaner_district;
|
|
|
|
drop table if exists cleaner_district;
|
|
|
|
drop index link_cleaner_district_FK on cleaner_info;
|
|
|
|
drop index 用户与保洁师关系_FK on cleaner_info;
|
|
|
|
drop index 商户与保洁师关系_FK on cleaner_info;
|
|
|
|
drop table if exists cleaner_info;
|
|
|
|
drop index 保洁师与保洁师排班记录_FK on cleaner_pool;
|
|
|
|
drop table if exists cleaner_pool;
|
|
|
|
drop index 保洁师排班与排班操作日志_FK on cleaner_pool_log;
|
|
|
|
drop table if exists cleaner_pool_log;
|
|
|
|
drop table if exists code_region;
|
|
|
|
drop index 客户与客户评价关系_FK on consumer_evaluated;
|
|
|
|
drop table if exists consumer_evaluated;
|
|
|
|
drop index 用户与客户关系_FK on consumer_info;
|
|
|
|
drop table if exists consumer_info;
|
|
|
|
drop index 优惠券批次与优惠券信息关系_FK on coupon;
|
|
|
|
drop index 客户与优惠券关系_FK on coupon;
|
|
|
|
drop table if exists coupon;
|
|
|
|
drop table if exists coupon_batch;
|
|
|
|
drop index 优惠券信息操作日志_FK on coupon_log;
|
|
|
|
drop index 优惠券批次的操作关系_FK on coupon_log;
|
|
|
|
drop table if exists coupon_log;
|
|
|
|
drop index 商户与商户分销配置关系_FK on distribution_config;
|
|
|
|
drop table if exists distribution_config;
|
|
|
|
drop index 用户与提现记录关系_FK on enchashment_record;
|
|
|
|
drop table if exists enchashment_record;
|
|
|
|
drop index 商户与用户关系_FK on merchant;
|
|
|
|
drop table if exists merchant;
|
|
|
|
drop index 商户开放区域_FK on merchant_auth_area;
|
|
|
|
drop table if exists merchant_auth_area;
|
|
|
|
drop index 商户与商户操作日志_FK on merchant_log;
|
|
|
|
drop table if exists merchant_log;
|
|
|
|
drop index 商户与商户商城图片设置表_FK on merchant_mall_img;
|
|
|
|
drop table if exists merchant_mall_img;
|
|
|
|
drop index 订单与订单操作日志_FK on order_log;
|
|
|
|
drop table if exists order_log;
|
|
|
|
drop table if exists permission_info;
|
|
|
|
drop index 交易流水对退款记录_FK on refund_process;
|
|
|
|
drop index 订单与退款记录_FK on refund_process;
|
|
|
|
drop table if exists refund_process;
|
|
|
|
drop index 退款记录与退款操作日志_FK on refund_process_log;
|
|
|
|
drop table if exists refund_process_log;
|
|
|
|
drop index cleaner_district_FK on rel_cleaner_district_auth_area;
|
|
|
|
drop index merchant_auth_area_FK on rel_cleaner_district_auth_area;
|
|
|
|
drop table if exists rel_cleaner_district_auth_area;
|
|
|
|
drop table if exists role_info;
|
|
|
|
drop index 权限与角色关系_FK on role_permission;
|
|
|
|
drop index 角色与权限关系_FK on role_permission;
|
|
|
|
drop table if exists role_permission;
|
|
|
|
drop index belongs_auth_area_FK on service_card;
|
|
|
|
drop index 拥有_FK on service_card;
|
|
|
|
drop index 订单与服务卡关系_FK on service_card;
|
|
|
|
drop table if exists service_card;
|
|
|
|
drop table if exists sms_template;
|
|
|
|
drop table if exists system_config;
|
|
|
|
drop index 订单与交易流水_FK on trans;
|
|
|
|
drop table if exists trans;
|
|
|
|
drop table if exists user;
|
|
|
|
drop index 用户与用户定位关系_FK on user_location;
|
|
|
|
drop table if exists user_location;
|
|
|
|
drop index 用户生成操作日志_FK on user_log;
|
|
|
|
drop table if exists user_log;
|
|
|
|
drop index 用户与第三方授权关系_FK on user_other_oauth;
|
|
|
|
drop table if exists user_other_oauth;
|
|
|
|
drop index 商户与用户推荐关系_FK on user_recommend;
|
|
|
|
drop index 用户与用户推荐关系_FK on user_recommend;
|
|
|
|
drop table if exists user_recommend;
|
|
|
|
drop index 角色与用户关系_FK on user_role;
|
|
|
|
drop index 用户角色关系生成_FK on user_role;
|
|
|
|
drop table if exists user_role;
|
|
|
|
drop table if exists verify_code;
|
|
|
|
drop index 商品与商品模板关系_FK on vgoods;
|
|
|
|
drop index 商户与商品关系_FK on vgoods;
|
|
|
|
drop table if exists vgoods;
|
|
|
|
drop index 商品与商品操作日志关系_FK on vgoods_log;
|
|
|
|
drop table if exists vgoods_log;
|
|
|
|
drop table if exists vgoods_template;
|
|
|
|
drop index 订单与服务卡关系_FK on vorder;
|
|
|
|
drop index 地址与订单关系_FK on vorder;
|
|
|
|
drop index 优惠券与订单关系_FK on vorder;
|
|
|
|
drop index 商品与订单关系_FK on vorder;
|
|
|
|
drop index 客户与订单关系_FK on vorder;
|
|
|
|
drop table if exists vorder;
|
|
|
|
drop table if exists wechat_tmplmsg;
|
|
|
|
/*==============================================================*/
|
|
/* Table: Association_1 */
|
|
/*==============================================================*/
|
|
create table Association_1
|
|
(
|
|
merchant_id bigint not null,
|
|
code_region_id int not null comment '主键ID'
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Index: Association_1_FK */
|
|
/*==============================================================*/
|
|
create index Association_1_FK on Association_1
|
|
(
|
|
merchant_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Index: Association_1_FK2 */
|
|
/*==============================================================*/
|
|
create index Association_1_FK2 on Association_1
|
|
(
|
|
code_region_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: account_flow */
|
|
/*==============================================================*/
|
|
create table account_flow
|
|
(
|
|
id bigint not null comment '主键ID',
|
|
user_recommend_id bigint,
|
|
account_info_id bigint not null comment '主键ID',
|
|
flow_no varchar(32) not null comment '流水编号',
|
|
create_time bigint default 0 comment '创建时间',
|
|
flow_title varchar(32) comment '流水标题',
|
|
flow_type tinyint default 0 comment '流水类型 0 购买服务 1 推荐保洁师 2 推荐用户 3 提现 4 转账前冻结金额 5 抹平冻结金额 6 退还冻结金额',
|
|
flow_status tinyint default 0 comment '流水状态 0默认 审核成功 1 处理中 2 审核失败',
|
|
flow_amount bigint default 0 comment '流水额度',
|
|
before_amount bigint default 0 comment '流水执行前额度',
|
|
after_amount bigint default 0 comment '流水执行后额度',
|
|
execute_time bigint default 0 comment '执行时间',
|
|
remark varchar(64) comment '备注',
|
|
merchant_no varchar(32) comment '商家编号'
|
|
);
|
|
|
|
alter table account_flow comment '账户流水表';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 账户与账户流水关系_FK */
|
|
/*==============================================================*/
|
|
create index 账户与账户流水关系_FK on account_flow
|
|
(
|
|
account_info_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Index: 流水与推荐记录的关系_FK */
|
|
/*==============================================================*/
|
|
create index 流水与推荐记录的关系_FK on account_flow
|
|
(
|
|
user_recommend_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: account_info */
|
|
/*==============================================================*/
|
|
create table account_info
|
|
(
|
|
id bigint unsigned not null comment '主键ID',
|
|
user_id2 bigint not null,
|
|
user_id varchar(32) not null comment '用户ID',
|
|
account_name varchar(8) comment '账号名称',
|
|
type tinyint default 0 comment '账号类型 0 普通账号 1 系统账号',
|
|
total_amount bigint unsigned default 0 comment '总额度',
|
|
current_amount bigint unsigned default 0 comment '可提现额度',
|
|
freeze_amount bigint unsigned default 0 comment '冻结额度',
|
|
create_time bigint default 0 comment '创建时间',
|
|
status tinyint default 0 comment '状态 0 可用 1 不可用'
|
|
);
|
|
|
|
alter table account_info comment '用户账号';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 用户与用户帐号关系_FK */
|
|
/*==============================================================*/
|
|
create index 用户与用户帐号关系_FK on account_info
|
|
(
|
|
user_id2
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: address */
|
|
/*==============================================================*/
|
|
create table address
|
|
(
|
|
id bigint unsigned not null,
|
|
consumer_info_id bigint,
|
|
"label" national varchar(16) comment '地址标签',
|
|
province_id int default 0 comment '省id',
|
|
city_id int default 0 comment '城市id',
|
|
district_id int default 0 comment '区id',
|
|
town_id int unsigned default 0 comment '街道id',
|
|
lat decimal(10,6) default 0.000000 comment '纬度',
|
|
lng decimal(10,6) default 0.000000 comment '经度',
|
|
detail national varchar(255) comment '地址明细',
|
|
full_name national varchar(255) not null comment '地址全称',
|
|
telephone national varchar(255) not null comment '地址电话',
|
|
linkman national varchar(32) not null comment '联系人',
|
|
created_at bigint unsigned default 0 comment '创建时间',
|
|
created_by national varchar(20) comment '创建者',
|
|
updated_at bigint unsigned default 0 comment '更新时间',
|
|
updated_by national varchar(20) comment '更新者',
|
|
is_default tinyint unsigned default 0 comment '默认地址 0否 1是',
|
|
status tinyint unsigned not null default 0 comment '状态',
|
|
square tinyint default 0,
|
|
location_address national varchar(255),
|
|
remark national varchar(255)
|
|
);
|
|
|
|
alter table address comment '地址';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 客户与地址关系_FK */
|
|
/*==============================================================*/
|
|
create index 客户与地址关系_FK on address
|
|
(
|
|
consumer_info_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: admin_info */
|
|
/*==============================================================*/
|
|
create table admin_info
|
|
(
|
|
id bigint unsigned not null,
|
|
user_id2 bigint,
|
|
merchant_no national varchar(32) comment '商户编号',
|
|
user_id national varchar(32) comment '用户id',
|
|
nick_name national varchar(20) comment '昵称',
|
|
mobile national varchar(20) comment '手机号',
|
|
type tinyint default 0 comment '类型',
|
|
status tinyint default 0 comment '状态',
|
|
created_at bigint default 0 comment '创建时间',
|
|
created_by national varchar(20) comment '创建者',
|
|
updated_at bigint default 0 comment '更新时间',
|
|
updated_by national varchar(20) comment '更新者',
|
|
del_flag tinyint default 0 comment '删除标志',
|
|
init_pwd national varchar(50) comment '初始密码'
|
|
);
|
|
|
|
alter table admin_info comment '员工';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 用户与管理员帐号关系_FK */
|
|
/*==============================================================*/
|
|
create index 用户与管理员帐号关系_FK on admin_info
|
|
(
|
|
user_id2
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: book */
|
|
/*==============================================================*/
|
|
create table book
|
|
(
|
|
id bigint unsigned not null comment '预约时间',
|
|
merchant_id bigint not null,
|
|
cleaner_pool_id bigint,
|
|
merchant_book_no national varchar(32) comment '商户预约记录统计编号',
|
|
type tinyint default 0 comment '类型 0合计 1细分区县',
|
|
province_id int default 0 comment '服务城市',
|
|
city_id int default 0 comment '服务省份',
|
|
district_id int default 0 comment '服务区县',
|
|
merchant_no national varchar(32) not null default '' comment '商家编号',
|
|
book_time date comment '时间',
|
|
time_type tinyint default 0 comment '时间类型',
|
|
bookable_count int default 0 comment '可预约次数',
|
|
extra_bookable_count int default 0 comment '运营手动增加的可预约次数',
|
|
reserved_count int default 0 comment '预留预约次数',
|
|
booked_count int default 0 comment '已预订次数',
|
|
created_at bigint unsigned default 0 comment '创建时间',
|
|
updated_at bigint default 0 comment '更新时间',
|
|
status tinyint unsigned default 0 comment '状态',
|
|
del_flag tinyint default 0 comment '删除标志'
|
|
);
|
|
|
|
alter table book comment '预约日历';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 保洁师排班与预约池关系_FK */
|
|
/*==============================================================*/
|
|
create index 保洁师排班与预约池关系_FK on book
|
|
(
|
|
cleaner_pool_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Index: 商户与商户预约池记录_FK */
|
|
/*==============================================================*/
|
|
create index 商户与商户预约池记录_FK on book
|
|
(
|
|
merchant_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: book_detail */
|
|
/*==============================================================*/
|
|
create table book_detail
|
|
(
|
|
id bigint unsigned not null,
|
|
cleaner_info_id bigint,
|
|
service_card_id bigint not null comment '主键ID',
|
|
merchant_no national varchar(32) not null comment '商家编号',
|
|
card_type tinyint default 0 comment '服务卡类型',
|
|
book_no national varchar(32) comment '预约编号',
|
|
user_id national varchar(32) default '0' comment '用户id',
|
|
type tinyint default 0 comment '类型',
|
|
book_time date comment '预约日期',
|
|
book_week tinyint default 0 comment '预约星期',
|
|
time_type tinyint default 0 comment '时间类型',
|
|
cleaner_name national varchar(32) comment '保洁师名称',
|
|
full_address national varchar(128) comment '服务地址',
|
|
address_telephone national varchar(16) comment '联系人号码',
|
|
linkman national varchar(16) comment '联系人姓名',
|
|
lng decimal(10,6) default 0.000000 comment '经度',
|
|
lat decimal(10,6) default 0.000000 comment '纬度',
|
|
square int default 0 comment '房屋面积',
|
|
region_id int default 0 comment '区域id',
|
|
created_at bigint unsigned default 0 comment '创建时间',
|
|
created_by national varchar(32) comment '创建者',
|
|
updated_at bigint unsigned default 0 comment '更新时间',
|
|
updated_by national varchar(32) comment '更新者',
|
|
remark national varchar(255) comment '备注',
|
|
status tinyint default 0 comment '状态',
|
|
del_flag tinyint default 0 comment '删除标志',
|
|
cleaner_comment national varchar(255) comment '保洁师评价',
|
|
has_check tinyint default 0 comment '保洁师是否已查看 0否1是',
|
|
has_send tinyint default 0 comment '是否已发送短信 只有待服务的状态下才体现 0否 1是'
|
|
);
|
|
|
|
alter table book_detail comment '预约明细';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 服务卡与预约订单关系_FK */
|
|
/*==============================================================*/
|
|
create index 服务卡与预约订单关系_FK on book_detail
|
|
(
|
|
service_card_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Index: 保洁师与客户预约订单关系_FK */
|
|
/*==============================================================*/
|
|
create index 保洁师与客户预约订单关系_FK on book_detail
|
|
(
|
|
cleaner_info_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: book_log */
|
|
/*==============================================================*/
|
|
create table book_log
|
|
(
|
|
id bigint unsigned not null,
|
|
book_detail_id bigint,
|
|
merchant_no national varchar(32) not null default '' comment '商家编号',
|
|
user_id national varchar(32) comment '用户id',
|
|
client_type tinyint default 0 comment '用户类型',
|
|
opt_type int default 0 comment '操作类型',
|
|
created_at bigint unsigned default 0 comment '创建时间',
|
|
created_by national varchar(20) comment '创建者',
|
|
status tinyint unsigned default 0 comment '状态',
|
|
del_flag tinyint default 0 comment '删除标志',
|
|
client_ip national varchar(50) comment '客户端ip',
|
|
remark national text comment '备注'
|
|
);
|
|
|
|
alter table book_log comment '预约日志';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 预约订单与预约订单操作日志_FK */
|
|
/*==============================================================*/
|
|
create index 预约订单与预约订单操作日志_FK on book_log
|
|
(
|
|
book_detail_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: cleaner_district */
|
|
/*==============================================================*/
|
|
create table cleaner_district
|
|
(
|
|
id int not null auto_increment,
|
|
merchant_id bigint not null,
|
|
merchant_no varchar(32),
|
|
province_id int,
|
|
province_name varchar(20),
|
|
city_id int,
|
|
city_name varchar(20),
|
|
district_id int,
|
|
district_name varchar(255),
|
|
del_flag tinyint
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Index: merchant_has_cleaner_ditstrict_FK */
|
|
/*==============================================================*/
|
|
create index merchant_has_cleaner_ditstrict_FK on cleaner_district
|
|
(
|
|
merchant_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: cleaner_info */
|
|
/*==============================================================*/
|
|
create table cleaner_info
|
|
(
|
|
id bigint not null,
|
|
merchant_id bigint,
|
|
user_id2 bigint,
|
|
cleaner_district_id int not null,
|
|
user_id national varchar(32) comment '用户id',
|
|
type tinyint default 0 comment '类型',
|
|
status tinyint default 0 comment '状态',
|
|
nick_name varchar(255) comment '昵称',
|
|
age int default 0 comment '年龄',
|
|
mobile national varchar(16) comment '手机号',
|
|
service_district national varchar(255) comment '服务区县id集,例如4401010000,4401020000',
|
|
province_id int default 0 comment '省id',
|
|
city_id int default 0 comment '市id',
|
|
district_id int default 0 comment '区id',
|
|
detail_address national varchar(128) comment '详细地址',
|
|
full_address national varchar(128) comment '完整住址',
|
|
lat decimal(10,6) default 0.000000 comment '纬度',
|
|
lng decimal(10,6) default 0.000000 comment '经度',
|
|
head_url national varchar(50) comment '头像',
|
|
entry_date date comment '入职时间',
|
|
last_arrange_date date comment '最后排班时间',
|
|
evaluate_score bigint default 0 comment '评价总分数',
|
|
evaluate_count int default 0 comment '评价总人数',
|
|
evaluate_rate double default 0.0 comment '好评率',
|
|
create_at bigint default 0 comment '创建时间',
|
|
create_by national varchar(20) comment '创建者',
|
|
update_at bigint default 0 comment '更新时间',
|
|
update_by national varchar(20) comment '更新者',
|
|
del_flag tinyint default 0 comment '删除标志',
|
|
token national varchar(32) comment '登录标识'
|
|
);
|
|
|
|
alter table cleaner_info comment '保洁师';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 商户与保洁师关系_FK */
|
|
/*==============================================================*/
|
|
create index 商户与保洁师关系_FK on cleaner_info
|
|
(
|
|
merchant_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Index: 用户与保洁师关系_FK */
|
|
/*==============================================================*/
|
|
create index 用户与保洁师关系_FK on cleaner_info
|
|
(
|
|
user_id2
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Index: link_cleaner_district_FK */
|
|
/*==============================================================*/
|
|
create index link_cleaner_district_FK on cleaner_info
|
|
(
|
|
cleaner_district_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: cleaner_pool */
|
|
/*==============================================================*/
|
|
create table cleaner_pool
|
|
(
|
|
id bigint unsigned not null,
|
|
cleaner_info_id bigint,
|
|
cleaner_pool_no national varchar(32) comment '保洁师池编号',
|
|
merchant_no national varchar(32) comment '所属商户',
|
|
book_no national varchar(32) comment '安排的预约记录',
|
|
type tinyint default 0 comment '保洁人员类型',
|
|
book_time date comment '预约日期',
|
|
book_week tinyint default 0 comment '预约星期',
|
|
time_type tinyint default 0 comment '时间类型',
|
|
created_at bigint unsigned default 0 comment '创建时间',
|
|
created_by national varchar(32) comment '创建者',
|
|
updated_at bigint unsigned default 0 comment '更新时间',
|
|
updated_by national varchar(32) comment '更新者',
|
|
status tinyint unsigned default 0 comment '状态'
|
|
);
|
|
|
|
alter table cleaner_pool comment '保洁师池';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 保洁师与保洁师排班记录_FK */
|
|
/*==============================================================*/
|
|
create index 保洁师与保洁师排班记录_FK on cleaner_pool
|
|
(
|
|
cleaner_info_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: cleaner_pool_log */
|
|
/*==============================================================*/
|
|
create table cleaner_pool_log
|
|
(
|
|
id bigint unsigned not null,
|
|
cleaner_pool_id bigint not null,
|
|
time_type tinyint not null default 0 comment '时间类型',
|
|
cleaner_id varchar(32) not null comment '保洁人员用户id',
|
|
book_time date not null comment '预约日期',
|
|
merchant_no national varchar(32) not null comment '商户编号',
|
|
client_type tinyint default 0 comment '用户类型',
|
|
opt_type tinyint default 0 comment '操作类型',
|
|
created_at bigint unsigned default 0 comment '创建时间',
|
|
created_by national varchar(32) comment '创建者',
|
|
status tinyint unsigned default 0 comment '状态',
|
|
del_flag tinyint default 0 comment '删除标志',
|
|
client_ip national varchar(50) comment '客户端ip',
|
|
remark national text comment '备注'
|
|
);
|
|
|
|
alter table cleaner_pool_log comment '保洁师池操作日志';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 保洁师排班与排班操作日志_FK */
|
|
/*==============================================================*/
|
|
create index 保洁师排班与排班操作日志_FK on cleaner_pool_log
|
|
(
|
|
cleaner_pool_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: code_region */
|
|
/*==============================================================*/
|
|
create table code_region
|
|
(
|
|
id int not null comment '主键ID',
|
|
pid int not null comment '父节点ID',
|
|
name varchar(32) not null comment '名称',
|
|
grade tinyint not null comment '行政级别',
|
|
is_last tinyint not null comment '是否最后一级,0否 1是',
|
|
path varchar(128) not null comment '地址详情'
|
|
);
|
|
|
|
alter table code_region comment '省、市、区、街道数据';
|
|
|
|
/*==============================================================*/
|
|
/* Table: consumer_evaluated */
|
|
/*==============================================================*/
|
|
create table consumer_evaluated
|
|
(
|
|
id bigint not null comment '自增主键',
|
|
consumer_info_id bigint not null,
|
|
merchant_no national varchar(32) comment '评价者所属商户',
|
|
opt_user_id national varchar(32) not null comment '评价者',
|
|
grade national char(50) not null comment '评级 A-B-C-D',
|
|
evaluate_content national varchar(255) comment '评价内容',
|
|
created_at bigint default 0 comment '评价时间'
|
|
);
|
|
|
|
alter table consumer_evaluated comment '销售对客户评价';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 客户与客户评价关系_FK */
|
|
/*==============================================================*/
|
|
create index 客户与客户评价关系_FK on consumer_evaluated
|
|
(
|
|
consumer_info_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: consumer_info */
|
|
/*==============================================================*/
|
|
create table consumer_info
|
|
(
|
|
id bigint unsigned not null,
|
|
user_id bigint,
|
|
nick_name varchar(255) comment '昵称',
|
|
mobile national varchar(20) comment '手机号',
|
|
head_url national varchar(255) comment '头像',
|
|
level int default 0 comment '等级',
|
|
growth_value int default 0 comment '成长值',
|
|
type tinyint default 0 comment '类型',
|
|
status tinyint default 0 comment '状态',
|
|
created_at bigint default 0 comment '创建时间',
|
|
created_by national varchar(32) comment '创建者',
|
|
updated_at bigint default 0 comment '更新时间',
|
|
updated_by national varchar(32) comment '更新者',
|
|
del_flag tinyint default 0 comment '删除标志'
|
|
);
|
|
|
|
alter table consumer_info comment '消费者';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 用户与客户关系_FK */
|
|
/*==============================================================*/
|
|
create index 用户与客户关系_FK on consumer_info
|
|
(
|
|
user_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: coupon */
|
|
/*==============================================================*/
|
|
create table coupon
|
|
(
|
|
id bigint unsigned not null,
|
|
consumer_info_id bigint,
|
|
coupon_batch_id int(20) comment '主键',
|
|
merchant_no national varchar(32) not null default '' comment '商家编号',
|
|
batch_name national varchar(128) comment '批次名,商城展示',
|
|
coupon_no national varchar(32) comment '优惠券编号',
|
|
order_no national varchar(32) comment '订单编号',
|
|
type tinyint default 0 comment '类型',
|
|
batch_type tinyint default 0 comment '批次类型',
|
|
status tinyint default 0 comment '状态',
|
|
amount bigint default 0 comment '优惠额度',
|
|
full_amount bigint default 0 comment '满减',
|
|
discount bigint default 0 comment '折扣',
|
|
created_at bigint default 0 comment '创建时间',
|
|
voucher national varchar(255) comment '兑换凭证',
|
|
created_by national varchar(32) comment '创建者',
|
|
updated_at bigint default 0 comment '更新时间',
|
|
updated_by national varchar(32) comment '更新者',
|
|
use_at bigint default 0 comment '使用时间',
|
|
invalid_at bigint default 0 comment '过期时间',
|
|
goods_no national varchar(256) comment '适用商品id',
|
|
goods_type tinyint default 0 comment '商品类型限制 0为不限制',
|
|
source_type tinyint default 0 comment '来源类型'
|
|
);
|
|
|
|
alter table coupon comment '优惠券';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 客户与优惠券关系_FK */
|
|
/*==============================================================*/
|
|
create index 客户与优惠券关系_FK on coupon
|
|
(
|
|
consumer_info_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Index: 优惠券批次与优惠券信息关系_FK */
|
|
/*==============================================================*/
|
|
create index 优惠券批次与优惠券信息关系_FK on coupon
|
|
(
|
|
coupon_batch_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: coupon_batch */
|
|
/*==============================================================*/
|
|
create table coupon_batch
|
|
(
|
|
id int(20) unsigned not null auto_increment comment '主键',
|
|
merchant_no national varchar(32) comment '商户编号',
|
|
project_name national varchar(128) comment '方案名,后台展示',
|
|
batch_name national varchar(128) comment '批次名,商城展示',
|
|
coupon_batch_no national varchar(32) comment '优惠券批次编号',
|
|
batch_type tinyint default 0 comment '批次类型',
|
|
type tinyint default 0 comment '类型',
|
|
status tinyint default 0 comment '状态',
|
|
amount bigint default 0 comment '优惠额度',
|
|
full_amount bigint default 0 comment '满减券的满减额度,如满99减20的99',
|
|
discount bigint default 0 comment '折扣',
|
|
num int default 0 comment '数量',
|
|
received_num int default 0 comment '已领取数量',
|
|
created_at bigint default 0 comment '创建时间',
|
|
created_by national varchar(32) comment '创建者',
|
|
updated_at bigint default 0 comment '更新时间',
|
|
updated_by national varchar(32) comment '更新者',
|
|
time_type tinyint default 0 comment '时间类型',
|
|
invalid_at bigint default 0 comment '失效时间',
|
|
duration_day int default 0 comment '有效天数',
|
|
del_flag tinyint default 0 comment '删除标志',
|
|
goods_no national varchar(256) comment '适用商品id',
|
|
goods_type tinyint default 0 comment '商品类型限制 0为不限制'
|
|
);
|
|
|
|
alter table coupon_batch comment '优惠券批次';
|
|
|
|
/*==============================================================*/
|
|
/* Table: coupon_log */
|
|
/*==============================================================*/
|
|
create table coupon_log
|
|
(
|
|
id bigint unsigned not null,
|
|
coupon_id bigint,
|
|
coupon_batch_id int(20) not null comment '主键',
|
|
merchant_no national varchar(32) not null default '' comment '商户编号',
|
|
order_no national varchar(32) comment '订单编号',
|
|
user_id national varchar(32) comment '用户id',
|
|
client_type tinyint default 0 comment '类型',
|
|
opt_type int default 0 comment '操作类型',
|
|
created_at bigint unsigned default 0 comment '创建时间',
|
|
created_by national varchar(32) default '' comment '创建者',
|
|
status tinyint unsigned default 0 comment '状态',
|
|
del_flag tinyint default 0 comment '删除标志',
|
|
client_ip national varchar(50) default '' comment '客户端ip',
|
|
remark national text comment '备注'
|
|
);
|
|
|
|
alter table coupon_log comment '优惠券日志';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 优惠券批次的操作关系_FK */
|
|
/*==============================================================*/
|
|
create index 优惠券批次的操作关系_FK on coupon_log
|
|
(
|
|
coupon_batch_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Index: 优惠券信息操作日志_FK */
|
|
/*==============================================================*/
|
|
create index 优惠券信息操作日志_FK on coupon_log
|
|
(
|
|
coupon_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: distribution_config */
|
|
/*==============================================================*/
|
|
create table distribution_config
|
|
(
|
|
id bigint not null,
|
|
merchant_id bigint,
|
|
merchant_no national varchar(32) comment '商家编号',
|
|
updated_by national varchar(32) comment '操作用户id',
|
|
rate int default 10 comment '抽成比例',
|
|
coupon_batch_no national varchar(32) default '0' comment '券码',
|
|
commission int default 50000 comment '佣金',
|
|
create_time bigint default 0 comment '创建时间',
|
|
update_time bigint default 0 comment '修改时间'
|
|
);
|
|
|
|
alter table distribution_config comment '分销配置';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 商户与商户分销配置关系_FK */
|
|
/*==============================================================*/
|
|
create index 商户与商户分销配置关系_FK on distribution_config
|
|
(
|
|
merchant_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: enchashment_record */
|
|
/*==============================================================*/
|
|
create table enchashment_record
|
|
(
|
|
id bigint not null,
|
|
user_id bigint not null,
|
|
enchashment_no national varchar(32) not null comment '提现记录编号',
|
|
trans_amount bigint default 0 comment '提现金额',
|
|
bank_name national varchar(20) default '0' comment '开户银行',
|
|
bank_account national varchar(50) default '0' comment '银行账号',
|
|
account_name national varchar(20) default '0' comment '开户名称',
|
|
create_time bigint default 0 comment '创建时间',
|
|
status tinyint default 0 comment '状态 0 未审核 1 审核通过 2 审核不通过',
|
|
remark national varchar(50) default '0' comment '描述信息',
|
|
del_flag tinyint default 0 comment '删除标志 0正常 1删除',
|
|
update_at bigint default 0 comment '更新时间',
|
|
update_by national varchar(32) default '0' comment '更新人'
|
|
);
|
|
|
|
alter table enchashment_record comment '提现记录表';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 用户与提现记录关系_FK */
|
|
/*==============================================================*/
|
|
create index 用户与提现记录关系_FK on enchashment_record
|
|
(
|
|
user_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: merchant */
|
|
/*==============================================================*/
|
|
create table merchant
|
|
(
|
|
id bigint unsigned not null,
|
|
user_id bigint,
|
|
merchant_no national varchar(32) comment '商家编号',
|
|
name national varchar(20) comment '名称',
|
|
type tinyint default 0 comment '类型',
|
|
status tinyint default 0 comment '状态',
|
|
address_detail national varchar(50) comment '地址明细',
|
|
address_full_name national varchar(50) comment '地址全称',
|
|
address_telephone national varchar(20) comment '地址电话',
|
|
linkman_name national varchar(20) comment '联系人名称',
|
|
linkman_mobile national varchar(20) comment '联系人电话',
|
|
desc_str national varchar(255) comment '描述',
|
|
district_id int default 0 comment '地区id',
|
|
district_name national varchar(255) comment '地区名',
|
|
province_id int default 0 comment '省id',
|
|
province_name national varchar(20) comment '省名字',
|
|
city_id int default 0 comment '城市id',
|
|
city_name national varchar(20) comment '城市名',
|
|
service_city_id national varchar(255) comment '服务的城市id,以逗号相隔',
|
|
created_at bigint default 0 comment '创建时间',
|
|
created_by national varchar(32) comment '创建者',
|
|
updated_at bigint default 0 comment '更新时间',
|
|
updated_by national varchar(32) comment '更新者',
|
|
del_flag tinyint default 0 comment '删除标志',
|
|
remark national text comment '备注'
|
|
);
|
|
|
|
alter table merchant comment '商户';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 商户与用户关系_FK */
|
|
/*==============================================================*/
|
|
create index 商户与用户关系_FK on merchant
|
|
(
|
|
user_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: merchant_auth_area */
|
|
/*==============================================================*/
|
|
create table merchant_auth_area
|
|
(
|
|
id int not null auto_increment,
|
|
merchant_id bigint not null,
|
|
merchant_no varchar(32),
|
|
province_id int,
|
|
province_name varchar(20),
|
|
city_id int,
|
|
city_name varchar(20),
|
|
district_id int,
|
|
district_name varchar(255),
|
|
is_open tinyint comment '是否开放:0-不开放,1-开放',
|
|
is_auth tinyint comment '是否授权:0-未授权,1-已授权',
|
|
created_at bigint,
|
|
created_by varchar(32),
|
|
updated_at bigint,
|
|
updated_by varchar(32),
|
|
del_flag tinyint
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Index: 商户开放区域_FK */
|
|
/*==============================================================*/
|
|
create index 商户开放区域_FK on merchant_auth_area
|
|
(
|
|
merchant_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: merchant_log */
|
|
/*==============================================================*/
|
|
create table merchant_log
|
|
(
|
|
id int(10) unsigned not null auto_increment,
|
|
merchant_id bigint,
|
|
created_at bigint default 0 comment '创建时间',
|
|
created_by national varchar(32) comment '创建者',
|
|
status tinyint default 0 comment '状态',
|
|
opt_type int default 0 comment '操作类型',
|
|
client_ip national varchar(50) comment '客户端ip',
|
|
remark national text comment '备注'
|
|
);
|
|
|
|
alter table merchant_log comment '商户日志';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 商户与商户操作日志_FK */
|
|
/*==============================================================*/
|
|
create index 商户与商户操作日志_FK on merchant_log
|
|
(
|
|
merchant_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: merchant_mall_img */
|
|
/*==============================================================*/
|
|
create table merchant_mall_img
|
|
(
|
|
id bigint not null,
|
|
merchant_id bigint not null,
|
|
type tinyint not null default 0 comment '类型 0banner 1广告图',
|
|
sequence_number tinyint not null default 0 comment '排序序号',
|
|
img_url national varchar(255) not null comment '图片地址',
|
|
link_url national varchar(255) comment '跳转链接地址',
|
|
del_flag tinyint default 0 comment '删除标识',
|
|
status tinyint default 0 comment '状态',
|
|
created_at bigint default 0 comment '创建时间',
|
|
created_by national varchar(32) comment '创建人',
|
|
updated_at bigint default 0 comment '更新时间',
|
|
updated_by national varchar(32) comment '更新人'
|
|
);
|
|
|
|
alter table merchant_mall_img comment '商户对应的商城banner、广告图配置';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 商户与商户商城图片设置表_FK */
|
|
/*==============================================================*/
|
|
create index 商户与商户商城图片设置表_FK on merchant_mall_img
|
|
(
|
|
merchant_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: order_log */
|
|
/*==============================================================*/
|
|
create table order_log
|
|
(
|
|
id bigint unsigned not null,
|
|
vorder_id bigint,
|
|
created_at bigint default 0 comment '创建时间',
|
|
created_by national varchar(32) comment '创建者',
|
|
status tinyint default 0 comment '状态',
|
|
opt_type int default 0 comment '操作类型',
|
|
"label" national varchar(20) comment '标签',
|
|
is_finished national char(1) default N comment '是否完成',
|
|
step int unsigned default 0 comment '第几步',
|
|
client_ip national varchar(50) comment '客户端ip',
|
|
remark national text comment '备注'
|
|
);
|
|
|
|
alter table order_log comment '订单日志';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 订单与订单操作日志_FK */
|
|
/*==============================================================*/
|
|
create index 订单与订单操作日志_FK on order_log
|
|
(
|
|
vorder_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: permission_info */
|
|
/*==============================================================*/
|
|
create table permission_info
|
|
(
|
|
id int(20) not null auto_increment comment '权限ID',
|
|
permission_name national varchar(32) comment '权限名称',
|
|
create_time bigint default 0 comment '创建时间',
|
|
remark national varchar(64) comment '备注',
|
|
del_flag tinyint default 0 comment '删除标志'
|
|
);
|
|
|
|
alter table permission_info comment '权限';
|
|
|
|
/*==============================================================*/
|
|
/* Table: refund_process */
|
|
/*==============================================================*/
|
|
create table refund_process
|
|
(
|
|
id bigint not null comment '主键',
|
|
trans_id bigint not null,
|
|
vorder_id bigint not null,
|
|
refund_no national varchar(32) not null comment '退款编号',
|
|
card_no national varchar(32) not null comment '服务卡号',
|
|
merchant_no national varchar(32) not null comment '商户号',
|
|
user_id national varchar(32) not null comment '退款用户id',
|
|
goods_name national varchar(32) comment '退款商品名称',
|
|
goods_type tinyint default 0 comment '退款商品类型',
|
|
total_service_cnt int default 0 comment '总服务次数',
|
|
serviced_cnt int default 0 comment '已服务次数',
|
|
pay_price bigint default 0 comment '实付价格',
|
|
payment_type tinyint default 0 comment '支付方式',
|
|
total_price bigint default 0 comment '商品原价',
|
|
refund_price bigint default 0 comment '退款金额',
|
|
status tinyint default 0 comment '退款申请状态',
|
|
created_at bigint default 0 comment '创建时间',
|
|
created_by national varchar(32) comment '创建人',
|
|
updated_by national varchar(32) comment '更新人',
|
|
updated_at bigint default 0 comment '更新时间'
|
|
);
|
|
|
|
alter table refund_process comment '用户退款记录';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 订单与退款记录_FK */
|
|
/*==============================================================*/
|
|
create index 订单与退款记录_FK on refund_process
|
|
(
|
|
vorder_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Index: 交易流水对退款记录_FK */
|
|
/*==============================================================*/
|
|
create index 交易流水对退款记录_FK on refund_process
|
|
(
|
|
trans_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: refund_process_log */
|
|
/*==============================================================*/
|
|
create table refund_process_log
|
|
(
|
|
id bigint unsigned not null,
|
|
refund_process_id bigint not null comment '主键',
|
|
order_no national varchar(32) comment '订单号',
|
|
created_at bigint default 0 comment '创建时间',
|
|
created_by national varchar(32) comment '创建者',
|
|
status tinyint default 0 comment '状态',
|
|
opt_type int default 0 comment '操作类型',
|
|
refund_price bigint default 0 comment '退款金额',
|
|
review_comment national text comment '审核内容',
|
|
client_ip national varchar(50) comment '客户端ip',
|
|
remark national text comment '备注'
|
|
);
|
|
|
|
alter table refund_process_log comment '退款流程日志记录';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 退款记录与退款操作日志_FK */
|
|
/*==============================================================*/
|
|
create index 退款记录与退款操作日志_FK on refund_process_log
|
|
(
|
|
refund_process_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: rel_cleaner_district_auth_area */
|
|
/*==============================================================*/
|
|
create table rel_cleaner_district_auth_area
|
|
(
|
|
merchant_auth_area_id int not null,
|
|
cleaner_district_id int not null
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Index: merchant_auth_area_FK */
|
|
/*==============================================================*/
|
|
create index merchant_auth_area_FK on rel_cleaner_district_auth_area
|
|
(
|
|
merchant_auth_area_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Index: cleaner_district_FK */
|
|
/*==============================================================*/
|
|
create index cleaner_district_FK on rel_cleaner_district_auth_area
|
|
(
|
|
cleaner_district_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: role_info */
|
|
/*==============================================================*/
|
|
create table role_info
|
|
(
|
|
id int(20) not null auto_increment comment '角色ID',
|
|
role_name national varchar(100) comment '角色名',
|
|
create_time bigint default 0 comment '创建时间',
|
|
remark national varchar(64) comment '备注',
|
|
del_flag tinyint default 0 comment '删除标志'
|
|
);
|
|
|
|
alter table role_info comment '角色';
|
|
|
|
/*==============================================================*/
|
|
/* Table: role_permission */
|
|
/*==============================================================*/
|
|
create table role_permission
|
|
(
|
|
id bigint not null comment '主键ID',
|
|
role_info_id int(20) comment '角色ID',
|
|
permission_info_id int(20) comment '权限ID',
|
|
role_name national varchar(100) comment '角色名',
|
|
permission_id bigint default 0 comment '权限ID',
|
|
permission_name national varchar(32) comment '权限名',
|
|
del_flag tinyint default 0 comment '删除标志'
|
|
);
|
|
|
|
alter table role_permission comment '角色与权限';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 角色与权限关系_FK */
|
|
/*==============================================================*/
|
|
create index 角色与权限关系_FK on role_permission
|
|
(
|
|
role_info_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Index: 权限与角色关系_FK */
|
|
/*==============================================================*/
|
|
create index 权限与角色关系_FK on role_permission
|
|
(
|
|
permission_info_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: service_card */
|
|
/*==============================================================*/
|
|
create table service_card
|
|
(
|
|
id bigint not null comment '主键ID',
|
|
merchant_auth_area_id int not null,
|
|
vorder_id bigint not null,
|
|
consumer_info_id bigint not null,
|
|
user_id national varchar(32) not null comment '用户id',
|
|
merchant_no national varchar(32) not null comment '商户编号',
|
|
card_no varchar(32),
|
|
goods_no national varchar(32) not null comment '对应的商品编号',
|
|
card_name national varchar(32) not null comment '服务卡名称',
|
|
show_img national varchar(255) not null comment '服务卡展示图片',
|
|
card_type tinyint unsigned default 0 comment '服务卡类型',
|
|
cycle_mode tinyint unsigned default 0 comment '周期模式',
|
|
cycle_freq tinyint unsigned default 0 comment '周期频率',
|
|
create_at bigint unsigned default 0 comment '创建时间',
|
|
create_by national varchar(32) comment '创建者',
|
|
update_at bigint unsigned default 0 comment '更新时间',
|
|
update_by national varchar(32) comment '更新者',
|
|
status tinyint unsigned default 0 comment '服务卡状态',
|
|
del_flag tinyint unsigned default 0 comment '删除标识 0否 1是',
|
|
active_invalid_at bigint unsigned default 0 comment '激活有效期限',
|
|
use_invalid_at bigint unsigned default 0 comment '使用有效期限',
|
|
active_at bigint unsigned default 0 comment '激活时间',
|
|
total_service_cnt int unsigned not null default 0 comment '总服务次数',
|
|
booked_cnt int unsigned default 0 comment '已预约次数',
|
|
serviced_cnt int unsigned default 0 comment '已服务次数',
|
|
region_id int unsigned default 0 comment '地区id',
|
|
full_address national varchar(128) comment '全地址',
|
|
address_telephone national varchar(16) comment '联系电话',
|
|
linkman national varchar(32) comment '联系人',
|
|
lat decimal(10,6) default 0.000000 comment '纬度',
|
|
lng decimal(10,6) default 0.000000 comment '经度',
|
|
remark national varchar(255) not null comment '服务备注',
|
|
address_id bigint default 0 comment '地址id',
|
|
square int default 0 comment '房屋面积'
|
|
);
|
|
|
|
alter table service_card comment '服务卡';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 订单与服务卡关系_FK */
|
|
/*==============================================================*/
|
|
create index 订单与服务卡关系_FK on service_card
|
|
(
|
|
vorder_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Index: 拥有_FK */
|
|
/*==============================================================*/
|
|
create index 拥有_FK on service_card
|
|
(
|
|
consumer_info_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Index: belongs_auth_area_FK */
|
|
/*==============================================================*/
|
|
create index belongs_auth_area_FK on service_card
|
|
(
|
|
merchant_auth_area_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: sms_template */
|
|
/*==============================================================*/
|
|
create table sms_template
|
|
(
|
|
id int(20) not null auto_increment comment '自增编号',
|
|
client_type tinyint default 0 comment '发送用户类型(ClientTypeEnum)',
|
|
sms_sp national varchar(10) comment '短信服务商(EnumSmsServiceProvider)',
|
|
sms_key national varchar(50) comment '代码调用(EnumSmsKeyTmpl)',
|
|
sms_code national varchar(20) comment '短信平台模板编码(EnumSmsKeyTmpl)',
|
|
sms_tmpl national text comment '短信模板内容',
|
|
tmpl_params national text comment '短信模板参数',
|
|
tmpl_status tinyint default 0 comment '模版状态(EnumWechatTmplStatus)',
|
|
create_at bigint default 0 comment '创建时间',
|
|
update_at bigint default 0 comment '更新时间'
|
|
);
|
|
|
|
alter table sms_template comment '短信模版';
|
|
|
|
/*==============================================================*/
|
|
/* Table: system_config */
|
|
/*==============================================================*/
|
|
create table system_config
|
|
(
|
|
id int(20) not null auto_increment,
|
|
title national varchar(32) comment '标题',
|
|
type tinyint default 0 comment '类型',
|
|
status tinyint default 0 comment '状态',
|
|
created_at bigint default 0 comment '更新时间',
|
|
updated_at bigint default 0 comment '更新时间',
|
|
config_key national varchar(64) comment '配置key',
|
|
config_value national text comment '配置value'
|
|
);
|
|
|
|
alter table system_config comment '系统配置';
|
|
|
|
/*==============================================================*/
|
|
/* Table: trans */
|
|
/*==============================================================*/
|
|
create table trans
|
|
(
|
|
id bigint not null,
|
|
vorder_id bigint,
|
|
merchant_no national varchar(32) comment '商家编号',
|
|
trans_no national varchar(32) comment '交易号',
|
|
payer_user_id national varchar(32) comment '付款人userID',
|
|
payee_user_id national varchar(32) comment '收款人userID',
|
|
status tinyint default 0 comment '交易状态',
|
|
payment_type tinyint default 1 comment '支付方式 1-支付宝 2-微信APP 3-余额 4-支付宝扫码 5-微信扫码 6-微信公众号支付',
|
|
trans_type tinyint default 1 comment '交易类型 1-支付 2-充值 3-收款 4-提现',
|
|
channel_id tinyint default 0 comment '我方为合作商分配的渠道号 0-官方渠道 其他值由逻辑决定',
|
|
channel_trade_number national varchar(128) comment '渠道方的交易序列号',
|
|
channel_user_id national varchar(64) comment '渠道方的用户ID(唯一标志)',
|
|
channel_user_name national varchar(64) comment '渠道方用户名',
|
|
trans_amount bigint default 0 comment '交易总价 单位:分',
|
|
create_time bigint default 0 comment '记录创建时间',
|
|
trans_create_time bigint default 0 comment '交易创建时间(第三方响应的支付创建时间)',
|
|
payment_time bigint default 0 comment '交易成功时间',
|
|
refund_status tinyint default 0 comment '退款状态,默认为0无退款',
|
|
invalid_time bigint default 0 comment '失效时间,微信所有支付和支付宝扫码支付用,默认2小时',
|
|
refund_time bigint default 0 comment '退款时间,默认为0无退款',
|
|
internal_callback_url national varchar(256) comment '产品的回调接口,用于支付回调',
|
|
qr_code national varchar(256) comment '扫码支付链接,用于生成二维码',
|
|
qr_url national varchar(512) comment '通过第三方api生成的支付二维码',
|
|
extend_parameter national varchar(1024) comment '扩展信息,用于存储预生成数据,失效前重复调用',
|
|
remark varchar(256) comment '备注内容'
|
|
);
|
|
|
|
alter table trans comment '交易流水';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 订单与交易流水_FK */
|
|
/*==============================================================*/
|
|
create index 订单与交易流水_FK on trans
|
|
(
|
|
vorder_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: user */
|
|
/*==============================================================*/
|
|
create table user
|
|
(
|
|
id bigint not null,
|
|
user_id national varchar(32) comment '用户id',
|
|
user_name national varchar(100) comment '登录用户名',
|
|
nick_name varchar(255) comment '昵称',
|
|
password national varchar(50) comment '登录密码',
|
|
salt national varchar(128) comment '加密用的盐',
|
|
mobile national varchar(11) comment '手机号',
|
|
sex national char(1) default M comment '性别F/M',
|
|
status tinyint default 0 comment '状态',
|
|
create_at bigint default 0 comment '创建时间',
|
|
update_at bigint default 0 comment '更新时间',
|
|
del_flag tinyint default 0 comment '删除标志'
|
|
);
|
|
|
|
alter table user comment '用户基础';
|
|
|
|
/*==============================================================*/
|
|
/* Table: user_location */
|
|
/*==============================================================*/
|
|
create table user_location
|
|
(
|
|
id bigint not null,
|
|
user_id bigint not null,
|
|
client_ip national varchar(50) comment 'ip',
|
|
client_type tinyint default 0 comment '客户端',
|
|
created_at bigint default 0 comment '上报时间',
|
|
lng decimal(10,6) default 0.000000 comment '纬度',
|
|
lat decimal(10,6) default 0.000000 comment '经度'
|
|
);
|
|
|
|
alter table user_location comment '用户上报定位信息(目前只有保洁师端有上报)';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 用户与用户定位关系_FK */
|
|
/*==============================================================*/
|
|
create index 用户与用户定位关系_FK on user_location
|
|
(
|
|
user_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: user_log */
|
|
/*==============================================================*/
|
|
create table user_log
|
|
(
|
|
id bigint unsigned not null,
|
|
user_id bigint,
|
|
client_type tinyint default 0 comment '类型',
|
|
opt_type int default 0 comment '操作类型',
|
|
created_at bigint unsigned default 0 comment '创建时间',
|
|
created_by national varchar(32) comment '创建者',
|
|
status tinyint unsigned default 0 comment '状态',
|
|
del_flag tinyint default 0 comment '删除标志',
|
|
client_ip national varchar(50) comment '客户端ip',
|
|
remark national text comment '备注'
|
|
);
|
|
|
|
alter table user_log comment '用户日志';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 用户生成操作日志_FK */
|
|
/*==============================================================*/
|
|
create index 用户生成操作日志_FK on user_log
|
|
(
|
|
user_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: user_other_oauth */
|
|
/*==============================================================*/
|
|
create table user_other_oauth
|
|
(
|
|
id bigint not null comment '主键',
|
|
user_id bigint not null,
|
|
oauth_key national varchar(32) not null comment '授权类型key如--wechat_app_open_id',
|
|
oauth_value national varchar(64) not null comment '第三方id',
|
|
status tinyint default 0 comment '当前记录的状态',
|
|
create_at bigint not null default 0 comment '创建时间',
|
|
update_at bigint default 0 comment '更新时间'
|
|
);
|
|
|
|
alter table user_other_oauth comment '用户第三方授权信息';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 用户与第三方授权关系_FK */
|
|
/*==============================================================*/
|
|
create index 用户与第三方授权关系_FK on user_other_oauth
|
|
(
|
|
user_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: user_recommend */
|
|
/*==============================================================*/
|
|
create table user_recommend
|
|
(
|
|
id bigint not null,
|
|
merchant_id bigint,
|
|
user_id bigint not null,
|
|
recommend_no national varchar(32) not null comment '推荐编号',
|
|
order_no national varchar(32) comment '订单编号',
|
|
source_nick_name national varchar(32) comment '推荐人名称',
|
|
source_user_phone national varchar(11) comment '推荐人电话',
|
|
target_user_id national varchar(32) comment '被推荐人id',
|
|
target_nick_name national varchar(32) comment '被推荐人名称',
|
|
target_user_phone national varchar(11) not null comment '被推荐人手机号码',
|
|
type tinyint default 0 comment '推荐类型 0保洁师 1用户',
|
|
status tinyint default 3 comment '状态 0 审核中 1 审核通过 2 审核不通过 3 默认,不被查找',
|
|
commission bigint default 0 comment '佣金',
|
|
remark national varchar(50) comment '描述',
|
|
create_at bigint default 0 comment '创建时间',
|
|
update_at bigint default 0 comment '更新时间',
|
|
update_by national varchar(32) comment '更新人'
|
|
);
|
|
|
|
alter table user_recommend comment '推荐表';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 用户与用户推荐关系_FK */
|
|
/*==============================================================*/
|
|
create index 用户与用户推荐关系_FK on user_recommend
|
|
(
|
|
user_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Index: 商户与用户推荐关系_FK */
|
|
/*==============================================================*/
|
|
create index 商户与用户推荐关系_FK on user_recommend
|
|
(
|
|
merchant_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: user_role */
|
|
/*==============================================================*/
|
|
create table user_role
|
|
(
|
|
admin_info_id bigint not null,
|
|
id bigint not null comment '主键id',
|
|
role_info_id int(20) comment '角色ID',
|
|
nick_name national varchar(20) comment '用户昵称',
|
|
role_name national varchar(100) comment '角色名',
|
|
create_time bigint default 0 comment '创建时间',
|
|
open_time bigint default 0 comment '开通时间',
|
|
close_time bigint default 0 comment '关闭时间',
|
|
del_flag tinyint default 0 comment '删除标志'
|
|
);
|
|
|
|
alter table user_role comment '用户角色';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 用户角色关系生成_FK */
|
|
/*==============================================================*/
|
|
create index 用户角色关系生成_FK on user_role
|
|
(
|
|
admin_info_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Index: 角色与用户关系_FK */
|
|
/*==============================================================*/
|
|
create index 角色与用户关系_FK on user_role
|
|
(
|
|
role_info_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: verify_code */
|
|
/*==============================================================*/
|
|
create table verify_code
|
|
(
|
|
id int(20) not null auto_increment,
|
|
type tinyint default 0 comment '类型',
|
|
mobile_number national varchar(16) comment '手机号码',
|
|
verify_code national varchar(8) comment '验证码',
|
|
send_at bigint default 0 comment '发送时间',
|
|
invalid_at bigint default 0 comment '失效时间',
|
|
client_ip national varchar(20) comment 'ip地址'
|
|
);
|
|
|
|
alter table verify_code comment '短信验证码';
|
|
|
|
/*==============================================================*/
|
|
/* Table: vgoods */
|
|
/*==============================================================*/
|
|
create table vgoods
|
|
(
|
|
id bigint unsigned not null,
|
|
merchant_id bigint,
|
|
vgoods_template_id int(20),
|
|
goods_no national varchar(32) comment '商品编号',
|
|
goods_version tinyint default 0 comment '商品版本',
|
|
template_version tinyint default 0 comment '商品模板版本',
|
|
name national varchar(50) comment '商品名称',
|
|
type tinyint default 0 comment '商品类型',
|
|
is_show_countdown national char(1) default N comment '是否显示倒计时,Y:是,N:否',
|
|
original_price bigint default 0 comment '原价',
|
|
price bigint default 0 comment '现价',
|
|
service_count int default 0 comment '服务次数',
|
|
cycle_mode tinyint default 0 comment '周期模式',
|
|
cycle_freq tinyint default 0 comment '周期频率',
|
|
active_period int default 0 comment '激活天数',
|
|
use_period int default 0 comment '使用天数',
|
|
created_at bigint unsigned default 0 comment '创建日期',
|
|
created_by national varchar(32) comment '创建者',
|
|
updated_at bigint unsigned default 0 comment '更新时间',
|
|
updated_by national varchar(32) comment '更新者',
|
|
started_at bigint default 0 comment '开售时间',
|
|
ended_at bigint default 0 comment '结束时间',
|
|
total_num int default 0 comment '商品总数量',
|
|
sold_num int default 0 comment '已售数量',
|
|
focused_num int default 0 comment '被关注人数',
|
|
short_desc national varchar(100) comment '简短描述',
|
|
show_img national varchar(255) comment '展示图片',
|
|
service_desc national text comment '服务描述',
|
|
banner_imgs national varchar(1000) comment 'banner图片',
|
|
evaluate_num int default 0 comment '评价个数',
|
|
evaluate_score bigint default 0 comment '评价分数',
|
|
evaluate_rate double default 0.00 comment '好评率',
|
|
status tinyint unsigned default 0 comment '商品状态',
|
|
notice national text comment '下单须知',
|
|
small_label national varchar(255) comment '小标签,以逗号相隔',
|
|
big_label national varchar(255) comment '大标签图片地址',
|
|
limit_type tinyint default 0 comment '限购方式 0不限购 1限新 2每人单次',
|
|
del_flag tinyint default 0 comment '删除标志',
|
|
sale_profit int default 0 comment '分销提成,万分比',
|
|
sequence_num int default 0 comment '排序'
|
|
);
|
|
|
|
alter table vgoods comment '虚拟商品';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 商户与商品关系_FK */
|
|
/*==============================================================*/
|
|
create index 商户与商品关系_FK on vgoods
|
|
(
|
|
merchant_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Index: 商品与商品模板关系_FK */
|
|
/*==============================================================*/
|
|
create index 商品与商品模板关系_FK on vgoods
|
|
(
|
|
vgoods_template_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: vgoods_log */
|
|
/*==============================================================*/
|
|
create table vgoods_log
|
|
(
|
|
id bigint unsigned not null,
|
|
vgoods_id bigint,
|
|
merchant_no national varchar(32) not null comment '商户编号',
|
|
user_id national varchar(32) comment '用户id',
|
|
client_type tinyint default 0 comment '类型',
|
|
opt_type int default 0 comment '操作类型',
|
|
created_at bigint unsigned default 0 comment '创建时间',
|
|
status tinyint unsigned default 0 comment '状态',
|
|
del_flag tinyint default 0 comment '删除标志',
|
|
client_ip national varchar(50) comment '客户端ip',
|
|
remark national text comment '备注'
|
|
);
|
|
|
|
alter table vgoods_log comment '商品日志';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 商品与商品操作日志关系_FK */
|
|
/*==============================================================*/
|
|
create index 商品与商品操作日志关系_FK on vgoods_log
|
|
(
|
|
vgoods_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: vgoods_template */
|
|
/*==============================================================*/
|
|
create table vgoods_template
|
|
(
|
|
id int(20) unsigned not null auto_increment,
|
|
template_no national varchar(32) not null comment '商品模版编号',
|
|
template_version tinyint default 0 comment '商品模版版本',
|
|
name national varchar(50) comment '商品名称',
|
|
type tinyint default 0 comment '商品类型',
|
|
original_price bigint default 0 comment '原价',
|
|
price bigint default 0 comment '现价',
|
|
service_count int default 0 comment '服务次数',
|
|
cycle_mode tinyint default 0 comment '周期模式',
|
|
cycle_freq tinyint default 0 comment '周期频率',
|
|
active_period int default 0 comment '激活天数',
|
|
use_period int default 0 comment '使用天数',
|
|
created_at bigint unsigned default 0 comment '创建日期',
|
|
created_by national varchar(32) comment '创建者',
|
|
updated_at bigint unsigned default 0 comment '更新日期',
|
|
updated_by national varchar(32) comment '更新者',
|
|
short_desc national varchar(100) comment '简短描述',
|
|
show_img national varchar(255) comment '展示图片',
|
|
service_desc national text comment '服务描述',
|
|
banner_imgs national varchar(1000) comment 'banner图片',
|
|
status tinyint unsigned default 0 comment '商品状态',
|
|
notice national text comment '下单须知',
|
|
small_label national varchar(255) comment '小标签,以逗号相隔',
|
|
big_label national varchar(255) comment '大标签图片地址',
|
|
limit_type tinyint default 0 comment '限购方式 0不限购 1限新 2每人单次',
|
|
del_flag tinyint default 0 comment '删除标志',
|
|
sale_profit int default 0 comment '分销提成'
|
|
);
|
|
|
|
alter table vgoods_template comment '虚拟商品模版';
|
|
|
|
/*==============================================================*/
|
|
/* Table: vorder */
|
|
/*==============================================================*/
|
|
create table vorder
|
|
(
|
|
id bigint unsigned not null,
|
|
address_id bigint,
|
|
coupon_id bigint not null,
|
|
consumer_info_id bigint,
|
|
vgoods_id bigint,
|
|
service_card_id bigint comment '主键ID',
|
|
merchant_no national varchar(32) comment '商家编号',
|
|
order_no national varchar(32) comment '订单编号',
|
|
address_full_name national varchar(100) comment '地址全称',
|
|
address_telephone national varchar(20) comment '地址电话',
|
|
region_id int default 0 comment '地区id',
|
|
linkman national varchar(32) comment '联系人',
|
|
lat decimal(10,6) default 0.000000 comment '纬度',
|
|
lng decimal(10,6) default 0.000000 comment '经度',
|
|
remark national varchar(255) comment '留言',
|
|
goods_version tinyint default 0 comment '商品版本',
|
|
goods_name national varchar(50) comment '商品名称',
|
|
goods_img_url national varchar(255) comment '商品图片地址',
|
|
goods_num int default 0 comment '商品数量',
|
|
origin_total_price bigint default 0 comment '商品总原价',
|
|
total_price bigint unsigned default 0 comment '商品现总价',
|
|
coupon_price bigint default 0 comment '优惠金额',
|
|
pay_price bigint default 0 comment '支付金额',
|
|
pay_type tinyint default 0 comment '支付类型',
|
|
pay_time bigint default 0 comment '支付时间',
|
|
order_source tinyint default 0 comment '订单来源',
|
|
status tinyint default 0 comment '订单状态',
|
|
voucher national varchar(255) comment '兑换凭证',
|
|
created_at bigint unsigned default 0 comment '创建时间',
|
|
created_by national varchar(20) comment '创建者',
|
|
updated_at bigint unsigned default 0 comment '更新时间',
|
|
updated_by national varchar(20) comment '更新者',
|
|
del_flag tinyint default 0 comment '删除标志',
|
|
sale_profit int default 0 comment '分销'
|
|
);
|
|
|
|
alter table vorder comment '虚拟订单';
|
|
|
|
/*==============================================================*/
|
|
/* Index: 客户与订单关系_FK */
|
|
/*==============================================================*/
|
|
create index 客户与订单关系_FK on vorder
|
|
(
|
|
consumer_info_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Index: 商品与订单关系_FK */
|
|
/*==============================================================*/
|
|
create index 商品与订单关系_FK on vorder
|
|
(
|
|
vgoods_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Index: 优惠券与订单关系_FK */
|
|
/*==============================================================*/
|
|
create index 优惠券与订单关系_FK on vorder
|
|
(
|
|
coupon_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Index: 地址与订单关系_FK */
|
|
/*==============================================================*/
|
|
create index 地址与订单关系_FK on vorder
|
|
(
|
|
address_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Index: 订单与服务卡关系_FK */
|
|
/*==============================================================*/
|
|
create index 订单与服务卡关系_FK on vorder
|
|
(
|
|
service_card_id
|
|
);
|
|
|
|
/*==============================================================*/
|
|
/* Table: wechat_tmplmsg */
|
|
/*==============================================================*/
|
|
create table wechat_tmplmsg
|
|
(
|
|
id int(20) not null auto_increment comment '自增编号',
|
|
tmpl_id national varchar(32) comment '模版编号',
|
|
tmpl_key national varchar(50) comment '代码调用(EnumWechatTmplKey)',
|
|
tmpl_title national varchar(50) comment '模版标题',
|
|
tmpl_status tinyint default 0 comment '模版状态(EnumWechatTmplStatus)',
|
|
tmpl_call_id national varchar(100) comment '调用模版消息ID',
|
|
tmpl_msg national text comment '模板消息参数与赋值内容',
|
|
tmpl_params national text comment '模板参数',
|
|
create_at bigint default 0 comment '创建时间',
|
|
update_at bigint default 0 comment '更新时间',
|
|
del_flag tinyint default 0 comment '删除标志'
|
|
);
|
|
|
|
alter table wechat_tmplmsg comment '微信推送消息模板';
|
|
|