oracle_test.sql 20 KB

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