/*
 Navicat Premium Data Transfer

 Source Server         : 测试
 Source Server Type    : MariaDB
 Source Server Version : 100318
 Source Host           : test.tall.wiki:3306
 Source Schema         : ct

 Target Server Type    : MariaDB
 Target Server Version : 100318
 File Encoding         : 65001

 Date: 13/05/2021 15:10:11
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for t_business
-- ----------------------------
DROP TABLE IF EXISTS `t_business`;
CREATE TABLE `t_business`  (
  `id` bigint(20) NOT NULL,
  `name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '商户名',
  `address` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '地址',
  `applicant_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '申请人姓名',
  `applicant_id_card` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '申请人身份证号',
  `applicant_phone` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '申请人手机号',
  `business_license` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '营业执照',
  `qr_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '公众号二维码',
  `user_id` bigint(20) NULL DEFAULT 0 COMMENT '申请人的userid',
  `passed` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '是否通过审核 0未通过 1通过',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `user_index`(`user_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商户表' ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for t_site
-- ----------------------------
DROP TABLE IF EXISTS `t_site`;
CREATE TABLE `t_site`  (
  `id` bigint(20) NOT NULL,
  `business_id` bigint(20) NULL DEFAULT 0 COMMENT '商户id',
  `site_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '场馆名',
  `site_code` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '场馆code',
  `longitude` decimal(5, 2) NULL DEFAULT 0.00 COMMENT '经度',
  `latitude` decimal(5, 2) NULL DEFAULT 0.00 COMMENT '纬度',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `business_index`(`business_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '场所表' ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for t_site_clock_in
-- ----------------------------
DROP TABLE IF EXISTS `t_site_clock_in`;
CREATE TABLE `t_site_clock_in`  (
  `id` bigint(20) NOT NULL,
  `qrcode_id` bigint(20) NULL DEFAULT 0 COMMENT '二维码id',
  `time` bigint(20) NULL DEFAULT 0 COMMENT '打卡时间',
  `longitude` decimal(5, 2) NULL DEFAULT 0.00 COMMENT '经度',
  `latitude` decimal(5, 2) NULL DEFAULT 0.00 COMMENT '纬度',
  `user_id` bigint(20) NULL DEFAULT 0 COMMENT '用户id',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `qrcode_index`(`qrcode_id`) USING BTREE,
  INDEX `user_index`(`user_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '打卡记录' ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for t_site_qrcode
-- ----------------------------
DROP TABLE IF EXISTS `t_site_qrcode`;
CREATE TABLE `t_site_qrcode`  (
  `id` bigint(20) NOT NULL,
  `site_id` bigint(20) NULL DEFAULT 0 COMMENT '场馆id',
  `out_or_in` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '进or出 0进 1出',
  `qrcode_path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '二维码路径',
  `big_qrcode_path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '二维码大图路径',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `site_index`(`site_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '场所二维码表' ROW_FORMAT = Compact;

SET FOREIGN_KEY_CHECKS = 1;
