-- 插入字典
INSERT INTO `lyr-one`.`system_dict_type`(`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (NULL, '归档状态', 'archives_file_status', 0, NULL, '1', '2023-09-08 11:16:23', '1', '2023-09-08 11:16:23', b'0', '1970-01-01 00:00:00');
INSERT INTO `lyr-one`.`system_dict_type`(`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (NULL, '会计凭证完整性', 'accounting_file_status', 0, NULL, '1', '2023-09-19 15:17:27', '1', '2023-09-19 15:41:11', b'0', '1970-01-01 00:00:00');
INSERT INTO `lyr-one`.`system_dict_type`(`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (NULL, '会计凭证借阅状态', 'accounting_borrow_stauts', 0, NULL, '1', '2023-09-19 15:21:18', '1', '2023-09-19 15:41:12', b'0', '1970-01-01 00:00:00');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 0, '不完整', '0', 'accounting_file_status', 0, 'warning', '', NULL, '', '2023-09-19 15:18:27', '', '2023-09-19 15:18:39', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 0, '完整', '1', 'accounting_file_status', 0, 'success', '', NULL, '', '2023-09-19 15:18:56', '', '2023-09-19 15:18:56', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 0, '未借阅', '0', 'accounting_borrow_stauts', 0, 'info', '', NULL, '', '2023-09-19 15:22:06', '', '2023-09-19 15:22:06', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 0, '已借阅', '1', 'accounting_borrow_stauts', 0, 'danger', '', NULL, '', '2023-09-19 15:22:29', '', '2023-09-19 15:22:29', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 0, '未归档', '0', 'archives_file_status', 0, 'warning', '', NULL, '1', '2023-09-08 11:18:38', '1', '2023-09-08 11:18:38', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 0, '已归档', '1', 'archives_file_status', 0, 'success', '', NULL, '1', '2023-09-08 11:18:53', '1', '2023-09-08 11:18:53', b'0');
INSERT INTO `lyr-one`.`system_dict_type`(`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (NULL, '档案类型', 'archives_file_type', 0, NULL, '1', '2023-09-08 11:13:18', '1', '2023-09-08 11:13:18', b'0', '1970-01-01 00:00:00');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 0, '资产档案', 'electronic_assets', 'archives_file_type', 0, 'default', '', NULL, '136', '2023-09-08 15:35:38', '136', '2023-09-08 16:05:31', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 1, '咨询档案', 'electronic_consultation', 'archives_file_type', 0, 'default', '', NULL, '136', '2023-09-08 16:05:42', '136', '2023-09-08 16:06:24', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 2, '合同档案', 'electronic_contracts', 'archives_file_type', 0, 'default', '', NULL, '136', '2023-09-08 16:06:06', '136', '2023-09-08 16:06:48', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 3, '客诉档案', 'electronic_customer_complaint', 'archives_file_type', 0, 'default', '', NULL, '136', '2023-09-08 16:06:20', '136', '2023-09-08 16:06:58', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 4, '员工档案', 'electronic_employee', 'archives_file_type', 0, 'default', '', NULL, '136', '2023-09-08 16:07:12', '136', '2023-09-08 16:07:17', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 5, '其它电子档案', 'electronic_other', 'archives_file_type', 0, 'default', '', NULL, '136', '2023-09-08 16:07:35', '136', '2023-09-08 16:10:18', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 6, '会计凭证档案', 'accounting_voucher', 'archives_file_type', 0, 'default', '', NULL, '136', '2023-09-08 16:08:02', '136', '2023-09-08 16:09:34', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 7, '会计账簿档案', 'accounting_book', 'archives_file_type', 0, 'default', '', NULL, '136', '2023-09-08 16:08:30', '136', '2023-09-08 16:09:27', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 8, '其它会计档案', 'archives_other', 'archives_file_type', 0, 'default', '', NULL, '136', '2023-09-08 16:10:01', '136', '2023-09-08 16:10:01', b'0');

-- ----------------------------
-- 会计凭证表 for accounting_voucher
-- ----------------------------
DROP TABLE IF EXISTS `accounting_voucher`;
CREATE TABLE `accounting_voucher`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `create_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '制单人',
  `creator` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建日期',
  `company_id` bigint(20) NULL DEFAULT NULL COMMENT '业务实体id',
  `company` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务实体',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新日期',
  `dept_id` bigint(20) NULL DEFAULT NULL COMMENT '所属部门id',
  `dept_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属部门',
  `voucher_time` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '凭证日期',
  `voucher_num` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '凭证号',
  `digest` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '摘要',
  `audit` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人',
  `checker` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '核准人',
  `handle` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '经办人',
  `service_id` bigint(20) NULL DEFAULT NULL COMMENT '业务标识',
  `service_explain` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务说明',
  `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '凭证类型',
  `flow_id` bigint(20) NULL DEFAULT NULL COMMENT '流程号/文件号',
  `source` 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 '会计期间',
  `borrow_status` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '借阅状态',
  `record_time` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '归档时间',
  `position` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '纸档位置',
  `cherks` int(10) NULL DEFAULT NULL COMMENT '完整性',
  `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id',
  `deleted` bit(1) NULL DEFAULT b'0' COMMENT '是否删除',
  `updater` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者',
  `record_id` bigint(20) NULL DEFAULT NULL COMMENT '归档id，一个归档id对应多个凭证号',
  `file_status` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '归档状态',
  `tenant_id` bigint(20) NOT NULL COMMENT '租户编号，一个集团/总公司对应一个租户',
  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 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',
  `organization_id` bigint(20) NULL DEFAULT NULL COMMENT '立档单位ID',
  `depot_id` bigint(20) NULL DEFAULT NULL COMMENT '库房ID',
  `cabinet_id` bigint(20) NULL DEFAULT NULL COMMENT '档案柜ID',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '凭证表头' ROW_FORMAT = Dynamic;


-- ----------------------------
-- 凭证详情表 accounting_voucher_details
-- ----------------------------
DROP TABLE IF EXISTS `accounting_voucher_details`;
CREATE TABLE `accounting_voucher_details`  (
                                               `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
                                               `line_num` int(11) NULL DEFAULT NULL COMMENT '条目顺序号',
                                               `create_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '制单人',
                                               `creator` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
                                               `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建日期',
                                               `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新日期',
                                               `digest` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '摘要',
                                               `voucher_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '凭证类型',
                                               `subject_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '科目编码',
                                               `subject_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '科目名称',
                                               `assist_check` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '辅助核算',
                                               `debit_money` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '借方金额',
                                               `creditor_money` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '贷方金额',
                                               `flow_id` bigint(20) NULL DEFAULT NULL COMMENT '相关单据关联号',
                                               `voucher_id` bigint(20) NOT NULL COMMENT '凭证id，一个凭证对应多个凭证详情',
                                               `voucher_num` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '凭证号',
                                               `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id',
                                               `deleted` bit(1) NULL DEFAULT b'0' COMMENT '是否删除',
                                               `updater` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者',
                                               `file_status` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '归档状态',
                                               `tenant_id` bigint(20) NOT NULL COMMENT '租户编号，一个集团/总公司对应一个租户',
                                               `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 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',
                                               PRIMARY KEY (`id`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '凭证详情' ROW_FORMAT = Dynamic;

-- 插入会计档案菜单
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 ('会计档案', '', 1, 1, 0, '/accounting', 'pay', NULL, NULL, 0, b'1', b'1', b'1', '1', '2023-09-06 16:14:44', '126', '2023-09-19 14:26:20', b'0');
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, 'voucher', '', 'accounting/voucher/index', 'Voucher', 0, b'1', b'1', b'1', '', '2023-09-19 14:33:30', '', '2023-09-19 14:33:30', 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, '会计凭证查询', 'accounting:voucher:query', 3, 1, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-19 14:33:30', '', '2023-09-19 14:33:30', 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, '会计凭证创建', 'accounting:voucher:create', 3, 2, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-19 14:33:30', '', '2023-09-19 14:33:30', 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, '会计凭证更新', 'accounting:voucher:update', 3, 3, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-19 14:33:30', '', '2023-09-19 14:33:30', 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, '会计凭证删除', 'accounting:voucher:delete', 3, 4, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-19 14:33:30', '', '2023-09-19 14:33:30', 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, '会计凭证导出', 'accounting:voucher:export', 3, 5, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-19 14:33:30', '', '2023-09-19 14:33:30', b'0');
