15_20240701.sql 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. CREATE TABLE `trade_shop_settlement` (
  2. `id` bigint NOT NULL AUTO_INCREMENT COMMENT '结算id',
  3. `shop_id` bigint NOT NULL COMMENT '店铺id',
  4. `merchant_id` bigint NOT NULL COMMENT '商户id',
  5. `platform_collection_amount` int NOT NULL DEFAULT '0' COMMENT '销售额(积分 + 支付金额)',
  6. `shop_amount` bigint NOT NULL DEFAULT '0' COMMENT '抵扣积分',
  7. `shop_total_high_amount` decimal(20,6) DEFAULT '0.000000' COMMENT '共计成本价格(高精度 + 成本)',
  8. `pt_settlement_id` bigint NOT NULL COMMENT '平台结算ID',
  9. `attachment` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '转账凭证附件',
  10. `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '' COMMENT '创建者',
  11. `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  12. `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '' COMMENT '更新者',
  13. `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  14. `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  15. PRIMARY KEY (`id`) USING BTREE
  16. ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='订单结算信息表,记录店铺的结算信息';
  17. ALTER TABLE trade_order_item
  18. ADD COLUMN `settlement_time` datetime DEFAULT NULL COMMENT '是否结算账单';
  19. CREATE TABLE trade_order_settlement (
  20. `id` bigint NOT NULL AUTO_INCREMENT COMMENT '结算二级表ID',
  21. `trade_shop_settlement_id` bigint NOT NULL COMMENT '结算表ID',
  22. `trade_order_id` bigint NOT NULL COMMENT '订单ID',
  23. `creator` VARCHAR ( 64 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '' COMMENT '创建者',
  24. `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  25. `updater` VARCHAR ( 64 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '' COMMENT '更新者',
  26. `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  27. `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  28. PRIMARY KEY ( `id` ) USING BTREE
  29. ) AUTO_INCREMENT = 3 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '订单结算表,记录有那些订单参与了本次结算';
  30. CREATE TABLE trade_order_item_settlement (
  31. `id` bigint NOT NULL AUTO_INCREMENT COMMENT '结算二级表ID',
  32. `trade_shop_settlement_id` bigint NOT NULL COMMENT '结算表ID',
  33. `trade_order_item_id` bigint NOT NULL COMMENT '订单项ID',
  34. `creator` VARCHAR ( 64 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '' COMMENT '创建者',
  35. `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  36. `updater` VARCHAR ( 64 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '' COMMENT '更新者',
  37. `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  38. `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  39. PRIMARY KEY ( `id` ) USING BTREE
  40. ) AUTO_INCREMENT = 3 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '订单结算表,记录有那些订单项参与了本次结算';
  41. CREATE TABLE `trade_pt_settlement` (
  42. `id` bigint NOT NULL AUTO_INCREMENT COMMENT '结算id',
  43. `platform_collection_amount` int NOT NULL DEFAULT '0' COMMENT '销售额(积分 + 支付金额)',
  44. `shop_amount` bigint NOT NULL DEFAULT '0' COMMENT '抵扣积分',
  45. `shop_total_high_amount` decimal(20,6) DEFAULT '0.000000' COMMENT '共计成本价格(高精度 + 成本)',
  46. `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '' COMMENT '创建者',
  47. `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  48. `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '' COMMENT '更新者',
  49. `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  50. `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  51. `platform_transfer_confirm` bit(1) DEFAULT b'0' COMMENT '是否结账',
  52. PRIMARY KEY (`id`) USING BTREE
  53. ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='平台每日结算信息表,记录店铺的结算信息';