-- 设备台账
DROP TABLE IF EXISTS `blade_equipment_ledger`;
CREATE TABLE `blade_equipment_ledger` (
  `id` bigint(20) NOT NULL COMMENT '主键',
  `tenant_id` varchar(12) DEFAULT '000000' COMMENT '租户ID',
  `vehicle_type` varchar(20) NOT NULL COMMENT '车船类型',
  `vehicle_no` varchar(30) NOT NULL COMMENT '车牌号/船号',
  `equipment_code` varchar(12) NOT NULL COMMENT '设备编号',
  `equipment_name` varchar(100) NOT NULL COMMENT '设备名称',
  `factory_date` date DEFAULT NULL COMMENT '出厂日期',
  `equipment_brand` varchar(50) DEFAULT NULL COMMENT '设备品牌',
  `equipment_type` varchar(50) DEFAULT NULL COMMENT '设备类型',
  `specification_model` varchar(100) DEFAULT NULL COMMENT '规格型号',
  `original_equipment_no` varchar(100) DEFAULT NULL COMMENT '原厂设备号',
  `remark` varchar(200) DEFAULT NULL COMMENT '备注',
  `attachments` varchar(1000) DEFAULT NULL COMMENT '附件',
  `online_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否在线：0否，1是',
  `create_user` bigint(20) DEFAULT NULL COMMENT '创建人',
  `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_user` bigint(20) DEFAULT NULL COMMENT '修改人',
  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
  `status` int(11) DEFAULT '1' COMMENT '状态',
  `is_deleted` int(11) DEFAULT '0' COMMENT '是否已删除',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `uk_equipment_ledger_code` (`equipment_code`) USING BTREE,
  KEY `idx_equipment_ledger_vehicle` (`vehicle_type`, `vehicle_no`) USING BTREE,
  KEY `idx_equipment_ledger_dept` (`create_dept`) USING BTREE,
  KEY `idx_equipment_ledger_create_time` (`create_time`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='设备台账';

-- 菜单父级为车/船务管理
INSERT IGNORE INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES
(2077670000000000101, 2075436235826896898, 'equipment_ledger', '设备台账', 'equipment_ledger', '/vehicle/equipment-ledger', 'iconfont iconicon_doc', 130, 1, 0, 1, '', '', 0),
(2077670000000000102, 2077670000000000101, 'equipment_ledger_add', '新增', 'equipment_ledger_add', '', '', 1, 2, 0, 1, NULL, '', 0),
(2077670000000000103, 2077670000000000101, 'equipment_ledger_edit', '编辑', 'equipment_ledger_edit', '', '', 2, 2, 0, 1, NULL, '', 0),
(2077670000000000104, 2077670000000000101, 'equipment_ledger_delete', '删除', 'equipment_ledger_delete', '', '', 3, 2, 0, 1, NULL, '', 0),
(2077670000000000105, 2077670000000000101, 'equipment_ledger_view', '查看', 'equipment_ledger_view', '', '', 4, 2, 0, 1, NULL, '', 0),
(2077670000000000106, 2077670000000000101, 'equipment_ledger_import', '批量导入', 'equipment_ledger_import', '', '', 5, 2, 0, 1, NULL, '', 0),
(2077670000000000107, 2077670000000000101, 'equipment_ledger_template', '下载模板', 'equipment_ledger_template', '', '', 6, 2, 0, 1, NULL, '', 0),
(2077670000000000108, 2077670000000000101, 'equipment_ledger_export', '批量导出', 'equipment_ledger_export', '', '', 7, 2, 0, 1, NULL, '', 0),
(2077670000000000109, 2077670000000000101, 'equipment_ledger_list', '列表', 'equipment_ledger_list', '/blade-transport/equipment-ledger/list', '', 8, 2, 0, 1, NULL, '', 0);
