2_20240307.sql 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. -- 使用汉鹏新的设计,本SQL文件已经作废
  2. -- 扩展消费者(会员)“身价”相关修改
  3. -- 为消费者(即会员表)增加当前身价值、预增加的身价值、增加后的身价总值、 直接推荐人id字段等
  4. /*
  5. ALTER TABLE `member_user`
  6. ADD COLUMN `recommenderd_id` bigint COMMENT '直接推荐人id',
  7. ADD COLUMN `current_member_worth_value` bigint COMMENT '当前身价值',
  8. ADD COLUMN `pre_added_member_worth_value` bigint COMMENT '预增加身价值',
  9. ADD COLUMN `future_member_worth_value` bigint COMMENT '未来身价值,未来身价值=当前身价值+预增加身价值',
  10. ADD COLUMN `current_member_worth_level_name` varchar(64) COMMENT '当前身价级别名称',
  11. ADD COLUMN `current_member_worth_level_id` bigint COMMENT '当前身价级别id',
  12. ADD COLUMN `last_sign_in_time` datetime COMMENT '最后签到时间',
  13. ADD COLUMN `continuous_sign_in_days` datetime COMMENT '连续签到天数';
  14. -- 身价级别表设置表
  15. CREATE TABLE `member_worth_level_setting` (
  16. `id` bigint NOT NULL COMMENT '身价级别id',
  17. `level_name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '身价级别名称',
  18. `member_worth_value` bigint NOT NULL DEFAULT 0 COMMENT '本级别需达到的身价值',
  19. `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
  20. `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  21. `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
  22. `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  23. `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  24. `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
  25. PRIMARY KEY (`id`) USING BTREE
  26. ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '铺身价级别表设置表' ROW_FORMAT = Dynamic;
  27. -- 增加 会员资产变化类别表, 此表主要用于设置各种导致用户资产发生变化的行为的分值变化
  28. -- 字段有id、类别码(数字类型,在java中对应常量)、类别名称、类别描述、变化值(就是签到身价加100那个100)
  29. CREATE TABLE `member_assets_change_category` (
  30. `id` bigint NOT NULL COMMENT '会员资产变化类别id',
  31. `name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '类别名称',
  32. `code` int NOT NULL DEFAULT -1 COMMENT '类别码',
  33. `variation_value` int NOT NULL DEFAULT 0 COMMENT '身价、积分、看点在本类别操作的变化值',
  34. `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '描述',
  35. `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
  36. `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  37. `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
  38. `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  39. `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  40. `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
  41. PRIMARY KEY (`id`) USING BTREE
  42. ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员资产变化类别表,含身价、积分、看点变化类别' ROW_FORMAT = Dynamic;
  43. -- 会员身价变化日志表
  44. -- 字段有会员资产变化类别id、分值、操作时间、对象名(如 订单表名)、对象id(如 订单id)、是否已生效、计划生效时间、实际生效时间、描述
  45. CREATE TABLE `member_worth_value_change_log` (
  46. `id` bigint NOT NULL AUTO_INCREMENT COMMENT '会员身价变化日志id',
  47. `member_assets_change_category_id` bigint NOT NULL COMMENT '会员资产变化类别id',-- 新加字段
  48. `member_worth_value` bigint NOT NULL COMMENT '身价值',
  49. `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '操作时间',
  50. `object_name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '操作对应业务对象名称',
  51. `object_id` bigint NOT NULL DEFAULT 0 COMMENT '操作对应业务对象id',
  52. `effective` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否已生效',
  53. `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '描述',
  54. `plan_effective_time` datetime NULL COMMENT '计划生效时间',
  55. `actual_effective_time` datetime NULL COMMENT '实际生效时间',
  56. `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
  57. `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
  58. `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  59. `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  60. `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
  61. PRIMARY KEY (`id`) USING BTREE
  62. ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '店铺表' ROW_FORMAT = Dynamic;
  63. -- 增加 会员签到表
  64. CREATE TABLE `member_sign_in` (
  65. `id` bigint NOT NULL AUTO_INCREMENT COMMENT '会员签到表id',
  66. `member_user_id` bigint NOT NULL DEFAULT 0 COMMENT '会员用户id',
  67. `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '签到时间',
  68. `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
  69. `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
  70. `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  71. `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  72. `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
  73. PRIMARY KEY (`id`) USING BTREE
  74. ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '店铺表' ROW_FORMAT = Dynamic;
  75. -- 为消费者(即会员表)增加当前的积分值、预增加的积分值、累计消费额(只算人民币)
  76. ALTER TABLE `member_user`
  77. ADD COLUMN `current_member_points` bigint COMMENT '当前积分值',
  78. ADD COLUMN `pre_added_member_worth` bigint COMMENT '预增加积分值'
  79. ;
  80. -- 消费者(即会员表)增加累计消费金额(只算人民币)
  81. ALTER TABLE `member_user`
  82. ADD COLUMN `cumulative_spending` bigint COMMENT '累计消费金额(只算人民币,单位为分)';
  83. /* 会员积分变化日志表:会员资产变化类别id、分值、操作时间、对象名(如 订单表名)、对象id(如 订单id)、
  84. 是否已生效、计划生效时间、实际生效时间、描述。定时器直接扫描本表未生效,且过了计划生效时间的数据进行处理。
  85. */
  86. CREATE TABLE `member_points_change_log` (
  87. `id` bigint NOT NULL AUTO_INCREMENT COMMENT '会员积分变化日志id',
  88. `member_assets_change_category_id` bigint NOT NULL COMMENT '会员资产变化类别id',
  89. `member_points` bigint NOT NULL COMMENT '积分值',
  90. `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '操作时间',
  91. `object_name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '操作对应业务对象名称(如 订单表名)',
  92. `object_id` bigint NOT NULL DEFAULT 0 COMMENT '操作对应业务对象id(如 订单id)',
  93. `effective` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否已生效',
  94. `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '描述',
  95. `plan_effective_time` datetime NULL COMMENT '计划生效时间',
  96. `actual_effective_time` datetime NULL COMMENT '实际生效时间',
  97. `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
  98. `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
  99. `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  100. `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  101. `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
  102. PRIMARY KEY (`id`) USING BTREE
  103. ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '店铺表' ROW_FORMAT = Dynamic;
  104. */