Commit f0ee6467b3befb653dfebb6686cd29bfcd966151
1 parent
face9cae
mall:提交优惠券sql文件
Showing
1 changed file
with
85 additions
and
0 deletions
sql/optional/mall/coupon.sql
0 → 100644
| 1 | +DROP TABLE IF EXISTS `coupon`; | |
| 2 | +CREATE TABLE `coupon` | |
| 3 | +( | |
| 4 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户ID', | |
| 5 | + `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '优惠券类型 reward-满减 discount-折扣 random-随机', | |
| 6 | + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '优惠券名称', | |
| 7 | + `coupon_type_id` bigint UNSIGNED DEFAULT 0 COMMENT '优惠券类型id', | |
| 8 | + `coupon_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '优惠券编码', | |
| 9 | + `member_id` bigint UNSIGNED NOT NULL DEFAULT 0 COMMENT '领用人', | |
| 10 | + `use_order_id` bigint UNSIGNED NOT NULL DEFAULT 0 COMMENT '优惠券使用订单id', | |
| 11 | + `goods_type` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用', | |
| 12 | + `goods_ids` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '适用商品id', | |
| 13 | + `at_least` decimal(10, 2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '最小金额', | |
| 14 | + `money` decimal(10, 2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '面额', | |
| 15 | + `discount` decimal(10, 2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '1 =< 折扣 <= 9.9 当type为discount时需要添加', | |
| 16 | + `discount_limit` decimal(10, 2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '最多折扣金额 当type为discount时可选择性添加', | |
| 17 | + `whether_forbid_preference` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用', | |
| 18 | + `whether_expire_notice` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否开启过期提醒0-不开启 1-开启', | |
| 19 | + `expire_notice_fixed_term` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '过期前N天提醒', | |
| 20 | + `whether_noticed` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否已提醒', | |
| 21 | + `state` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '优惠券状态 1已领用(未使用) 2已使用 3已过期', | |
| 22 | + `get_type` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取', | |
| 23 | + `fetch_time` datetime NOT NULL DEFAULT 0 COMMENT '领取时间', | |
| 24 | + `use_time` datetime NOT NULL DEFAULT 0 COMMENT '使用时间', | |
| 25 | + `start_time` datetime NOT NULL DEFAULT 0 COMMENT '可使用的开始时间', | |
| 26 | + `end_time` datetime NOT NULL DEFAULT 0 COMMENT '有效期结束时间', | |
| 27 | + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | |
| 28 | + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | |
| 29 | + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | |
| 30 | + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | |
| 31 | + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | |
| 32 | + `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | |
| 33 | + PRIMARY KEY (`id`) USING BTREE | |
| 34 | +) ENGINE = InnoDB | |
| 35 | + AUTO_INCREMENT = 119 | |
| 36 | + CHARACTER SET = utf8mb4 | |
| 37 | + COLLATE = utf8mb4_unicode_ci COMMENT = '优惠券'; | |
| 38 | + | |
| 39 | +DROP TABLE IF EXISTS `coupon_templete`; | |
| 40 | +CREATE TABLE `coupon_templete` | |
| 41 | +( | |
| 42 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户ID', | |
| 43 | + `type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '优惠券类型 reward-满减 discount-折扣 random-随机', | |
| 44 | + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '优惠券名称', | |
| 45 | + `coupon_name_remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '名称备注', | |
| 46 | + `image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '优惠券图片', | |
| 47 | + `count` int(11) NOT NULL DEFAULT 0 COMMENT '发放数量', | |
| 48 | + `lead_count` int(11) NOT NULL DEFAULT 0 COMMENT '已领取数量', | |
| 49 | + `used_count` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '已使用数量', | |
| 50 | + `goods_type` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用', | |
| 51 | + `product_ids` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '适用商品id', | |
| 52 | + `has_use_limit` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '使用门槛0-无门槛 1-有门槛', | |
| 53 | + `at_least` decimal(10, 2) NOT NULL DEFAULT 0 COMMENT '满多少元使用 0代表无限制', | |
| 54 | + `money` decimal(10, 2) NOT NULL DEFAULT 0 COMMENT '发放面额 当type为reward时需要添加', | |
| 55 | + `discount` decimal(10, 2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '1 =< 折扣 <= 9.9 当type为discount时需要添加', | |
| 56 | + `discount_limit` decimal(10, 2) NOT NULL DEFAULT 0 COMMENT '最多折扣金额 当type为discount时可选择性添加', | |
| 57 | + `min_money` decimal(10, 2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '最低金额 当type为radom时需要添加', | |
| 58 | + `max_money` decimal(10, 2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '最大金额 当type为radom时需要添加', | |
| 59 | + `validity_type` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期', | |
| 60 | + `start_use_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '使用开始日期 过期类型1时必填', | |
| 61 | + `end_use_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '使用结束日期 过期类型1时必填', | |
| 62 | + `fixed_term` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效', | |
| 63 | + `whether_limitless` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否无限制0-否 1是', | |
| 64 | + `max_fetch` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '每人最大领取个数', | |
| 65 | + `whether_expire_notice` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否开启过期提醒0-不开启 1-开启', | |
| 66 | + `expire_notice_fixed_term` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '过期前N天提醒', | |
| 67 | + `whether_forbid_preference` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用', | |
| 68 | + `whether_show` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否显示', | |
| 69 | + `discount_order_money` decimal(10, 2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '订单的优惠总金额', | |
| 70 | + `order_money` decimal(10, 2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '用券总成交额', | |
| 71 | + `whether_forbidden` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否禁止发放0-否 1-是', | |
| 72 | + `order_goods_num` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '使用优惠券购买的商品数量', | |
| 73 | + `status` int(11) NOT NULL DEFAULT 0 COMMENT '状态(1进行中2已结束-1已关闭)', | |
| 74 | + `end_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '有效日期结束时间', | |
| 75 | + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | |
| 76 | + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | |
| 77 | + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | |
| 78 | + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | |
| 79 | + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | |
| 80 | + `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | |
| 81 | + PRIMARY KEY (`id`) USING BTREE | |
| 82 | +) ENGINE = InnoDB | |
| 83 | + AUTO_INCREMENT = 119 | |
| 84 | + CHARACTER SET = utf8mb4 | |
| 85 | + COLLATE = utf8mb4_unicode_ci COMMENT = '优惠券'; | |
| 0 | 86 | \ No newline at end of file | ... | ... |