谷粒商城学习条记-15-数据库初始化

打印 上一主题 下一主题

主题 523|帖子 523|积分 1569

上一节已经把工程准备好了,创建了5个子模块,分别是:


  • 商品模块-product
  • 订单模块-order
  • 库存模块-ware
  • 优惠券模块-coupon
  • 会员模块-member
这一节的主要内容是把创建对应的数据库和数据库表。
一,创建数据库

1,数据库名称

每个子模块都是一个独立的服务,完成不同的业务功能,也对应着一个独立的数据库。
5个子模块对应着5个数据库,分别是:


  • 商品模块-product,数据库名称:gulimall_pms
  • 订单模块-order,数据库名称:gulimall_oms
  • 库存模块-ware,数据库名称:gulimall_wms
  • 优惠券模块-coupon,数据库名称:gulimall_sms
  • 会员模块-member,数据库名称:gulimall_ums
留意,数据库名是下划线链接,不是中划线。
Docker小技巧:由于开发过程中虚拟机可能关机,重启后,docker会自动重启,但是容器不会自动重启,可以设置让容器自动重启,好比要让mysql容器自动重启,可以执行如下命令:
  1. sudo docker update mysql --restart=always
复制代码
2,创建数据库

如图所示,创建5个数据库,名称堆栈下面:


  • 商品模块-product,数据库名称:gulimall_pms
  • 订单模块-order,数据库名称:gulimall_oms
  • 库存模块-ware,数据库名称:gulimall_wms
  • 优惠券模块-coupon,数据库名称:gulimall_sms
  • 会员模块-member,数据库名称:gulimall_ums

    留意,字符集选择utf8mb4,排序规则选择默认就行。
完成后,可以看到如下5个数据库。

二,创建表

每个数据库都有自己的表,根据课程提供的脚本,创建表,并插入数据。

