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

DROP TABLE IF EXISTS `med_my_material`;

CREATE TABLE `med_my_material` (
    PRIMARY KEY (`id`),
    `id` BIGINT(10) AUTO_INCREMENT COMMENT 'ID',
    `user_id` BIGINT(10) NOT NULL COMMENT '作者/用户ID',
    `material_id` BIGINT(10) 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 时必填)',
    `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`)
) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='我的素材表';

INSERT INTO med_my_material(user_id, material_id, category_id, title, description, content, thumb, material_type, file) VALUES
    (1, 1, 1, '测试素材A', 'aa', '', '/uploads/20240222/20240222134224.png', 1, '/uploads/20240222/20240222134224.png'),
    (1, 3, 7, '测试素材C', 'ccccc', '', '/uploads/20240222/20240222134224.png', 1, '/uploads/20240222/20240222134224.png'),
    (2, 3, 7, '测试素材333', 'ccccc', '', '/uploads/20240222/20240222134224.png', 1, '/uploads/20240222/20240222134224.png'),
    (2, 3, 7, '测试素材333', 'ccccc', '', '/uploads/20240222/20240222134224.png', 1, '/uploads/20240222/20240222134224.png'),
    (2, 3, 7, '测试素材333', 'ccccc', '', '/uploads/20240222/20240222134224.png', 1, '/uploads/20240222/20240222134224.png'),
    (2, 3, 7, '测试素材333', 'ccccc', '', '/uploads/20240222/20240222134224.png', 1, '/uploads/20240222/20240222134224.png')
;
