数字人管理平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

408 line
31 KiB

  1. # SET NAMES utf8mb4;
  2. #
  3. # -- ----------------------------
  4. # -- 1、部门表
  5. # -- ----------------------------
  6. # drop table if exists sys_dept;
  7. # create table sys_dept (
  8. # id bigint not null comment '部门id',
  9. # parent_id bigint default 0 comment '父部门id',
  10. # code varchar(64) default null comment '部门编码',
  11. # name varchar(30) default '' comment '部门名称',
  12. # level int not null comment '树层级',
  13. # ancestors varchar(500) default '' comment '祖级列表',
  14. # leader varchar(20) default '' comment '负责人',
  15. # phone varchar(11) default '' comment '联系电话',
  16. # email varchar(50) default '' comment '邮箱',
  17. # sort int unsigned not null default 0 comment '显示顺序',
  18. # status char(1) not null default '0' comment '状态(0正常 1停用)',
  19. # remark varchar(200) default null comment '备注',
  20. # create_by bigint default null comment '创建者',
  21. # create_time datetime default current_timestamp comment '创建时间',
  22. # update_by bigint default null comment '更新者',
  23. # update_time datetime on update current_timestamp comment '更新时间',
  24. # del_flag tinyint not null default 0 comment '删除标志(0正常 1删除)',
  25. # tenant_id bigint not null comment '租户Id',
  26. # primary key (id)
  27. # ) engine = innodb comment = '部门信息表';
  28. #
  29. # -- ----------------------------
  30. # -- 2、岗位信息表
  31. # -- ----------------------------
  32. # drop table if exists sys_post;
  33. # create table sys_post (
  34. # id bigint not null comment '岗位Id',
  35. # dept_id bigint not null comment '部门Id',
  36. # code varchar(64) default null comment '岗位编码',
  37. # name varchar(50) not null comment '岗位名称',
  38. # sort int unsigned not null default 0 comment '显示顺序',
  39. # status char(1) not null default '0' comment '状态(0正常 1停用)',
  40. # remark varchar(200) default null comment '备注',
  41. # create_by bigint default null comment '创建者',
  42. # create_time datetime default current_timestamp comment '创建时间',
  43. # update_by bigint default null comment '更新者',
  44. # update_time datetime on update current_timestamp comment '更新时间',
  45. # del_flag tinyint not null default 0 comment '删除标志(0正常 1删除)',
  46. # tenant_id bigint not null comment '租户Id',
  47. # primary key (id)
  48. # ) engine = innodb comment = '岗位信息表';
  49. #
  50. # -- ----------------------------
  51. # -- 3、用户信息表
  52. # -- ----------------------------
  53. # drop table if exists sys_user;
  54. # create table sys_user (
  55. # id bigint not null comment '用户Id',
  56. # code varchar(64) default null comment '用户编码',
  57. # user_name varchar(30) not null comment '用户账号',
  58. # nick_name varchar(30) not null comment '用户昵称',
  59. # user_type varchar(2) default '01' comment '用户类型(00超管用户 01普通用户)',
  60. # phone varchar(11) default '' comment '手机号码',
  61. # email varchar(50) default '' comment '用户邮箱',
  62. # sex char(1) default '2' comment '用户性别(0男 1女 2保密)',
  63. # avatar varchar(100) default '' comment '头像地址',
  64. # profile varchar(100) default '这个人很懒,暂未留下什么' comment '个人简介',
  65. # password varchar(100) default '' comment '密码',
  66. # login_ip varchar(128) default '' comment '最后登录IP',
  67. # login_date datetime comment '最后登录时间',
  68. # sort int unsigned not null default 0 comment '显示顺序',
  69. # status char(1) not null default '0' comment '状态(0正常 1停用)',
  70. # remark varchar(200) default null comment '备注',
  71. # create_by bigint default null comment '创建者',
  72. # create_time datetime default current_timestamp comment '创建时间',
  73. # update_by bigint default null comment '更新者',
  74. # update_time datetime on update current_timestamp comment '更新时间',
  75. # del_flag tinyint not null default 0 comment '删除标志(0正常 1删除)',
  76. # tenant_id bigint not null comment '租户Id',
  77. # primary key (id)
  78. # ) engine = innodb comment = '用户信息表';
  79. #
  80. # -- ----------------------------
  81. # -- 4、用户-岗位关联表
  82. # -- ----------------------------
  83. # drop table if exists sys_user_post_merge;
  84. # create table sys_user_post_merge (
  85. # id bigint not null comment 'id',
  86. # user_id bigint not null comment '用户Id',
  87. # post_id bigint not null comment '职位Id',
  88. # tenant_id bigint not null comment '租户Id',
  89. # primary key (id),
  90. # unique (user_id, post_id)
  91. # ) engine = innodb comment = '用户-岗位关联表';
  92. #
  93. # -- ----------------------------
  94. # -- 5、角色信息表
  95. # -- ----------------------------
  96. # drop table if exists sys_role;
  97. # create table sys_role (
  98. # id bigint not null comment '角色Id',
  99. # code varchar(64) default null comment '角色编码',
  100. # name varchar(30) not null comment '角色名称',
  101. # role_key varchar(100) default null comment '角色权限字符串',
  102. # data_scope char(1) default '1' comment '数据范围(1全部数据权限 2自定数据权限 3本部门数据权限 4本部门及以下数据权限 5本岗位数据权限 6仅本人数据权限)',
  103. # sort int unsigned not null default 0 comment '显示顺序',
  104. # status char(1) not null default '0' comment '状态(0正常 1停用)',
  105. # remark varchar(200) default null comment '备注',
  106. # create_by bigint default null comment '创建者',
  107. # create_time datetime default current_timestamp comment '创建时间',
  108. # update_by bigint default null comment '更新者',
  109. # update_time datetime on update current_timestamp comment '更新时间',
  110. # del_flag tinyint not null default 0 comment '删除标志(0正常 1删除)',
  111. # tenant_id bigint not null comment '租户Id',
  112. # primary key (id)
  113. # ) engine = innodb comment = '角色信息表';
  114. #
  115. # -- ----------------------------
  116. # -- 6、租户和模块关联表
  117. # -- ----------------------------
  118. # drop table if exists sys_tenant_module_merge;
  119. # create table sys_tenant_module_merge (
  120. # id bigint not null comment 'id',
  121. # module_id bigint not null comment '模块Id',
  122. # tenant_id bigint not null comment '租户Id',
  123. # primary key (id),
  124. # unique (module_id, tenant_id)
  125. # ) engine = innodb comment = '租户和模块关联表';
  126. #
  127. # -- ----------------------------
  128. # -- 7、租户和菜单关联表
  129. # -- ----------------------------
  130. # drop table if exists sys_tenant_menu_merge;
  131. # create table sys_tenant_menu_merge (
  132. # id bigint not null comment 'id',
  133. # menu_id bigint not null comment '菜单Id',
  134. # tenant_id bigint not null comment '租户Id',
  135. # primary key (id),
  136. # unique (menu_id, tenant_id)
  137. # ) engine = innodb comment = '租户和菜单关联表';
  138. #
  139. # -- ----------------------------
  140. # -- 8、角色和模块关联表
  141. # -- ----------------------------
  142. # drop table if exists sys_role_module_merge;
  143. # create table sys_role_module_merge (
  144. # id bigint not null comment 'id',
  145. # role_id bigint not null comment '角色Id',
  146. # module_id bigint not null comment '模块Id',
  147. # tenant_id bigint not null comment '租户Id',
  148. # primary key (id),
  149. # unique (role_id, module_id)
  150. # ) engine = innodb comment = '角色和模块关联表';
  151. #
  152. # -- ----------------------------
  153. # -- 9、角色和菜单关联表
  154. # -- ----------------------------
  155. # drop table if exists sys_role_menu_merge;
  156. # create table sys_role_menu_merge (
  157. # id bigint not null comment 'id',
  158. # role_id bigint not null comment '角色Id',
  159. # menu_id bigint not null comment '菜单Id',
  160. # tenant_id bigint not null comment '租户Id',
  161. # primary key (id),
  162. # unique (role_id, menu_id)
  163. # ) engine = innodb comment = '角色和菜单关联表';
  164. #
  165. # -- ----------------------------
  166. # -- 10、角色和部门关联表(权限范围)
  167. # -- ----------------------------
  168. # drop table if exists sys_role_dept_merge;
  169. # create table sys_role_dept_merge (
  170. # id bigint not null comment 'id',
  171. # role_id bigint not null comment '角色Id',
  172. # dept_id bigint not null comment '部门Id',
  173. # tenant_id bigint not null comment '租户Id',
  174. # primary key(id),
  175. # unique (role_id, dept_id)
  176. # ) engine = innodb comment = '角色和部门-岗位关联表';
  177. #
  178. # -- ----------------------------
  179. # -- 11、角色和岗位关联表(权限范围)
  180. # -- ----------------------------
  181. # drop table if exists sys_role_post_merge;
  182. # create table sys_role_post_merge (
  183. # id bigint not null comment 'id',
  184. # role_id bigint not null comment '角色Id',
  185. # post_id bigint not null comment '岗位Id',
  186. # tenant_id bigint not null comment '租户Id',
  187. # primary key(id),
  188. # unique (role_id, post_id)
  189. # ) engine = innodb comment = '角色和部门-岗位关联表';
  190. #
  191. # -- ----------------------------
  192. # -- 12、组织和角色关联表(角色绑定)
  193. # -- ----------------------------
  194. # drop table if exists sys_organize_role_merge;
  195. # create table sys_organize_role_merge (
  196. # id bigint not null auto_increment comment 'id',
  197. # dept_id bigint default null comment '部门id',
  198. # post_id bigint default null comment '岗位id',
  199. # user_id bigint default null comment '用户id',
  200. # role_id bigint not null comment '角色Id',
  201. # tenant_id bigint not null comment '租户Id',
  202. # primary key(id),
  203. # unique (dept_id, post_id, user_id, role_id)
  204. # ) engine = innodb auto_increment=1 comment = '组织和角色关联表';
  205. #
  206. # -- ----------------------------
  207. # -- 13、素材信息表|管理素材信息
  208. # -- ----------------------------
  209. # drop table if exists xy_material;
  210. # create table xy_material (
  211. # id bigint not null comment '素材Id',
  212. # folder_id bigint not null default 0 comment '分类Id',
  213. # nick varchar(100) not null comment '素材昵称',
  214. # name varchar(100) not null comment '素材名称',
  215. # original_name varchar(100) not null comment '原图名称',
  216. # url varchar(200) not null comment '素材地址',
  217. # original_url varchar(200) not null comment '原图地址',
  218. # size decimal(8,4) not null comment '素材大小',
  219. # type char(1) not null default '0' comment '素材类型(0默认素材 1系统素材)',
  220. # sort int unsigned not null default 0 comment '显示顺序',
  221. # status char(1) not null default '0' comment '状态(0正常 1停用)',
  222. # create_by bigint default null comment '创建者',
  223. # create_time datetime default current_timestamp comment '创建时间',
  224. # update_by bigint default null comment '更新者',
  225. # update_time datetime on update current_timestamp comment '更新时间',
  226. # del_flag tinyint not null default 0 comment '删除标志(0正常 1删除)',
  227. # tenant_id bigint not null comment '租户Id',
  228. # primary key (id)
  229. # ) engine = innodb comment = '素材信息表';
  230. #
  231. # -- ----------------------------
  232. # -- 14、素材分类信息表
  233. # -- ----------------------------
  234. # drop table if exists xy_material_folder;
  235. # create table xy_material_folder (
  236. # id bigint not null comment '分类Id',
  237. # parent_id bigint not null default 0 comment '父类Id',
  238. # name varchar(100) not null comment '分类名称',
  239. # level int not null comment '树层级',
  240. # ancestors varchar(500) default '' comment '祖级列表',
  241. # type char(1) not null default '0' comment '分类类型(0默认文件夹 1系统文件夹)',
  242. # sort int unsigned not null default 0 comment '显示顺序',
  243. # status char(1) not null default '0' comment '状态(0正常 1停用)',
  244. # create_by bigint default null comment '创建者',
  245. # create_time datetime default current_timestamp comment '创建时间',
  246. # update_by bigint default null comment '更新者',
  247. # update_time datetime on update current_timestamp comment '更新时间',
  248. # del_flag tinyint not null default 0 comment '删除标志(0正常 1删除)',
  249. # tenant_id bigint not null comment '租户Id',
  250. # primary key (id)
  251. # ) engine = innodb comment = '素材分类信息表';
  252. #
  253. # -- ----------------------------
  254. # -- 15、操作日志记录
  255. # -- ----------------------------
  256. # drop table if exists sys_operate_log;
  257. # create table sys_operate_log (
  258. # id bigint not null auto_increment comment '日志主键',
  259. # title varchar(50) default '' comment '模块标题',
  260. # business_type char(2) default '00' comment '业务类型(0其它 1新增 2修改 3删除)',
  261. # method varchar(100) default '' comment '方法名称',
  262. # request_method varchar(10) default '' comment '请求方式',
  263. # operate_type char(2) default '00' comment '操作类别(00其它 01后台 02手机端)',
  264. # user_id bigint not null default -2 comment '操作人员',
  265. # user_name varchar(50) default null comment '操作人员账号',
  266. # user_nick varchar(50) default null comment '操作人员名称',
  267. # url varchar(255) default '' comment '请求URL',
  268. # ip varchar(128) default '' comment '主机地址',
  269. # param varchar(2000) default '' comment '请求参数',
  270. # location varchar(255) default '' comment '操作地点',
  271. # json_result varchar(2000) default '' comment '返回参数',
  272. # status char(1) default 0 comment '操作状态(0正常 1异常)',
  273. # error_msg varchar(2000) default '' comment '错误消息',
  274. # cost_time bigint default 0 comment '消耗时间',
  275. # operate_time datetime default current_timestamp comment '操作时间',
  276. # del_time datetime on update current_timestamp comment '删除时间',
  277. # del_flag tinyint not null default 0 comment '删除标志(0正常 1删除)',
  278. # tenant_id bigint not null comment '租户Id',
  279. # primary key (id),
  280. # key idx_sys_operate_log_bt (business_type),
  281. # key idx_sys_operate_log_s (status),
  282. # key idx_sys_operate_log_ot (operate_time)
  283. # ) engine = innodb auto_increment=100 comment = '操作日志记录';
  284. #
  285. # -- ----------------------------
  286. # -- 16、系统访问记录
  287. # -- ----------------------------
  288. # drop table if exists sys_login_log;
  289. # create table sys_login_log (
  290. # id bigint not null auto_increment comment '访问Id',
  291. # enterprise_name varchar(50) default '' comment '企业账号',
  292. # user_id bigint not null default -2 comment '用户Id',
  293. # user_name varchar(50) default '' comment '用户账号',
  294. # user_nick varchar(50) default '' comment '用户名称',
  295. # ipaddr varchar(128) default '' comment '登录IP地址',
  296. # status char(1) default '0' comment '登录状态(0成功 1失败)',
  297. # msg varchar(255) default '' comment '提示信息',
  298. # access_time datetime default current_timestamp comment '访问时间',
  299. # del_time datetime on update current_timestamp comment '删除时间',
  300. # del_flag tinyint not null default 0 comment '删除标志(0正常 1删除)',
  301. # tenant_id bigint not null comment '租户Id',
  302. # primary key (id),
  303. # key idx_sys_login_log_s (status),
  304. # key idx_sys_login_log_lt (access_time)
  305. # ) engine = innodb auto_increment=100 comment = '系统访问记录';
  306. #
  307. # -- ----------------------------
  308. # -- 17、通知公告表
  309. # -- ----------------------------
  310. # drop table if exists sys_notice;
  311. # create table sys_notice (
  312. # id bigint not null comment '公告Id',
  313. # name varchar(50) not null comment '公告标题',
  314. # type char(1) not null default '0' comment '公告类型(0通知 1公告)',
  315. # content longblob default null comment '公告内容',
  316. # status char(1) default '0' comment '公告状态(0待发送 1已发送 2已关闭 3发送失败 4发送异常)',
  317. # remark varchar(200) default null comment '备注',
  318. # create_by bigint default null comment '创建者',
  319. # create_time datetime default current_timestamp comment '创建时间',
  320. # update_by bigint default null comment '更新者',
  321. # update_time datetime on update current_timestamp comment '更新时间',
  322. # del_flag tinyint not null default 0 comment '删除标志(0正常 1删除)',
  323. # tenant_id bigint not null comment '租户Id',
  324. # primary key (id)
  325. # ) engine = innodb comment = '通知公告表';
  326. #
  327. # -- ----------------------------
  328. # -- 18、通知公告记录表
  329. # -- ----------------------------
  330. # drop table if exists sys_notice_log;
  331. # create table sys_notice_log (
  332. # id bigint not null comment 'id',
  333. # notice_id bigint not null comment '公告Id',
  334. # user_id bigint not null comment '用户Id',
  335. # receive_status char(1) not null comment '发送状态(0成功 1失败)',
  336. # status char(1) default '0' comment '阅读状态(0未读 1已读)',
  337. # remark varchar(200) default null comment '备注',
  338. # create_time datetime default current_timestamp comment '创建时间',
  339. # del_flag tinyint not null default 0 comment '删除标志(0正常 1删除)',
  340. # tenant_id bigint not null comment '租户Id',
  341. # primary key (id)
  342. # ) engine = innodb comment = '通知公告记录表';
  343. #
  344. # -- ----------------------------
  345. # -- 19、定时任务调度日志表
  346. # -- ----------------------------
  347. # drop table if exists sys_job_log;
  348. # create table sys_job_log (
  349. # id bigint not null auto_increment comment '任务日志Id',
  350. # job_id bigint not null comment '任务Id',
  351. # name varchar(64) not null comment '任务名称',
  352. # job_group varchar(64) not null comment '任务组名',
  353. # invoke_target varchar(500) not null comment '调用目标字符串',
  354. # invoke_tenant varchar(500) not null comment '调用租户字符串',
  355. # job_message varchar(500) comment '日志信息',
  356. # status char(1) not null default '0' comment '执行状态(0正常 1失败)',
  357. # exception_info varchar(2000) default '' comment '异常信息',
  358. # create_time datetime default current_timestamp comment '创建时间',
  359. # del_time datetime on update current_timestamp comment '删除时间',
  360. # del_flag tinyint not null default 0 comment '删除标志(0正常 1删除)',
  361. # tenant_id bigint not null comment '租户Id',
  362. # primary key (id)
  363. # ) engine = innodb comment = '定时任务调度日志表';
  364. #
  365. # -- ----------------------------
  366. # -- 20、文件信息表
  367. # -- ----------------------------
  368. # drop table if exists sys_file;
  369. # create table sys_file (
  370. # id bigint not null comment '文件Id',
  371. # folder_id bigint not null default 0 comment '分类Id',
  372. # name varchar(100) not null comment '文件名称',
  373. # nick varchar(100) default null comment '文件别名',
  374. # url varchar(500) not null comment '文件地址',
  375. # size bigint not null default 0 comment '文件大小',
  376. # type char(1) not null default '0' comment '文件类型(0默认 1系统)',
  377. # sort int unsigned not null default 0 comment '显示顺序',
  378. # status char(1) not null default '0' comment '状态(0正常 1停用)',
  379. # create_by bigint default null comment '创建者',
  380. # create_time datetime default current_timestamp comment '创建时间',
  381. # update_by bigint default null comment '更新者',
  382. # update_time datetime on update current_timestamp comment '更新时间',
  383. # del_flag tinyint not null default 0 comment '删除标志(0正常 1删除)',
  384. # tenant_id bigint not null comment '租户Id',
  385. # primary key (id)
  386. # ) engine = innodb comment = '文件信息表';
  387. #
  388. # -- ----------------------------
  389. # -- 21、文件分类信息表
  390. # -- ----------------------------
  391. # drop table if exists sys_file_folder;
  392. # create table sys_file_folder (
  393. # id bigint not null comment '分类Id',
  394. # parent_id bigint not null default 0 comment '父分类Id',
  395. # name varchar(100) not null comment '分类名称',
  396. # level int not null comment '树层级',
  397. # ancestors varchar(500) default '' comment '祖级列表',
  398. # type char(1) not null default '0' comment '分类类型(0默认文件夹 1系统文件夹)',
  399. # sort int unsigned not null default 0 comment '显示顺序',
  400. # status char(1) not null default '0' comment '状态(0正常 1停用)',
  401. # create_by bigint default null comment '创建者',
  402. # create_time datetime default current_timestamp comment '创建时间',
  403. # update_by bigint default null comment '更新者',
  404. # update_time datetime on update current_timestamp comment '更新时间',
  405. # del_flag tinyint not null default 0 comment '删除标志(0正常 1删除)',
  406. # tenant_id bigint not null comment '租户Id',
  407. # primary key (id)
  408. # ) engine = innodb comment = '文件分类信息表';