/**
Source Server Version: 8.0.31
Source Database: backendsys
Date: 2023/05/23 17:09:22
*/

DROP TABLE IF EXISTS `med_material`;

CREATE TABLE `med_material` (
    PRIMARY KEY (`id`),
    `id` BIGINT(10) AUTO_INCREMENT COMMENT 'ID',
    `category_id` BIGINT(10) NOT NULL COMMENT '素材分类ID',
    `title` VARCHAR(255) NOT NULL COMMENT '标题',
    `description` VARCHAR(500) COMMENT '描述',
    `thumb` VARCHAR(500) COMMENT '缩略图',
    `material_type` TINYINT(1) NOT NULL COMMENT '素材文件类型 (1图片, 2视频, 3音频, 4文案)',
    `content` VARCHAR(10000) COMMENT '素材内容 (material_type: 4 时必填)',
    `file` VARCHAR(500) COMMENT '素材文件 (material_type: 1,2,3 时必填)',
    `is_top` TINYINT(1) DEFAULT '-1' NOT NULL COMMENT '是否置顶 (-1否, 1是)',
    `status` TINYINT(1) DEFAULT '1' COMMENT '素材状态 (-1禁用, 1启用)',
    `audit_status` TINYINT(1) DEFAULT '1' COMMENT '审核状态 (-1审核拒绝, 1待审核, 2审核通过)',
    `audit_note` VARCHAR(255) COMMENT '审核备注',
    `del_flag` TINYINT(1) DEFAULT '-1' COMMENT '删除标志 (-1未删除, 1删除)',
    `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    INDEX `idx_title` (`title`),
    INDEX `idx_description` (`description`),
    INDEX `idx_category_id` (`category_id`),
    INDEX `idx_status` (`status`),
    INDEX `idx_audit_status` (`audit_status`)
) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='素材中心表';

INSERT INTO med_material(category_id, title, description, content, thumb, material_type, file, is_top, audit_status, status) VALUES
    (1, '测试素材A', 'aa', null, '/uploads/20240222/20240222134224.png', 1, '/uploads/20240222/20240222134224.png', -1, 2, 1),
    (1, '勇敢前行', '勇敢前行，追寻内心光芒', '在人生的旅途中，勇敢前行，永不停歇。内心的光芒照亮前行的道路，指引我们走向梦想的彼岸。坚定的信念如磐石般支撑，让我们勇敢地面对挑战，不忘初心，砥砺前行。', null, 3, null, -1, 2, 1),
    (7, '测试素材B', 'bbb', null, '/uploads/20240222/20240222134224.png', 1, '/uploads/20240222/20240222134224.png', -1, 2, -1),
    (7, '测试素材C', 'ccccc', null, '/uploads/20240222/20240222134224.png', 1, '/uploads/20240222/20240222134224.png', -1, 2, -1)
;
