DROP TABLE IF EXISTS `za_user`;
CREATE TABLE `za_user`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '用户名或手机号',
  `password` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '密码',
  `avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '头像url',
  `gender` int NULL DEFAULT NULL COMMENT '性别（0-女，1-男）',
  `nick_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '昵称',
  `mobile` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '手机号',
  `email` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '邮箱',
  `grade_id` int NULL DEFAULT NULL COMMENT '年级',
  `birth_date` date NULL DEFAULT NULL COMMENT '出生日期',
  `union_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '微信union_id',
  `open_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '微信open_id',
  `status` int NULL DEFAULT 1 COMMENT '是否启用(1启用，0禁用)',
  `deleted` bit(1) NOT NULL DEFAULT 0 COMMENT '逻辑删除标记(0-正常,1-已删除)',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `create_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '创建人',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `update_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '修改人',
  `tenant_id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT 'Default' COMMENT '租户id',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_german2_ci ROW_FORMAT = Dynamic comment '用户表';


DROP TABLE IF EXISTS `za_user_extend`;
CREATE TABLE `za_user_extend`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL COMMENT '用户ID',
  `grade_id` int COMMENT '年级ID',
  `level_id` int  COMMENT '等级ID',
  `experience` int  COMMENT '经验值',
  `deleted` bit(1) NOT NULL default 0 COMMENT '逻辑删除标记(0-正常,1-已删除)',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `create_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '创建人',
  `update_time`datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `update_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '修改人',
  `tenant_id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT 'Default'  COMMENT '租户id',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `user_id`(`user_id`) USING BTREE COMMENT '用户ID索引'
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_german2_ci ROW_FORMAT = Dynamic;



DROP TABLE IF EXISTS `za_user_relation`;
CREATE TABLE `za_user_relation`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL COMMENT '用户ID',
  `relation_id` int NOT NULL COMMENT '关系ID',
  `type` int NULL DEFAULT NULL COMMENT '类型',
  `deleted` tinyint(1) NOT NULL COMMENT '逻辑删除标记(0-正常,1-已删除)',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `create_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '创建人',
  `update_time`datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `update_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '修改人',
  `tenant_id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT 'Default'  COMMENT '租户id',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `user_id`(`user_id`) USING BTREE COMMENT '用户ID索引'
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_german2_ci ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `za_role`;
CREATE TABLE `za_role`  (
   `id` int NOT NULL AUTO_INCREMENT,
   `role_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色名称',
   `deleted` bit(1) NOT NULL default 0 COMMENT '逻辑删除标记(0-正常,1-已删除)',
   `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   `create_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '创建人',
   `update_time`datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
   `update_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '修改人',
   `tenant_id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT 'Default'  COMMENT '租户id',
    PRIMARY KEY (`id`) USING BTREE,
    INDEX `idx_roal_name`(`role_name` ASC) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_german2_ci ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of teacher_role
-- ----------------------------
INSERT INTO `za_role`(`role_name`,`create_by`,`update_by`,`tenant_id`) VALUES ( 'admin','system', 'system','default');
INSERT INTO `za_role`(`role_name`,`create_by`,`update_by`,`tenant_id`)  VALUES ('parent','system', 'system','default');
INSERT INTO `za_role`(`role_name`,`create_by`,`update_by`,`tenant_id`)  VALUES ('children','system', 'system','default');
INSERT INTO `za_role`(`role_name`,`create_by`,`update_by`,`tenant_id`)  VALUES ('guest','system', 'system','default');