1,仓储模块建表

  1. /*
  2. Navicat MySQL Data Transfer
  3. Source Server         : 192.168.56.10_3306
  4. Source Server Version : 50727
  5. Source Host           : 192.168.56.10:3306
  6. Source Database       : gulimall_wms
  7. Target Server Type    : MYSQL
  8. Target Server Version : 50727
  9. File Encoding         : 65001
  10. Date: 2020-03-11 17:37:28
  11. */
  12. SET FOREIGN_KEY_CHECKS=0;
  13. -- ----------------------------
  14. -- Table structure for undo_log
  15. -- ----------------------------
  16. DROP TABLE IF EXISTS `undo_log`;
  17. CREATE TABLE `undo_log` (
  18.   `id` bigint(20) NOT NULL AUTO_INCREMENT,
  19.   `branch_id` bigint(20) NOT NULL,
  20.   `xid` varchar(100) NOT NULL,
  21.   `context` varchar(128) NOT NULL,
  22.   `rollback_info` longblob NOT NULL,
  23.   `log_status` int(11) NOT NULL,
  24.   `log_created` datetime NOT NULL,
  25.   `log_modified` datetime NOT NULL,
  26.   `ext` varchar(100) DEFAULT NULL,
  27.   PRIMARY KEY (`id`),
  28.   UNIQUE KEY `ux_undo_log` (`xid`,`branch_id`) USING BTREE
  29. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  30. -- ----------------------------
  31. -- Records of undo_log
  32. -- ----------------------------
  33. -- ----------------------------
  34. -- Table structure for wms_purchase
  35. -- ----------------------------
  36. DROP TABLE IF EXISTS `wms_purchase`;
  37. CREATE TABLE `wms_purchase` (
  38.   `id` bigint(20) NOT NULL AUTO_INCREMENT,
  39.   `assignee_id` bigint(20) DEFAULT NULL,
  40.   `assignee_name` varchar(255) DEFAULT NULL,
  41.   `phone` char(13) DEFAULT NULL,
  42.   `priority` int(4) DEFAULT NULL,
  43.   `status` int(4) DEFAULT NULL,
  44.   `ware_id` bigint(20) DEFAULT NULL,
  45.   `amount` decimal(18,4) DEFAULT NULL,
  46.   `create_time` datetime DEFAULT NULL,
  47.   `update_time` datetime DEFAULT NULL,
  48.   PRIMARY KEY (`id`)
  49. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='采购信息';
  50. -- ----------------------------
  51. -- Records of wms_purchase
  52. -- ----------------------------
  53. -- ----------------------------
  54. -- Table structure for wms_purchase_detail
  55. -- ----------------------------
  56. DROP TABLE IF EXISTS `wms_purchase_detail`;
  57. CREATE TABLE `wms_purchase_detail` (
  58.   `id` bigint(20) NOT NULL AUTO_INCREMENT,
  59.   `purchase_id` bigint(20) DEFAULT NULL COMMENT '采购单id',
  60.   `sku_id` bigint(20) DEFAULT NULL COMMENT '采购商品id',
  61.   `sku_num` int(11) DEFAULT NULL COMMENT '采购数量',
  62.   `sku_price` decimal(18,4) DEFAULT NULL COMMENT '采购金额',
  63.   `ware_id` bigint(20) DEFAULT NULL COMMENT '仓库id',
  64.   `status` int(11) DEFAULT NULL COMMENT '状态[0新建,1已分配,2正在采购,3已完成,4采购失败]',
  65.   PRIMARY KEY (`id`)
  66. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  67. -- ----------------------------
  68. -- Records of wms_purchase_detail
  69. -- ----------------------------
  70. -- ----------------------------
  71. -- Table structure for wms_ware_info
  72. -- ----------------------------
  73. DROP TABLE IF EXISTS `wms_ware_info`;
  74. CREATE TABLE `wms_ware_info` (
  75.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  76.   `name` varchar(255) DEFAULT NULL COMMENT '仓库名',
  77.   `address` varchar(255) DEFAULT NULL COMMENT '仓库地址',
  78.   `areacode` varchar(20) DEFAULT NULL COMMENT '区域编码',
  79.   PRIMARY KEY (`id`)
  80. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='仓库信息';
  81. -- ----------------------------
  82. -- Records of wms_ware_info
  83. -- ----------------------------
  84. -- ----------------------------
  85. -- Table structure for wms_ware_order_task
  86. -- ----------------------------
  87. DROP TABLE IF EXISTS `wms_ware_order_task`;
  88. CREATE TABLE `wms_ware_order_task` (
  89.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  90.   `order_id` bigint(20) DEFAULT NULL COMMENT 'order_id',
  91.   `order_sn` varchar(255) DEFAULT NULL COMMENT 'order_sn',
  92.   `consignee` varchar(100) DEFAULT NULL COMMENT '收货人',
  93.   `consignee_tel` char(15) DEFAULT NULL COMMENT '收货人电话',
  94.   `delivery_address` varchar(500) DEFAULT NULL COMMENT '配送地址',
  95.   `order_comment` varchar(200) DEFAULT NULL COMMENT '订单备注',
  96.   `payment_way` tinyint(1) DEFAULT NULL COMMENT '付款方式【 1:在线付款 2:货到付款】',
  97.   `task_status` tinyint(2) DEFAULT NULL COMMENT '任务状态',
  98.   `order_body` varchar(255) DEFAULT NULL COMMENT '订单描述',
  99.   `tracking_no` char(30) DEFAULT NULL COMMENT '物流单号',
  100.   `create_time` datetime DEFAULT NULL COMMENT 'create_time',
  101.   `ware_id` bigint(20) DEFAULT NULL COMMENT '仓库id',
  102.   `task_comment` varchar(500) DEFAULT NULL COMMENT '工作单备注',
  103.   PRIMARY KEY (`id`)
  104. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='库存工作单';
  105. -- ----------------------------
  106. -- Records of wms_ware_order_task
  107. -- ----------------------------
  108. -- ----------------------------
  109. -- Table structure for wms_ware_order_task_detail
  110. -- ----------------------------
  111. DROP TABLE IF EXISTS `wms_ware_order_task_detail`;
  112. CREATE TABLE `wms_ware_order_task_detail` (
  113.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  114.   `sku_id` bigint(20) DEFAULT NULL COMMENT 'sku_id',
  115.   `sku_name` varchar(255) DEFAULT NULL COMMENT 'sku_name',
  116.   `sku_num` int(11) DEFAULT NULL COMMENT '购买个数',
  117.   `task_id` bigint(20) DEFAULT NULL COMMENT '工作单id',
  118.   `ware_id` bigint(20) DEFAULT NULL COMMENT '仓库id',
  119.   `lock_status` int(1) DEFAULT NULL COMMENT '1-已锁定  2-已解锁  3-扣减',
  120.   PRIMARY KEY (`id`)
  121. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='库存工作单';
  122. -- ----------------------------
  123. -- Records of wms_ware_order_task_detail
  124. -- ----------------------------
  125. -- ----------------------------
  126. -- Table structure for wms_ware_sku
  127. -- ----------------------------
  128. DROP TABLE IF EXISTS `wms_ware_sku`;
  129. CREATE TABLE `wms_ware_sku` (
  130.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  131.   `sku_id` bigint(20) DEFAULT NULL COMMENT 'sku_id',
  132.   `ware_id` bigint(20) DEFAULT NULL COMMENT '仓库id',
  133.   `stock` int(11) DEFAULT NULL COMMENT '库存数',
  134.   `sku_name` varchar(200) DEFAULT NULL COMMENT 'sku_name',
  135.   `stock_locked` int(11) DEFAULT '0' COMMENT '锁定库存',
  136.   PRIMARY KEY (`id`),
  137.   KEY `sku_id` (`sku_id`) USING BTREE,
  138.   KEY `ware_id` (`ware_id`) USING BTREE
  139. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品库存';
  140. -- ----------------------------
  141. -- Records of wms_ware_sku
  142. -- ----------------------------
复制代码
2,订单模块建表

  1. /*
  2. Navicat MySQL Data Transfer
  3. Source Server         : 192.168.56.10_3306
  4. Source Server Version : 50727
  5. Source Host           : 192.168.56.10:3306
  6. Source Database       : gulimall_oms
  7. Target Server Type    : MYSQL
  8. Target Server Version : 50727
  9. File Encoding         : 65001
  10. Date: 2020-03-11 17:36:38
  11. */
  12. SET FOREIGN_KEY_CHECKS=0;
  13. -- ----------------------------
  14. -- Table structure for mq_message
  15. -- ----------------------------
  16. DROP TABLE IF EXISTS `mq_message`;
  17. CREATE TABLE `mq_message` (
  18.   `message_id` char(32) NOT NULL,
  19.   `content` text,
  20.   `to_exchane` varchar(255) DEFAULT NULL,
  21.   `routing_key` varchar(255) DEFAULT NULL,
  22.   `class_type` varchar(255) DEFAULT NULL,
  23.   `message_status` int(1) DEFAULT '0' COMMENT '0-新建 1-已发送 2-错误抵达 3-已抵达',
  24.   `create_time` datetime DEFAULT NULL,
  25.   `update_time` datetime DEFAULT NULL,
  26.   PRIMARY KEY (`message_id`)
  27. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  28. -- ----------------------------
  29. -- Records of mq_message
  30. -- ----------------------------
  31. -- ----------------------------
  32. -- Table structure for oms_order
  33. -- ----------------------------
  34. DROP TABLE IF EXISTS `oms_order`;
  35. CREATE TABLE `oms_order` (
  36.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  37.   `member_id` bigint(20) DEFAULT NULL COMMENT 'member_id',
  38.   `order_sn` char(64) DEFAULT NULL COMMENT '订单号',
  39.   `coupon_id` bigint(20) DEFAULT NULL COMMENT '使用的优惠券',
  40.   `create_time` datetime DEFAULT NULL COMMENT 'create_time',
  41.   `member_username` varchar(200) DEFAULT NULL COMMENT '用户名',
  42.   `total_amount` decimal(18,4) DEFAULT NULL COMMENT '订单总额',
  43.   `pay_amount` decimal(18,4) DEFAULT NULL COMMENT '应付总额',
  44.   `freight_amount` decimal(18,4) DEFAULT NULL COMMENT '运费金额',
  45.   `promotion_amount` decimal(18,4) DEFAULT NULL COMMENT '促销优化金额(促销价、满减、阶梯价)',
  46.   `integration_amount` decimal(18,4) DEFAULT NULL COMMENT '积分抵扣金额',
  47.   `coupon_amount` decimal(18,4) DEFAULT NULL COMMENT '优惠券抵扣金额',
  48.   `discount_amount` decimal(18,4) DEFAULT NULL COMMENT '后台调整订单使用的折扣金额',
  49.   `pay_type` tinyint(4) DEFAULT NULL COMMENT '支付方式【1->支付宝;2->微信;3->银联; 4->货到付款;】',
  50.   `source_type` tinyint(4) DEFAULT NULL COMMENT '订单来源[0->PC订单;1->app订单]',
  51.   `status` tinyint(4) DEFAULT NULL COMMENT '订单状态【0->待付款;1->待发货;2->已发货;3->已完成;4->已关闭;5->无效订单】',
  52.   `delivery_company` varchar(64) DEFAULT NULL COMMENT '物流公司(配送方式)',
  53.   `delivery_sn` varchar(64) DEFAULT NULL COMMENT '物流单号',
  54.   `auto_confirm_day` int(11) DEFAULT NULL COMMENT '自动确认时间(天)',
  55.   `integration` int(11) DEFAULT NULL COMMENT '可以获得的积分',
  56.   `growth` int(11) DEFAULT NULL COMMENT '可以获得的成长值',
  57.   `bill_type` tinyint(4) DEFAULT NULL COMMENT '发票类型[0->不开发票;1->电子发票;2->纸质发票]',
  58.   `bill_header` varchar(255) DEFAULT NULL COMMENT '发票抬头',
  59.   `bill_content` varchar(255) DEFAULT NULL COMMENT '发票内容',
  60.   `bill_receiver_phone` varchar(32) DEFAULT NULL COMMENT '收票人电话',
  61.   `bill_receiver_email` varchar(64) DEFAULT NULL COMMENT '收票人邮箱',
  62.   `receiver_name` varchar(100) DEFAULT NULL COMMENT '收货人姓名',
  63.   `receiver_phone` varchar(32) DEFAULT NULL COMMENT '收货人电话',
  64.   `receiver_post_code` varchar(32) DEFAULT NULL COMMENT '收货人邮编',
  65.   `receiver_province` varchar(32) DEFAULT NULL COMMENT '省份/直辖市',
  66.   `receiver_city` varchar(32) DEFAULT NULL COMMENT '城市',
  67.   `receiver_region` varchar(32) DEFAULT NULL COMMENT '区',
  68.   `receiver_detail_address` varchar(200) DEFAULT NULL COMMENT '详细地址',
  69.   `note` varchar(500) DEFAULT NULL COMMENT '订单备注',
  70.   `confirm_status` tinyint(4) DEFAULT NULL COMMENT '确认收货状态[0->未确认;1->已确认]',
  71.   `delete_status` tinyint(4) DEFAULT NULL COMMENT '删除状态【0->未删除;1->已删除】',
  72.   `use_integration` int(11) DEFAULT NULL COMMENT '下单时使用的积分',
  73.   `payment_time` datetime DEFAULT NULL COMMENT '支付时间',
  74.   `delivery_time` datetime DEFAULT NULL COMMENT '发货时间',
  75.   `receive_time` datetime DEFAULT NULL COMMENT '确认收货时间',
  76.   `comment_time` datetime DEFAULT NULL COMMENT '评价时间',
  77.   `modify_time` datetime DEFAULT NULL COMMENT '修改时间',
  78.   PRIMARY KEY (`id`),
  79.   UNIQUE KEY `order_sn` (`order_sn`) USING BTREE
  80. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单';
  81. -- ----------------------------
  82. -- Records of oms_order
  83. -- ----------------------------
  84. -- ----------------------------
  85. -- Table structure for oms_order_item
  86. -- ----------------------------
  87. DROP TABLE IF EXISTS `oms_order_item`;
  88. CREATE TABLE `oms_order_item` (
  89.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  90.   `order_id` bigint(20) DEFAULT NULL COMMENT 'order_id',
  91.   `order_sn` char(64) DEFAULT NULL COMMENT 'order_sn',
  92.   `spu_id` bigint(20) DEFAULT NULL COMMENT 'spu_id',
  93.   `spu_name` varchar(255) DEFAULT NULL COMMENT 'spu_name',
  94.   `spu_pic` varchar(500) DEFAULT NULL COMMENT 'spu_pic',
  95.   `spu_brand` varchar(200) DEFAULT NULL COMMENT '品牌',
  96.   `category_id` bigint(20) DEFAULT NULL COMMENT '商品分类id',
  97.   `sku_id` bigint(20) DEFAULT NULL COMMENT '商品sku编号',
  98.   `sku_name` varchar(255) DEFAULT NULL COMMENT '商品sku名字',
  99.   `sku_pic` varchar(500) DEFAULT NULL COMMENT '商品sku图片',
  100.   `sku_price` decimal(18,4) DEFAULT NULL COMMENT '商品sku价格',
  101.   `sku_quantity` int(11) DEFAULT NULL COMMENT '商品购买的数量',
  102.   `sku_attrs_vals` varchar(500) DEFAULT NULL COMMENT '商品销售属性组合(JSON)',
  103.   `promotion_amount` decimal(18,4) DEFAULT NULL COMMENT '商品促销分解金额',
  104.   `coupon_amount` decimal(18,4) DEFAULT NULL COMMENT '优惠券优惠分解金额',
  105.   `integration_amount` decimal(18,4) DEFAULT NULL COMMENT '积分优惠分解金额',
  106.   `real_amount` decimal(18,4) DEFAULT NULL COMMENT '该商品经过优惠后的分解金额',
  107.   `gift_integration` int(11) DEFAULT NULL COMMENT '赠送积分',
  108.   `gift_growth` int(11) DEFAULT NULL COMMENT '赠送成长值',
  109.   PRIMARY KEY (`id`)
  110. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单项信息';
  111. -- ----------------------------
  112. -- Records of oms_order_item
  113. -- ----------------------------
  114. -- ----------------------------
  115. -- Table structure for oms_order_operate_history
  116. -- ----------------------------
  117. DROP TABLE IF EXISTS `oms_order_operate_history`;
  118. CREATE TABLE `oms_order_operate_history` (
  119.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  120.   `order_id` bigint(20) DEFAULT NULL COMMENT '订单id',
  121.   `operate_man` varchar(100) DEFAULT NULL COMMENT '操作人[用户;系统;后台管理员]',
  122.   `create_time` datetime DEFAULT NULL COMMENT '操作时间',
  123.   `order_status` tinyint(4) DEFAULT NULL COMMENT '订单状态【0->待付款;1->待发货;2->已发货;3->已完成;4->已关闭;5->无效订单】',
  124.   `note` varchar(500) DEFAULT NULL COMMENT '备注',
  125.   PRIMARY KEY (`id`)
  126. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单操作历史记录';
  127. -- ----------------------------
  128. -- Records of oms_order_operate_history
  129. -- ----------------------------
  130. -- ----------------------------
  131. -- Table structure for oms_order_return_apply
  132. -- ----------------------------
  133. DROP TABLE IF EXISTS `oms_order_return_apply`;
  134. CREATE TABLE `oms_order_return_apply` (
  135.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  136.   `order_id` bigint(20) DEFAULT NULL COMMENT 'order_id',
  137.   `sku_id` bigint(20) DEFAULT NULL COMMENT '退货商品id',
  138.   `order_sn` char(32) DEFAULT NULL COMMENT '订单编号',
  139.   `create_time` datetime DEFAULT NULL COMMENT '申请时间',
  140.   `member_username` varchar(64) DEFAULT NULL COMMENT '会员用户名',
  141.   `return_amount` decimal(18,4) DEFAULT NULL COMMENT '退款金额',
  142.   `return_name` varchar(100) DEFAULT NULL COMMENT '退货人姓名',
  143.   `return_phone` varchar(20) DEFAULT NULL COMMENT '退货人电话',
  144.   `status` tinyint(1) DEFAULT NULL COMMENT '申请状态[0->待处理;1->退货中;2->已完成;3->已拒绝]',
  145.   `handle_time` datetime DEFAULT NULL COMMENT '处理时间',
  146.   `sku_img` varchar(500) DEFAULT NULL COMMENT '商品图片',
  147.   `sku_name` varchar(200) DEFAULT NULL COMMENT '商品名称',
  148.   `sku_brand` varchar(200) DEFAULT NULL COMMENT '商品品牌',
  149.   `sku_attrs_vals` varchar(500) DEFAULT NULL COMMENT '商品销售属性(JSON)',
  150.   `sku_count` int(11) DEFAULT NULL COMMENT '退货数量',
  151.   `sku_price` decimal(18,4) DEFAULT NULL COMMENT '商品单价',
  152.   `sku_real_price` decimal(18,4) DEFAULT NULL COMMENT '商品实际支付单价',
  153.   `reason` varchar(200) DEFAULT NULL COMMENT '原因',
  154.   `description述` varchar(500) DEFAULT NULL COMMENT '描述',
  155.   `desc_pics` varchar(2000) DEFAULT NULL COMMENT '凭证图片,以逗号隔开',
  156.   `handle_note` varchar(500) DEFAULT NULL COMMENT '处理备注',
  157.   `handle_man` varchar(200) DEFAULT NULL COMMENT '处理人员',
  158.   `receive_man` varchar(100) DEFAULT NULL COMMENT '收货人',
  159.   `receive_time` datetime DEFAULT NULL COMMENT '收货时间',
  160.   `receive_note` varchar(500) DEFAULT NULL COMMENT '收货备注',
  161.   `receive_phone` varchar(20) DEFAULT NULL COMMENT '收货电话',
  162.   `company_address` varchar(500) DEFAULT NULL COMMENT '公司收货地址',
  163.   PRIMARY KEY (`id`)
  164. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单退货申请';
  165. -- ----------------------------
  166. -- Records of oms_order_return_apply
  167. -- ----------------------------
  168. -- ----------------------------
  169. -- Table structure for oms_order_return_reason
  170. -- ----------------------------
  171. DROP TABLE IF EXISTS `oms_order_return_reason`;
  172. CREATE TABLE `oms_order_return_reason` (
  173.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  174.   `name` varchar(200) DEFAULT NULL COMMENT '退货原因名',
  175.   `sort` int(11) DEFAULT NULL COMMENT '排序',
  176.   `status` tinyint(1) DEFAULT NULL COMMENT '启用状态',
  177.   `create_time` datetime DEFAULT NULL COMMENT 'create_time',
  178.   PRIMARY KEY (`id`)
  179. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='退货原因';
  180. -- ----------------------------
  181. -- Records of oms_order_return_reason
  182. -- ----------------------------
  183. -- ----------------------------
  184. -- Table structure for oms_order_setting
  185. -- ----------------------------
  186. DROP TABLE IF EXISTS `oms_order_setting`;
  187. CREATE TABLE `oms_order_setting` (
  188.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  189.   `flash_order_overtime` int(11) DEFAULT NULL COMMENT '秒杀订单超时关闭时间(分)',
  190.   `normal_order_overtime` int(11) DEFAULT NULL COMMENT '正常订单超时时间(分)',
  191.   `confirm_overtime` int(11) DEFAULT NULL COMMENT '发货后自动确认收货时间(天)',
  192.   `finish_overtime` int(11) DEFAULT NULL COMMENT '自动完成交易时间,不能申请退货(天)',
  193.   `comment_overtime` int(11) DEFAULT NULL COMMENT '订单完成后自动好评时间(天)',
  194.   `member_level` tinyint(2) DEFAULT NULL COMMENT '会员等级【0-不限会员等级,全部通用;其他-对应的其他会员等级】',
  195.   PRIMARY KEY (`id`)
  196. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单配置信息';
  197. -- ----------------------------
  198. -- Records of oms_order_setting
  199. -- ----------------------------
  200. -- ----------------------------
  201. -- Table structure for oms_payment_info
  202. -- ----------------------------
  203. DROP TABLE IF EXISTS `oms_payment_info`;
  204. CREATE TABLE `oms_payment_info` (
  205.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  206.   `order_sn` char(64) DEFAULT NULL COMMENT '订单号(对外业务号)',
  207.   `order_id` bigint(20) DEFAULT NULL COMMENT '订单id',
  208.   `alipay_trade_no` varchar(50) DEFAULT NULL COMMENT '支付宝交易流水号',
  209.   `total_amount` decimal(18,4) DEFAULT NULL COMMENT '支付总金额',
  210.   `subject` varchar(200) DEFAULT NULL COMMENT '交易内容',
  211.   `payment_status` varchar(20) DEFAULT NULL COMMENT '支付状态',
  212.   `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  213.   `confirm_time` datetime DEFAULT NULL COMMENT '确认时间',
  214.   `callback_content` varchar(4000) DEFAULT NULL COMMENT '回调内容',
  215.   `callback_time` datetime DEFAULT NULL COMMENT '回调时间',
  216.   PRIMARY KEY (`id`),
  217.   UNIQUE KEY `order_sn` (`order_sn`) USING BTREE,
  218.   UNIQUE KEY `alipay_trade_no` (`alipay_trade_no`) USING BTREE
  219. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='支付信息表';
  220. -- ----------------------------
  221. -- Records of oms_payment_info
  222. -- ----------------------------
  223. -- ----------------------------
  224. -- Table structure for oms_refund_info
  225. -- ----------------------------
  226. DROP TABLE IF EXISTS `oms_refund_info`;
  227. CREATE TABLE `oms_refund_info` (
  228.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  229.   `order_return_id` bigint(20) DEFAULT NULL COMMENT '退款的订单',
  230.   `refund` decimal(18,4) DEFAULT NULL COMMENT '退款金额',
  231.   `refund_sn` varchar(64) DEFAULT NULL COMMENT '退款交易流水号',
  232.   `refund_status` tinyint(1) DEFAULT NULL COMMENT '退款状态',
  233.   `refund_channel` tinyint(4) DEFAULT NULL COMMENT '退款渠道[1-支付宝,2-微信,3-银联,4-汇款]',
  234.   `refund_content` varchar(5000) DEFAULT NULL,
  235.   PRIMARY KEY (`id`)
  236. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='退款信息';
  237. -- ----------------------------
  238. -- Records of oms_refund_info
  239. -- ----------------------------
  240. -- ----------------------------
  241. -- Table structure for undo_log
  242. -- ----------------------------
  243. DROP TABLE IF EXISTS `undo_log`;
  244. CREATE TABLE `undo_log` (
  245.   `id` bigint(20) NOT NULL AUTO_INCREMENT,
  246.   `branch_id` bigint(20) NOT NULL,
  247.   `xid` varchar(100) NOT NULL,
  248.   `context` varchar(128) NOT NULL,
  249.   `rollback_info` longblob NOT NULL,
  250.   `log_status` int(11) NOT NULL,
  251.   `log_created` datetime NOT NULL,
  252.   `log_modified` datetime NOT NULL,
  253.   `ext` varchar(100) DEFAULT NULL,
  254.   PRIMARY KEY (`id`),
  255.   UNIQUE KEY `ux_undo_log` (`xid`,`branch_id`) USING BTREE
  256. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  257. -- ----------------------------
  258. -- Records of undo_log
  259. -- ----------------------------
复制代码
3,商品模块建表

脚本太长,就不贴出来了。
4,优惠券模块建表

  1. /*
  2. Navicat MySQL Data Transfer
  3. Source Server         : 192.168.56.10_3306
  4. Source Server Version : 50727
  5. Source Host           : 192.168.56.10:3306
  6. Source Database       : gulimall_sms
  7. Target Server Type    : MYSQL
  8. Target Server Version : 50727
  9. File Encoding         : 65001
  10. Date: 2020-03-11 17:37:07
  11. */
  12. SET FOREIGN_KEY_CHECKS=0;
  13. -- ----------------------------
  14. -- Table structure for sms_coupon
  15. -- ----------------------------
  16. DROP TABLE IF EXISTS `sms_coupon`;
  17. CREATE TABLE `sms_coupon` (
  18.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  19.   `coupon_type` tinyint(1) DEFAULT NULL COMMENT '优惠卷类型[0->全场赠券;1->会员赠券;2->购物赠券;3->注册赠券]',
  20.   `coupon_img` varchar(2000) DEFAULT NULL COMMENT '优惠券图片',
  21.   `coupon_name` varchar(100) DEFAULT NULL COMMENT '优惠卷名字',
  22.   `num` int(11) DEFAULT NULL COMMENT '数量',
  23.   `amount` decimal(18,4) DEFAULT NULL COMMENT '金额',
  24.   `per_limit` int(11) DEFAULT NULL COMMENT '每人限领张数',
  25.   `min_point` decimal(18,4) DEFAULT NULL COMMENT '使用门槛',
  26.   `start_time` datetime DEFAULT NULL COMMENT '开始时间',
  27.   `end_time` datetime DEFAULT NULL COMMENT '结束时间',
  28.   `use_type` tinyint(1) DEFAULT NULL COMMENT '使用类型[0->全场通用;1->指定分类;2->指定商品]',
  29.   `note` varchar(200) DEFAULT NULL COMMENT '备注',
  30.   `publish_count` int(11) DEFAULT NULL COMMENT '发行数量',
  31.   `use_count` int(11) DEFAULT NULL COMMENT '已使用数量',
  32.   `receive_count` int(11) DEFAULT NULL COMMENT '领取数量',
  33.   `enable_start_time` datetime DEFAULT NULL COMMENT '可以领取的开始日期',
  34.   `enable_end_time` datetime DEFAULT NULL COMMENT '可以领取的结束日期',
  35.   `code` varchar(64) DEFAULT NULL COMMENT '优惠码',
  36.   `member_level` tinyint(1) DEFAULT NULL COMMENT '可以领取的会员等级[0->不限等级,其他-对应等级]',
  37.   `publish` tinyint(1) DEFAULT NULL COMMENT '发布状态[0-未发布,1-已发布]',
  38.   PRIMARY KEY (`id`)
  39. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='优惠券信息';
  40. -- ----------------------------
  41. -- Records of sms_coupon
  42. -- ----------------------------
  43. -- ----------------------------
  44. -- Table structure for sms_coupon_history
  45. -- ----------------------------
  46. DROP TABLE IF EXISTS `sms_coupon_history`;
  47. CREATE TABLE `sms_coupon_history` (
  48.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  49.   `coupon_id` bigint(20) DEFAULT NULL COMMENT '优惠券id',
  50.   `member_id` bigint(20) DEFAULT NULL COMMENT '会员id',
  51.   `member_nick_name` varchar(64) DEFAULT NULL COMMENT '会员名字',
  52.   `get_type` tinyint(1) DEFAULT NULL COMMENT '获取方式[0->后台赠送;1->主动领取]',
  53.   `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  54.   `use_type` tinyint(1) DEFAULT NULL COMMENT '使用状态[0->未使用;1->已使用;2->已过期]',
  55.   `use_time` datetime DEFAULT NULL COMMENT '使用时间',
  56.   `order_id` bigint(20) DEFAULT NULL COMMENT '订单id',
  57.   `order_sn` bigint(20) DEFAULT NULL COMMENT '订单号',
  58.   PRIMARY KEY (`id`)
  59. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='优惠券领取历史记录';
  60. -- ----------------------------
  61. -- Records of sms_coupon_history
  62. -- ----------------------------
  63. -- ----------------------------
  64. -- Table structure for sms_coupon_spu_category_relation
  65. -- ----------------------------
  66. DROP TABLE IF EXISTS `sms_coupon_spu_category_relation`;
  67. CREATE TABLE `sms_coupon_spu_category_relation` (
  68.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  69.   `coupon_id` bigint(20) DEFAULT NULL COMMENT '优惠券id',
  70.   `category_id` bigint(20) DEFAULT NULL COMMENT '产品分类id',
  71.   `category_name` varchar(64) DEFAULT NULL COMMENT '产品分类名称',
  72.   PRIMARY KEY (`id`)
  73. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='优惠券分类关联';
  74. -- ----------------------------
  75. -- Records of sms_coupon_spu_category_relation
  76. -- ----------------------------
  77. -- ----------------------------
  78. -- Table structure for sms_coupon_spu_relation
  79. -- ----------------------------
  80. DROP TABLE IF EXISTS `sms_coupon_spu_relation`;
  81. CREATE TABLE `sms_coupon_spu_relation` (
  82.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  83.   `coupon_id` bigint(20) DEFAULT NULL COMMENT '优惠券id',
  84.   `spu_id` bigint(20) DEFAULT NULL COMMENT 'spu_id',
  85.   `spu_name` varchar(255) DEFAULT NULL COMMENT 'spu_name',
  86.   PRIMARY KEY (`id`)
  87. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='优惠券与产品关联';
  88. -- ----------------------------
  89. -- Records of sms_coupon_spu_relation
  90. -- ----------------------------
  91. -- ----------------------------
  92. -- Table structure for sms_home_adv
  93. -- ----------------------------
  94. DROP TABLE IF EXISTS `sms_home_adv`;
  95. CREATE TABLE `sms_home_adv` (
  96.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  97.   `name` varchar(100) DEFAULT NULL COMMENT '名字',
  98.   `pic` varchar(500) DEFAULT NULL COMMENT '图片地址',
  99.   `start_time` datetime DEFAULT NULL COMMENT '开始时间',
  100.   `end_time` datetime DEFAULT NULL COMMENT '结束时间',
  101.   `status` tinyint(1) DEFAULT NULL COMMENT '状态',
  102.   `click_count` int(11) DEFAULT NULL COMMENT '点击数',
  103.   `url` varchar(500) DEFAULT NULL COMMENT '广告详情连接地址',
  104.   `note` varchar(500) DEFAULT NULL COMMENT '备注',
  105.   `sort` int(11) DEFAULT NULL COMMENT '排序',
  106.   `publisher_id` bigint(20) DEFAULT NULL COMMENT '发布者',
  107.   `auth_id` bigint(20) DEFAULT NULL COMMENT '审核者',
  108.   PRIMARY KEY (`id`)
  109. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='首页轮播广告';
  110. -- ----------------------------
  111. -- Records of sms_home_adv
  112. -- ----------------------------
  113. -- ----------------------------
  114. -- Table structure for sms_home_subject
  115. -- ----------------------------
  116. DROP TABLE IF EXISTS `sms_home_subject`;
  117. CREATE TABLE `sms_home_subject` (
  118.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  119.   `name` varchar(200) DEFAULT NULL COMMENT '专题名字',
  120.   `title` varchar(255) DEFAULT NULL COMMENT '专题标题',
  121.   `sub_title` varchar(255) DEFAULT NULL COMMENT '专题副标题',
  122.   `status` tinyint(1) DEFAULT NULL COMMENT '显示状态',
  123.   `url` varchar(500) DEFAULT NULL COMMENT '详情连接',
  124.   `sort` int(11) DEFAULT NULL COMMENT '排序',
  125.   `img` varchar(500) DEFAULT NULL COMMENT '专题图片地址',
  126.   PRIMARY KEY (`id`)
  127. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='首页专题表【jd首页下面很多专题,每个专题链接新的页面,展示专题商品信息】';
  128. -- ----------------------------
  129. -- Records of sms_home_subject
  130. -- ----------------------------
  131. -- ----------------------------
  132. -- Table structure for sms_home_subject_spu
  133. -- ----------------------------
  134. DROP TABLE IF EXISTS `sms_home_subject_spu`;
  135. CREATE TABLE `sms_home_subject_spu` (
  136.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  137.   `name` varchar(200) DEFAULT NULL COMMENT '专题名字',
  138.   `subject_id` bigint(20) DEFAULT NULL COMMENT '专题id',
  139.   `spu_id` bigint(20) DEFAULT NULL COMMENT 'spu_id',
  140.   `sort` int(11) DEFAULT NULL COMMENT '排序',
  141.   PRIMARY KEY (`id`)
  142. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='专题商品';
  143. -- ----------------------------
  144. -- Records of sms_home_subject_spu
  145. -- ----------------------------
  146. -- ----------------------------
  147. -- Table structure for sms_member_price
  148. -- ----------------------------
  149. DROP TABLE IF EXISTS `sms_member_price`;
  150. CREATE TABLE `sms_member_price` (
  151.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  152.   `sku_id` bigint(20) DEFAULT NULL COMMENT 'sku_id',
  153.   `member_level_id` bigint(20) DEFAULT NULL COMMENT '会员等级id',
  154.   `member_level_name` varchar(100) DEFAULT NULL COMMENT '会员等级名',
  155.   `member_price` decimal(18,4) DEFAULT NULL COMMENT '会员对应价格',
  156.   `add_other` tinyint(1) DEFAULT NULL COMMENT '可否叠加其他优惠[0-不可叠加优惠,1-可叠加]',
  157.   PRIMARY KEY (`id`)
  158. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品会员价格';
  159. -- ----------------------------
  160. -- Records of sms_member_price
  161. -- ----------------------------
  162. -- ----------------------------
  163. -- Table structure for sms_seckill_promotion
  164. -- ----------------------------
  165. DROP TABLE IF EXISTS `sms_seckill_promotion`;
  166. CREATE TABLE `sms_seckill_promotion` (
  167.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  168.   `title` varchar(255) DEFAULT NULL COMMENT '活动标题',
  169.   `start_time` datetime DEFAULT NULL COMMENT '开始日期',
  170.   `end_time` datetime DEFAULT NULL COMMENT '结束日期',
  171.   `status` tinyint(4) DEFAULT NULL COMMENT '上下线状态',
  172.   `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  173.   `user_id` bigint(20) DEFAULT NULL COMMENT '创建人',
  174.   PRIMARY KEY (`id`)
  175. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='秒杀活动';
  176. -- ----------------------------
  177. -- Records of sms_seckill_promotion
  178. -- ----------------------------
  179. -- ----------------------------
  180. -- Table structure for sms_seckill_session
  181. -- ----------------------------
  182. DROP TABLE IF EXISTS `sms_seckill_session`;
  183. CREATE TABLE `sms_seckill_session` (
  184.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  185.   `name` varchar(200) DEFAULT NULL COMMENT '场次名称',
  186.   `start_time` datetime DEFAULT NULL COMMENT '每日开始时间',
  187.   `end_time` datetime DEFAULT NULL COMMENT '每日结束时间',
  188.   `status` tinyint(1) DEFAULT NULL COMMENT '启用状态',
  189.   `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  190.   PRIMARY KEY (`id`)
  191. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='秒杀活动场次';
  192. -- ----------------------------
  193. -- Records of sms_seckill_session
  194. -- ----------------------------
  195. -- ----------------------------
  196. -- Table structure for sms_seckill_sku_notice
  197. -- ----------------------------
  198. DROP TABLE IF EXISTS `sms_seckill_sku_notice`;
  199. CREATE TABLE `sms_seckill_sku_notice` (
  200.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  201.   `member_id` bigint(20) DEFAULT NULL COMMENT 'member_id',
  202.   `sku_id` bigint(20) DEFAULT NULL COMMENT 'sku_id',
  203.   `session_id` bigint(20) DEFAULT NULL COMMENT '活动场次id',
  204.   `subcribe_time` datetime DEFAULT NULL COMMENT '订阅时间',
  205.   `send_time` datetime DEFAULT NULL COMMENT '发送时间',
  206.   `notice_type` tinyint(1) DEFAULT NULL COMMENT '通知方式[0-短信,1-邮件]',
  207.   PRIMARY KEY (`id`)
  208. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='秒杀商品通知订阅';
  209. -- ----------------------------
  210. -- Records of sms_seckill_sku_notice
  211. -- ----------------------------
  212. -- ----------------------------
  213. -- Table structure for sms_seckill_sku_relation
  214. -- ----------------------------
  215. DROP TABLE IF EXISTS `sms_seckill_sku_relation`;
  216. CREATE TABLE `sms_seckill_sku_relation` (
  217.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  218.   `promotion_id` bigint(20) DEFAULT NULL COMMENT '活动id',
  219.   `promotion_session_id` bigint(20) DEFAULT NULL COMMENT '活动场次id',
  220.   `sku_id` bigint(20) DEFAULT NULL COMMENT '商品id',
  221.   `seckill_price` decimal(10,4) DEFAULT NULL COMMENT '秒杀价格',
  222.   `seckill_count` int(11) DEFAULT NULL COMMENT '秒杀总量',
  223.   `seckill_limit` int(11) DEFAULT NULL COMMENT '每人限购数量',
  224.   `seckill_sort` int(11) DEFAULT NULL COMMENT '排序',
  225.   PRIMARY KEY (`id`)
  226. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='秒杀活动商品关联';
  227. -- ----------------------------
  228. -- Records of sms_seckill_sku_relation
  229. -- ----------------------------
  230. -- ----------------------------
  231. -- Table structure for sms_sku_full_reduction
  232. -- ----------------------------
  233. DROP TABLE IF EXISTS `sms_sku_full_reduction`;
  234. CREATE TABLE `sms_sku_full_reduction` (
  235.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  236.   `sku_id` bigint(20) DEFAULT NULL COMMENT 'spu_id',
  237.   `full_price` decimal(18,4) DEFAULT NULL COMMENT '满多少',
  238.   `reduce_price` decimal(18,4) DEFAULT NULL COMMENT '减多少',
  239.   `add_other` tinyint(1) DEFAULT NULL COMMENT '是否参与其他优惠',
  240.   PRIMARY KEY (`id`)
  241. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品满减信息';
  242. -- ----------------------------
  243. -- Records of sms_sku_full_reduction
  244. -- ----------------------------
  245. -- ----------------------------
  246. -- Table structure for sms_sku_ladder
  247. -- ----------------------------
  248. DROP TABLE IF EXISTS `sms_sku_ladder`;
  249. CREATE TABLE `sms_sku_ladder` (
  250.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  251.   `sku_id` bigint(20) DEFAULT NULL COMMENT 'spu_id',
  252.   `full_count` int(11) DEFAULT NULL COMMENT '满几件',
  253.   `discount` decimal(4,2) DEFAULT NULL COMMENT '打几折',
  254.   `price` decimal(18,4) DEFAULT NULL COMMENT '折后价',
  255.   `add_other` tinyint(1) DEFAULT NULL COMMENT '是否叠加其他优惠[0-不可叠加,1-可叠加]',
  256.   PRIMARY KEY (`id`)
  257. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品阶梯价格';
  258. -- ----------------------------
  259. -- Records of sms_sku_ladder
  260. -- ----------------------------
  261. -- ----------------------------
  262. -- Table structure for sms_spu_bounds
  263. -- ----------------------------
  264. DROP TABLE IF EXISTS `sms_spu_bounds`;
  265. CREATE TABLE `sms_spu_bounds` (
  266.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  267.   `spu_id` bigint(20) DEFAULT NULL,
  268.   `grow_bounds` decimal(18,4) DEFAULT NULL COMMENT '成长积分',
  269.   `buy_bounds` decimal(18,4) DEFAULT NULL COMMENT '购物积分',
  270.   `work` tinyint(1) DEFAULT NULL COMMENT '优惠生效情况[1111(四个状态位,从右到左);0 - 无优惠,成长积分是否赠送;1 - 无优惠,购物积分是否赠送;2 - 有优惠,成长积分是否赠送;3 - 有优惠,购物积分是否赠送【状态位0:不赠送,1:赠送】]',
  271.   PRIMARY KEY (`id`)
  272. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品spu积分设置';
  273. -- ----------------------------
  274. -- Records of sms_spu_bounds
  275. -- ----------------------------
  276. -- ----------------------------
  277. -- Table structure for undo_log
  278. -- ----------------------------
  279. DROP TABLE IF EXISTS `undo_log`;
  280. CREATE TABLE `undo_log` (
  281.   `id` bigint(20) NOT NULL AUTO_INCREMENT,
  282.   `branch_id` bigint(20) NOT NULL,
  283.   `xid` varchar(100) NOT NULL,
  284.   `context` varchar(128) NOT NULL,
  285.   `rollback_info` longblob NOT NULL,
  286.   `log_status` int(11) NOT NULL,
  287.   `log_created` datetime NOT NULL,
  288.   `log_modified` datetime NOT NULL,
  289.   `ext` varchar(100) DEFAULT NULL,
  290.   PRIMARY KEY (`id`),
  291.   UNIQUE KEY `ux_undo_log` (`xid`,`branch_id`) USING BTREE
  292. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  293. -- ----------------------------
  294. -- Records of undo_log
  295. -- ----------------------------
复制代码
5,会员模块建表

  1. /*
  2. Navicat MySQL Data Transfer
  3. Source Server         : 192.168.56.10_3306
  4. Source Server Version : 50727
  5. Source Host           : 192.168.56.10:3306
  6. Source Database       : gulimall_ums
  7. Target Server Type    : MYSQL
  8. Target Server Version : 50727
  9. File Encoding         : 65001
  10. Date: 2020-03-11 17:37:18
  11. */
  12. SET FOREIGN_KEY_CHECKS=0;
  13. -- ----------------------------
  14. -- Table structure for ums_growth_change_history
  15. -- ----------------------------
  16. DROP TABLE IF EXISTS `ums_growth_change_history`;
  17. CREATE TABLE `ums_growth_change_history` (
  18.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  19.   `member_id` bigint(20) DEFAULT NULL COMMENT 'member_id',
  20.   `create_time` datetime DEFAULT NULL COMMENT 'create_time',
  21.   `change_count` int(11) DEFAULT NULL COMMENT '改变的值(正负计数)',
  22.   `note` varchar(0) DEFAULT NULL COMMENT '备注',
  23.   `source_type` tinyint(4) DEFAULT NULL COMMENT '积分来源[0-购物,1-管理员修改]',
  24.   PRIMARY KEY (`id`)
  25. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='成长值变化历史记录';
  26. -- ----------------------------
  27. -- Records of ums_growth_change_history
  28. -- ----------------------------
  29. -- ----------------------------
  30. -- Table structure for ums_integration_change_history
  31. -- ----------------------------
  32. DROP TABLE IF EXISTS `ums_integration_change_history`;
  33. CREATE TABLE `ums_integration_change_history` (
  34.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  35.   `member_id` bigint(20) DEFAULT NULL COMMENT 'member_id',
  36.   `create_time` datetime DEFAULT NULL COMMENT 'create_time',
  37.   `change_count` int(11) DEFAULT NULL COMMENT '变化的值',
  38.   `note` varchar(255) DEFAULT NULL COMMENT '备注',
  39.   `source_tyoe` tinyint(4) DEFAULT NULL COMMENT '来源[0->购物;1->管理员修改;2->活动]',
  40.   PRIMARY KEY (`id`)
  41. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分变化历史记录';
  42. -- ----------------------------
  43. -- Records of ums_integration_change_history
  44. -- ----------------------------
  45. -- ----------------------------
  46. -- Table structure for ums_member
  47. -- ----------------------------
  48. DROP TABLE IF EXISTS `ums_member`;
  49. CREATE TABLE `ums_member` (
  50.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  51.   `level_id` bigint(20) DEFAULT NULL COMMENT '会员等级id',
  52.   `username` char(64) DEFAULT NULL COMMENT '用户名',
  53.   `password` varchar(64) DEFAULT NULL COMMENT '密码',
  54.   `nickname` varchar(64) DEFAULT NULL COMMENT '昵称',
  55.   `mobile` varchar(20) DEFAULT NULL COMMENT '手机号码',
  56.   `email` varchar(64) DEFAULT NULL COMMENT '邮箱',
  57.   `header` varchar(500) DEFAULT NULL COMMENT '头像',
  58.   `gender` tinyint(4) DEFAULT NULL COMMENT '性别',
  59.   `birth` date DEFAULT NULL COMMENT '生日',
  60.   `city` varchar(500) DEFAULT NULL COMMENT '所在城市',
  61.   `job` varchar(255) DEFAULT NULL COMMENT '职业',
  62.   `sign` varchar(255) DEFAULT NULL COMMENT '个性签名',
  63.   `source_type` tinyint(4) DEFAULT NULL COMMENT '用户来源',
  64.   `integration` int(11) DEFAULT NULL COMMENT '积分',
  65.   `growth` int(11) DEFAULT NULL COMMENT '成长值',
  66.   `status` tinyint(4) DEFAULT NULL COMMENT '启用状态',
  67.   `create_time` datetime DEFAULT NULL COMMENT '注册时间',
  68.   `social_uid` varchar(255) DEFAULT NULL COMMENT '社交用户的唯一id',
  69.   `access_token` varchar(255) DEFAULT NULL COMMENT '访问令牌',
  70.   `expires_in` varchar(255) DEFAULT NULL COMMENT '访问令牌的时间',
  71.   PRIMARY KEY (`id`)
  72. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员';
  73. -- ----------------------------
  74. -- Records of ums_member
  75. -- ----------------------------
  76. -- ----------------------------
  77. -- Table structure for ums_member_collect_spu
  78. -- ----------------------------
  79. DROP TABLE IF EXISTS `ums_member_collect_spu`;
  80. CREATE TABLE `ums_member_collect_spu` (
  81.   `id` bigint(20) NOT NULL COMMENT 'id',
  82.   `member_id` bigint(20) DEFAULT NULL COMMENT '会员id',
  83.   `spu_id` bigint(20) DEFAULT NULL COMMENT 'spu_id',
  84.   `spu_name` varchar(500) DEFAULT NULL COMMENT 'spu_name',
  85.   `spu_img` varchar(500) DEFAULT NULL COMMENT 'spu_img',
  86.   `create_time` datetime DEFAULT NULL COMMENT 'create_time',
  87.   PRIMARY KEY (`id`)
  88. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员收藏的商品';
  89. -- ----------------------------
  90. -- Records of ums_member_collect_spu
  91. -- ----------------------------
  92. -- ----------------------------
  93. -- Table structure for ums_member_collect_subject
  94. -- ----------------------------
  95. DROP TABLE IF EXISTS `ums_member_collect_subject`;
  96. CREATE TABLE `ums_member_collect_subject` (
  97.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  98.   `subject_id` bigint(20) DEFAULT NULL COMMENT 'subject_id',
  99.   `subject_name` varchar(255) DEFAULT NULL COMMENT 'subject_name',
  100.   `subject_img` varchar(500) DEFAULT NULL COMMENT 'subject_img',
  101.   `subject_urll` varchar(500) DEFAULT NULL COMMENT '活动url',
  102.   PRIMARY KEY (`id`)
  103. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员收藏的专题活动';
  104. -- ----------------------------
  105. -- Records of ums_member_collect_subject
  106. -- ----------------------------
  107. -- ----------------------------
  108. -- Table structure for ums_member_level
  109. -- ----------------------------
  110. DROP TABLE IF EXISTS `ums_member_level`;
  111. CREATE TABLE `ums_member_level` (
  112.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  113.   `name` varchar(100) DEFAULT NULL COMMENT '等级名称',
  114.   `growth_point` int(11) DEFAULT NULL COMMENT '等级需要的成长值',
  115.   `default_status` tinyint(4) DEFAULT NULL COMMENT '是否为默认等级[0->不是;1->是]',
  116.   `free_freight_point` decimal(18,4) DEFAULT NULL COMMENT '免运费标准',
  117.   `comment_growth_point` int(11) DEFAULT NULL COMMENT '每次评价获取的成长值',
  118.   `priviledge_free_freight` tinyint(4) DEFAULT NULL COMMENT '是否有免邮特权',
  119.   `priviledge_member_price` tinyint(4) DEFAULT NULL COMMENT '是否有会员价格特权',
  120.   `priviledge_birthday` tinyint(4) DEFAULT NULL COMMENT '是否有生日特权',
  121.   `note` varchar(255) DEFAULT NULL COMMENT '备注',
  122.   PRIMARY KEY (`id`)
  123. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员等级';
  124. -- ----------------------------
  125. -- Records of ums_member_level
  126. -- ----------------------------
  127. -- ----------------------------
  128. -- Table structure for ums_member_login_log
  129. -- ----------------------------
  130. DROP TABLE IF EXISTS `ums_member_login_log`;
  131. CREATE TABLE `ums_member_login_log` (
  132.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  133.   `member_id` bigint(20) DEFAULT NULL COMMENT 'member_id',
  134.   `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  135.   `ip` varchar(64) DEFAULT NULL COMMENT 'ip',
  136.   `city` varchar(64) DEFAULT NULL COMMENT 'city',
  137.   `login_type` tinyint(1) DEFAULT NULL COMMENT '登录类型[1-web,2-app]',
  138.   PRIMARY KEY (`id`)
  139. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员登录记录';
  140. -- ----------------------------
  141. -- Records of ums_member_login_log
  142. -- ----------------------------
  143. -- ----------------------------
  144. -- Table structure for ums_member_receive_address
  145. -- ----------------------------
  146. DROP TABLE IF EXISTS `ums_member_receive_address`;
  147. CREATE TABLE `ums_member_receive_address` (
  148.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  149.   `member_id` bigint(20) DEFAULT NULL COMMENT 'member_id',
  150.   `name` varchar(255) DEFAULT NULL COMMENT '收货人姓名',
  151.   `phone` varchar(64) DEFAULT NULL COMMENT '电话',
  152.   `post_code` varchar(64) DEFAULT NULL COMMENT '邮政编码',
  153.   `province` varchar(100) DEFAULT NULL COMMENT '省份/直辖市',
  154.   `city` varchar(100) DEFAULT NULL COMMENT '城市',
  155.   `region` varchar(100) DEFAULT NULL COMMENT '区',
  156.   `detail_address` varchar(255) DEFAULT NULL COMMENT '详细地址(街道)',
  157.   `areacode` varchar(15) DEFAULT NULL COMMENT '省市区代码',
  158.   `default_status` tinyint(1) DEFAULT NULL COMMENT '是否默认',
  159.   PRIMARY KEY (`id`)
  160. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员收货地址';
  161. -- ----------------------------
  162. -- Records of ums_member_receive_address
  163. -- ----------------------------
  164. -- ----------------------------
  165. -- Table structure for ums_member_statistics_info
  166. -- ----------------------------
  167. DROP TABLE IF EXISTS `ums_member_statistics_info`;
  168. CREATE TABLE `ums_member_statistics_info` (
  169.   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  170.   `member_id` bigint(20) DEFAULT NULL COMMENT '会员id',
  171.   `consume_amount` decimal(18,4) DEFAULT NULL COMMENT '累计消费金额',
  172.   `coupon_amount` decimal(18,4) DEFAULT NULL COMMENT '累计优惠金额',
  173.   `order_count` int(11) DEFAULT NULL COMMENT '订单数量',
  174.   `coupon_count` int(11) DEFAULT NULL COMMENT '优惠券数量',
  175.   `comment_count` int(11) DEFAULT NULL COMMENT '评价数',
  176.   `return_order_count` int(11) DEFAULT NULL COMMENT '退货数量',
  177.   `login_count` int(11) DEFAULT NULL COMMENT '登录次数',
  178.   `attend_count` int(11) DEFAULT NULL COMMENT '关注数量',
  179.   `fans_count` int(11) DEFAULT NULL COMMENT '粉丝数量',
  180.   `collect_product_count` int(11) DEFAULT NULL COMMENT '收藏的商品数量',
  181.   `collect_subject_count` int(11) DEFAULT NULL COMMENT '收藏的专题活动数量',
  182.   `collect_comment_count` int(11) DEFAULT NULL COMMENT '收藏的评论数量',
  183.   `invite_friend_count` int(11) DEFAULT NULL COMMENT '邀请的朋友数量',
  184.   PRIMARY KEY (`id`)
  185. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员统计信息';
  186. -- ----------------------------
  187. -- Records of ums_member_statistics_info
  188. -- ----------------------------
  189. -- ----------------------------
  190. -- Table structure for undo_log
  191. -- ----------------------------
  192. DROP TABLE IF EXISTS `undo_log`;
  193. CREATE TABLE `undo_log` (
  194.   `id` bigint(20) NOT NULL AUTO_INCREMENT,
  195.   `branch_id` bigint(20) NOT NULL,
  196.   `xid` varchar(100) NOT NULL,
  197.   `context` varchar(128) NOT NULL,
  198.   `rollback_info` longblob NOT NULL,
  199.   `log_status` int(11) NOT NULL,
  200.   `log_created` datetime NOT NULL,
  201.   `log_modified` datetime NOT NULL,
  202.   `ext` varchar(100) DEFAULT NULL,
  203.   PRIMARY KEY (`id`),
  204.   UNIQUE KEY `ux_undo_log` (`xid`,`branch_id`) USING BTREE
  205. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  206. -- ----------------------------
  207. -- Records of undo_log
  208. -- ----------------------------
复制代码
6,DBeaver批量执行SQL小技巧

可以参考这篇小文章,如安在DBeaver上批量执行SQL。

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

九天猎人

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表