feat: 新增sql文件
含有三个核心表: - clock_records: 记录员工打卡事件 - qr_codes: 存储二维码位置信息 - workers: 存储员工账户信息 包含初始测试数据用于系统开发和测试
This commit is contained in:
@@ -0,0 +1,78 @@
|
|||||||
|
# Host: localhost (Version: 5.7.26)
|
||||||
|
# Date: 2025-06-17 17:40:28
|
||||||
|
# Generator: MySQL-Front 5.3 (Build 4.234)
|
||||||
|
|
||||||
|
/*!40101 SET NAMES utf8 */;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Structure for table "clock_records"
|
||||||
|
#
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `clock_records`;
|
||||||
|
CREATE TABLE `clock_records` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`worker_id` int(11) NOT NULL,
|
||||||
|
`event_type` enum('clock_in','clock_out') NOT NULL,
|
||||||
|
`timestamp` datetime NOT NULL,
|
||||||
|
`qr_code_id` varchar(255) DEFAULT NULL,
|
||||||
|
`latitude` decimal(10,8) DEFAULT NULL,
|
||||||
|
`longitude` decimal(11,8) DEFAULT NULL,
|
||||||
|
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
`notes` text,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `worker_id` (`worker_id`),
|
||||||
|
KEY `qr_code_id` (`qr_code_id`)
|
||||||
|
) ENGINE=MyISAM AUTO_INCREMENT=39 DEFAULT CHARSET=utf8 COMMENT='Logs every clock-in and clock-out event for all workers.';
|
||||||
|
|
||||||
|
#
|
||||||
|
# Data for table "clock_records"
|
||||||
|
#
|
||||||
|
|
||||||
|
/*!40000 ALTER TABLE `clock_records` DISABLE KEYS */;
|
||||||
|
INSERT INTO `clock_records` VALUES (2,1,'clock_out','2025-06-10 17:30:00','FACTORY-MAIN-ENTRANCE',NULL,NULL,'2025-06-13 13:39:51',NULL),(3,1,'clock_in','2025-06-13 14:09:50','FACTORY-MAIN-ENTRANCE',3.15785050,101.72055800,'2025-06-13 14:09:49',NULL),(4,1,'clock_out','2025-06-13 14:10:01','FACTORY-MAIN-ENTRANCE',3.15785050,101.72055800,'2025-06-13 14:10:00',NULL),(5,2,'clock_in','2025-06-13 14:10:41','FACTORY-MAIN-ENTRANCE',3.15785050,101.72055800,'2025-06-13 14:10:41',NULL),(6,2,'clock_out','2025-06-13 14:10:55','FACTORY-MAIN-ENTRANCE',3.15785050,101.72055800,'2025-06-13 14:10:54',NULL),(7,2,'clock_in','2025-06-13 14:17:51','d654a6bf-2b48-49e9-95c8-4fe9af6c3e44',3.15785050,101.72055800,'2025-06-13 14:17:50',NULL),(8,2,'clock_out','2025-06-13 14:17:56','d654a6bf-2b48-49e9-95c8-4fe9af6c3e44',3.15785050,101.72055800,'2025-06-13 14:17:56',NULL),(9,4,'clock_in','2025-06-13 14:59:56','d654a6bf-2b48-49e9-95c8-4fe9af6c3e44',3.15785050,101.72055800,'2025-06-13 14:59:55',NULL),(10,4,'clock_out','2025-06-13 15:00:08','d654a6bf-2b48-49e9-95c8-4fe9af6c3e44',3.15785050,101.72055800,'2025-06-13 15:00:07',NULL),(16,8,'clock_in','2025-06-12 09:05:00','WAREHOUSE-SECTION-A',NULL,NULL,'2025-06-13 16:02:39',NULL),(17,8,'clock_out','2025-06-12 17:15:00','WAREHOUSE-SECTION-A',NULL,NULL,'2025-06-13 16:02:39',NULL),(18,10,'clock_in','2025-06-13 08:45:00','FACTORY-MAIN-ENTRANCE',NULL,NULL,'2025-06-13 16:02:39',NULL),(19,4,'clock_in','2025-06-12 09:28:19','d654a6bf-2b48-49e9-95c8-4fe9af6c3e44',3.15792400,101.72059600,'2025-06-16 11:28:19',NULL),(20,4,'clock_out','2025-06-12 17:28:56','WAREHOUSE-SECTION-A',3.15760800,101.72043600,'2025-06-16 11:28:55',NULL),(22,8,'clock_in','2025-06-13 09:05:00','WAREHOUSE-SECTION-A',NULL,NULL,'2025-06-16 14:19:37',NULL),(23,8,'clock_out','2025-06-13 12:15:00','WAREHOUSE-SECTION-A',NULL,NULL,'2025-06-16 14:19:37',NULL),(24,8,'clock_in','2025-06-13 14:05:00','WAREHOUSE-SECTION-A',NULL,NULL,'2025-06-16 14:19:37',NULL),(25,8,'clock_out','2025-06-13 17:15:00','WAREHOUSE-SECTION-A',NULL,NULL,'2025-06-16 14:19:37',NULL),(30,6,'clock_in','2025-06-13 09:05:00','WAREHOUSE-SECTION-A',NULL,NULL,'2025-06-16 14:39:58',NULL),(31,6,'clock_out','2025-06-13 12:15:00','WAREHOUSE-SECTION-A',NULL,NULL,'2025-06-16 14:39:58',NULL),(32,6,'clock_in','2025-06-13 14:05:00','WAREHOUSE-SECTION-A',NULL,NULL,'2025-06-16 14:39:58',NULL),(33,6,'clock_out','2025-06-13 17:15:00','WAREHOUSE-SECTION-A',NULL,NULL,'2025-06-16 14:39:58',NULL),(34,10,'clock_in','2025-06-13 09:05:00','WAREHOUSE-SECTION-A',NULL,NULL,'2025-06-16 14:39:58',NULL),(35,10,'clock_out','2025-06-13 12:15:00','WAREHOUSE-SECTION-A',NULL,NULL,'2025-06-16 14:39:58',NULL),(36,10,'clock_in','2025-06-13 14:05:00','WAREHOUSE-SECTION-A',NULL,NULL,'2025-06-16 14:39:58',NULL),(37,10,'clock_out','2025-06-13 17:15:00','WAREHOUSE-SECTION-A',NULL,NULL,'2025-06-16 14:39:58',NULL),(38,1,'clock_in','2025-06-17 10:51:00','WAREHOUSE-SECTION-A',3.15786900,101.72065000,'2025-06-17 10:50:59',NULL),(39,1,'clock_out','2025-06-17 10:58:00',NULL,NULL,NULL,'2025-06-17 10:59:44','testing');
|
||||||
|
/*!40000 ALTER TABLE `clock_records` ENABLE KEYS */;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Structure for table "qr_codes"
|
||||||
|
#
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `qr_codes`;
|
||||||
|
CREATE TABLE `qr_codes` (
|
||||||
|
`id` varchar(255) NOT NULL COMMENT 'Using the UUID string as the primary key',
|
||||||
|
`name` varchar(255) NOT NULL,
|
||||||
|
`is_active` tinyint(1) NOT NULL DEFAULT '1',
|
||||||
|
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Stores all physical QR code locations and their status.';
|
||||||
|
|
||||||
|
#
|
||||||
|
# Data for table "qr_codes"
|
||||||
|
#
|
||||||
|
|
||||||
|
/*!40000 ALTER TABLE `qr_codes` DISABLE KEYS */;
|
||||||
|
INSERT INTO `qr_codes` VALUES ('ASSEMBLY-LINE-1','Assembly Line 1',1,'2025-06-13 13:39:51'),('d654a6bf-2b48-49e9-95c8-4fe9af6c3e44','Gate B',1,'2025-06-13 14:00:31'),('FACTORY-MAIN-ENTRANCE','Factory Main Entrance',0,'2025-06-13 13:39:51'),('WAREHOUSE-SECTION-A','Warehouse Section A',1,'2025-06-13 13:39:51');
|
||||||
|
/*!40000 ALTER TABLE `qr_codes` ENABLE KEYS */;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Structure for table "workers"
|
||||||
|
#
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `workers`;
|
||||||
|
CREATE TABLE `workers` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`username` varchar(255) NOT NULL,
|
||||||
|
`password_hash` varchar(255) NOT NULL COMMENT 'Store hashed passwords, not plain text!',
|
||||||
|
`full_name` varchar(255) NOT NULL,
|
||||||
|
`role` enum('worker','manager') NOT NULL,
|
||||||
|
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `username` (`username`)
|
||||||
|
) ENGINE=MyISAM AUTO_INCREMENT=27 DEFAULT CHARSET=utf8 COMMENT='Stores user account information for both workers and managers.';
|
||||||
|
|
||||||
|
#
|
||||||
|
# Data for table "workers"
|
||||||
|
#
|
||||||
|
|
||||||
|
/*!40000 ALTER TABLE `workers` DISABLE KEYS */;
|
||||||
|
INSERT INTO `workers` VALUES (1,'worker','password','John Doe','worker','2025-06-13 13:39:51'),(2,'worker2','password','Jane Smith','worker','2025-06-13 13:39:51'),(3,'manager','password','Manager Bob','manager','2025-06-13 13:39:51'),(4,'ryanlee','password','Ryan Lee','worker','2025-06-13 14:48:06'),(6,'modewang','password','Ryan Qi','worker','2025-06-13 15:53:08'),(8,'bwilliams','password','Bob Williams','worker','2025-06-13 15:57:30'),(10,'dmiller','password','Diana Miller','worker','2025-06-13 15:57:30');
|
||||||
|
/*!40000 ALTER TABLE `workers` ENABLE KEYS */;
|
||||||
Reference in New Issue
Block a user