etrade_admin.sql 17.7 KB
USE dili_etrade;

DROP TABLE IF EXISTS `banner`;
CREATE TABLE `banner`  (
    `id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增ID',
    `created_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `modified_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
    `creater_id` bigint NOT NULL COMMENT '创建人ID',
    `creater` varchar(50) NOT NULL COMMENT '创建人姓名',
    `modifier_id` bigint NULL DEFAULT NULL COMMENT '修改人ID',
    `modifier` varchar(50) NULL DEFAULT NULL COMMENT '修改人名字',
    `sort` int NOT NULL COMMENT '排序',
    `banner_type_id` bigint NOT NULL COMMENT '轮播图所属类型ID',
    `title` varchar(25) NOT NULL COMMENT '标题',
    `pic_url` varchar(255) NULL DEFAULT NULL COMMENT '图片链接',
    `link_type` int NULL DEFAULT NULL COMMENT '链接类型(枚举)',
    `link` varchar(255) NULL DEFAULT NULL COMMENT '链接',
    `remark` varchar(255) NULL DEFAULT NULL COMMENT '备注',
    `state` tinyint(1) NOT NULL COMMENT '状态:禁用0,启用1',
    `market_id` bigint NOT NULL COMMENT '市场ID',
    `deleted` tinyint(1) NOT NULL COMMENT '是否删除:已删除0,未删除1',
    `version` int NOT NULL DEFAULT 1 COMMENT '版本号',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 COMMENT='内容管理-轮播图';

DROP TABLE IF EXISTS `banner_type`;
CREATE TABLE `banner_type`  (
    `id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增ID',
    `created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `modified_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
    `creater_id` bigint NULL DEFAULT NULL COMMENT '创建人ID',
    `creater` varchar(50) NULL DEFAULT NULL COMMENT '创建人姓名',
    `sort` int NULL DEFAULT NULL COMMENT '排序',
    `name` varchar(20) NOT NULL COMMENT '轮播图类型名称',
    `state` tinyint(1) NOT NULL COMMENT '状态:禁用0,启用1',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 COMMENT='内容管理-轮播图类型';

DROP TABLE IF EXISTS `market_config`;
CREATE TABLE `market_config`  (
    `id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增ID',
    `created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `modified_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
    `creater_id` bigint NOT NULL COMMENT '创建人ID',
    `creater` varchar(50) NOT NULL COMMENT '创建人姓名',
    `modifier_id` bigint NULL DEFAULT NULL COMMENT '修改人ID',
    `modifier` varchar(50) NULL DEFAULT NULL COMMENT '修改人名字',
    `market_id` bigint NOT NULL COMMENT '市场ID',
    `market_code` varchar(20) NOT NULL COMMENT '市场编号',
    `simple_name` varchar(30) DEFAULT NULL COMMENT '市场简称',
    `market_name` varchar(50) NOT NULL COMMENT '市场名称',
    `state` tinyint(1) NOT NULL COMMENT '状态:关闭0,开通1',
    `source` tinyint NOT NULL COMMENT '数据应用平台,来源',
    PRIMARY KEY (`id`) USING BTREE,
    UNIQUE INDEX `u_idx_market_source`(`market_id`, `source`) USING BTREE COMMENT '同市场和来源的开关配置唯一索引'
) ENGINE = InnoDB AUTO_INCREMENT = 1 COMMENT='市场选择开关配置';

DROP TABLE IF EXISTS `issue`;
CREATE TABLE `issue`  (
    `id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增ID',
    `created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `modified_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
    `creater_id` bigint NOT NULL COMMENT '创建人ID',
    `creater` varchar(50) NOT NULL COMMENT '创建人姓名',
    `modifier_id` bigint NULL DEFAULT NULL COMMENT '修改人ID',
    `modifier` varchar(50) NULL DEFAULT NULL COMMENT '修改人名字',
    `sort` int NOT NULL COMMENT '排序',
    `issue_type_id` bigint NOT NULL COMMENT '问题类型ID',
    `title` varchar(100) NOT NULL COMMENT '问题名称',
    `content` varchar(100) NOT NULL COMMENT '问题内容',
    `issue_answer_id` bigint NOT NULL COMMENT '问题回答描述ID',
    `remark` varchar(255) NULL DEFAULT NULL COMMENT '备注',
    `state` tinyint(1) NOT NULL COMMENT '状态:禁用0,启用1',
    `market_id` bigint NOT NULL COMMENT '市场ID',
    `version` int NOT NULL DEFAULT 1 COMMENT '版本号',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 COMMENT='客服-问题';

DROP TABLE IF EXISTS `issue_answer`;
CREATE TABLE `issue_answer`  (
    `id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增ID',
    `answer` text  NOT NULL COMMENT '问题回答描述',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 COMMENT='客服-问题回答';

DROP TABLE IF EXISTS `issue_manager`;
CREATE TABLE `issue_manager`  (
    `id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增ID',
    `created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `modified_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
    `creater_id` bigint NOT NULL COMMENT '创建人ID',
    `creater` varchar(50) NOT NULL COMMENT '创建人姓名',
    `modifier_id` bigint NULL DEFAULT NULL COMMENT '修改人ID',
    `modifier` varchar(50) NULL DEFAULT NULL COMMENT '修改人名字',
    `sort` int NOT NULL COMMENT '排序',
    `name` varchar(20) NOT NULL COMMENT '接线员名字',
    `content` varchar(50) NOT NULL COMMENT '接线员描述',
    `head_pic_url` varchar(255) NOT NULL COMMENT '接线员头像图片URL',
    `weixin_pic_url` varchar(255) NOT NULL COMMENT '接线员企业微信图片URL',
    `remark` varchar(255) NULL DEFAULT NULL COMMENT '备注',
    `state` tinyint(1) NOT NULL COMMENT '状态:禁用0,启用1',
    `market_id` bigint NOT NULL COMMENT '市场ID',
    `version` int NOT NULL DEFAULT 1 COMMENT '版本号',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 COMMENT='客服-接线员';

DROP TABLE IF EXISTS `issue_type`;
CREATE TABLE `issue_type`  (
    `id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增ID',
    `created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `modified_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
    `creater_id` bigint NOT NULL COMMENT '创建人ID',
    `creater` varchar(50) NOT NULL COMMENT '创建人姓名',
    `modifier_id` bigint NULL DEFAULT NULL COMMENT '修改人ID',
    `modifier` varchar(50) NULL DEFAULT NULL COMMENT '修改人名字',
    `sort` int NOT NULL COMMENT '排序',
    `name` varchar(20) NOT NULL COMMENT '问题类型名称',
    `remark` varchar(255) NULL DEFAULT NULL COMMENT '备注',
    `state` tinyint(1) NOT NULL COMMENT '状态:禁用0,启用1',
    `market_id` bigint NOT NULL COMMENT '市场ID',
    `version` int NOT NULL DEFAULT 1 COMMENT '版本号',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 COMMENT='客服-问题类型';

CREATE TABLE `market_location`  (
    `id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
    `created_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
    `modified_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
    `market_id` bigint(0) NOT NULL COMMENT '市场ID',
    `market_code` varchar(20) NULL DEFAULT NULL,
    `market_name` varchar(50) NULL DEFAULT NULL,
    `market_gitude` decimal(10, 6) NULL DEFAULT NULL COMMENT '市场纬度',
    `market_latitude` decimal(10, 6) NULL DEFAULT NULL COMMENT '市场经度',
    `market_img` varchar(255) NULL DEFAULT NULL COMMENT '小程序登录选择市场--背景图',
    PRIMARY KEY (`id`) USING BTREE,
    KEY `idx_market_id` (`market_id`) USING BTREE COMMENT '市场ID索引'
) ENGINE = InnoDB COMMENT = '市场位置信息经纬度配置' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for store_customer
-- ----------------------------
DROP TABLE IF EXISTS `dili_etrade`.`store_customer`;
CREATE TABLE `dili_etrade`.`store_customer`  (
    `id` bigint NOT NULL AUTO_INCREMENT,
    `name` varchar(50) NOT NULL COMMENT '客户名称',
    `remark` varchar(50) NULL DEFAULT NULL COMMENT '备注',
    `store_id` bigint NOT NULL COMMENT '商家id(所属客户id)',
    `market_id` bigint NOT NULL COMMENT '市场id',
    `customer_cellphone_id` bigint NOT NULL COMMENT 'store_customer_cellphone id',
    `deleted` tinyint NOT NULL COMMENT '是否删除',
    `creator_id` bigint NULL DEFAULT NULL COMMENT '创建人id',
    `creator_name` varchar(50) NULL DEFAULT NULL COMMENT '创建人',
    `creator_source` tinyint NULL DEFAULT NULL COMMENT '创建来源',
    `created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `modifer_id` bigint NULL DEFAULT NULL COMMENT '更改人id',
    `modifer_name` varchar(50) NULL DEFAULT NULL COMMENT '更改人',
    `modifer_source` tinyint NULL DEFAULT NULL,
    `modifed_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更改时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for store_customer_cellphone
-- ----------------------------
DROP TABLE IF EXISTS `dili_etrade`.`store_customer_cellphone`;
CREATE TABLE `dili_etrade`.`store_customer_cellphone`  (
    `id` bigint NOT NULL AUTO_INCREMENT,
    `cellphone` varchar(20) NOT NULL COMMENT '电话号码',
    `state` tinyint NOT NULL COMMENT '状态',
    `invite_time` datetime NULL DEFAULT NULL COMMENT '邀请注册时间',
    `customer_id` bigint NULL DEFAULT NULL COMMENT '绑定客户id',
    PRIMARY KEY (`id`) USING BTREE,
    UNIQUE INDEX `unq_cellphone_customer`(`cellphone`, `customer_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for store_employee
-- ----------------------------
DROP TABLE IF EXISTS `dili_etrade`.`store_employee`;
CREATE TABLE `dili_etrade`.`store_employee`  (
    `id` bigint NOT NULL AUTO_INCREMENT,
    `name` varchar(50) NOT NULL COMMENT '员工姓名',
    `employee_account_id` bigint NULL DEFAULT NULL COMMENT '员工账号id',
    `card_no` varchar(50) NULL DEFAULT NULL COMMENT '员工卡号',
    `account_id` bigint NULL DEFAULT NULL COMMENT '员工卡账户id',
    `market_id` bigint NOT NULL COMMENT '商家市场',
    `store_id` bigint NOT NULL COMMENT '商家id(所属客户id)',
    `auth` tinyint NOT NULL COMMENT '员工权限',
    `deleted` tinyint NULL DEFAULT 0 COMMENT '是否删除',
    `creator_id` bigint NULL DEFAULT NULL COMMENT '创建人id',
    `creator_source` tinyint NULL DEFAULT NULL COMMENT '创建来源',
    `creator_name` varchar(50) NULL DEFAULT NULL COMMENT '创建人姓名',
    `created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `modifer_id` bigint NULL DEFAULT NULL COMMENT '更改人id',
    `modifer_name` varchar(50) NULL DEFAULT NULL COMMENT '更改人',
    `modifer_source` tinyint NULL DEFAULT NULL COMMENT '更改来源',
    `modifed_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更改时间',
    PRIMARY KEY (`id`) USING BTREE,
    INDEX `idx_employee_account_id`(`employee_account_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 12 ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for store_employee_account
-- ----------------------------
DROP TABLE IF EXISTS `dili_etrade`.`store_employee_account`;
CREATE TABLE `dili_etrade`.`store_employee_account`  (
    `id` bigint NOT NULL AUTO_INCREMENT,
    `cellphone` varchar(20) NOT NULL COMMENT '登录手机',
    `password` varchar(255) NOT NULL COMMENT '密码',
    `created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `modifed_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更改时间',
    `first_login` tinyint NOT NULL DEFAULT 0 COMMENT '是否第一次登录(冗余客户系统中的1否  0是)',
    `state` tinyint NOT NULL DEFAULT 1 COMMENT '账号状态是否正常',
    PRIMARY KEY (`id`) USING BTREE,
    UNIQUE INDEX `idx_cellphone`(`cellphone`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 12 ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `setting_payment_method`;
CREATE TABLE `setting_payment_method`
(
    `id`            bigint   NOT NULL AUTO_INCREMENT COMMENT '主键',
    `market_id`     bigint   NOT NULL COMMENT '市场id',
    `method_code`   bigint   NOT NULL COMMENT '支付方式(1.现金2.微信3.支付宝4.地利通扫码付5.赊销二维码6.赊销)',
    `created_time`  datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `modified_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
    PRIMARY KEY (`id`),
    UNIQUE KEY `idx_m_m` (`market_id`,`method_code`)
) ENGINE=InnoDB AUTO_INCREMENT=1 COMMENT='支付方式设置';

DROP TABLE IF EXISTS `setting_payment_method_classification`;
CREATE TABLE `setting_payment_method_classification`
(
    `id`            bigint      NOT NULL AUTO_INCREMENT,
    `code`          bigint      NOT NULL COMMENT '代码',
    `name`          varchar(40) NOT NULL COMMENT '名称',
    `created_time`  datetime    NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `modified_time` datetime    NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
    PRIMARY KEY (`id`),
    UNIQUE KEY `idx_code` (`code`)
) ENGINE=InnoDB AUTO_INCREMENT=1 COMMENT='支付方式分类';

DROP TABLE IF EXISTS `setting_payment_method_type`;
CREATE TABLE `setting_payment_method_type`
(
    `id`                  bigint      NOT NULL AUTO_INCREMENT,
    `classification_code` bigint      NOT NULL COMMENT '分类代码',
    `code`                bigint      NOT NULL COMMENT '代码',
    `name`                varchar(40) NOT NULL COMMENT '名称',
    `created_time`        datetime    NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `modified_time`       datetime    NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
    PRIMARY KEY (`id`),
    UNIQUE KEY `idx_code` (`code`)
) ENGINE=InnoDB AUTO_INCREMENT=1 COMMENT='支付方式类型';

DROP TABLE IF EXISTS `dili_etrade`.`setting_payment_qr_code`;
CREATE TABLE `dili_etrade`.`setting_payment_qr_code`  (
  `id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `market_id` bigint(0) NOT NULL COMMENT '市场id',
  `seller_id` bigint(0) NOT NULL COMMENT '卖家id',
  `shop_id` bigint(0) NOT NULL COMMENT '店铺id',
  `code_type` tinyint(0) NOT NULL COMMENT '二维码类型(1.微信收款码2.支付宝收款码)',
  `img_file_id` varchar(40) NOT NULL COMMENT '二维码图片id',
  `created_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `modified_time` datetime(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `idx_m_s_s`(`market_id`, `shop_id`,`code_type`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 COMMENT = '支付二维码设置' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `dili_etrade`.`setting_print`;
CREATE TABLE `dili_etrade`.`setting_print`  (
    `id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '主键',
    `market_id` bigint(0) NOT NULL COMMENT '市场id',
    `seller_id` bigint(0) NOT NULL COMMENT '卖家id',
    `shop_id` bigint(0) NOT NULL COMMENT '店铺id',
    `device_id` bigint(0) DEFAULT NULL COMMENT '设备id',
    `print_switch` tinyint(0) NOT NULL COMMENT '打印小票开关(0.关1.开)',
    `print_number` tinyint(0) DEFAULT NULL COMMENT '打印张数(1.1张2.2张3.3张)',
    `print_type` tinyint(0) DEFAULT NULL COMMENT '打印类型(1.电子小票2.纸质小票3.电子小票+纸质小票)',
    `created_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `modified_time` datetime(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE,
    UNIQUE INDEX `idx_m_s_s_d`(`market_id`, `shop_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 COMMENT = '打印设置' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `dili_etrade`.`setting_shop_common`;
CREATE TABLE `dili_etrade`.`setting_shop_common`
(
    `id`            bigint   NOT NULL AUTO_INCREMENT,
    `market_id`     bigint   NOT NULL COMMENT '市场id',
    `shop_id`       bigint   NOT NULL COMMENT '店铺id',
    `type`          int      NOT NULL COMMENT '1核销',
    `state`         int      NOT NULL COMMENT '1开启0关闭',
    `extra`         text     NULL COMMENT '额外的',
    `created_time`  datetime NOT NULL DEFAULT current_timestamp COMMENT '创建时间',
    `modified_time` datetime NOT NULL DEFAULT current_timestamp on update current_timestamp COMMENT '更新时间',
    PRIMARY KEY (`id`) USING BTREE,
    UNIQUE KEY `unq_s_t_m` (`shop_id`, `type`, `market_id`) USING BTREE COMMENT '店铺唯一'
) ENGINE = InnoDB
  AUTO_INCREMENT = 1 COMMENT ='店铺公共设置';

DROP TABLE IF EXISTS `dili_xtrade`.`banner_content`;
CREATE TABLE `dili_xtrade`.`banner_content` (
                                                `id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增ID',
                                                `banner_id` bigint DEFAULT NULL COMMENT '轮播图ID',
                                                `content` text  COMMENT '内容',
                                                `pic_url` varchar(255) DEFAULT NULL COMMENT '图片链接',
                                                PRIMARY KEY (`id`) USING BTREE,
                                                UNIQUE INDEX `unq_banner_id`(`banner_id`) USING BTREE
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC COMMENT='内容管理-轮播图';