-- ----------------------------
-- Table structure for blade_credit_score_quantification
-- ----------------------------
DROP TABLE IF EXISTS `blade_credit_score_quantification`;
CREATE TABLE `blade_credit_score_quantification` (
  `id` bigint NOT NULL COMMENT '主键',
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户ID',
  `name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '评定表名称',
  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
  `standard_description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标准说明',
  `create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
  `create_dept` bigint NULL DEFAULT NULL COMMENT '创建部门',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_user` bigint NULL DEFAULT NULL COMMENT '修改人',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  `status` int NULL DEFAULT 3 COMMENT '状态：1正常，2停用，3草稿',
  `is_deleted` int NULL DEFAULT 0 COMMENT '是否已删除',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `uk_credit_score_quantification_name` (`tenant_id`, `name`, `is_deleted`) USING BTREE,
  KEY `idx_credit_score_quantification_status` (`tenant_id`, `status`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '评分量化表';

-- ----------------------------
-- Table structure for blade_credit_score_category
-- ----------------------------
DROP TABLE IF EXISTS `blade_credit_score_category`;
CREATE TABLE `blade_credit_score_category` (
  `id` bigint NOT NULL COMMENT '主键',
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户ID',
  `quantification_id` bigint NOT NULL COMMENT '评分量化表ID',
  `category_code` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分类编码',
  `category_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分类名称',
  `sort` int NULL DEFAULT 0 COMMENT '排序',
  `create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
  `create_dept` bigint NULL DEFAULT NULL COMMENT '创建部门',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_user` bigint NULL DEFAULT NULL COMMENT '修改人',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  `status` int NULL DEFAULT 1 COMMENT '状态',
  `is_deleted` int NULL DEFAULT 0 COMMENT '是否已删除',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx_credit_score_category_code` (`quantification_id`, `category_code`) USING BTREE,
  KEY `idx_credit_score_category_table` (`tenant_id`, `quantification_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '评分分类';

-- ----------------------------
-- Table structure for blade_credit_score_item
-- ----------------------------
DROP TABLE IF EXISTS `blade_credit_score_item`;
CREATE TABLE `blade_credit_score_item` (
  `id` bigint NOT NULL COMMENT '主键',
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户ID',
  `quantification_id` bigint NOT NULL COMMENT '评分量化表ID',
  `category_id` bigint NOT NULL COMMENT '评分分类ID',
  `category_code` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分类编码',
  `item_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '评分项目',
  `score` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '分值',
  `score_description` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '得分说明',
  `option_description` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '选项描述',
  `sort` int NULL DEFAULT 0 COMMENT '排序',
  `create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
  `create_dept` bigint NULL DEFAULT NULL COMMENT '创建部门',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_user` bigint NULL DEFAULT NULL COMMENT '修改人',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  `status` int NULL DEFAULT 1 COMMENT '状态',
  `is_deleted` int NULL DEFAULT 0 COMMENT '是否已删除',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx_credit_score_item_name` (`quantification_id`, `category_code`, `item_name`) USING BTREE,
  KEY `idx_credit_score_item_category` (`tenant_id`, `category_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '评分项目';

-- ----------------------------
-- Table structure for blade_credit_score_item_option
-- ----------------------------
DROP TABLE IF EXISTS `blade_credit_score_item_option`;
CREATE TABLE `blade_credit_score_item_option` (
  `id` bigint NOT NULL COMMENT '主键',
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户ID',
  `quantification_id` bigint NOT NULL COMMENT '评分量化表ID',
  `item_id` bigint NOT NULL COMMENT '评分项目ID',
  `option_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '选项描述',
  `score` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '分值',
  `sort` int NULL DEFAULT 0 COMMENT '排序',
  `create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
  `create_dept` bigint NULL DEFAULT NULL COMMENT '创建部门',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_user` bigint NULL DEFAULT NULL COMMENT '修改人',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  `status` int NULL DEFAULT 1 COMMENT '状态',
  `is_deleted` int NULL DEFAULT 0 COMMENT '是否已删除',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx_credit_score_item_option_item` (`tenant_id`, `item_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '评分项目选项';

-- ----------------------------
-- Table structure for blade_credit_rating_standard
-- ----------------------------
DROP TABLE IF EXISTS `blade_credit_rating_standard`;
CREATE TABLE `blade_credit_rating_standard` (
  `id` bigint NOT NULL COMMENT '主键',
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户ID',
  `quantification_id` bigint NOT NULL COMMENT '评分量化表ID',
  `credit_level` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '信用等级',
  `score_rate_lower` int NOT NULL COMMENT '得分率下限',
  `score_rate_upper` int NOT NULL COMMENT '得分率上限',
  `score_rate_increase` int NOT NULL DEFAULT 1 COMMENT '得分率每增加',
  `credit_limit_lower` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '最大资金使用额度下限（万元）',
  `credit_limit_upper` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '最大资金使用额度上限（万元）',
  `credit_limit_increase` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '额度增加（万元）',
  `standard_description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标准说明',
  `sort` int NULL DEFAULT 0 COMMENT '排序',
  `create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
  `create_dept` bigint NULL DEFAULT NULL COMMENT '创建部门',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_user` bigint NULL DEFAULT NULL COMMENT '修改人',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  `status` int NULL DEFAULT 1 COMMENT '状态',
  `is_deleted` int NULL DEFAULT 0 COMMENT '是否已删除',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx_credit_rating_standard_level` (`quantification_id`, `credit_level`) USING BTREE,
  KEY `idx_credit_rating_standard_table` (`tenant_id`, `quantification_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '信用等级评估标准';

-- ----------------------------
-- Records of blade_menu for credit score quantification
-- parent_id 默认挂载至 transport.sql 中的“车/船务管理”：2075436235826896898
-- ----------------------------
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2077590000000000001, 2075436235826896898, 'credit_score_quantification', '评分量化表', 'credit_score_quantification', '/vehicle/credit-score-quantification', 'iconfont iconicon_doc', 40, 1, 0, 1, '', '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2077590000000000002, 2077590000000000001, 'credit_score_quantification_add', '新增', 'credit_score_quantification_add', '', '', 1, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2077590000000000003, 2077590000000000001, 'credit_score_quantification_edit', '编辑', 'credit_score_quantification_edit', '', '', 2, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2077590000000000004, 2077590000000000001, 'credit_score_quantification_delete', '删除', 'credit_score_quantification_delete', '', '', 3, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2077590000000000005, 2077590000000000001, 'credit_score_quantification_view', '查看', 'credit_score_quantification_view', '', '', 4, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2077590000000000006, 2077590000000000001, 'credit_score_quantification_publish', '发布', 'credit_score_quantification_publish', '', '', 5, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2077590000000000007, 2077590000000000001, 'credit_score_quantification_status', '启停', 'credit_score_quantification_status', '', '', 6, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2077590000000000008, 2077590000000000001, 'credit_score_quantification_import', '批量导入', 'credit_score_quantification_import', '', '', 7, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2077590000000000009, 2077590000000000001, 'credit_score_quantification_template', '下载模板', 'credit_score_quantification_template', '', '', 8, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2077590000000000010, 2077590000000000001, 'credit_score_quantification_export', '批量导出', 'credit_score_quantification_export', '', '', 9, 2, 0, 1, NULL, '', 0);
