postgres_test.sql 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. DROP TABLE if EXISTS test_demo;
  2. create table if not exists test_demo
  3. (
  4. id int8,
  5. dept_id int8,
  6. user_id int8,
  7. order_num int4 default 0,
  8. test_key varchar(255),
  9. value varchar(255),
  10. version int4 default 0,
  11. create_time timestamp,
  12. create_by varchar(64),
  13. update_time timestamp,
  14. update_by varchar(64),
  15. del_flag int4 default 0
  16. );
  17. comment on table test_demo is '测试单表';
  18. comment on column test_demo.id is '主键';
  19. comment on column test_demo.dept_id is '部门id';
  20. comment on column test_demo.user_id is '用户id';
  21. comment on column test_demo.order_num is '排序号';
  22. comment on column test_demo.test_key is 'key键';
  23. comment on column test_demo.value is '值';
  24. comment on column test_demo.version is '版本';
  25. comment on column test_demo.create_time is '创建时间';
  26. comment on column test_demo.create_by is '创建人';
  27. comment on column test_demo.update_time is '更新时间';
  28. comment on column test_demo.update_by is '更新人';
  29. comment on column test_demo.del_flag is '删除标志';
  30. DROP TABLE if EXISTS test_tree;
  31. create table if not exists test_tree
  32. (
  33. id int8,
  34. parent_id int8 default 0,
  35. dept_id int8,
  36. user_id int8,
  37. tree_name varchar(255),
  38. version int4 default 0,
  39. create_time timestamp,
  40. create_by varchar(64),
  41. update_time timestamp,
  42. update_by varchar(64),
  43. del_flag integer default 0
  44. );
  45. comment on table test_tree is '测试树表';
  46. comment on column test_tree.id is '主键';
  47. comment on column test_tree.parent_id is '父id';
  48. comment on column test_tree.dept_id is '部门id';
  49. comment on column test_tree.user_id is '用户id';
  50. comment on column test_tree.tree_name is '值';
  51. comment on column test_tree.version is '版本';
  52. comment on column test_tree.create_time is '创建时间';
  53. comment on column test_tree.create_by is '创建人';
  54. comment on column test_tree.update_time is '更新时间';
  55. comment on column test_tree.update_by is '更新人';
  56. comment on column test_tree.del_flag is '删除标志';
  57. INSERT INTO sys_user(user_id, dept_id, user_name, nick_name, user_type, email, phonenumber, sex, avatar, password, status, del_flag, login_ip, login_date, create_by, create_time, update_by, update_time, remark) VALUES (3, 108, 'test', '本部门及以下 密码666666', 'sys_user', '', '', '0', '', '$2a$10$b8yUzN0C71sbz.PhNOCgJe.Tu1yWC3RNrTyjSQ8p1W0.aaUXUJ.Ne', '0', '0', '127.0.0.1', now(), 'admin', now(), 'test', now(), NULL);
  58. INSERT INTO sys_user(user_id, dept_id, user_name, nick_name, user_type, email, phonenumber, sex, avatar, password, status, del_flag, login_ip, login_date, create_by, create_time, update_by, update_time, remark) VALUES (4, 102, 'test1', '仅本人 密码666666', 'sys_user', '', '', '0', '', '$2a$10$b8yUzN0C71sbz.PhNOCgJe.Tu1yWC3RNrTyjSQ8p1W0.aaUXUJ.Ne', '0', '0', '127.0.0.1', now(), 'admin', now(), 'test1', now(), NULL);
  59. INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (5, '测试菜单', 0, 5, 'demo', NULL, 1, 0, 'M', '0', '0', NULL, 'star', 'admin', now(), NULL, NULL, '');
  60. INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1500, '测试单表', 5, 1, 'demo', 'demo/demo/index', 1, 0, 'C', '0', '0', 'demo:demo:list', '#', 'admin', now(), '', NULL, '测试单表菜单');
  61. INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1501, '测试单表查询', 1500, 1, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:query', '#', 'admin', now(), '', NULL, '');
  62. INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1502, '测试单表新增', 1500, 2, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:add', '#', 'admin', now(), '', NULL, '');
  63. INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1503, '测试单表修改', 1500, 3, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:edit', '#', 'admin', now(), '', NULL, '');
  64. INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1504, '测试单表删除', 1500, 4, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:remove', '#', 'admin', now(), '', NULL, '');
  65. INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1505, '测试单表导出', 1500, 5, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:export', '#', 'admin', now(), '', NULL, '');
  66. INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1506, '测试树表', 5, 1, 'tree', 'demo/tree/index', 1, 0, 'C', '0', '0', 'demo:tree:list', '#', 'admin', now(), '', NULL, '测试树表菜单');
  67. INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1507, '测试树表查询', 1506, 1, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:query', '#', 'admin', now(), '', NULL, '');
  68. INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1508, '测试树表新增', 1506, 2, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:add', '#', 'admin', now(), '', NULL, '');
  69. INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1509, '测试树表修改', 1506, 3, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:edit', '#', 'admin', now(), '', NULL, '');
  70. INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1510, '测试树表删除', 1506, 4, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:remove', '#', 'admin', now(), '', NULL, '');
  71. INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1511, '测试树表导出', 1506, 5, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:export', '#', 'admin', now(), '', NULL, '');
  72. INSERT INTO sys_role(role_id, role_name, role_key, role_sort, data_scope, menu_check_strictly, dept_check_strictly, status, del_flag, create_by, create_time, update_by, update_time, remark) VALUES (3, '本部门及以下', 'test1', 3, '4', 't', 't', '0', '0', 'admin', now(), 'admin', NULL, NULL);
  73. INSERT INTO sys_role(role_id, role_name, role_key, role_sort, data_scope, menu_check_strictly, dept_check_strictly, status, del_flag, create_by, create_time, update_by, update_time, remark) VALUES (4, '仅本人', 'test2', 4, '5', 't', 't', '0', '0', 'admin', now(), 'admin', NULL, NULL);
  74. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1);
  75. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 5);
  76. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 100);
  77. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 101);
  78. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 102);
  79. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 103);
  80. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 104);
  81. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 105);
  82. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 106);
  83. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 107);
  84. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 108);
  85. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 500);
  86. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 501);
  87. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1001);
  88. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1002);
  89. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1003);
  90. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1004);
  91. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1005);
  92. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1006);
  93. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1007);
  94. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1008);
  95. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1009);
  96. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1010);
  97. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1011);
  98. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1012);
  99. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1013);
  100. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1014);
  101. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1015);
  102. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1016);
  103. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1017);
  104. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1018);
  105. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1019);
  106. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1020);
  107. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1021);
  108. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1022);
  109. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1023);
  110. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1024);
  111. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1025);
  112. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1026);
  113. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1027);
  114. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1028);
  115. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1029);
  116. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1030);
  117. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1031);
  118. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1032);
  119. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1033);
  120. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1034);
  121. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1035);
  122. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1036);
  123. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1037);
  124. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1038);
  125. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1039);
  126. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1040);
  127. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1041);
  128. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1042);
  129. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1043);
  130. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1044);
  131. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1045);
  132. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1500);
  133. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1501);
  134. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1502);
  135. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1503);
  136. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1504);
  137. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1505);
  138. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1506);
  139. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1507);
  140. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1508);
  141. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1509);
  142. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1510);
  143. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1511);
  144. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 5);
  145. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1500);
  146. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1501);
  147. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1502);
  148. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1503);
  149. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1504);
  150. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1505);
  151. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1506);
  152. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1507);
  153. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1508);
  154. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1509);
  155. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1510);
  156. INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1511);
  157. INSERT INTO sys_user_role(user_id, role_id) VALUES (3, 3);
  158. INSERT INTO sys_user_role(user_id, role_id) VALUES (4, 4);
  159. INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (1, 102, 4, 1, '测试数据权限', '测试', 0, now(), 'admin', NULL, NULL, 0);
  160. INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (2, 102, 3, 2, '子节点1', '111', 0, now(), 'admin', NULL, NULL, 0);
  161. INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (3, 102, 3, 3, '子节点2', '222', 0, now(), 'admin', NULL, NULL, 0);
  162. INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (4, 108, 4, 4, '测试数据', 'demo', 0, now(), 'admin', NULL, NULL, 0);
  163. INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (5, 108, 3, 13, '子节点11', '1111', 0, now(), 'admin', NULL, NULL, 0);
  164. INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (6, 108, 3, 12, '子节点22', '2222', 0, now(), 'admin', NULL, NULL, 0);
  165. INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (7, 108, 3, 11, '子节点33', '3333', 0, now(), 'admin', NULL, NULL, 0);
  166. INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (8, 108, 3, 10, '子节点44', '4444', 0, now(), 'admin', NULL, NULL, 0);
  167. INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (9, 108, 3, 9, '子节点55', '5555', 0, now(), 'admin', NULL, NULL, 0);
  168. INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (10, 108, 3, 8, '子节点66', '6666', 0, now(), 'admin', NULL, NULL, 0);
  169. INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (11, 108, 3, 7, '子节点77', '7777', 0, now(), 'admin', NULL, NULL, 0);
  170. INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (12, 108, 3, 6, '子节点88', '8888', 0, now(), 'admin', NULL, NULL, 0);
  171. INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (13, 108, 3, 5, '子节点99', '9999', 0, now(), 'admin', NULL, NULL, 0);
  172. INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (1, 0, 102, 4, '测试数据权限', 0, now(), 'admin', NULL, NULL, 0);
  173. INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (2, 1, 102, 3, '子节点1', 0, now(), 'admin', NULL, NULL, 0);
  174. INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (3, 2, 102, 3, '子节点2', 0, now(), 'admin', NULL, NULL, 0);
  175. INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (4, 0, 108, 4, '测试树1', 0, now(), 'admin', NULL, NULL, 0);
  176. INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (5, 4, 108, 3, '子节点11', 0, now(), 'admin', NULL, NULL, 0);
  177. INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (6, 4, 108, 3, '子节点22', 0, now(), 'admin', NULL, NULL, 0);
  178. INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (7, 4, 108, 3, '子节点33', 0, now(), 'admin', NULL, NULL, 0);
  179. INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (8, 5, 108, 3, '子节点44', 0, now(), 'admin', NULL, NULL, 0);
  180. INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (9, 6, 108, 3, '子节点55', 0, now(), 'admin', NULL, NULL, 0);
  181. INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (10, 7, 108, 3, '子节点66', 0, now(), 'admin', NULL, NULL, 0);
  182. INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (11, 7, 108, 3, '子节点77', 0, now(), 'admin', NULL, NULL, 0);
  183. INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (12, 10, 108, 3, '子节点88', 0, now(), 'admin', NULL, NULL, 0);
  184. INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (13, 10, 108, 3, '子节点99', 0, now(), 'admin', NULL, NULL, 0);