-- 借阅申请页面修改

SELECT `id` INTO @menuId FROM system_menu WHERE `name` = '档案管理';

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 ( '借阅申请', 'borrow:apply:list', 2, 1, @menuId, 'apply', 'education', 'borrow/apply/index', 'apply', 0, b'1', b'1', b'1', '', '2023-09-13 15:29:48', '', '2023-09-13 15:29:48', b'0');
SET @menuId2 = 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 ( '新增借阅申请', 'archives:borrowAapply:create', 3, 1, @menuId2, '', '', '', '', 0, b'1', b'1', b'1', '', '2023-09-13 15:36:56', '', '2023-09-13 15:36:56', b'0');
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 ( '导出借阅申请', 'archives:borrowAapply:export', 3, 2, @menuId2, '', '', '', '', 0, b'1', b'1', b'1', '', '2023-09-13 15:37:31', '', '2023-09-13 15:37:31', b'0');
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 ( '修改借阅申请', 'archives:borrowAapply:update', 3, 3, @menuId2, '', '', '', '', 0, b'1', b'1', b'1', '', '2023-09-13 15:39:24', '', '2023-09-13 15:39:24', b'0');
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 ('删除借阅申请', 'archives:borrowAapply:delete', 3, 4, @menuId2, '', '', '', '', 0, b'1', b'1', b'1', '', '2023-09-13 15:39:53', '', '2023-09-13 16:08:02', b'1');
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 ( '删除借阅申请', 'archives:borrowAapply:delete', 3, 4, @menuId2, '', '', '', '', 0, b'1', b'1', b'1', '', '2023-09-13 16:08:23', '', '2023-09-13 16:08:23', b'0');

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 ( '借阅历史记录', 'borrow:record:list', 2, 2,  @menuId, 'record', 'table', 'borrow/record/index', 'record', 0, b'1', b'1', b'1', '', '2023-09-13 16:09:53', '', '2023-09-13 16:12:09', b'0');

-- 会计账簿新增 password 字段
ALTER TABLE archives_accounting_book ADD COLUMN `password` varchar(64) NULL DEFAULT NULL COMMENT '密码';

-- 会计报表新增 password 字段

ALTER TABLE archives_accounting_report ADD COLUMN `password` varchar(64) NULL DEFAULT NULL COMMENT '密码';


-- 新增审批流程表 --
CREATE TABLE `lyr-one`.`archives_flow`  (
                                       `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键Id',
                                       `flow_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'OA/ERP流程编号',
                                       `voucher_id` bigint(20) NULL DEFAULT NULL COMMENT '凭证id',
                                       `voucher_num` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '凭证号',
                                       `business_id` bigint(20) NULL DEFAULT NULL COMMENT '业务id',
                                       `business_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务类型',
                                       `creator` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者',
                                       `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
                                       `updater` datetime NULL DEFAULT NULL COMMENT '修改者',
                                       `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
                                       `deleted` bit(1) NULL DEFAULT b'0' COMMENT '是否删除',
                                       `company_id` bigint(20) NULL DEFAULT NULL COMMENT '业务实体id',
                                       `company` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务实体',
                                       `del_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '删除状态',
                                       `suffix` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件后缀',
                                       `file_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件地址',
                                       `file_ap` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '绝对路径',
                                       `flow_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '流程号',
                                       `note` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '摘要',
                                       `dept_id` bigint(20) NULL DEFAULT NULL COMMENT '部门id',
                                       `dept_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '部门名称',
                                       `archive_id` bigint(20) NULL DEFAULT NULL COMMENT '归档id',
                                       `archive_state` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '归档状态',
                                       `tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '住户编号',
                                       PRIMARY KEY (`id`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '审批流程表' ROW_FORMAT = Dynamic;

-- 新增审批流程页面 权限
SELECT `id` INTO @menuId5 FROM system_menu WHERE `name` = '档案管理';

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, 5, @menuId5, 'flow', 'order', 'accounting/flow/index', 'flow', 0, b'1', b'1', b'1', '', '2023-09-25 14:51:39', '', '2023-09-25 14:51:39', b'0');
SET @menuId6 = 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 ( '新增审批流程', 'archives:flow:create', 3, 1, @menuId6, '', '', '', '', 0, b'1', b'1', b'1', '', '2023-10-07 16:48:22', '', '2023-10-07 16:48:22', b'0');
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 ('更新审批流程', 'archives:flow:update', 3, 2, @menuId6, '', '', '', '', 0, b'1', b'1', b'1', '', '2023-10-07 16:48:40', '', '2023-10-07 16:52:39', b'0');
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 ('删除审批流程', 'archives:flow:delete', 3, 3, @menuId6, '', '', '', '', 0, b'1', b'1', b'1', '', '2023-10-07 16:48:57', '', '2023-10-07 16:48:57', b'0');
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 ( '查询审批流程', 'archives:flow:query', 3, 4, @menuId6, '', '', '', '', 0, b'1', b'1', b'1', '', '2023-10-07 16:49:23', '', '2023-10-07 16:49:23', b'0');
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 ('导出审批流程', 'archives:flow:export', 3, 5, @menuId6, '', '', '', '', 0, b'1', b'1', b'1', '', '2023-10-07 16:49:46', '', '2023-10-07 16:49:46', b'0');

