mysql_use.sql 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. create database video_tools_user_db; --创建数据库
  2. -- build_video_list_tab_id int DEFAULT -1 COMMENT '用户生成视频列表的表id',
  3. -- head_video_list_tab_id int DEFAULT -1 COMMENT '用户上传片头视频列表的表id',
  4. -- end_video_list_tab_id int DEFAULT -1 COMMENT '用户上传片片尾频列表的表id',
  5. -- audio_bg_list_tab_id int DEFAULT -1 COMMENT '用户上传音频背景列表的表id',
  6. -- audio_text_list_tab_id int DEFAULT -1 COMMENT '用户上传音频文字列表的表id',
  7. -- img_list_tab_id int DEFAULT -1 COMMENT '用户上传图片列表的表id',
  8. --创建用户表
  9. create table users (
  10. id int not null auto_increment COMMENT '唯一id',
  11. name varchar(30) not null COMMENT '用户昵称',
  12. account varchar(30) not null COMMENT '账号',
  13. password varchar(30) not null COMMENT '密码',
  14. is_ban int DEFAULT 0 COMMENT '账号是否被禁用',
  15. user_info JSON,
  16. create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  17. group_id int not NULL COMMENT '部门ID',
  18. permit_id int not NULL COMMENT '权限ID',
  19. primary key (id));
  20. DROP TABLE users; --删除用户表
  21. INSERT INTO users (name,account, password,user_permit_level,group_type) VALUES ('小强', '13599887766','123',1,1); --插入一条数据
  22. SELECT * FROM users; --查询用户表的所有内容
  23. --用户生成的视频表
  24. create table generate_video_list_tab (
  25. id int not null auto_increment COMMENT '唯一id',
  26. user_id int not null COMMENT '用户id',
  27. template_id int not null COMMENT '模板id',
  28. folder_id int not null COMMENT '文件夹id',
  29. video_name varchar(30) not null COMMENT '视频名称',
  30. book_name varchar(30) not null COMMENT '小说名称',
  31. ratio int not null COMMENT '视频比例 1=9:16 2=4:3',
  32. video_stype int not null COMMENT '视频类型 1 解压 2 滚屏',
  33. video_url varchar(1024) not null COMMENT '展示使用的视频地址',
  34. path varchar(1024) DEFAULT "" COMMENT '删除使用的path地址',
  35. is_delete int DEFAULT 0 COMMENT '0=没有被删除,1=等待被删除',
  36. is_use int DEFAULT 0 COMMENT '0=未使用,1=已使用',
  37. create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  38. generate_video_info JSON COMMENT '生成详情',
  39. video_state int DEFAULT 0 COMMENT '0=等待生成,1=成功,2=失败',
  40. custom JSON COMMENT '扩展信息',
  41. primary key (id));
  42. --用户生成的视频文件夹表
  43. create table generate_video_folder_list_tab (
  44. id int not null auto_increment COMMENT '唯一id',
  45. user_id int not null COMMENT '用户id',
  46. book_name varchar(30) not null COMMENT '小说名称/文件夹名字',
  47. is_delete int DEFAULT 0 COMMENT '0=没有被删除,1=等待被删除',
  48. create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  49. generate_video_info JSON COMMENT '生成详情',
  50. video_stype int not null COMMENT '视频类型 1 解压 2 滚屏',
  51. primary key (id));
  52. --文件夹 表
  53. create table folder_list_tab (
  54. id int not null auto_increment COMMENT '唯一id',
  55. user_id int not null COMMENT '用户id',
  56. folder_name varchar(30) not null COMMENT '文件夹名称',
  57. folder_type int not null COMMENT '文件夹类型',
  58. is_public int DEFAULT 0 COMMENT '是否公共资源',
  59. classification_id int DEFAULT 0 COMMENT '分类id',
  60. create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  61. ref_id int DEFAULT 0 COMMENT '引用的id',
  62. primary key (id));
  63. INSERT INTO folder_list_tab (user_id,folder_name, folder_type,is_public) VALUES (1, '恐怖',1,0); --插入一条数据
  64. --资源文件 表
  65. create table res_list_tab (
  66. id int not null auto_increment COMMENT '唯一id',
  67. user_id int not null COMMENT '用户id',
  68. folder_id int not null COMMENT '文件夹ID',
  69. file_type int not null COMMENT '文件类型',
  70. file_name varchar(30) not null COMMENT '文件名字',
  71. file_info JSON COMMENT '文件详情',
  72. is_public int DEFAULT 0 COMMENT '是否公共资源',
  73. duration float DEFAULT 0 COMMENT '时长 单位秒,保留2位小数',
  74. create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  75. is_delete int DEFAULT 0 COMMENT '0=没有被删除,1=等待被删除',
  76. ref_id int DEFAULT 0 COMMENT '引用的资源id',
  77. classification_id int DEFAULT 0 COMMENT '分类id',
  78. primary key (id));
  79. --模板 表
  80. create table template_list_tab (
  81. id int not null auto_increment COMMENT '唯一id',
  82. user_id int not null COMMENT '用户id',
  83. project_name varchar(30) not null COMMENT '项目名',
  84. book_name varchar(30) not null COMMENT '小说名称',
  85. ratio int not null COMMENT '视频比例 1=9:16 2=4:3',
  86. video_stype int not null COMMENT '视频类型 1 解压 2 滚屏',
  87. subtitles varchar(1024) not null COMMENT '字幕地址',
  88. subtitles_audio varchar(1024) not null COMMENT '字幕音频地址',
  89. video_nums int not null COMMENT '视频条数',
  90. video_crop_time int not null COMMENT '正片截取,每个视频截取多少秒',
  91. create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  92. template_info JSON COMMENT '模板详情',
  93. primary key (id));
  94. --公共文件夹 表
  95. create table public_folder_list_tab (
  96. id int not null auto_increment COMMENT '唯一id',
  97. user_id int not null COMMENT '用户id',
  98. folder_name varchar(30) not null COMMENT '文件夹名称',
  99. folder_type int not null COMMENT '文件夹类型',
  100. create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  101. ref_id int DEFAULT 0 COMMENT '引用的资源id',
  102. upload_user_id int DEFAULT 0 COMMENT '上传的用户id',
  103. classification_id int DEFAULT 0 COMMENT '分类id',
  104. primary key (id));
  105. INSERT INTO folder_list_tab (user_id,folder_name, folder_type,is_public) VALUES (1, '恐怖',1,0); --插入一条数据
  106. --公共资源文件 表
  107. create table public_res_list_tab (
  108. id int not null auto_increment COMMENT '唯一id',
  109. user_id int not null COMMENT '用户id',
  110. folder_id int not null COMMENT '文件夹ID',
  111. file_type int not null COMMENT '文件类型',
  112. file_name varchar(30) not null COMMENT '文件名字',
  113. file_info JSON COMMENT '文件详情',
  114. duration float DEFAULT 0 COMMENT '时长 单位秒,保留2位小数',
  115. create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  116. is_delete int DEFAULT 0 COMMENT '0=没有被删除,1=等待被删除',
  117. ref_id int DEFAULT 0 COMMENT '引用的资源id',
  118. upload_user_id int DEFAULT 0 COMMENT '上传的用户id',
  119. classification_id int DEFAULT 0 COMMENT '分类id',
  120. primary key (id));
  121. --配置
  122. create table video_tools_config_tab (
  123. id int not null auto_increment COMMENT '唯一id',
  124. config_info JSON COMMENT '资源类型配置',
  125. permissions_info JSON COMMENT '权限配置',
  126. group_info JSON COMMENT '组配置',
  127. other_info JSON COMMENT '其他配置',
  128. primary key (id));
  129. 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}'); --插入一条数据
  130. select * from res_list_tab where user_id = %d AND folder_id = %d AND is_public = %d
  131. TRUNCATE TABLE users; --清理users表