/*
 Navicat Premium Dump SQL

 Source Server         : home
 Source Server Type    : MySQL
 Source Server Version : 90500 (9.5.0)
 Source Host           : localhost:3306
 Source Schema         : library_management

 Target Server Type    : MySQL
 Target Server Version : 90500 (9.5.0)
 File Encoding         : 65001

 Date: 21/03/2026 11:35:12
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- 删除旧表（如果存在）
-- ----------------------------
DROP TABLE IF EXISTS `library_management_activity_registration`;
DROP TABLE IF EXISTS `library_management_assistance_log`;
DROP TABLE IF EXISTS `library_management_borrow_record`;
DROP TABLE IF EXISTS `library_management_book_copy`;
DROP TABLE IF EXISTS `library_management_activity`;
DROP TABLE IF EXISTS `library_management_book`;
DROP TABLE IF EXISTS `library_management_employee`;
DROP TABLE IF EXISTS `library_management_reader`;

-- ----------------------------
-- Table structure for library_management_reader（读者信息表）
-- ----------------------------
CREATE TABLE `library_management_reader`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `card_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '读者证号',
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '读者姓名',
  `age` int NULL DEFAULT NULL COMMENT '年龄',
  `reader_type` tinyint NOT NULL DEFAULT 3 COMMENT '读者类型：1-老年，2-成人，3-儿童',
  `contact` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '联系方式',
  `reg_date` date NULL DEFAULT NULL COMMENT '注册日期',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `uk_card_number`(`card_number` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '读者信息表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of library_management_reader（测试数据：不同类型的读者）
-- ----------------------------
INSERT INTO `library_management_reader` VALUES
(1, 'R2024001', '张小明', 8, 3, '13800000001', '2024-01-15', 'E001', '2024-01-15 10:00:00', NULL, NULL),
(2, 'R2024002', '李华', 65, 1, '13800000002', '2024-02-10', 'E001', '2024-02-10 09:30:00', NULL, NULL),
(3, 'R2024003', '王芳', 35, 2, '13800000003', '2024-03-05', 'E002', '2024-03-05 14:20:00', NULL, NULL),
(4, 'R2024004', '陈思思', 12, 3, '13800000004', '2024-04-01', 'E002', '2024-04-01 11:00:00', NULL, NULL),
(5, 'R2024005', '刘建国', 72, 1, '13800000005', '2024-04-20', 'E002', '2024-04-20 16:45:00', NULL, NULL),
(6, 'R2024006', '赵敏', 28, 2, '13800000006', '2024-05-10', 'E001', '2024-05-10 08:00:00', NULL, NULL),
(7, 'R2024007', '孙小燕', 6, 3, '13800000007', '2024-06-01', 'E003', '2024-06-01 10:30:00', NULL, NULL),
(8, 'R2024008', '周大伟', 45, 2, '13800000008', '2024-06-15', 'E003', '2024-06-15 13:00:00', NULL, NULL);

-- ----------------------------
-- Table structure for library_management_employee（员工信息表）
-- ----------------------------
CREATE TABLE `library_management_employee`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `employee_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '员工工号',
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '员工姓名',
  `position` tinyint NOT NULL DEFAULT 1 COMMENT '职位：1-馆员，2-工作人员，3-经理',
  `contact` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '联系方式',
  `hire_date` date NULL DEFAULT NULL COMMENT '入职日期',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `uk_employee_code`(`employee_code` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '员工信息表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of library_management_employee（测试数据：三种角色的员工）
-- ----------------------------
INSERT INTO `library_management_employee` VALUES
(1, 'E001', '张经理', 3, '13900000001', '2020-01-01', NULL, '2020-01-01 08:00:00', NULL, NULL),
(2, 'E002', '李工作人员', 2, '13900000002', '2021-03-15', 'E001', '2021-03-15 09:00:00', NULL, NULL),
(3, 'E003', '王馆员', 1, '13900000003', '2022-06-01', 'E001', '2022-06-01 10:00:00', NULL, NULL),
(4, 'E004', '刘工作人员', 2, '13900000004', '2023-01-10', 'E001', '2023-01-10 08:30:00', NULL, NULL),
(5, 'E005', '陈馆员', 1, '13900000005', '2023-09-01', 'E001', '2023-09-01 09:00:00', NULL, NULL);

-- ----------------------------
-- Table structure for library_management_book（图书基本信息表）
-- ----------------------------
CREATE TABLE `library_management_book`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `isbn` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '国际标准书号',
  `title` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '书名',
  `author` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '作者',
  `publisher` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '出版社',
  `publish_year` int NULL DEFAULT NULL COMMENT '出版年份',
  `total_stock` int NOT NULL DEFAULT 0 COMMENT '总副本数',
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '图书简介',
  `target_audience` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '通用' COMMENT '面向群体：通用/儿童/成人/老年',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `uk_isbn`(`isbn` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '图书基本信息表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of library_management_book（测试数据：多种类型图书）
-- ----------------------------
INSERT INTO `library_management_book` VALUES
(1, '978-7-111-00001-1', 'Java核心技术卷I', 'Cay S. Horstmann', '机械工业出版社', 2020, 3, 'Java语言经典教材，涵盖Java基础语法和核心库', '通用', 'E003', '2024-01-10 10:00:00', NULL, NULL),
(2, '978-7-111-00002-8', 'Python编程：从入门到实践', 'Eric Matthes', '人民邮电出版社', 2019, 5, 'Python入门经典书籍，配有大量实践项目', '通用', 'E003', '2024-01-12 11:00:00', NULL, NULL),
(3, '978-7-111-00003-5', '小王子', '安托万·德·圣-埃克苏佩里', '商务印书馆', 2018, 4, '儿童文学经典，讲述小王子的星际旅行', '儿童', 'E003', '2024-01-15 09:00:00', NULL, NULL),
(4, '978-7-111-00004-2', '格林童话全集', '格林兄弟', '译林出版社', 2021, 3, '经典童话故事集，适合儿童阅读', '儿童', 'E003', '2024-01-18 14:00:00', NULL, NULL),
(5, '978-7-111-00005-9', '活着', '余华', '作家出版社', 2012, 2, '余华代表作，讲述普通人的命运', '成人', 'E003', '2024-02-01 10:00:00', NULL, NULL),
(6, '978-7-111-00006-6', '老年健康养生指南', '张明', '卫生出版社', 2023, 2, '老年人健康养生实用手册', '老年', 'E002', '2024-02-05 15:00:00', NULL, NULL),
(7, '978-7-111-00007-3', '数据结构与算法分析', 'Mark Allen Weiss', '电子工业出版社', 2020, 3, '经典算法教材，深入分析各种数据结构', '通用', 'E003', '2024-02-10 09:00:00', NULL, NULL),
(8, '978-7-111-00008-0', '安徒生童话选', '汉斯·克里斯蒂安·安徒生', '少年儿童出版社', 2022, 3, '安徒生经典童话故事，适合亲子阅读', '儿童', 'E002', '2024-02-15 11:00:00', NULL, NULL),
(9, '978-7-111-00009-7', '红楼梦', '曹雪芹', '人民文学出版社', 2019, 2, '中国古典四大名著之一', '成人', 'E003', '2024-03-01 10:00:00', NULL, NULL),
(10, '978-7-111-00010-3', '书法与养生', '李明', '文化艺术出版社', 2023, 2, '书法练习对老年人健康的好处', '老年', 'E002', '2024-03-10 14:00:00', NULL, NULL);

-- ----------------------------
-- Table structure for library_management_book_copy（图书副本表）
-- ----------------------------
CREATE TABLE `library_management_book_copy`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `book_id` bigint NOT NULL COMMENT '所属图书ID',
  `barcode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '条形码',
  `location` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '存放位置',
  `status` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '可借' COMMENT '状态：可借/借出/损坏',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `uk_barcode`(`barcode` ASC) USING BTREE,
  INDEX `idx_book_id`(`book_id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '图书副本表（每本实体书）' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of library_management_book_copy（每本书的副本数据）
-- ----------------------------
INSERT INTO `library_management_book_copy` VALUES
(1, 1, '978-7-111-00001-1-001', 'A区-1-01', '可借', 'E003', '2024-01-10 10:00:00', NULL, NULL),
(2, 1, '978-7-111-00001-1-002', 'A区-1-02', '可借', 'E003', '2024-01-10 10:00:00', NULL, NULL),
(3, 1, '978-7-111-00001-1-003', 'A区-1-03', '可借', 'E003', '2024-01-10 10:00:00', NULL, NULL),
(4, 2, '978-7-111-00002-8-001', 'A区-2-01', '可借', 'E003', '2024-01-12 11:00:00', NULL, NULL),
(5, 2, '978-7-111-00002-8-002', 'A区-2-02', '可借', 'E003', '2024-01-12 11:00:00', NULL, NULL),
(6, 2, '978-7-111-00002-8-003', 'A区-2-03', '可借', 'E003', '2024-01-12 11:00:00', NULL, NULL),
(7, 2, '978-7-111-00002-8-004', 'A区-2-04', '可借', 'E003', '2024-01-12 11:00:00', NULL, NULL),
(8, 2, '978-7-111-00002-8-005', 'A区-2-05', '可借', 'E003', '2024-01-12 11:00:00', NULL, NULL),
(9, 3, '978-7-111-00003-5-001', 'B区-1-01', '可借', 'E003', '2024-01-15 09:00:00', NULL, NULL),
(10, 3, '978-7-111-00003-5-002', 'B区-1-02', '可借', 'E003', '2024-01-15 09:00:00', NULL, NULL),
(11, 3, '978-7-111-00003-5-003', 'B区-1-03', '可借', 'E003', '2024-01-15 09:00:00', NULL, NULL),
(12, 3, '978-7-111-00003-5-004', 'B区-1-04', '可借', 'E003', '2024-01-15 09:00:00', NULL, NULL),
(13, 4, '978-7-111-00004-2-001', 'B区-2-01', '可借', 'E003', '2024-01-18 14:00:00', NULL, NULL),
(14, 4, '978-7-111-00004-2-002', 'B区-2-02', '可借', 'E003', '2024-01-18 14:00:00', NULL, NULL),
(15, 4, '978-7-111-00004-2-003', 'B区-2-03', '可借', 'E003', '2024-01-18 14:00:00', NULL, NULL),
(16, 5, '978-7-111-00005-9-001', 'C区-1-01', '可借', 'E003', '2024-02-01 10:00:00', NULL, NULL),
(17, 5, '978-7-111-00005-9-002', 'C区-1-02', '可借', 'E003', '2024-02-01 10:00:00', NULL, NULL),
(18, 6, '978-7-111-00006-6-001', 'D区-1-01', '可借', 'E002', '2024-02-05 15:00:00', NULL, NULL),
(19, 6, '978-7-111-00006-6-002', 'D区-1-02', '可借', 'E002', '2024-02-05 15:00:00', NULL, NULL),
(20, 7, '978-7-111-00007-3-001', 'A区-3-01', '可借', 'E003', '2024-02-10 09:00:00', NULL, NULL),
(21, 7, '978-7-111-00007-3-002', 'A区-3-02', '可借', 'E003', '2024-02-10 09:00:00', NULL, NULL),
(22, 7, '978-7-111-00007-3-003', 'A区-3-03', '可借', 'E003', '2024-02-10 09:00:00', NULL, NULL),
(23, 8, '978-7-111-00008-0-001', 'B区-3-01', '可借', 'E002', '2024-02-15 11:00:00', NULL, NULL),
(24, 8, '978-7-111-00008-0-002', 'B区-3-02', '可借', 'E002', '2024-02-15 11:00:00', NULL, NULL),
(25, 8, '978-7-111-00008-0-003', 'B区-3-03', '可借', 'E002', '2024-02-15 11:00:00', NULL, NULL),
(26, 9, '978-7-111-00009-7-001', 'C区-2-01', '可借', 'E003', '2024-03-01 10:00:00', NULL, NULL),
(27, 9, '978-7-111-00009-7-002', 'C区-2-02', '可借', 'E003', '2024-03-01 10:00:00', NULL, NULL),
(28, 10, '978-7-111-00010-3-001', 'D区-2-01', '可借', 'E002', '2024-03-10 14:00:00', NULL, NULL),
(29, 10, '978-7-111-00010-3-002', 'D区-2-02', '可借', 'E002', '2024-03-10 14:00:00', NULL, NULL);

-- ----------------------------
-- Table structure for library_management_borrow_record（借阅记录表）
-- ----------------------------
CREATE TABLE `library_management_borrow_record`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `reader_id` bigint NOT NULL COMMENT '读者ID',
  `copy_id` bigint NOT NULL COMMENT '副本ID',
  `borrow_date` date NOT NULL COMMENT '借出日期',
  `due_date` date NOT NULL COMMENT '应还日期',
  `return_date` date NULL DEFAULT NULL COMMENT '实际归还日期',
  `renew_count` int NOT NULL DEFAULT 0 COMMENT '续借次数',
  `operator_id` bigint NULL DEFAULT NULL COMMENT '办理员工ID（读者自助借书时为空）',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_reader_id`(`reader_id` ASC) USING BTREE,
  INDEX `idx_copy_id`(`copy_id` ASC) USING BTREE,
  INDEX `idx_operator_id`(`operator_id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '借阅记录表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of library_management_borrow_record（测试数据：部分借阅记录）
-- ----------------------------
INSERT INTO `library_management_borrow_record` VALUES
(1, 3, 1, '2024-02-10', '2024-03-11', '2024-03-05', 0, 2, 'E002', '2024-02-10 10:00:00', NULL, NULL),
(2, 6, 5, '2024-02-20', '2024-03-21', '2024-03-18', 0, 2, 'E002', '2024-02-20 14:00:00', NULL, NULL),
(3, 8, 20, '2024-03-01', '2024-03-31', NULL, 0, 3, 'E003', '2024-03-01 09:00:00', NULL, NULL),
(4, 3, 9, '2024-03-05', '2024-04-04', NULL, 0, 2, 'E002', '2024-03-05 11:00:00', NULL, NULL),
(5, 6, 16, '2024-03-10', '2024-04-09', NULL, 0, 3, 'E003', '2024-03-10 10:00:00', NULL, NULL),
(6, 8, 4, '2024-03-15', '2024-04-14', NULL, 0, 2, 'E002', '2024-03-15 15:00:00', NULL, NULL);

-- ----------------------------
-- Table structure for library_management_activity（活动信息表）
-- ----------------------------
CREATE TABLE `library_management_activity`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '活动名称',
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '活动描述',
  `start_time` datetime NOT NULL COMMENT '开始时间',
  `end_time` datetime NOT NULL COMMENT '结束时间',
  `location` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '活动地点',
  `target_reader_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '面向群体，如"老年,儿童"',
  `manager_id` bigint NULL DEFAULT NULL COMMENT '负责人ID（读者端创建活动时为空）',
  `max_participants` int NOT NULL DEFAULT 0 COMMENT '最大参与人数',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_manager_id`(`manager_id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '活动信息表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of library_management_activity（测试数据：面向不同群体的活动）
-- ----------------------------
INSERT INTO `library_management_activity` VALUES
(1, '儿童绘本故事会', '邀请专业讲师为小朋友讲述经典绘本故事，培养阅读兴趣', '2026-04-05 10:00:00', '2026-04-05 11:30:00', '二楼儿童阅览室', '儿童', 1, 30, 'E001', '2026-03-20 09:00:00', NULL, NULL),
(2, '老年健康讲座', '邀请医学专家讲解老年健康养生知识', '2026-04-12 14:00:00', '2026-04-12 16:00:00', '三楼报告厅', '老年', 1, 50, 'E001', '2026-03-21 10:00:00', NULL, NULL),
(3, '成人读书分享会', '本月主题：《活着》读书分享与讨论', '2026-04-20 19:00:00', '2026-04-20 21:00:00', '一楼多功能厅', '成人', 1, 40, 'E001', '2026-03-22 08:00:00', NULL, NULL),
(4, '青少年编程体验课', 'Python入门体验，让青少年感受编程乐趣', '2026-04-08 14:00:00', '2026-04-08 16:00:00', '电子阅览室', '儿童,成人', 1, 20, 'E001', '2026-03-23 09:00:00', NULL, NULL),
(5, '书法交流活动', '老年人书法爱好者交流活动', '2026-04-15 09:00:00', '2026-04-15 12:00:00', '五楼书法室', '老年', 1, 25, 'E001', '2026-03-23 14:00:00', NULL, NULL);

-- ----------------------------
-- Table structure for library_management_activity_registration（活动报名表）
-- ----------------------------
CREATE TABLE `library_management_activity_registration`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `activity_id` bigint NOT NULL COMMENT '活动ID',
  `reader_id` bigint NOT NULL COMMENT '读者ID',
  `register_time` datetime NOT NULL COMMENT '报名时间',
  `check_in` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否签到：0-未签到，1-已签到',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `uk_activity_reader`(`activity_id` ASC, `reader_id` ASC) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '活动报名表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of library_management_activity_registration
-- ----------------------------
INSERT INTO `library_management_activity_registration` VALUES
(1, 1, 1, '2026-03-20 10:00:00', 0, NULL, '2026-03-20 10:00:00', NULL, NULL),
(2, 1, 4, '2026-03-20 11:00:00', 0, NULL, '2026-03-20 11:00:00', NULL, NULL),
(3, 1, 7, '2026-03-21 09:00:00', 0, NULL, '2026-03-21 09:00:00', NULL, NULL),
(4, 2, 2, '2026-03-21 10:00:00', 0, NULL, '2026-03-21 10:00:00', NULL, NULL),
(5, 2, 5, '2026-03-21 14:00:00', 0, NULL, '2026-03-21 14:00:00', NULL, NULL),
(6, 3, 3, '2026-03-22 08:00:00', 0, NULL, '2026-03-22 08:00:00', NULL, NULL),
(7, 3, 6, '2026-03-22 09:00:00', 0, NULL, '2026-03-22 09:00:00', NULL, NULL),
(8, 3, 8, '2026-03-22 15:00:00', 0, NULL, '2026-03-22 15:00:00', NULL, NULL),
(9, 4, 1, '2026-03-23 09:00:00', 0, NULL, '2026-03-23 09:00:00', NULL, NULL),
(10, 5, 2, '2026-03-23 14:00:00', 0, NULL, '2026-03-23 14:00:00', NULL, NULL),
(11, 5, 5, '2026-03-23 16:00:00', 0, NULL, '2026-03-23 16:00:00', NULL, NULL);

-- ----------------------------
-- Table structure for library_management_assistance_log（读者咨询记录表）
-- ----------------------------
CREATE TABLE `library_management_assistance_log`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `reader_id` bigint NOT NULL COMMENT '读者ID',
  `worker_id` bigint NOT NULL COMMENT '工作人员ID',
  `assist_time` datetime NOT NULL COMMENT '咨询时间',
  `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '咨询内容',
  `notes` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_reader_id`(`reader_id` ASC) USING BTREE,
  INDEX `idx_worker_id`(`worker_id` ASC) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '读者咨询记录表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of library_management_assistance_log
-- ----------------------------
INSERT INTO `library_management_assistance_log` VALUES
(1, 1, 2, '2024-02-10 10:00:00', '帮助小读者张小明注册办证', '家长陪同', NULL, '2024-02-10 10:00:00', NULL, NULL),
(2, 2, 2, '2024-02-15 14:00:00', '老年读者李华咨询借阅规则', '已解答', NULL, '2024-02-15 14:00:00', NULL, NULL),
(3, 4, 4, '2024-04-05 11:00:00', '帮助陈思思注册办证（儿童）', '家长陪同', NULL, '2024-04-05 11:00:00', NULL, NULL),
(4, 7, 4, '2024-06-10 10:30:00', '帮助孙小燕注册办证（儿童）', '家长陪同', NULL, '2024-06-10 10:30:00', NULL, NULL);

SET FOREIGN_KEY_CHECKS = 1;
