upms-script.sql 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. -- ----------------------------
  2. -- 请仅在下面的数据库链接中执行该脚本。
  3. -- 主数据源 [localhost:3306/workFlow]
  4. -- ----------------------------
  5. SET NAMES utf8mb4;
  6. SET FOREIGN_KEY_CHECKS = 0;
  7. -- ----------------------------
  8. -- 部门管理表
  9. -- ----------------------------
  10. DROP TABLE IF EXISTS `work_sys_dept`;
  11. CREATE TABLE `work_sys_dept`
  12. (
  13. `dept_id` bigint(20) NOT NULL COMMENT '部门Id',
  14. `parent_id` bigint(20) DEFAULT NULL COMMENT '父部门Id',
  15. `dept_name` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '部门名称',
  16. `show_order` int(11) NOT NULL COMMENT '兄弟部分之间的显示顺序,数字越小越靠前',
  17. `create_user_id` bigint(20) NOT NULL COMMENT '创建者Id',
  18. `create_time` datetime NOT NULL COMMENT '创建时间',
  19. `update_user_id` bigint(20) NOT NULL COMMENT '更新者Id',
  20. `update_time` datetime NOT NULL COMMENT '最后更新时间',
  21. `deleted_flag` int(1) NOT NULL COMMENT '删除标记(1: 正常 -1: 已删除)',
  22. PRIMARY KEY (`dept_id`) USING BTREE,
  23. KEY `idx_parent_id` (`parent_id`) USING BTREE,
  24. KEY `idx_show_order` (`show_order`) USING BTREE
  25. ) ENGINE = InnoDB
  26. DEFAULT CHARSET = utf8mb4
  27. COLLATE = utf8mb4_bin
  28. ROW_FORMAT = COMPACT COMMENT ='部门管理表';
  29. -- ----------------------------
  30. -- 部门关联关系表
  31. -- ----------------------------
  32. DROP TABLE IF EXISTS `work_sys_dept_relation`;
  33. CREATE TABLE `work_sys_dept_relation`
  34. (
  35. `parent_dept_id` bigint(20) NOT NULL COMMENT '父部门Id',
  36. `dept_id` bigint(20) NOT NULL COMMENT '部门Id',
  37. PRIMARY KEY (`parent_dept_id`, `dept_id`),
  38. KEY `idx_dept_id` (`dept_id`) USING BTREE
  39. ) ENGINE = InnoDB
  40. DEFAULT CHARSET = utf8mb4
  41. COLLATE = utf8mb4_bin
  42. ROW_FORMAT = COMPACT COMMENT ='部门关联关系表';
  43. -- ----------------------------
  44. -- 系统部门岗位表
  45. -- ----------------------------
  46. DROP TABLE IF EXISTS `work_sys_dept_post`;
  47. CREATE TABLE `work_sys_dept_post`
  48. (
  49. `dept_post_id` bigint(20) NOT NULL COMMENT '主键Id',
  50. `dept_id` bigint(20) NOT NULL COMMENT '部门Id',
  51. `post_id` bigint(20) NOT NULL COMMENT '岗位Id',
  52. `post_show_name` varchar(255) COLLATE utf8mb4_bin NOT NULL COMMENT '部门岗位显示名称',
  53. PRIMARY KEY (`dept_post_id`) USING BTREE,
  54. KEY `idx_post_id` (`post_id`) USING BTREE,
  55. KEY `idx_dept_id` (`dept_id`) USING BTREE
  56. ) ENGINE = InnoDB
  57. DEFAULT CHARSET = utf8mb4
  58. COLLATE = utf8mb4_bin;
  59. -- ----------------------------
  60. -- 系统岗位表
  61. -- ----------------------------
  62. DROP TABLE IF EXISTS `work_sys_post`;
  63. CREATE TABLE `work_sys_post`
  64. (
  65. `post_id` bigint(20) NOT NULL COMMENT '岗位Id',
  66. `post_name` varchar(255) COLLATE utf8mb4_bin NOT NULL COMMENT '岗位名称',
  67. `post_level` int(11) NOT NULL COMMENT '岗位层级,数值越小级别越高',
  68. `leader_post` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否领导岗位',
  69. `create_user_id` bigint(20) NOT NULL COMMENT '创建者Id',
  70. `create_time` datetime NOT NULL COMMENT '创建时间',
  71. `update_user_id` bigint(20) NOT NULL COMMENT '更新者Id',
  72. `update_time` datetime NOT NULL COMMENT '最后更新时间',
  73. PRIMARY KEY (`post_id`) USING BTREE
  74. ) ENGINE = InnoDB
  75. DEFAULT CHARSET = utf8mb4
  76. COLLATE = utf8mb4_bin;
  77. -- ----------------------------
  78. -- 系统用户岗位表
  79. -- ----------------------------
  80. DROP TABLE IF EXISTS `work_sys_user_post`;
  81. CREATE TABLE `work_sys_user_post`
  82. (
  83. `user_id` bigint(20) NOT NULL COMMENT '用户Id',
  84. `dept_post_id` bigint(20) NOT NULL COMMENT '部门岗位Id',
  85. `post_id` bigint(20) NOT NULL COMMENT '岗位Id',
  86. PRIMARY KEY (`user_id`, `dept_post_id`) USING BTREE,
  87. KEY `idx_post_id` (`post_id`) USING BTREE
  88. ) ENGINE = InnoDB
  89. DEFAULT CHARSET = utf8mb4
  90. COLLATE = utf8mb4_bin;
  91. -- ----------------------------
  92. -- 系统用户表
  93. -- ----------------------------
  94. DROP TABLE IF EXISTS `work_sys_user`;
  95. CREATE TABLE `work_sys_user`
  96. (
  97. `user_id` bigint(20) NOT NULL COMMENT '主键Id',
  98. `login_name` varchar(64) COLLATE utf8mb4_bin NOT NULL COMMENT '用户登录名称',
  99. `password` varchar(64) COLLATE utf8mb4_bin NOT NULL COMMENT '密码',
  100. `show_name` varchar(32) COLLATE utf8mb4_bin NOT NULL COMMENT '用户显示名称',
  101. `dept_id` bigint(20) NOT NULL COMMENT '用户所在部门Id',
  102. `head_image_url` varchar(512) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '用户头像的Url',
  103. `user_type` int(11) NOT NULL COMMENT '用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)',
  104. `user_status` int(11) NOT NULL COMMENT '状态(0: 正常 1: 锁定)',
  105. `email` varchar(512) COLLATE utf8mb4_bin COMMENT '用户邮箱',
  106. `mobile` varchar(64) COLLATE utf8mb4_bin COMMENT '用户手机',
  107. `create_user_id` bigint(20) NOT NULL COMMENT '创建者Id',
  108. `create_time` datetime NOT NULL COMMENT '创建时间',
  109. `update_user_id` bigint(20) NOT NULL COMMENT '更新者Id',
  110. `update_time` datetime NOT NULL COMMENT '最后更新时间',
  111. `deleted_flag` int(11) NOT NULL COMMENT '删除标记(1: 正常 -1: 已删除)',
  112. PRIMARY KEY (`user_id`) USING BTREE,
  113. UNIQUE KEY `uk_login_name` (`login_name`) USING BTREE,
  114. KEY `idx_dept_id` (`dept_id`) USING BTREE,
  115. KEY `idx_status` (`user_status`) USING BTREE
  116. ) ENGINE = InnoDB
  117. DEFAULT CHARSET = utf8mb4
  118. COLLATE = utf8mb4_bin
  119. ROW_FORMAT = COMPACT COMMENT ='系统用户表';
  120. -- ----------------------------
  121. -- 系统角色表
  122. -- ----------------------------
  123. DROP TABLE IF EXISTS `work_sys_role`;
  124. CREATE TABLE `work_sys_role`
  125. (
  126. `role_id` bigint(20) NOT NULL COMMENT '主键Id',
  127. `role_name` varchar(64) COLLATE utf8mb4_bin NOT NULL COMMENT '角色名称',
  128. `create_user_id` bigint(20) NOT NULL COMMENT '创建者Id',
  129. `create_time` datetime NOT NULL COMMENT '创建时间',
  130. `update_user_id` bigint(20) NOT NULL COMMENT '更新者Id',
  131. `update_time` datetime NOT NULL COMMENT '最后更新时间',
  132. PRIMARY KEY (`role_id`) USING BTREE
  133. ) ENGINE = InnoDB
  134. DEFAULT CHARSET = utf8mb4
  135. COLLATE = utf8mb4_bin
  136. ROW_FORMAT = COMPACT COMMENT ='系统角色表';
  137. -- ----------------------------
  138. -- 用户与角色对应关系表
  139. -- ----------------------------
  140. DROP TABLE IF EXISTS `work_sys_user_role`;
  141. CREATE TABLE `work_sys_user_role`
  142. (
  143. `user_id` bigint(20) NOT NULL COMMENT '用户Id',
  144. `role_id` bigint(20) NOT NULL COMMENT '角色Id',
  145. PRIMARY KEY (`user_id`, `role_id`) USING BTREE,
  146. KEY `idx_role_id` (`role_id`) USING BTREE
  147. ) ENGINE = InnoDB
  148. DEFAULT CHARSET = utf8mb4
  149. COLLATE = utf8mb4_bin
  150. ROW_FORMAT = COMPACT COMMENT ='用户与角色对应关系表';
  151. -- ----------------------------
  152. -- 菜单和操作权限管理表
  153. -- ----------------------------
  154. DROP TABLE IF EXISTS `work_sys_menu`;
  155. CREATE TABLE `work_sys_menu`
  156. (
  157. `menu_id` bigint(20) NOT NULL COMMENT '主键Id',
  158. `parent_id` bigint(20) DEFAULT NULL COMMENT '父菜单Id,目录菜单的父菜单为null',
  159. `menu_name` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '菜单显示名称',
  160. `menu_type` int(11) NOT NULL COMMENT '(0: 目录 1: 菜单 2: 按钮 3: UI片段)',
  161. `form_router_name` varchar(64) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '前端表单路由名称,仅用于menu_type为1的菜单类型',
  162. `online_form_id` bigint(20) DEFAULT NULL COMMENT '在线表单主键Id',
  163. `online_menu_perm_type` int(11) DEFAULT NULL COMMENT '在线表单菜单的权限控制类型',
  164. `report_page_id` bigint(20) DEFAULT NULL COMMENT '统计页面主键Id',
  165. `online_flow_entry_id` bigint(20) DEFAULT NULL COMMENT '仅用于在线表单的流程Id',
  166. `show_order` int(11) NOT NULL COMMENT '菜单显示顺序 (值越小,排序越靠前)',
  167. `icon` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '菜单图标',
  168. `create_user_id` bigint(20) NOT NULL COMMENT '创建者Id',
  169. `create_time` datetime NOT NULL COMMENT '创建时间',
  170. `update_user_id` bigint(20) NOT NULL COMMENT '更新者Id',
  171. `update_time` datetime NOT NULL COMMENT '最后更新时间',
  172. PRIMARY KEY (`menu_id`) USING BTREE,
  173. KEY `idx_show_order` (`show_order`) USING BTREE,
  174. KEY `idx_parent_id` (`parent_id`) USING BTREE,
  175. KEY `idx_menu_type` (`menu_type`) USING BTREE
  176. ) ENGINE = InnoDB
  177. DEFAULT CHARSET = utf8mb4
  178. COLLATE = utf8mb4_bin
  179. ROW_FORMAT = COMPACT COMMENT ='菜单和操作权限管理表';
  180. -- ----------------------------
  181. -- 角色与菜单对应关系表
  182. -- ----------------------------
  183. DROP TABLE IF EXISTS `work_sys_role_menu`;
  184. CREATE TABLE `work_sys_role_menu`
  185. (
  186. `role_id` bigint(20) NOT NULL COMMENT '角色Id',
  187. `menu_id` bigint(20) NOT NULL COMMENT '菜单Id',
  188. PRIMARY KEY (`role_id`, `menu_id`) USING BTREE,
  189. KEY `idx_menu_id` (`menu_id`) USING BTREE
  190. ) ENGINE = InnoDB
  191. DEFAULT CHARSET = utf8mb4
  192. COLLATE = utf8mb4_bin
  193. ROW_FORMAT = COMPACT COMMENT ='角色与菜单对应关系表';
  194. -- ----------------------------
  195. -- 系统权限资源表
  196. -- ----------------------------
  197. DROP TABLE IF EXISTS `work_sys_perm_code`;
  198. CREATE TABLE `work_sys_perm_code`
  199. (
  200. `perm_code_id` bigint(20) NOT NULL COMMENT '主键Id',
  201. `parent_id` bigint(20) DEFAULT NULL COMMENT '上级权限字Id',
  202. `perm_code` varchar(128) COLLATE utf8_bin NOT NULL COMMENT '权限字标识(一般为有含义的英文字符串)',
  203. `perm_code_type` int(11) NOT NULL COMMENT '类型(0: 表单 1: UI片段 2: 操作)',
  204. `show_name` varchar(128) COLLATE utf8_bin NOT NULL COMMENT '显示名称',
  205. `show_order` int(11) NOT NULL COMMENT '显示顺序(数值越小,越靠前)',
  206. `create_user_id` bigint(20) NOT NULL COMMENT '创建者Id',
  207. `create_time` datetime NOT NULL COMMENT '创建时间',
  208. `update_user_id` bigint(20) NOT NULL COMMENT '更新者Id',
  209. `update_time` datetime NOT NULL COMMENT '最后更新时间',
  210. PRIMARY KEY (`perm_code_id`),
  211. UNIQUE KEY `uk_perm_code` (`perm_code`) USING BTREE,
  212. KEY `idx_parent_id` (`parent_id`) USING BTREE,
  213. KEY `idx_show_order` (`show_order`) USING BTREE
  214. ) ENGINE = InnoDB
  215. DEFAULT CHARSET = utf8mb4
  216. COLLATE = utf8mb4_bin
  217. ROW_FORMAT = COMPACT COMMENT ='系统权限资源表';
  218. -- ----------------------------
  219. -- 菜单和权限关系表
  220. -- ----------------------------
  221. DROP TABLE IF EXISTS `work_sys_menu_perm_code`;
  222. CREATE TABLE `work_sys_menu_perm_code`
  223. (
  224. `menu_id` bigint(20) NOT NULL COMMENT '关联菜单Id',
  225. `perm_code_id` bigint(20) NOT NULL COMMENT '关联权限字Id',
  226. PRIMARY KEY (`menu_id`, `perm_code_id`) USING BTREE,
  227. KEY `idx_perm_code_id` (`perm_code_id`) USING BTREE
  228. ) ENGINE = InnoDB
  229. DEFAULT CHARSET = utf8mb4
  230. COLLATE = utf8mb4_bin COMMENT ='菜单和权限关系表';
  231. -- ----------------------------
  232. -- 系统权限模块表
  233. -- ----------------------------
  234. DROP TABLE IF EXISTS `work_sys_perm_module`;
  235. CREATE TABLE `work_sys_perm_module`
  236. (
  237. `module_id` bigint(20) NOT NULL COMMENT '权限模块id',
  238. `parent_id` bigint(20) DEFAULT 0 COMMENT '上级权限模块id',
  239. `module_name` varchar(64) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '权限模块名称',
  240. `module_type` int(11) NOT NULL COMMENT '模块类型(0: 普通模块 1: Controller模块)',
  241. `show_order` int(11) NOT NULL DEFAULT 0 COMMENT '权限模块在当前层级下的顺序,由小到大',
  242. `create_user_id` bigint(20) NOT NULL COMMENT '创建者Id',
  243. `create_time` datetime NOT NULL COMMENT '创建时间',
  244. `update_user_id` bigint(20) NOT NULL COMMENT '更新者Id',
  245. `update_time` datetime NOT NULL COMMENT '最后更新时间',
  246. PRIMARY KEY (`module_id`) USING BTREE,
  247. KEY `idx_show_order` (`show_order`) USING BTREE,
  248. KEY `idx_parent_id` (`parent_id`) USING BTREE,
  249. KEY `idx_module_type` (`module_type`) USING BTREE
  250. ) ENGINE = InnoDB
  251. DEFAULT CHARSET = utf8mb4
  252. COLLATE = utf8mb4_bin
  253. ROW_FORMAT = COMPACT COMMENT ='系统权限模块表';
  254. -- ----------------------------
  255. -- 系统权限表
  256. -- ----------------------------
  257. DROP TABLE IF EXISTS `work_sys_perm`;
  258. CREATE TABLE `work_sys_perm`
  259. (
  260. `perm_id` bigint(20) NOT NULL COMMENT '权限id',
  261. `module_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '权限所在的权限模块id',
  262. `perm_name` varchar(64) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '权限名称',
  263. `url` varchar(128) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '关联的url',
  264. `show_order` int(11) NOT NULL DEFAULT 0 COMMENT '权限在当前模块下的顺序,由小到大',
  265. `create_user_id` bigint(20) NOT NULL COMMENT '创建者Id',
  266. `create_time` datetime NOT NULL COMMENT '创建时间',
  267. `update_user_id` bigint(20) NOT NULL COMMENT '更新者Id',
  268. `update_time` datetime NOT NULL COMMENT '最后更新时间',
  269. PRIMARY KEY (`perm_id`) USING BTREE,
  270. KEY `idx_show_order` (`show_order`) USING BTREE,
  271. KEY `idx_module_id` (`module_id`) USING BTREE
  272. ) ENGINE = InnoDB
  273. DEFAULT CHARSET = utf8mb4
  274. COLLATE = utf8mb4_bin
  275. ROW_FORMAT = COMPACT COMMENT ='系统权限表';
  276. -- ----------------------------
  277. -- 系统权限字和权限资源关联表
  278. -- ----------------------------
  279. DROP TABLE IF EXISTS `work_sys_perm_code_perm`;
  280. CREATE TABLE `work_sys_perm_code_perm`
  281. (
  282. `perm_code_id` bigint(20) NOT NULL COMMENT '权限字Id',
  283. `perm_id` bigint(20) NOT NULL COMMENT '权限id',
  284. PRIMARY KEY (`perm_code_id`, `perm_id`),
  285. KEY `idx_perm_id` (`perm_id`) USING BTREE
  286. ) ENGINE = InnoDB
  287. DEFAULT CHARSET = utf8mb4
  288. COLLATE = utf8mb4_bin
  289. ROW_FORMAT = COMPACT COMMENT ='系统权限字和权限资源关联表';
  290. -- ----------------------------
  291. -- 权限资源白名单表
  292. -- ----------------------------
  293. DROP TABLE IF EXISTS `work_sys_perm_whitelist`;
  294. CREATE TABLE `work_sys_perm_whitelist`
  295. (
  296. `perm_url` varchar(512) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '权限资源的url',
  297. `module_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT '权限资源所属模块名字(通常是Controller的名字)',
  298. `perm_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT '权限的名称',
  299. PRIMARY KEY (`perm_url`)
  300. ) ENGINE = InnoDB
  301. DEFAULT CHARSET = utf8mb4
  302. COLLATE = utf8mb4_bin COMMENT ='权限资源白名单表(认证用户均可访问的url资源)';
  303. -- ----------------------------
  304. -- 数据权限表
  305. -- ----------------------------
  306. DROP TABLE IF EXISTS `work_sys_data_perm`;
  307. CREATE TABLE `work_sys_data_perm`
  308. (
  309. `data_perm_id` bigint(20) NOT NULL COMMENT '主键',
  310. `data_perm_name` varchar(64) COLLATE utf8mb4_bin NOT NULL COMMENT '显示名称',
  311. `rule_type` tinyint(2) NOT NULL COMMENT '数据权限规则类型(0: 全部可见 1: 只看自己 2: 只看本部门 3: 本部门及子部门 4: 多部门及子部门 5: 自定义部门列表)。',
  312. `create_user_id` bigint(20) NOT NULL COMMENT '创建者Id',
  313. `create_time` datetime NOT NULL COMMENT '创建时间',
  314. `update_user_id` bigint(20) NOT NULL COMMENT '更新者Id',
  315. `update_time` datetime NOT NULL COMMENT '最后更新时间',
  316. PRIMARY KEY (`data_perm_id`) USING BTREE,
  317. KEY `idx_create_time` (`create_time`) USING BTREE
  318. ) ENGINE = InnoDB
  319. DEFAULT CHARSET = utf8mb4
  320. COLLATE = utf8mb4_bin COMMENT ='数据权限表';
  321. -- ----------------------------
  322. -- 数据权限和用户关联表
  323. -- ----------------------------
  324. DROP TABLE IF EXISTS `work_sys_data_perm_user`;
  325. CREATE TABLE `work_sys_data_perm_user`
  326. (
  327. `data_perm_id` bigint(20) NOT NULL COMMENT '数据权限Id',
  328. `user_id` bigint(20) NOT NULL COMMENT '用户Id',
  329. PRIMARY KEY (`data_perm_id`, `user_id`),
  330. KEY `idx_user_id` (`user_id`) USING BTREE
  331. ) ENGINE = InnoDB
  332. DEFAULT CHARSET = utf8mb4
  333. COLLATE = utf8mb4_bin COMMENT ='数据权限和用户关联表';
  334. -- ----------------------------
  335. -- 数据权限和部门关联表
  336. -- ----------------------------
  337. DROP TABLE IF EXISTS `work_sys_data_perm_dept`;
  338. CREATE TABLE `work_sys_data_perm_dept`
  339. (
  340. `data_perm_id` bigint(20) NOT NULL COMMENT '数据权限Id',
  341. `dept_id` bigint(20) NOT NULL COMMENT '部门Id',
  342. PRIMARY KEY (`data_perm_id`, `dept_id`),
  343. KEY `idx_dept_id` (`dept_id`) USING BTREE
  344. ) ENGINE = InnoDB
  345. DEFAULT CHARSET = utf8mb4
  346. COLLATE = utf8mb4_bin COMMENT ='数据权限和部门关联表';
  347. -- ----------------------------
  348. -- 数据权限和菜单关联表
  349. -- ----------------------------
  350. DROP TABLE IF EXISTS `work_sys_data_perm_menu`;
  351. CREATE TABLE `work_sys_data_perm_menu`
  352. (
  353. `data_perm_id` bigint(20) NOT NULL COMMENT '数据权限Id',
  354. `menu_id` bigint(20) NOT NULL COMMENT '菜单Id',
  355. PRIMARY KEY (`data_perm_id`, `menu_id`),
  356. KEY `idx_menu_id` (`menu_id`) USING BTREE
  357. ) ENGINE = InnoDB
  358. DEFAULT CHARSET = utf8mb4
  359. COLLATE = utf8mb4_bin COMMENT ='数据权限和菜单关联表';
  360. -- ----------------------------
  361. -- 系统操作日志表
  362. -- ----------------------------
  363. DROP TABLE IF EXISTS `zz_sys_operation_log`;
  364. CREATE TABLE `zz_sys_operation_log`
  365. (
  366. `log_id` bigint(20) NOT NULL COMMENT '主键Id',
  367. `description` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '日志描述',
  368. `operation_type` int(11) DEFAULT NULL COMMENT '操作类型',
  369. `service_name` varchar(128) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '接口所在服务名称',
  370. `api_class` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '调用的controller全类名',
  371. `api_method` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '调用的controller中的方法',
  372. `session_id` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '用户会话sessionId',
  373. `trace_id` char(32) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '每次请求的Id',
  374. `elapse` int(11) DEFAULT NULL COMMENT '调用时长',
  375. `request_method` varchar(32) COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'HTTP 请求方法,如GET',
  376. `request_url` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'HTTP 请求地址',
  377. `request_arguments` longtext COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'controller接口参数',
  378. `response_result` varchar(2000) COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'controller应答结果',
  379. `request_ip` varchar(32) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '请求IP',
  380. `success` bit(1) DEFAULT NULL COMMENT '应答状态',
  381. `error_msg` varchar(2000) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '错误信息',
  382. `tenant_id` bigint(20) DEFAULT NULL COMMENT '租户Id',
  383. `operator_id` bigint(20) DEFAULT NULL COMMENT '操作员Id',
  384. `operator_name` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '操作员名称',
  385. `operation_time` datetime DEFAULT NULL COMMENT '操作时间',
  386. PRIMARY KEY (`log_id`),
  387. KEY `idx_trace_id_idx` (`trace_id`),
  388. KEY `idx_operation_type_idx` (`operation_type`),
  389. KEY `idx_operation_time_idx` (`operation_time`) USING BTREE,
  390. KEY `idx_success` (`success`) USING BTREE,
  391. KEY `idx_elapse` (`elapse`) USING BTREE
  392. ) ENGINE = InnoDB
  393. DEFAULT CHARSET = utf8mb4
  394. COLLATE = utf8mb4_bin COMMENT ='系统操作日志表';
  395. -- ----------------------------
  396. -- 管理员账号数据
  397. -- ----------------------------
  398. BEGIN;
  399. INSERT INTO `work_sys_dept`
  400. VALUES (1573942230803025922, NULL, '公司总部', 1, 1573942230794637312, CURDATE(), 1573942230794637312, CURDATE(), 1);
  401. INSERT INTO `work_sys_user`
  402. VALUES (1573942230794637312, 'admin', '$2a$10$HFGMYjSpAp9QA8gETgIXv.MObyKA11so0N9gk35tcSZylN2A5QzE6', '管理员',
  403. 1573942230803025922, NULL, 0, 0, NULL, NULL, 1573942230794637312, CURDATE(), 1573942230794637312, CURDATE(), 1);
  404. INSERT INTO `work_sys_dept_relation`
  405. VALUES (1573942230803025922, 1573942230803025922);
  406. COMMIT;
  407. SET FOREIGN_KEY_CHECKS = 1;