Files
pj_service_cloud/db/800pjcloudx_hardware.sql
T
2025-04-10 11:20:40 +08:00

402 lines
25 KiB
SQL

create
database `pjcloudx_hardware` default character set utf8mb4 collate utf8mb4_general_ci;
-- ----------------------------
-- Table structure for hard_manager
-- ----------------------------
DROP TABLE IF EXISTS `hard_manager`;
CREATE TABLE hard_manager
(
id bigint NOT NULL COMMENT '编号',
merchant_id bigint COMMENT '商户id',
hard_group_id bigint COMMENT '分组id',
dept_id bigint COMMENT '商家部门id',
name varchar(128) NOT NULL COMMENT '设备名',
type char(10) NOT NULL COMMENT '设备类型',
mq_client_id varchar(256) COMMENT 'mq连接id',
unique_code varchar(128) COMMENT '设备唯一编号',
main_topic varchar(128) COMMENT '当前设备的topic',
mq_socket_address varchar(128) COMMENT 'mq地址',
mq_socket_port varchar(128) COMMENT 'mq端口',
mq_username varchar(128) COMMENT 'mq用户名',
mq_password varchar(128) COMMENT 'mq密码',
is_take_food char(1) DEFAULT '0' COMMENT '是否为当前商户的取餐机器',
face_app_id varchar(256) COMMENT '人脸appid',
face_sdk_key varchar(256) COMMENT '人脸sdkKey',
face_active_key varchar(256) COMMENT '人脸activeKey',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT ='设备管理';
-- ----------------------------
-- Table structure for hard_door_manager
-- ----------------------------
DROP TABLE IF EXISTS `hard_door_manager`;
CREATE TABLE hard_door_manager
(
id bigint NOT NULL COMMENT '编号',
hard_id bigint NOT NULL COMMENT '设备编号',
imei varchar(32) NOT NULL COMMENT '设备 IMEI 号(15 位)',
device_code int DEFAULT NULL COMMENT '设备编号',
cabinet_num int DEFAULT NULL COMMENT '货柜数量',
door_count int DEFAULT NULL COMMENT '货柜层数',
cabinet_camera_num int DEFAULT NULL COMMENT '每个货柜中摄像头数量',
cabinet_weight_unit_num int DEFAULT NULL COMMENT '每个货柜中称重单元数量',
power_status int DEFAULT NULL COMMENT '1:通电;2:断电',
net_status int DEFAULT NULL COMMENT '在线状态。1:在线;2:离线',
sale_status int DEFAULT NULL COMMENT '售卖状态。1:在售;2:停售',
signal_intensity int DEFAULT NULL COMMENT 'sim 信号强度。大于-95 表示信号强度好;-95 到-105 表示信号强度中等;小于-105 表示信号差;',
signal_ratio int DEFAULT NULL COMMENT '信噪比,体现信道传输质量的参数。大于 15 表示质量好;15 到 0 表示质量中等;小于等于 0 表示质量差;',
signal_time int DEFAULT NULL COMMENT 'sim 信号值更新时间。yyyy-MM-dd HH:mm:ss',
cabinet_list text DEFAULT NULL COMMENT '货柜列表JSON',
restart_time datetime DEFAULT NULL COMMENT '上次重启时间',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT ='柜子设备管理';
-- ----------------------------
-- Table structure for hard_group
-- ----------------------------
DROP TABLE IF EXISTS `hard_group`;
CREATE TABLE hard_group
(
id bigint NOT NULL COMMENT '编号',
dept_id bigint COMMENT '部门id',
name varchar(128) NOT NULL COMMENT '分组名',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT ='设备分组管理';
-- ----------------------------
-- Table structure for hard_invoice
-- ----------------------------
DROP TABLE IF EXISTS `hard_invoice`;
CREATE TABLE hard_invoice
(
id bigint NOT NULL COMMENT '编号',
dept_id bigint NOT NULL COMMENT '部门id',
hard_id bigint NOT NULL COMMENT '设备id',
order_id bigint NOT NULL COMMENT '硬件订单id',
status char(10) NOT NULL COMMENT '状态',
pic varchar(256) NOT NULL COMMENT '发票图片',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT ='发票记录';
-- ----------------------------
-- Table structure for hard_car
-- ----------------------------
DROP TABLE IF EXISTS `hard_car`;
CREATE TABLE hard_car
(
id bigint NOT NULL COMMENT '编号',
parent_car_id bigint NOT NULL COMMENT '父购物车id',
product_id bigint NOT NULL COMMENT '商品id',
product_name varchar(128) NOT NULL COMMENT '商品名',
product_pic varchar(256) NOT NULL COMMENT '商品图片',
product_price bigint NOT NULL COMMENT '商品价格',
product_count int NOT NULL COMMENT '数量',
product_weight decimal(10, 2) COMMENT '重量',
total_price bigint COMMENT '总价(分)',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT ='购物车表';
-- ----------------------------
-- Table structure for hard_parent_car
-- ----------------------------
DROP TABLE IF EXISTS `hard_parent_car`;
CREATE TABLE hard_parent_car
(
id bigint NOT NULL COMMENT '标号',
user_id bigint NOT NULL COMMENT '用户id',
merchant_id bigint NOT NULL COMMENT '商户id',
hard_type char(10) NOT NULL COMMENT '设备类型',
order_status char(10) NOT NULL COMMENT '订单状态',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT ='父订单表';
-- ----------------------------
-- Table structure for hard_order
-- ----------------------------
DROP TABLE IF EXISTS `hard_order`;
CREATE TABLE hard_order
(
id bigint NOT NULL COMMENT '编号',
user_id bigint NOT NULL COMMENT '用户id',
merchant_id bigint COMMENT '商户id',
hard_id bigint COMMENT '设备id',
dept_id bigint COMMENT '部门id',
wallet_id bigint COMMENT '钱包id',
parent_car_id bigint NOT NULL COMMENT '购物车父id',
order_source_type_id bigint COMMENT '订单类型渠道id',
order_type char(10) NOT NULL COMMENT '订单类型',
order_status char(10) NOT NULL COMMENT '订单状态',
pay_type char(10) NOT NULL COMMENT '支付方式',
hour_type char(10) COMMENT '用餐类型',
sys_type char(10) COMMENT '订单设备类型',
total_price int NOT NULL COMMENT '总价(分)',
extra_price int DEFAULT 0 NOT NULL COMMENT '额外价格(分)',
pay_price int DEFAULT 0 COMMENT '支付金额(分)',
pay_time timestamp COMMENT '支付时间',
pay_refund_id bigint COMMENT '支付退款单号',
refund_price int COMMENT '退款金额,单位:分',
refund_time timestamp COMMENT '退款完成时间',
refund_status char(10) COMMENT '退款状态',
apply_cancel_time timestamp COMMENT '订单取消时间',
android_order_code varchar(128) COMMENT '设备上的唯一订单号',
is_offline_order char(1) DEFAULT 0 NOT NULL COMMENT '是否为离线订单',
product_desc varchar(256) DEFAULT '' NOT NULL COMMENT '商品描述',
offline_pay_success char(1) COMMENT '离线自动支付是否成功',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB COMMENT ='订单表';
-- ----------------------------
-- Table structure for hard_after_sale
-- ----------------------------
DROP TABLE IF EXISTS hard_after_sale;
CREATE TABLE hard_after_sale
(
id bigint NOT NULL COMMENT '售后编号',
no varchar(32) NOT NULL COMMENT '售后单号',
type char(10) COMMENT '售后类型',
status char(10) DEFAULT 0 NOT NULL COMMENT '售后状态',
way char(10) NOT NULL COMMENT '售后方式',
user_id bigint NOT NULL COMMENT '用户id',
apply_reason varchar(255) NOT NULL COMMENT '申请原因',
apply_description varchar(255) COMMENT '补充描述',
apply_pic_urls varchar(255) COMMENT '补充凭证图片',
order_id bigint NOT NULL COMMENT '订单编号',
order_no varchar(32) COMMENT '订单流水号',
audit_time timestamp DEFAULT CURRENT_TIMESTAMP COMMENT '审批时间',
audit_user_id bigint COMMENT '审批人',
audit_reason varchar(255) COMMENT '审批备注',
refund_price int DEFAULT 0 NOT NULL COMMENT '退款金额,单位:分',
pay_refund_id bigint COMMENT '支付退款编号',
refund_time timestamp DEFAULT CURRENT_TIMESTAMP COMMENT '退款时间',
delivery_time timestamp COMMENT '退货时间',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB COMMENT ='售后订单';
-- ----------------------------
-- Table structure for hard_after_sale_log
-- ----------------------------
DROP TABLE IF EXISTS hard_after_sale_log;
CREATE TABLE hard_after_sale_log
(
id bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
user_id bigint NOT NULL COMMENT '用户编号',
after_sale_id bigint NOT NULL COMMENT '售后编号',
before_status char(10) COMMENT '售后状态(之前)',
after_status char(10) NOT NULL COMMENT '售后状态(之后)',
operate_type char(10) NOT NULL COMMENT '操作类型',
content varchar(512) NOT NULL COMMENT '操作明细',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB COMMENT ='售后订单日志';
-- ----------------------------
-- Table structure for hard_broadcast
-- ----------------------------
DROP TABLE IF EXISTS hard_broadcast;
CREATE TABLE hard_broadcast
(
id bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
user_id bigint NOT NULL COMMENT '预定用户',
hard_id bigint NOT NULL COMMENT '硬件id',
topic varchar(128) NOT NULL COMMENT 'mq主题',
biz_id varchar(64) NOT NULL COMMENT '关联业务编号',
title varchar(64) NOT NULL COMMENT '预定标题',
unique_code varchar(16) NOT NULL COMMENT '广播唯一编号',
broadcast_count int DEFAULT 0 NOT NULL COMMENT '广播次数',
is_broadcast char(1) DEFAULT '0' COMMENT '是否广播语音',
is_done char(1) DEFAULT '0' COMMENT '是否完成',
is_done_time datetime DEFAULT NULL COMMENT '完成时间',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB COMMENT ='设备广播';
-- ----------------------------
-- Table structure for hard_auth
-- ----------------------------
DROP TABLE IF EXISTS hard_auth;
CREATE TABLE hard_auth
(
id bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
user_id bigint NOT NULL COMMENT '预定用户',
hard_id bigint NOT NULL COMMENT '硬件id',
auth_status char(1) DEFAULT '0' COMMENT '是否授权',
auth_time datetime DEFAULT NULL COMMENT '授权时间',
is_done char(1) DEFAULT '0' COMMENT '是否完成',
is_done_time datetime DEFAULT NULL COMMENT '完成时间',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB COMMENT ='硬件授权';
-- ----------------------------
-- Table structure for hard_spu
-- ----------------------------
DROP TABLE IF EXISTS hard_spu;
CREATE TABLE hard_spu
(
id bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
spu_category_id bigint NOT NULL COMMENT '商品分类id',
name varchar(64) NOT NULL COMMENT '商品名',
pic varchar(256) NOT NULL COMMENT '商品图片',
price int NOT NULL COMMENT '单价(分)',
sales_count int DEFAULT 0 NOT NULL COMMENT '销量',
repertory_count int DEFAULT 0 NOT NULL COMMENT '库存',
sort int DEFAULT 0 NOT NULL COMMENT '排序',
status char(1) DEFAULT '0' COMMENT '是否启用',
is_default char(1) DEFAULT '0' COMMENT '是否为标品',
specs_taste varchar(128) DEFAULT NULL COMMENT '规格-口味',
specs_capacity varchar(128) DEFAULT NULL COMMENT '规格-容量',
specs_weight varchar(128) DEFAULT NULL COMMENT '规格-重量',
sku_type varchar(32) DEFAULT NULL COMMENT 'sku类型,0:标准库;1:私有库 ',
ks_barcode varchar(32) DEFAULT NULL COMMENT '69码',
ks_has_sub_sku varchar(128) DEFAULT NULL COMMENT '是否为集合SKU',
ks_sub_sku text DEFAULT NULL COMMENT '集合SKU的子SKU信息',
ks_status char(1) DEFAULT NULL COMMENT '旷世审核状态',
ks_status_title varchar(64) DEFAULT NULL COMMENT '旷世审核状态标题',
ks_comments varchar(512) DEFAULT NULL COMMENT '旷世审核状态描述',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB COMMENT ='硬件商品';
-- ----------------------------
-- Table structure for hard_spu_join
-- ----------------------------
DROP TABLE IF EXISTS hard_spu_join;
CREATE TABLE hard_spu_join
(
id bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
hard_door_id bigint DEFAULT NULL COMMENT '硬件柜子id',
cabinet_no varchar(32) DEFAULT NULL COMMENT '货柜编号',
spu_id bigint DEFAULT NULL COMMENT '商品id',
hard_door_number int DEFAULT NULL COMMENT '商品放置层数',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB COMMENT ='硬件商品绑定';
-- ----------------------------
-- Table structure for hard_spu_category
-- ----------------------------
DROP TABLE IF EXISTS hard_spu_category;
CREATE TABLE hard_spu_category
(
id bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
name varchar(64) NOT NULL COMMENT '分类名',
sort int DEFAULT 0 NOT NULL COMMENT '排序',
mch_id bigint DEFAULT NULL COMMENT '商户id',
mch_dept_id bigint DEFAULT NULL COMMENT '商户部门id',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB COMMENT ='硬件商品分类';
-- ----------------------------
-- Table structure for hard_spu_repertory
-- ----------------------------
DROP TABLE IF EXISTS hard_spu_repertory;
CREATE TABLE hard_spu_repertory
(
id bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
user_id bigint NOT NULL COMMENT '用户id',
hard_id bigint NOT NULL COMMENT '设备id',
spu_id bigint NOT NULL COMMENT '商品id',
before_count int NOT NULL COMMENT '更新前的库存数量',
count int DEFAULT 0 COMMENT '更新库存数量',
biz_type tinytext NOT NULL COMMENT '上架类型',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB COMMENT ='硬件商品库存更新记录';