Files
dk-server/sql/bus.sql
dute7liang 5b04a92a55 init
2023-12-19 22:26:38 +08:00

352 lines
18 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

CREATE TABLE `bus_order_count` (
`id` bigint(20) NOT NULL AUTO_INCREMENT comment 'id',
`count_date` date not NULL comment '订单金额',
`order_amount` bigint(11) not NULL DEFAULT 0 comment '订单金额',
`vip_amount` bigint(11) not NULL DEFAULT 0 comment '会员金额',
`qualification_amount` bigint(11) not NULL DEFAULT 0 comment '证书办理金额',
`order_num` bigint(11) not null DEFAULT 0 comment '订单销售量',
`vip_num` bigint(11) not null DEFAULT 0 comment 'vip销售量',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC comment '订单统计接口';
CREATE TABLE `bus_shop_amount_logs` (
`id` bigint(20) NOT NULL AUTO_INCREMENT comment 'id',
`shop_id` bigint(20) NOT NULL comment '商家ID',
`incs_amount` bigint(20) NOT NULL comment '修改金额',
`operator_id` bigint(20) NOT NULL comment '操作人ID',
`operator_name` varchar(200) NOT NULL comment '操作人',
`operator_remark` varchar(255) comment '操作说明',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC comment '商家修改初始化金额操作记录';
CREATE TABLE `bus_order_logs` (
`id` bigint(20) NOT NULL AUTO_INCREMENT comment 'id',
`order_id` bigint(20) NOT NULL comment '订单id',
`user_id` bigint(20) NOT NULL comment '用户id',
`user_name` varchar(200) NOT NULL comment '操作人',
`operator_step` varchar(255) comment '操作说明',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC comment '订单操作说明';
CREATE TABLE `bus_system_config` (
`id` bigint(20) NOT NULL,
`vip_auth` bit(1) DEFAULT 1 comment '是否开启Vip权限-关闭vip权限则视频和图像可直接观看',
`default_order_commit` int(2) DEFAULT 10 COMMENT '默认的平台抽佣比例 1-100',
`platform_phone` varchar(36) comment '平台电话',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC comment '系统设置';
CREATE TABLE `bus_evaluation` (
`id` bigint(20) NOT NULL,
`order_id` bigint(20) DEFAULT NULL comment '订单id',
`order_no` varchar(64) DEFAULT NULL comment '订单编号',
`service_item_id` bigint(20) default null comment '服务ID',
`content` varchar(500) DEFAULT NULL comment '评价内容-不超过500字符',
`status` int(11) NOT NULL DEFAULT 1 COMMENT '状态 0-停用 1-启用',
`customer_id` bigint(20) DEFAULT NULL COMMENT '客户ID',
`customer_avatar` varchar(255) default null comment '客户头像',
`customer_nick_name` varchar(255) default null comment '客户昵称',
`shop_id` bigint(20) DEFAULT NULL comment '商家ID',
`mechanic_id` bigint(20) DEFAULT NULL comment '技师ID',
`mechanic_nick_name` bigint(20) DEFAULT NULL comment '技师昵称',
`score` int(1) DEFAULT NULL comment '分数 1-5',
`create_time` datetime not null default now(),
`virtual` bit(1) not NULL default 0 comment '是否为虚拟评价',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC comment '评价页面';
CREATE TABLE `bus_coupon` (
`id` bigint(20) NOT NULL AUTO_INCREMENT comment 'id',
`name` varchar(255) DEFAULT NULL comment '优惠券名称',
`image` varchar(1024) DEFAULT NULL comment '优惠券图片',
`note` varchar(255) DEFAULT NULL comment '优惠券说明',
`value` bigint(11) not null comment '优惠券金额',
`use_condition` bigint(20) not null comment '优惠券使用条件',
`status` int(2) not null default 1 comment '状态 0-停用 1-启用',
`time_start` date not null comment '优惠券生效时间',
`time_end` date not null comment '优惠券结束时间',
`count` int(11) not null comment '优惠券发放数量',
`got_count` int(11) not NULL comment '优惠券已领数量',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC comment '优惠券中心';
CREATE TABLE `bus_customer` (
`id` bigint(20) NOT NULL AUTO_INCREMENT comment '客户id',
`user_id` bigint(20) NOT NULL comment '用户id',
`vip_end` date DEFAULT NULL comment 'vip到期时间',
`vip` bit(1) default 0 comment '是否为vip',
`avatar` varchar(255) comment '客户头像',
`nick_name` varchar(255) comment '客户昵称',
`phone` varchar(13) comment '客户电话',
`sex` tinyint(2) DEFAULT NULL comment '性别 0 男 1 女',
`merchant` bit(1) default 0 comment '是否商家入驻',
`mechanic` bit(1) default 0 comment '是否技师入驻',
PRIMARY KEY (`id`),
KEY `user_idx` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC comment '客户管理';
CREATE TABLE `bus_customer_star` (
`id` bigint(20) NOT NULL AUTO_INCREMENT comment 'id',
`user_id` bigint(20) NOT NULL comment '客户id',
`star_mechanic_id` bigint(20) NOT NULL comment '关注的技师ID',
PRIMARY KEY (`id`),
KEY `user_idx` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC comment '客户关注技师表';
CREATE TABLE `bus_customer_address` (
`id` bigint(20) NOT NULL AUTO_INCREMENT comment 'id',
`user_id` bigint(20) NOT NULL comment '用户id',
`customer_id` bigint(20) NOT NULL comment '客户id',
`address` varchar(1024) DEFAULT NULL comment '地址',
`house_number` varchar(64) DEFAULT NULL comment '门牌号',
`longitude` decimal(30,8) DEFAULT NULL COMMENT '经度',
`latitude` decimal(30,8) DEFAULT NULL COMMENT '纬度',
`name` varchar(255) NOT NULL comment '用户名称',
`phone` varchar(64) NOT NULL comment '用户手机',
`be_default` bit(1) NOT NULL default 0 comment '是否默认地址 0-不默认 1-默认',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC comment '客户地址管理';
CREATE TABLE `bus_customer_coupon` (
`id` bigint(20) NOT NULL AUTO_INCREMENT comment '客户id',
`name` varchar(255) DEFAULT NULL comment '优惠券名称',
`image` varchar(1024) DEFAULT NULL comment '优惠券图片',
`note` varchar(255) DEFAULT NULL comment '优惠券说明',
`value` bigint(11) not null comment '优惠券金额',
`use_condition` bigint(20) not null comment '优惠券使用条件',
`time_start` date not null comment '优惠券生效时间',
`time_end` date not null comment '优惠券结束时间',
`used` bit(1) DEFAULT 0 not null comment '是否使用',
`user_id` bigint(20) not NULL comment '用户id',
`sys_coupon_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `user_idx` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC comment '客户优惠券';
CREATE TABLE `bus_mechanic` (
`id` bigint(20) NOT NULL AUTO_INCREMENT comment '技师id',
`user_id` bigint(20) NOT NULL comment '用户id',
`income` bigint(20) NOT NULL DEFAULT 0 comment '收入',
`balance` bigint(20) NOT NULL DEFAULT 0 comment '余额',
`work_time_start` varchar(64) comment '开始接单时间',
`work_time_end` varchar(64) comment '结束接单时间',
`qualification` varchar(2048) comment '资格证书图片',
`identity_body` varchar(2048) comment '实名信息',
`status` int(2) DEFAULT NULL comment '状态 0-未审核 1-审核通过 3-暂停服务',
`service_items` varchar(255) DEFAULT NULL,
`service_year` int(3) comment '服务年限',
`phone_auth` bit(1) default 1 comment '手机认证',
`avatar_auth` bit(1) default 1 comment '头像认证',
`identity_auth` bit(1) default 1 comment '实名认证',
`health_auth` bit(1) default 1 comment '健康档案',
`qua_auth` bit(1) default 1 comment '资质档案',
`shop_id` bigint(20) comment '所属店铺',
`similarity` int(3) comment '头像相识度',
`order_count` int(11) not null default 0 comment '接单数量',
`applause_rate` int(11) not null default 100 comment '好评率',
`sex` int(2) comment '性别 0 男 1 女',
`avatar` varchar(255) comment '技师头像',
`real_avatar` varchar(255) comment '真实头像',
`read_name` varchar(64) comment '技师真实名称',
`nick_name` varchar(64) comment '技师昵称',
`address` varchar(255) DEFAULT NULL comment '技师地址',
`technical_title` varchar(1024) DEFAULT NULL,
`favorite_count` int(11) comment '关注数量' DEFAULT NULL,
`service_status` int(2) NOT NULL default 1 comment '接单状态 0 下线 1 在线',
`phone` varchar(64) NOT NULL comment '技师手机号码',
`remark` varchar(512) DEFAULT NULL comment '自我介绍',
`city` varchar(255) DEFAULT NULL,
`sign_time` datetime default null comment '签约时间',
`join_time` datetime default null comment '注册时间',
`app_type` varchar(10) DEFAULT NULL comment '所属APP',
`red_card` bit(1) DEFAULT b'0' COMMENT '红牌技师',
`longitude` decimal(30,8) DEFAULT NULL COMMENT '经度',
`latitude` decimal(30,8) DEFAULT NULL COMMENT '纬度',
`audit_avatar` varchar(255) DEFAULT NULL COMMENT '待审核的头像 - 空表示没有',
`audit_avatar_status` int(2) DEFAULT NULL COMMENT '头像审核状态 - 0-无审核 1-审核中 -1-审核失败',
`audit_avatar_message` varchar(255) DEFAULT NULL COMMENT '头像原因',
`limit_distance` int(5) NOT NULL DEFAULT '0' COMMENT '最大接单距离',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC comment '技师管理';
CREATE TABLE `bus_mechanic_info` (
`id` bigint(20) NOT NULL AUTO_INCREMENT comment 'id',
`user_id` bigint(20) NOT NULL comment '用户id',
`mechanic_id` bigint(20) NOT NULL DEFAULT 0 comment '技师id',
`info_type` int(2) NOT NULL comment '1-照片 2-视频',
`info_url` varchar(125) comment '内容',
`status` int(2) not null comment '状态 0-正常 1-下架',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC comment '技师照片-视频管理';
CREATE TABLE `bus_shop` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) NOT NULL comment '用户id',
`shop_avatar` varchar(1024) DEFAULT NULL comment '店铺头像',
`nick_name` varchar(255) DEFAULT NULL comment '企业昵称',
`id_front_url` varchar(255) DEFAULT NULL comment '身份证正面',
`id_back_url` varchar(255) DEFAULT NULL comment '身份证背面',
`id_hand_url` varchar(255) DEFAULT NULL comment '手持身份证照片',
`license_url` varchar(255) DEFAULT NULL comment '营业执照图片',
`capital` varchar(255) DEFAULT NULL comment '注册资本',
`shop_name` varchar(255) DEFAULT NULL comment '企业名称',
`address` varchar(512) DEFAULT NULL comment '店铺地址',
`shop_code` varchar(128) DEFAULT NULL comment '统一社会信用代码',
`invite_code` varchar(16) DEFAULT NULL comment '邀请码',
`introduction` varchar(500) COMMENT '店铺简介不超过500字符',
`legal_person` varchar(50) comment '店铺法人',
`mechanic_count` int(11) DEFAULT 0 comment '技师数量',
`order_count` int(11) DEFAULT 0 comment '订单数量',
`amount` bigint(20) DEFAULT 0 comment '余额',
`total_income` bigint(20) DEFAULT 0 comment '累计收入',
`register_date` datetime default now() comment '注册时间',
`in_time` datetime comment '审核时间',
`commission_rate` int(3) not null default 10 comment '平台提成',
`stop_status` int(2) default 0 not null comment '暂停状态',
`audit_status` int(2) default 0 not null comment '审核状态 0-待审核 1-审核通过 -1-审核失败',
`wx_open_id` varchar(64) DEFAULT NULL comment 'wxOpenId',
`wx_nick_name` varchar(64) DEFAULT NULL comment '微信昵称',
`wx_avatar` varchar(64) DEFAULT NULL comment '微信头像',
`bank_card_no` varchar(128) DEFAULT NULL comment '银行卡号',
`bank_card_name` varchar(128) DEFAULT NULL comment '银行卡姓名',
`bank` varchar(512) DEFAULT NULL comment '银行名称',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC comment '商家管理';
CREATE TABLE `bus_service_item` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL comment '服务名称',
`service_time` int(11) DEFAULT NULL comment '服务时间',
`offline_price` bigint(20) DEFAULT NULL comment '线下价格',
`online_price` bigint(10) DEFAULT NULL comment '线上价格',
`level` int(11) DEFAULT NULL comment '服务星级(0,1,2,3,4,5)',
`image` varchar(2048) DEFAULT NULL comment '项目头像',
`status` int(2) default 0 not null comment '是否上线(0下线 1上线)',
# `part` varchar(2048) comment '',
`shop_id` bigint(20) comment '所属店铺',
`order_count` int(11) DEFAULT 0 comment '下单数量',
`audit_status` int(2) NOT NULL DEFAULT '0' COMMENT '审核状态 0-待审核 1-审核通过 -1-审核失败',
`audit_message` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC comment '服务管理';
CREATE TABLE `bus_item_assign` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`mechanic_id` bigint(20) DEFAULT NULL,
`item_id` bigint(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC comment '技师-服务';
CREATE TABLE `bus_banner` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`banner_url` varchar(255) DEFAULT NULL comment 'banner图',
`status` int(2) default 1 not null comment '状态 0-停用 1-启用',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC comment 'banner图';
CREATE TABLE `bus_order` (
`id` bigint(20) NOT NULL,
`trade_no` varchar(128) DEFAULT NULL,
`customer_id` bigint(20) NOT NULL comment '客户ID',
`customer_phone` varchar(64) DEFAULT NULL comment '客户预约手机',
`customer_name` varchar(64) DEFAULT NULL comment '客户预约名称',
`customer_address` varchar(1024) DEFAULT NULL comment '客户地址',
`customer_address_c` varchar(1024) DEFAULT NULL comment '客户坐标',
`mechanic_id` bigint(20) NOT NULL comment '技师id',
`mechanic_address` varchar(1024) DEFAULT NULL comment '技师地址',
`mechanic_address_c` varchar(1024) DEFAULT NULL comment '技师坐标',
`mechanic_avatar` varchar(255) comment '技师头像',
`mechanic_nick_name` varchar(255) comment '技师昵称',
`shop_id` bigint(11) NOT NULL comment '商家id',
`service_item_id` bigint(20) DEFAULT NULL comment '服务id',
`coupon_id` bigint(20) default null comment '优惠券id',
`coupon` bigint(20) default null comment '优惠券抵扣',
`fare` bigint(20) default 0 comment '车费',
`price` bigint(20) default 0 NOT NULL comment '商品价格',
`amount` bigint(20) default 0 not NULL comment '最终实付金额',
`boss_amount` int(11) DEFAULT 0 comment '平台收入',
`commission_rate` int(3) DEFAULT 0 comment '平台利润',
`notes` varchar(255) DEFAULT NULL comment '备注',
`pay_status` int(11) not null default 0 comment '支付状态 0-未支付 1-已支付 2-已退款',
`service_status` int(11) not NULL default 0 comment '服务状态 0-未接单 1-已接单 2-已完成',
`pay_type` int(11) DEFAULT NULL comment '支付类型 1-支付宝 2-微信',
`appraise` bit(1) not NULL default 0 comment '是否评价',
`create_time` datetime not NULL default now() comment '创建时间',
`pay_time` datetime comment '支付时间',
`order_time` datetime comment '预约时间',
`service_time` datetime comment '接单时间',
`complete_time` datetime comment '完成时间',
`distance` varchar(255) comment '距离',
`agent` varchar(10) DEFAULT NULL,
`delete_flag` int(2) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC comment '订单管理';
CREATE TABLE `bus_order` (
`id` bigint(20) NOT NULL,
`trade_no` varchar(128) DEFAULT NULL,
`customer_id` bigint(20) NOT NULL comment '客户ID',
`customer_phone` varchar(64) DEFAULT NULL comment '客户预约手机',
`customer_name` varchar(64) DEFAULT NULL comment '客户预约名称',
`customer_address` varchar(1024) DEFAULT NULL comment '客户地址',
`customer_address_c` varchar(1024) DEFAULT NULL comment '客户坐标',
`mechanic_id` bigint(20) NOT NULL comment '技师id',
`mechanic_address` varchar(1024) DEFAULT NULL comment '技师地址',
`mechanic_address_c` varchar(1024) DEFAULT NULL comment '技师坐标',
`mechanic_avatar` varchar(255) comment '技师头像',
`mechanic_nick_name` varchar(255) comment '技师昵称',
`shop_id` bigint(11) NOT NULL comment '商家id',
`service_item_id` bigint(20) DEFAULT NULL comment '服务id',
`coupon_id` bigint(20) default null comment '优惠券id',
`coupon` bigint(20) default null comment '优惠券抵扣',
`fare` bigint(20) default 0 comment '车费',
`price` bigint(20) default 0 NOT NULL comment '商品价格',
`amount` bigint(20) default 0 not NULL comment '最终实付金额',
`boss_amount` int(11) DEFAULT 0 comment '平台收入',
`commission_rate` int(3) DEFAULT 0 comment '平台利润',
`notes` varchar(255) DEFAULT NULL comment '备注',
`pay_status` int(11) not null default 0 comment '支付状态 0-未支付 1-已支付 2-已退款',
`service_status` int(11) not NULL default 0 comment '服务状态 0-未接单 1-已接单 2-已完成',
`pay_type` int(11) DEFAULT NULL comment '支付类型 1-支付宝 2-微信',
`appraise` bit(1) not NULL default 0 comment '是否评价',
`create_time` datetime not NULL default now() comment '创建时间',
`pay_time` datetime comment '支付时间',
`order_time` datetime comment '预约时间',
`service_time` datetime comment '接单时间',
`complete_time` datetime comment '完成时间',
`distance` int(20) comment '距离-单位米',
`agent` varchar(10) DEFAULT NULL,
`delete_flag` int(2) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC comment '订单管理';