DROP TABLE IF EXISTS `za_user_role`;
CREATE TABLE `za_user_role`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL COMMENT '用户ID',
  `role_id` int NOT NULL COMMENT '角色ID',
  `deleted` bit(1) NOT NULL default 0 COMMENT '逻辑删除标记(0-正常,1-已删除)',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `create_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '创建人',
  `update_time`datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `update_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '修改人',
  `tenant_id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT 'Default'  COMMENT '租户id',
   PRIMARY KEY (`id`) USING BTREE,
  INDEX `user_id`(`user_id`) USING BTREE COMMENT '用户ID索引',
  INDEX `role_id`(`role_id`) USING BTREE COMMENT '角色ID索引'
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_german2_ci ROW_FORMAT = Dynamic;


DROP TABLE IF EXISTS `za_authority`;
CREATE TABLE `za_authority`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `authority_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '权限编码',
  `type` int NULL DEFAULT NULL COMMENT '类型\n1.菜单\n2.页面\n3.按钮',
  `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '名称',
  `icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'icon',
  `path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '路径',
  `component` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '组件路径',
  `component_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '组件名称',
  `hidden` int NULL DEFAULT NULL COMMENT '是否隐藏',
  `pid` int NULL DEFAULT 0 COMMENT '父级ID',
  `sort` int NULL DEFAULT NULL COMMENT '排序',
  `api_path` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'api接口的路径',
  `http_method` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'api接口的请求方式,get post put delete',
  `module` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '模块',
  `class_name` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '类名',
  `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '逻辑删除标记(0-正常,1-已删除)',
  `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
  `create_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '创建人',
  `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '修改时间',
  `update_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '修改人',
  `tenant_id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT 'Default' COMMENT '租户id',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_pid`(`pid`) USING BTREE,
  INDEX `idx_sort`(`sort`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 166 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_german2_ci COMMENT = '权限表' ROW_FORMAT = DYNAMIC;
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (1, '', 1, '权限菜单', '', NULL, '', NULL, 0, 0);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (2, '', 1, '商城管理', 'product', '/mall', 'Layout', NULL, 0, 1);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (3, '', 1, '系统管理', 'ums', '/sys', 'Layout', NULL, 0, 1);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (4, '', 1, '设备管理', 'ums', '/device', 'Layout', NULL, 0, 1);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (5, NULL, 2, '商品属性', 'product-cate', 'attribute', '/mall/good/attribute/index', 'attribute', NULL, 2);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (6, NULL, 2, '商品分类', 'product-cate', 'category', '/mall/good/category/index', 'category', NULL, 2);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (7, NULL, 2, '商品管理', 'product-add', 'product', '/mall/good/spu/index', 'product', NULL, 2);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (8, NULL, 2, '订单管理', 'product-attr', 'orderList', '/mall/order/orderIndex', 'orderList', NULL, 2);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (9, NULL, 2, '售后订单管理', 'product-attr', 'afterSaleList', '/mall/aftersale/index', 'afterSaleList', NULL, 2);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (10, NULL, 2, '充值记录列表', 'product-attr', 'recharge-list', '/mall/order/rechargeList', 'recharge-list', NULL, 2);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (11, NULL, 2, '退款申请管理', 'product-attr', 'refund-application', '/mall/order/refundApplication', 'RefundApplication', NULL, 2);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (12, NULL, 2, '评价列表', 'product-attr', 'comment-list', '/mall/order/commentList', 'comment-list', NULL, 2);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (13, NULL, 2, '用户列表', 'ums-admin', 'admin', '/sys/admin/index', 'admin', NULL, 3);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (14, NULL, 2, '角色列表', 'ums-role', 'role', '/sys/role/index', 'role', NULL, 3);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (15, NULL, 2, '权限列表', 'ums-resource', 'authority', '/sys/authority/index', 'authority', NULL, 3);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (16, NULL, 2, '学豆配置', 'ums-menu', 'coin-config', '/sys/coin/index', 'coin-config', NULL, 3);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (17, NULL, 2, '寄件人配置', 'ums-menu', 'sender-config', '/sys/sender/index', 'sender-config', NULL, 3);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (18, NULL, 2, '设备列表', 'product-attr', '/device', '/device/deviceInformation/deviceInformation', 'device', NULL, 4);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (19, NULL, 2, '设备详情', 'ums-admin', 'deviceDetail', '/device/deviceInformation/deviceDetail/deviceDetail', 'deviceDetail', NULL, 4);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (20, NULL, 1, 'APP管理', NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (21, NULL, 2, '用户列表', NULL, NULL, NULL, NULL, NULL, 20);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (22, NULL, 2, '浏览足迹', NULL, NULL, NULL, NULL, NULL, 20);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (23, NULL, 2, '商品规格', NULL, NULL, NULL, NULL, NULL, 2);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (24, NULL, 2, '地址管理', NULL, NULL, NULL, NULL, NULL, 20);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (25, NULL, 2, '商品收藏', NULL, NULL, NULL, NULL, NULL, 20);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (26, NULL, 2, '售后管理', NULL, NULL, NULL, NULL, NULL, 20);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (27, NULL, 2, '商品管理', NULL, NULL, NULL, NULL, NULL, 20);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (28, NULL, 2, '购物车', NULL, NULL, NULL, NULL, NULL, 20);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (29, NULL, 2, '订单管理', NULL, NULL, NULL, NULL, NULL, 20);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (30, NULL, 2, '评价列表', NULL, NULL, NULL, NULL, NULL, 20);
INSERT INTO `za_authority` (`id`, `authority_code`, `type`, `title`, `icon`, `path`, `component`, `component_name`, `hidden`, `pid`) VALUES (31, '', 1, '仪表盘', 'home', NULL, 'Layout', NULL, 0, 1);

CREATE TABLE `za_permission_sync_log` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `service_name` VARCHAR(100) NOT NULL COMMENT '服务名称',
  `sync_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '同步完成时间',
  `duration_ms` INT UNSIGNED NOT NULL COMMENT '同步耗时(毫秒)',
  `added_count` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '新增权限点数量',
  `added_permissions` JSON NOT NULL COMMENT '新增权限点明细(JSON数组)',
  `deleted_count` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除权限点数量',
  `deleted_permissions` JSON NOT NULL COMMENT '删除权限点明细(JSON数组)',
  `updated_count` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新权限点数量',
  `updated_permissions` JSON NOT NULL COMMENT '更新权限点明细(JSON数组)',
  `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '逻辑删除标记(0-正常,1-已删除)',
  `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
  `create_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '创建人',
  `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '修改时间',
  `update_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '修改人',
  `tenant_id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT 'Default' COMMENT '租户id',
  PRIMARY KEY (`id`),
  INDEX `idx_service` (`service_name`),
  INDEX `idx_sync_time` (`sync_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='权限同步日志表';

DROP TABLE IF EXISTS `za_role_authority`;
CREATE TABLE `za_role_authority`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `authority_id` int NOT NULL COMMENT '权限ID',
  `role_id` int NOT NULL COMMENT '角色ID',
  `deleted` bit(1) NOT NULL default 0 COMMENT '逻辑删除标记(0-正常,1-已删除)',
   `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   `create_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '创建人',
   `update_time`datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
   `update_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '修改人',
   `tenant_id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT 'Default' COMMENT '租户id',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_authority_id`(`authority_id` ASC) USING BTREE,
  INDEX `idx_role_id`(`role_id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 87 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_german2_ci ROW_FORMAT = DYNAMIC comment '权限表';


DROP TABLE IF EXISTS `za_level`;
CREATE TABLE `za_level`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NOT NULL COMMENT '等级名称',
  `sort` int NOT NULL COMMENT '排序',
  `point` int NOT NULL COMMENT '当前等级满分标准',
  `image_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NOT NULL COMMENT '图片地址',
   `deleted` bit(1) NOT NULL default 0 COMMENT '逻辑删除标记(0-正常,1-已删除)',
   `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   `create_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '创建人',
   `update_time`datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
   `update_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '修改人',
   `tenant_id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT 'Default' COMMENT '租户id',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_german2_ci ROW_FORMAT = DYNAMIC comment '等级表';
INSERT INTO `za_level` (`id`, `name`, `sort`, `point`, `image_url`, `deleted`, `create_time`, `create_by`, `update_time`, `update_by`, `tenant_id`) VALUES (1, '秀才', 1, 100, 'https://static.seerteach.net/seerteach/systemConfig/icon_badge_scholar.png', b'0', '2025-07-18 03:49:24', NULL, '2025-07-18 03:49:24', NULL, 'Default');
INSERT INTO `za_level` (`id`, `name`, `sort`, `point`, `image_url`, `deleted`, `create_time`, `create_by`, `update_time`, `update_by`, `tenant_id`) VALUES (2, '举人', 2, 200, 'https://static.seerteach.net/seerteach/systemConfig/icon_badge_juren.png', b'0', '2025-07-18 03:49:24', NULL, '2025-07-18 03:49:24', NULL, 'Default');
INSERT INTO `za_level` (`id`, `name`, `sort`, `point`, `image_url`, `deleted`, `create_time`, `create_by`, `update_time`, `update_by`, `tenant_id`) VALUES (3, '探花', 3, 400, 'https://static.seerteach.net/seerteach/systemConfig/icon_badge_tanhua.png', b'0', '2025-07-18 03:49:24', NULL, '2025-07-18 03:49:24', NULL, 'Default');
INSERT INTO `za_level` (`id`, `name`, `sort`, `point`, `image_url`, `deleted`, `create_time`, `create_by`, `update_time`, `update_by`, `tenant_id`) VALUES (4, '榜眼', 4, 500, 'https://static.seerteach.net/seerteach/systemConfig/icon_badge_banyan.png', b'0', '2025-07-18 03:49:24', NULL, '2025-07-18 03:49:24', NULL, 'Default');
INSERT INTO `za_level` (`id`, `name`, `sort`, `point`, `image_url`, `deleted`, `create_time`, `create_by`, `update_time`, `update_by`, `tenant_id`) VALUES (5, '状元', 5, 1000, 'https://static.seerteach.net/seerteach/systemConfig/icon_badge_zhuangyuan.png', b'0', '2025-07-18 03:49:24', NULL, '2025-07-18 03:49:24', NULL, 'Default');


DROP TABLE IF EXISTS `za_grade`;
CREATE TABLE `za_grade`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `grade` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NOT NULL COMMENT '年级',
  `deleted` bit(1) NOT NULL default 0 COMMENT '逻辑删除标记(0-正常,1-已删除)',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `create_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '创建人',
  `update_time`datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `update_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '修改人',
  `tenant_id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT 'Default' COMMENT '租户id',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_grade`(`grade` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_german2_ci ROW_FORMAT = DYNAMIC comment '年级表';
INSERT INTO `za_grade` (`id`, `grade`, `deleted`, `create_time`, `create_by`, `update_time`, `update_by`, `tenant_id`) VALUES (1, '一年级', b'0', '2025-07-18 03:34:52', NULL, '2025-07-18 03:34:52', NULL, NULL);
INSERT INTO `za_grade` (`id`, `grade`, `deleted`, `create_time`, `create_by`, `update_time`, `update_by`, `tenant_id`) VALUES (2, '二年级', b'0', '2025-07-18 03:34:52', NULL, '2025-07-18 03:34:52', NULL, NULL);
INSERT INTO `za_grade` (`id`, `grade`, `deleted`, `create_time`, `create_by`, `update_time`, `update_by`, `tenant_id`) VALUES (3, '三年级', b'0', '2025-07-18 03:34:52', NULL, '2025-07-18 03:34:52', NULL, NULL);
INSERT INTO `za_grade` (`id`, `grade`, `deleted`, `create_time`, `create_by`, `update_time`, `update_by`, `tenant_id`) VALUES (4, '四年级', b'0', '2025-07-18 03:34:52', NULL, '2025-07-18 03:34:52', NULL, NULL);
INSERT INTO `za_grade` (`id`, `grade`, `deleted`, `create_time`, `create_by`, `update_time`, `update_by`, `tenant_id`) VALUES (5, '五年级', b'0', '2025-07-18 03:34:52', NULL, '2025-07-18 03:34:52', NULL, NULL);
INSERT INTO `za_grade` (`id`, `grade`, `deleted`, `create_time`, `create_by`, `update_time`, `update_by`, `tenant_id`) VALUES (6, '六年级', b'0', '2025-07-18 03:34:52', NULL, '2025-07-18 03:34:52', NULL, NULL);
INSERT INTO `za_grade` (`id`, `grade`, `deleted`, `create_time`, `create_by`, `update_time`, `update_by`, `tenant_id`) VALUES (7, '初一', b'1', '2025-07-18 03:34:52', NULL, '2025-07-18 03:34:52', NULL, NULL);
INSERT INTO `za_grade` (`id`, `grade`, `deleted`, `create_time`, `create_by`, `update_time`, `update_by`, `tenant_id`) VALUES (8, '初二', b'1', '2025-07-18 03:34:52', NULL, '2025-07-18 03:34:52', NULL, NULL);
INSERT INTO `za_grade` (`id`, `grade`, `deleted`, `create_time`, `create_by`, `update_time`, `update_by`, `tenant_id`) VALUES (9, '初三', b'1', '2025-07-18 03:34:52', NULL, '2025-07-18 03:34:52', NULL, NULL);
INSERT INTO `za_grade` (`id`, `grade`, `deleted`, `create_time`, `create_by`, `update_time`, `update_by`, `tenant_id`) VALUES (10, '高一', b'1', '2025-07-18 03:34:52', NULL, '2025-07-18 03:34:52', NULL, NULL);
INSERT INTO `za_grade` (`id`, `grade`, `deleted`, `create_time`, `create_by`, `update_time`, `update_by`, `tenant_id`) VALUES (11, '高二', b'1', '2025-07-18 03:34:52', NULL, '2025-07-18 03:34:52', NULL, NULL);
INSERT INTO `za_grade` (`id`, `grade`, `deleted`, `create_time`, `create_by`, `update_time`, `update_by`, `tenant_id`) VALUES (12, '高三', b'1', '2025-07-18 03:34:52', NULL, '2025-07-18 03:34:52', NULL, NULL);


DROP TABLE IF EXISTS `za_home_layout`;
CREATE TABLE  `za_home_layout`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `block_name` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NOT NULL COMMENT '区块名称',
  `block_url` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NOT NULL COMMENT '区块url',
  `block_type` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NOT NULL COMMENT '区块类型',
  `sort_order` int NOT NULL DEFAULT 0 COMMENT '排序权重',
  `status` tinyint NOT NULL DEFAULT 1 COMMENT '状态: 0=禁用 1=启用',
  `deleted` tinyint(1) NOT NULL COMMENT '逻辑删除标记(0-正常，1-已删除)',
  `create_time` datetime NOT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  `create_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '创建人',
  `update_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '修改人',
  `tenant_id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '租户id',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_german2_ci COMMENT = '首页布局配置表' ROW_FORMAT = DYNAMIC;