-- ----------------------------
-- 创建装册管理表 for archives_package
-- ----------------------------
DROP TABLE IF EXISTS `archives_package`;
CREATE TABLE `archives_package`  (
                                     `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
                                     `depot_id` bigint(20) NULL DEFAULT NULL COMMENT '库房id',
                                     `depot_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '库房名称',
                                     `cabinet_id` bigint(20) NULL DEFAULT NULL COMMENT '档案柜id',
                                     `cabinet_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '档案柜名称',
                                     `record_id` bigint(20) NULL DEFAULT NULL COMMENT '档案id',
                                     `company_id` bigint(20) NULL DEFAULT NULL COMMENT '业务实体id',
                                     `company` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务实体',
                                     `year` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会计年份',
                                     `period` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会计月份',
                                     `manege_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '负责人名称',
                                     `case_num` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '全宗号',
                                     `catalog_num` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '目录号',
                                     `files_num` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '案卷号',
                                     `flow_id` bigint(20) NULL DEFAULT NULL COMMENT '关联号',
                                     `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建日期',
                                     `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
                                     `creator` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
                                     `status` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '状态待装册，已装册',
                                     `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
                                     `package_time` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '装册时间',
                                     `dept_id` bigint(20) NULL DEFAULT NULL COMMENT '所属部门id',
                                     `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id',
                                     `deleted` bit(1) NULL DEFAULT b'0' COMMENT '是否删除',
                                     `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者',
                                     `dept_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属部门',
                                     `tenant_id` bigint(20) NOT NULL COMMENT '租户编号',
                                     `attr1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预留字段1',
                                     `attr2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预留字段2',
                                     `attr3` int(11) NULL DEFAULT NULL COMMENT '预留字段3',
                                     `attr4` int(11) NULL DEFAULT NULL COMMENT '预留字段4',
                                     `create_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '制单人',
                                     `code_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '条码地址',
                                     `code_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '条码值',
                                     `package_num` int(11) NULL DEFAULT NULL COMMENT '装册数量',
                                     PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '装册表' ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;

-- 插入装册管理菜单
SELECT * FROM system_menu WHERE name='档案管理';
SET @menuId = LAST_INSERT_ID();
INSERT INTO `lyr-one`.`system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('装册管理', '', 2, 0, @menuId, 'packages', '', 'archives/packages/index', 'Packages', 0, b'1', b'1', b'1', '', '2023-09-15 13:20:18', '', '2023-09-15 13:20:18', b'0');
SET @menuId2 = LAST_INSERT_ID();
INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '装册查询', 'archives:packages:query', 3, 1, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-15 13:20:18', '', '2023-09-15 13:20:18', b'0');
INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '装册创建', 'archives:packages:create', 3, 2, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-15 13:20:18', '', '2023-09-15 13:20:18', b'0');
INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '装册更新', 'archives:packages:update', 3, 3, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-15 13:20:18', '', '2023-09-15 13:20:18', b'0');
INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '装册删除', 'archives:packages:delete', 3, 4, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-15 13:20:18', '', '2023-09-15 13:20:18', b'0');
INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '装册导出', 'archives:packages:export', 3, 5, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-15 13:20:18', '', '2023-09-15 13:20:18', b'0');
