数据表的创建
用户表
CREATE TABLE `bld_lucky_user` (
`id` bigint NOT NULL,
`username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NOT NULL COMMENT '账号',
`password` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NOT NULL COMMENT '密码',
`name` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NOT NULL COMMENT '姓名',
`phone` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NOT NULL COMMENT '电话',
`create_time` datetime DEFAULT NULL,
`creator` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`updater` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_german2_ci;
活动表
CREATE TABLE `bld_lucky_activity` (
`id` int NOT NULL,
`activity_name` varchar(100) COLLATE utf8mb4_german2_ci DEFAULT NULL COMMENT '活动名称',
`start_time` datetime DEFAULT NULL COMMENT '开始时间',
`end_time` datetime DEFAULT NULL COMMENT '结束时间',
`describe` varchar(500) COLLATE utf8mb4_german2_ci DEFAULT NULL COMMENT '描述信息',
`create_time` datetime DEFAULT NULL,
`creator` varchar(10) COLLATE utf8mb4_german2_ci DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`updater` varchar(10) COLLATE utf8mb4_german2_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_german2_ci;
奖品表
CREATE TABLE `bld_lucky_prize` (
`id` bigint NOT NULL,
`prize_name` varchar(20) COLLATE utf8mb4_german2_ci DEFAULT NULL COMMENT '奖品名称',
`inventory` int DEFAULT NULL COMMENT '库存',
`money` decimal(10,2) DEFAULT NULL COMMENT '金额',
`type` tinyint DEFAULT NULL COMMENT '类型(1:商品2:金额)',
`create_time` datetime DEFAULT NULL,
`creator` varchar(10) COLLATE utf8mb4_german2_ci DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`updater` varchar(10) COLLATE utf8mb4_german2_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_german2_ci;
奖项表
CREATE TABLE `bld_lucky_award` (
`id` bigint NOT NULL,
`prize_id` bigint DEFAULT NULL COMMENT '奖品id',
`number` int DEFAULT NULL COMMENT '数量',
`award_name` varchar(40) COLLATE utf8mb4_german2_ci DEFAULT NULL COMMENT '奖项名称',
`probability` double DEFAULT NULL COMMENT '获奖概率',
`create_time` datetime DEFAULT NULL,
`creator` varchar(10) COLLATE utf8mb4_german2_ci DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`updater` varchar(10) COLLATE utf8mb4_german2_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_german2_ci;
抽奖规则表
CREATE TABLE `bld_lucky_rule` (
`id` bigint NOT NULL,
`rule_name` varchar(50) COLLATE utf8mb4_german2_ci DEFAULT NULL COMMENT '规则名称',
`max_join_number` int DEFAULT NULL COMMENT '最大参与次数',
`max_winning_number` int DEFAULT NULL COMMENT '最大可中奖次数',
`create_time` datetime DEFAULT NULL,
`creator` varchar(10) COLLATE utf8mb4_german2_ci DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`updater` varchar(10) COLLATE utf8mb4_german2_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_german2_ci;
抽奖记录表
CREATE TABLE `bld_lucky_record` (
`id` bigint NOT NULL,
`user_id` bigint NOT NULL COMMENT '用户id',
`activity_id` bigint NOT NULL COMMENT '活动id',
`award_id` bigint NOT NULL COMMENT '奖项id',
`is_winning` tinyint(1) NOT NULL COMMENT '是否中奖0:未中奖 1:中奖',
`state` int DEFAULT NULL COMMENT '状态',
`create_time` datetime DEFAULT NULL,
`creator` varchar(10) COLLATE utf8mb4_german2_ci DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`updater` varchar(10) COLLATE utf8mb4_german2_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_german2_ci;
领奖记录表
CREATE TABLE `bld_lucky_accept_record` (
`id` bigint DEFAULT NULL,
`record_id` bigint DEFAULT NULL,
`phone` varchar(15) COLLATE utf8mb4_german2_ci DEFAULT NULL,
`address` varchar(500) COLLATE utf8mb4_german2_ci DEFAULT NULL,
`crate_time` datetime DEFAULT NULL,
`creator` varchar(10) COLLATE utf8mb4_german2_ci DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`updater` varchar(10) COLLATE utf8mb4_german2_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_german2_ci;