create database video_tools_user_db; --创建数据库 -- build_video_list_tab_id int DEFAULT -1 COMMENT '用户生成视频列表的表id', -- head_video_list_tab_id int DEFAULT -1 COMMENT '用户上传片头视频列表的表id', -- end_video_list_tab_id int DEFAULT -1 COMMENT '用户上传片片尾频列表的表id', -- audio_bg_list_tab_id int DEFAULT -1 COMMENT '用户上传音频背景列表的表id', -- audio_text_list_tab_id int DEFAULT -1 COMMENT '用户上传音频文字列表的表id', -- img_list_tab_id int DEFAULT -1 COMMENT '用户上传图片列表的表id', --创建用户表 create table users ( id int not null auto_increment COMMENT '唯一id', name varchar(30) not null COMMENT '用户昵称', account varchar(30) not null COMMENT '账号', password varchar(30) not null COMMENT '密码', is_ban int DEFAULT 0 COMMENT '账号是否被禁用', user_info JSON, create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', group_id int not NULL COMMENT '部门ID', permit_id int not NULL COMMENT '权限ID', primary key (id)); DROP TABLE users; --删除用户表 INSERT INTO users (name,account, password,user_permit_level,group_type) VALUES ('小强', '13599887766','123',1,1); --插入一条数据 SELECT * FROM users; --查询用户表的所有内容 --用户生成的视频表 create table generate_video_list_tab ( id int not null auto_increment COMMENT '唯一id', user_id int not null COMMENT '用户id', template_id int not null COMMENT '模板id', folder_id int not null COMMENT '文件夹id', video_name varchar(30) not null COMMENT '视频名称', book_name varchar(30) not null COMMENT '小说名称', ratio int not null COMMENT '视频比例 1=9:16 2=4:3', video_stype int not null COMMENT '视频类型 1 解压 2 滚屏', video_url varchar(1024) not null COMMENT '展示使用的视频地址', path varchar(1024) DEFAULT "" COMMENT '删除使用的path地址', is_delete int DEFAULT 0 COMMENT '0=没有被删除,1=等待被删除', is_use int DEFAULT 0 COMMENT '0=未使用,1=已使用', create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', generate_video_info JSON COMMENT '生成详情', video_state int DEFAULT 0 COMMENT '0=等待生成,1=成功,2=失败', custom JSON COMMENT '扩展信息', primary key (id)); --用户生成的视频文件夹表 create table generate_video_folder_list_tab ( id int not null auto_increment COMMENT '唯一id', user_id int not null COMMENT '用户id', book_name varchar(30) not null COMMENT '小说名称/文件夹名字', is_delete int DEFAULT 0 COMMENT '0=没有被删除,1=等待被删除', create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', generate_video_info JSON COMMENT '生成详情', video_stype int not null COMMENT '视频类型 1 解压 2 滚屏', primary key (id)); --文件夹 表 create table folder_list_tab ( id int not null auto_increment COMMENT '唯一id', user_id int not null COMMENT '用户id', folder_name varchar(30) not null COMMENT '文件夹名称', folder_type int not null COMMENT '文件夹类型', is_public int DEFAULT 0 COMMENT '是否公共资源', classification_id int DEFAULT 0 COMMENT '分类id', create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', ref_id int DEFAULT 0 COMMENT '引用的id', primary key (id)); INSERT INTO folder_list_tab (user_id,folder_name, folder_type,is_public) VALUES (1, '恐怖',1,0); --插入一条数据 --资源文件 表 create table res_list_tab ( id int not null auto_increment COMMENT '唯一id', user_id int not null COMMENT '用户id', folder_id int not null COMMENT '文件夹ID', file_type int not null COMMENT '文件类型', file_name varchar(100) not null COMMENT '文件名字', file_info JSON COMMENT '文件详情', is_public int DEFAULT 0 COMMENT '是否公共资源', duration float DEFAULT 0 COMMENT '时长 单位秒,保留2位小数', create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', is_delete int DEFAULT 0 COMMENT '0=没有被删除,1=等待被删除', ref_id int DEFAULT 0 COMMENT '引用的资源id', classification_id int DEFAULT 0 COMMENT '分类id', primary key (id)); --模板 表 create table template_list_tab ( id int not null auto_increment COMMENT '唯一id', user_id int not null COMMENT '用户id', project_name varchar(30) not null COMMENT '项目名', book_name varchar(30) not null COMMENT '小说名称', ratio int not null COMMENT '视频比例 1=9:16 2=4:3', video_stype int not null COMMENT '视频类型 1 解压 2 滚屏', subtitles varchar(1024) not null COMMENT '字幕地址', subtitles_audio varchar(1024) not null COMMENT '字幕音频地址', video_nums int not null COMMENT '视频条数', video_crop_time int not null COMMENT '正片截取,每个视频截取多少秒', create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', template_info JSON COMMENT '模板详情', primary key (id)); --公共文件夹 表 create table public_folder_list_tab ( id int not null auto_increment COMMENT '唯一id', user_id int not null COMMENT '用户id', folder_name varchar(30) not null COMMENT '文件夹名称', folder_type int not null COMMENT '文件夹类型', create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', ref_id int DEFAULT 0 COMMENT '引用的资源id', upload_user_id int DEFAULT 0 COMMENT '上传的用户id', classification_id int DEFAULT 0 COMMENT '分类id', primary key (id)); INSERT INTO folder_list_tab (user_id,folder_name, folder_type,is_public) VALUES (1, '恐怖',1,0); --插入一条数据 --公共资源文件 表 create table public_res_list_tab ( id int not null auto_increment COMMENT '唯一id', user_id int not null COMMENT '用户id', folder_id int not null COMMENT '文件夹ID', file_type int not null COMMENT '文件类型', file_name varchar(100) not null COMMENT '文件名字', file_info JSON COMMENT '文件详情', duration float DEFAULT 0 COMMENT '时长 单位秒,保留2位小数', create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', is_delete int DEFAULT 0 COMMENT '0=没有被删除,1=等待被删除', ref_id int DEFAULT 0 COMMENT '引用的资源id', upload_user_id int DEFAULT 0 COMMENT '上传的用户id', classification_id int DEFAULT 0 COMMENT '分类id', primary key (id)); --配置 INSERT INTO res_list_tab (user_id, folder_id, file_type, file_name, file_info) VALUES (2, 1, 2, "absd.mp4", '{"width": 100, "height": 100, "duration": 123}'); --插入一条数据 select * from res_list_tab where user_id = %d AND folder_id = %d AND is_public = %d TRUNCATE TABLE users; --清理users表