oracle_ry_vue_5.X.sql 81 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257
  1. -- ----------------------------
  2. -- 第三方平台授权表
  3. -- ----------------------------
  4. create table sys_social
  5. (
  6. id number(20) not null,
  7. user_id number(20) not null,
  8. tenant_id varchar2(20) default null,
  9. auth_id varchar2(255) not null,
  10. source varchar2(255) not null,
  11. open_id varchar2(255) default null,
  12. user_name varchar2(30) not null,
  13. nick_name varchar2(30) default '',
  14. email varchar2(255) default '',
  15. avatar varchar2(500) default '',
  16. access_token varchar2(255) not null,
  17. expire_in number(20) default null,
  18. refresh_token varchar2(255) default null,
  19. access_code varchar2(255) default null,
  20. union_id varchar2(255) default null,
  21. scope varchar2(255) default null,
  22. token_type varchar2(255) default null,
  23. id_token varchar2(255) default null,
  24. mac_algorithm varchar2(255) default null,
  25. mac_key varchar2(255) default null,
  26. code varchar2(255) default null,
  27. oauth_token varchar2(255) default null,
  28. oauth_token_secret varchar2(255) default null,
  29. create_dept number(20),
  30. create_by number(20),
  31. create_time date,
  32. update_by number(20),
  33. update_time date,
  34. del_flag char(1) default '0'
  35. );
  36. alter table sys_social add constraint pk_sys_social primary key (id);
  37. comment on table sys_social is '社会化关系表';
  38. comment on column sys_social.id is '主键';
  39. comment on column sys_social.user_id is '用户ID';
  40. comment on column sys_social.tenant_id is '租户id';
  41. comment on column sys_social.auth_id is '平台+平台唯一id';
  42. comment on column sys_social.source is '用户来源';
  43. comment on column sys_social.open_id is '平台编号唯一id';
  44. comment on column sys_social.user_name is '登录账号';
  45. comment on column sys_social.nick_name is '用户昵称';
  46. comment on column sys_social.email is '用户邮箱';
  47. comment on column sys_social.avatar is '头像地址';
  48. comment on column sys_social.access_token is '用户的授权令牌';
  49. comment on column sys_social.expire_in is '用户的授权令牌的有效期,部分平台可能没有';
  50. comment on column sys_social.refresh_token is '刷新令牌,部分平台可能没有';
  51. comment on column sys_social.access_code is '平台的授权信息,部分平台可能没有';
  52. comment on column sys_social.union_id is '用户的 unionid';
  53. comment on column sys_social.scope is '授予的权限,部分平台可能没有';
  54. comment on column sys_social.token_type is '个别平台的授权信息,部分平台可能没有';
  55. comment on column sys_social.id_token is 'id token,部分平台可能没有';
  56. comment on column sys_social.mac_algorithm is '小米平台用户的附带属性,部分平台可能没有';
  57. comment on column sys_social.mac_key is '小米平台用户的附带属性,部分平台可能没有';
  58. comment on column sys_social.code is '用户的授权code,部分平台可能没有';
  59. comment on column sys_social.oauth_token is 'Twitter平台用户的附带属性,部分平台可能没有';
  60. comment on column sys_social.oauth_token_secret is 'Twitter平台用户的附带属性,部分平台可能没有';
  61. comment on column sys_social.create_dept is '创建部门';
  62. comment on column sys_social.create_by is '创建者';
  63. comment on column sys_social.create_time is '创建时间';
  64. comment on column sys_social.update_by is '更新者';
  65. comment on column sys_social.update_time is '更新时间';
  66. comment on column sys_social.del_flag is '删除标志(0代表存在 2代表删除)';
  67. -- ----------------------------
  68. -- 租户表
  69. -- ----------------------------
  70. create table sys_tenant (
  71. id number(20) not null,
  72. tenant_id varchar2(20) not null,
  73. contact_user_name varchar2(20) default '',
  74. contact_phone varchar2(20) default '',
  75. company_name varchar2(50) default '',
  76. license_number varchar2(30) default '',
  77. address varchar2(200) default '',
  78. intro varchar2(200) default '',
  79. domain varchar2(200) default '',
  80. remark varchar2(200) default '',
  81. package_id number(20) default null,
  82. expire_time date default null,
  83. account_count number(4) default -1,
  84. status char(1) default '0',
  85. del_flag char(1) default '0',
  86. create_dept number(20) default null,
  87. create_by number(20) default null,
  88. create_time date,
  89. update_by number(20) default null,
  90. update_time date
  91. );
  92. alter table sys_tenant add constraint pk_sys_tenant primary key (id);
  93. comment on table sys_tenant is '租户表';
  94. comment on column sys_tenant.tenant_id is '租户编号';
  95. comment on column sys_tenant.contact_phone is '联系电话';
  96. comment on column sys_tenant.company_name is '企业名称';
  97. comment on column sys_tenant.company_name is '联系人';
  98. comment on column sys_tenant.license_number is '统一社会信用代码';
  99. comment on column sys_tenant.address is '地址';
  100. comment on column sys_tenant.intro is '企业简介';
  101. comment on column sys_tenant.remark is '备注';
  102. comment on column sys_tenant.package_id is '租户套餐编号';
  103. comment on column sys_tenant.expire_time is '过期时间';
  104. comment on column sys_tenant.account_count is '用户数量(-1不限制)';
  105. comment on column sys_tenant.status is '租户状态(0正常 1停用)';
  106. comment on column sys_tenant.del_flag is '删除标志(0代表存在 2代表删除)';
  107. comment on column sys_tenant.create_dept is '创建部门';
  108. comment on column sys_tenant.create_by is '创建者';
  109. comment on column sys_tenant.create_time is '创建时间';
  110. comment on column sys_tenant.update_by is '更新者';
  111. comment on column sys_tenant.update_time is '更新时间';
  112. -- ----------------------------
  113. -- 初始化-租户表数据
  114. -- ----------------------------
  115. insert into sys_tenant values(1, '000000', '管理组', '15888888888', 'XXX有限公司', null, null, '多租户通用后台管理管理系统', null, null, null, null, -1, '0', '0', 103, 1, sysdate, null, null);
  116. -- ----------------------------
  117. -- 租户套餐表
  118. -- ----------------------------
  119. create table sys_tenant_package (
  120. package_id number(20) not null,
  121. package_name varchar2(20) default '',
  122. menu_ids varchar2(3000) default '',
  123. remark varchar2(200) default '',
  124. menu_check_strictly number(1) default 1,
  125. status char(1) default '0',
  126. del_flag char(1) default '0',
  127. create_dept number(20) default null,
  128. create_by number(20) default null,
  129. create_time date,
  130. update_by number(20) default null,
  131. update_time date
  132. );
  133. alter table sys_tenant_package add constraint pk_sys_tenant_package primary key (package_id);
  134. comment on table sys_tenant_package is '租户套餐表';
  135. comment on column sys_tenant_package.package_id is '租户套餐id';
  136. comment on column sys_tenant_package.package_name is '套餐名称';
  137. comment on column sys_tenant_package.menu_ids is '关联菜单id';
  138. comment on column sys_tenant_package.remark is '备注';
  139. comment on column sys_tenant_package.status is '状态(0正常 1停用)';
  140. comment on column sys_tenant_package.del_flag is '删除标志(0代表存在 2代表删除)';
  141. comment on column sys_tenant_package.create_dept is '创建部门';
  142. comment on column sys_tenant_package.create_by is '创建者';
  143. comment on column sys_tenant_package.create_time is '创建时间';
  144. comment on column sys_tenant_package.update_by is '更新者';
  145. comment on column sys_tenant_package.update_time is '更新时间';
  146. -- ----------------------------
  147. -- 1、部门表
  148. -- ----------------------------
  149. create table sys_dept (
  150. dept_id number(20) not null,
  151. tenant_id varchar2(20) default '000000',
  152. parent_id number(20) default 0,
  153. ancestors varchar2(500) default '',
  154. dept_name varchar2(30) default '',
  155. order_num number(4) default 0,
  156. leader number(20) default null,
  157. phone varchar2(11) default null,
  158. email varchar2(50) default null,
  159. status char(1) default '0',
  160. del_flag char(1) default '0',
  161. create_dept number(20) default null,
  162. create_by number(20) default null,
  163. create_time date,
  164. update_by number(20) default null,
  165. update_time date
  166. );
  167. alter table sys_dept add constraint pk_sys_dept primary key (dept_id);
  168. comment on table sys_dept is '部门表';
  169. comment on column sys_dept.dept_id is '部门id';
  170. comment on column sys_dept.tenant_id is '租户编号';
  171. comment on column sys_dept.parent_id is '父部门id';
  172. comment on column sys_dept.ancestors is '祖级列表';
  173. comment on column sys_dept.dept_name is '部门名称';
  174. comment on column sys_dept.order_num is '显示顺序';
  175. comment on column sys_dept.leader is '负责人';
  176. comment on column sys_dept.phone is '联系电话';
  177. comment on column sys_dept.email is '邮箱';
  178. comment on column sys_dept.status is '部门状态(0正常 1停用)';
  179. comment on column sys_dept.del_flag is '删除标志(0代表存在 2代表删除)';
  180. comment on column sys_dept.create_dept is '创建部门';
  181. comment on column sys_dept.create_by is '创建者';
  182. comment on column sys_dept.create_time is '创建时间';
  183. comment on column sys_dept.update_by is '更新者';
  184. comment on column sys_dept.update_time is '更新时间';
  185. -- ----------------------------
  186. -- 初始化-部门表数据
  187. -- ----------------------------
  188. insert into sys_dept values(100, '000000', 0, '0', 'XXX科技', 0, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
  189. insert into sys_dept values(101, '000000', 100, '0,100', '深圳总公司', 1, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
  190. insert into sys_dept values(102, '000000', 100, '0,100', '长沙分公司', 2, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
  191. insert into sys_dept values(103, '000000', 101, '0,100,101', '研发部门', 1, 1, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
  192. insert into sys_dept values(104, '000000', 101, '0,100,101', '市场部门', 2, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
  193. insert into sys_dept values(105, '000000', 101, '0,100,101', '测试部门', 3, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
  194. insert into sys_dept values(106, '000000', 101, '0,100,101', '财务部门', 4, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
  195. insert into sys_dept values(107, '000000', 101, '0,100,101', '运维部门', 5, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
  196. insert into sys_dept values(108, '000000', 102, '0,100,102', '市场部门', 1, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
  197. insert into sys_dept values(109, '000000', 102, '0,100,102', '财务部门', 2, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
  198. -- ----------------------------
  199. -- 2、用户信息表
  200. -- ----------------------------
  201. create table sys_user (
  202. user_id number(20) not null,
  203. tenant_id varchar2(20) default '000000',
  204. dept_id number(20) default null,
  205. user_name varchar2(40) not null,
  206. nick_name varchar2(40) not null,
  207. user_type varchar2(10) default 'sys_user',
  208. email varchar2(50) default '',
  209. phonenumber varchar2(11) default '',
  210. sex char(1) default '0',
  211. avatar number(20) default null,
  212. password varchar2(100) default '',
  213. status char(1) default '0',
  214. del_flag char(1) default '0',
  215. login_ip varchar2(128) default '',
  216. login_date date,
  217. create_dept number(20) default null,
  218. create_by number(20) default null,
  219. create_time date,
  220. update_by number(20) default null,
  221. update_time date,
  222. remark varchar2(500) default ''
  223. );
  224. alter table sys_user add constraint pk_sys_user primary key (user_id);
  225. comment on table sys_user is '用户信息表';
  226. comment on column sys_user.user_id is '用户ID';
  227. comment on column sys_user.tenant_id is '租户编号';
  228. comment on column sys_user.dept_id is '部门ID';
  229. comment on column sys_user.user_name is '用户账号';
  230. comment on column sys_user.nick_name is '用户昵称';
  231. comment on column sys_user.user_type is '用户类型(sys_user系统用户)';
  232. comment on column sys_user.email is '用户邮箱';
  233. comment on column sys_user.phonenumber is '手机号码';
  234. comment on column sys_user.sex is '用户性别(0男 1女 2未知)';
  235. comment on column sys_user.avatar is '头像路径';
  236. comment on column sys_user.password is '密码';
  237. comment on column sys_user.status is '帐号状态(0正常 1停用)';
  238. comment on column sys_user.del_flag is '删除标志(0代表存在 2代表删除)';
  239. comment on column sys_user.login_ip is '最后登录IP';
  240. comment on column sys_user.login_date is '最后登录时间';
  241. comment on column sys_user.create_dept is '创建部门';
  242. comment on column sys_user.create_by is '创建者';
  243. comment on column sys_user.create_time is '创建时间';
  244. comment on column sys_user.update_by is '更新者';
  245. comment on column sys_user.update_time is '更新时间';
  246. comment on column sys_user.remark is '备注';
  247. -- ----------------------------
  248. -- 初始化-用户信息表数据
  249. -- ----------------------------
  250. insert into sys_user values(1, '000000', 103, 'admin', '疯狂的狮子Li', 'sys_user', 'crazyLionLi@163.com', '15888888888', '1', null, '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate, 103, 1, sysdate, null, null, '管理员');
  251. insert into sys_user values(2, '000000', 105, 'lionli', '疯狂的狮子Li', 'sys_user', 'crazyLionLi@qq.com', '15666666666', '1', null, '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate, 103, 1, sysdate, null, null, '测试员');
  252. -- ----------------------------
  253. -- 3、岗位信息表
  254. -- ----------------------------
  255. create table sys_post (
  256. post_id number(20) not null,
  257. tenant_id varchar2(20) default '000000',
  258. post_code varchar2(64) not null,
  259. post_name varchar2(50) not null,
  260. post_sort number(4) not null,
  261. status char(1) not null,
  262. create_dept number(20) default null,
  263. create_by number(20) default null,
  264. create_time date,
  265. update_by number(20) default null,
  266. update_time date,
  267. remark varchar2(500)
  268. );
  269. alter table sys_post add constraint pk_sys_post primary key (post_id);
  270. comment on table sys_post is '岗位信息表';
  271. comment on column sys_post.post_id is '岗位ID';
  272. comment on column sys_post.tenant_id is '租户编号';
  273. comment on column sys_post.post_code is '岗位编码';
  274. comment on column sys_post.post_name is '岗位名称';
  275. comment on column sys_post.post_sort is '显示顺序';
  276. comment on column sys_post.status is '状态(0正常 1停用)';
  277. comment on column sys_post.create_dept is '创建部门';
  278. comment on column sys_post.create_by is '创建者';
  279. comment on column sys_post.create_time is '创建时间';
  280. comment on column sys_post.update_by is '更新者';
  281. comment on column sys_post.update_time is '更新时间';
  282. comment on column sys_post.remark is '备注';
  283. -- ----------------------------
  284. -- 初始化-岗位信息表数据
  285. -- ----------------------------
  286. insert into sys_post values(1, '000000', 'ceo', '董事长', 1, '0', 103, 1, sysdate, null, null, '');
  287. insert into sys_post values(2, '000000', 'se', '项目经理', 2, '0', 103, 1, sysdate, null, null, '');
  288. insert into sys_post values(3, '000000', 'hr', '人力资源', 3, '0', 103, 1, sysdate, null, null, '');
  289. insert into sys_post values(4, '000000', 'user', '普通员工', 4, '0', 103, 1, sysdate, null, null, '');
  290. -- ----------------------------
  291. -- 4、角色信息表
  292. -- ----------------------------
  293. create table sys_role (
  294. role_id number(20) not null,
  295. tenant_id varchar2(20) default '000000',
  296. role_name varchar2(30) not null,
  297. role_key varchar2(100) not null,
  298. role_sort number(4) not null,
  299. data_scope char(1) default '1',
  300. menu_check_strictly number(1) default 1,
  301. dept_check_strictly number(1) default 1,
  302. status char(1) not null,
  303. del_flag char(1) default '0',
  304. create_dept number(20) default null,
  305. create_by number(20) default null,
  306. create_time date,
  307. update_by number(20) default null,
  308. update_time date,
  309. remark varchar2(500) default null
  310. );
  311. alter table sys_role add constraint pk_sys_role primary key (role_id);
  312. comment on table sys_role is '角色信息表';
  313. comment on column sys_role.role_id is '角色ID';
  314. comment on column sys_role.tenant_id is '租户编号';
  315. comment on column sys_role.role_name is '角色名称';
  316. comment on column sys_role.role_key is '角色权限字符串';
  317. comment on column sys_role.role_sort is '显示顺序';
  318. comment on column sys_role.data_scope is '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)';
  319. comment on column sys_role.menu_check_strictly is '菜单树选择项是否关联显示';
  320. comment on column sys_role.dept_check_strictly is '部门树选择项是否关联显示';
  321. comment on column sys_role.status is '角色状态(0正常 1停用)';
  322. comment on column sys_role.del_flag is '删除标志(0代表存在 2代表删除)';
  323. comment on column sys_role.create_dept is '创建部门';
  324. comment on column sys_role.create_by is '创建者';
  325. comment on column sys_role.create_time is '创建时间';
  326. comment on column sys_role.update_by is '更新者';
  327. comment on column sys_role.update_time is '更新时间';
  328. comment on column sys_role.remark is '备注';
  329. -- ----------------------------
  330. -- 初始化-角色信息表数据
  331. -- ----------------------------
  332. insert into sys_role values('1', '000000', '超级管理员', 'superadmin', 1, 1, 1, 1, '0', '0', 103, 1, sysdate, null, null, '超级管理员');
  333. insert into sys_role values('2', '000000', '普通角色', 'common', 2, 2, 1, 1, '0', '0', 103, 1, sysdate, null, null, '普通角色');
  334. -- ----------------------------
  335. -- 5、菜单权限表
  336. -- ----------------------------
  337. create table sys_menu (
  338. menu_id number(20) not null,
  339. menu_name varchar2(50) not null,
  340. parent_id number(20) default 0,
  341. order_num number(4) default 0,
  342. path varchar2(200) default '',
  343. component varchar2(255) default null,
  344. query_param varchar2(255) default null,
  345. is_frame number(1) default 1,
  346. is_cache number(1) default 0,
  347. menu_type char(1) default '',
  348. visible char(1) default 0,
  349. status char(1) default 0,
  350. perms varchar2(100) default null,
  351. icon varchar2(100) default '#',
  352. create_dept number(20) default null,
  353. create_by number(20) default null,
  354. create_time date,
  355. update_by number(20) default null,
  356. update_time date ,
  357. remark varchar2(500) default ''
  358. );
  359. alter table sys_menu add constraint pk_sys_menu primary key (menu_id);
  360. comment on table sys_menu is '菜单权限表';
  361. comment on column sys_menu.menu_id is '菜单ID';
  362. comment on column sys_menu.menu_name is '菜单名称';
  363. comment on column sys_menu.parent_id is '父菜单ID';
  364. comment on column sys_menu.order_num is '显示顺序';
  365. comment on column sys_menu.path is '请求地址';
  366. comment on column sys_menu.component is '路由地址';
  367. comment on column sys_menu.query_param is '路由参数';
  368. comment on column sys_menu.is_frame is '是否为外链(0是 1否)';
  369. comment on column sys_menu.is_cache is '是否缓存(0缓存 1不缓存)';
  370. comment on column sys_menu.menu_type is '菜单类型(M目录 C菜单 F按钮)';
  371. comment on column sys_menu.visible is '显示状态(0显示 1隐藏)';
  372. comment on column sys_menu.status is '菜单状态(0正常 1停用)';
  373. comment on column sys_menu.perms is '权限标识';
  374. comment on column sys_menu.icon is '菜单图标';
  375. comment on column sys_menu.create_dept is '创建部门';
  376. comment on column sys_menu.create_by is '创建者';
  377. comment on column sys_menu.create_time is '创建时间';
  378. comment on column sys_menu.update_by is '更新者';
  379. comment on column sys_menu.update_time is '更新时间';
  380. comment on column sys_menu.remark is '备注';
  381. -- ----------------------------
  382. -- 初始化-菜单信息表数据
  383. -- ----------------------------
  384. -- 一级菜单
  385. insert into sys_menu values('1', '系统管理', '0', '1', 'system', null, '', 1, 0, 'M', '0', '0', '', 'system', 103, 1, sysdate, null, null, '系统管理目录');
  386. insert into sys_menu values('6', '租户管理', '0', '2', 'tenant', null, '', 1, 0, 'M', '0', '0', '', 'chart', 103, 1, sysdate, null, null, '租户管理目录');
  387. insert into sys_menu values('2', '系统监控', '0', '3', 'monitor', null, '', 1, 0, 'M', '0', '0', '', 'monitor', 103, 1, sysdate, null, null, '系统监控目录');
  388. insert into sys_menu values('3', '系统工具', '0', '4', 'tool', null, '', 1, 0, 'M', '0', '0', '', 'tool', 103, 1, sysdate, null, null, '系统工具目录');
  389. insert into sys_menu values('4', 'PLUS官网', '0', '5', 'https://gitee.com/dromara/RuoYi-Vue-Plus', null, '', 0, 0, 'M', '0', '0', '', 'guide', 103, 1, sysdate, null, null, 'RuoYi-Vue-Plus官网地址');
  390. -- 二级菜单
  391. insert into sys_menu values('100', '用户管理', '1', '1', 'user', 'system/user/index', '', 1, 0, 'C', '0', '0', 'system:user:list', 'user', 103, 1, sysdate, null, null, '用户管理菜单');
  392. insert into sys_menu values('101', '角色管理', '1', '2', 'role', 'system/role/index', '', 1, 0, 'C', '0', '0', 'system:role:list', 'peoples', 103, 1, sysdate, null, null, '角色管理菜单');
  393. insert into sys_menu values('102', '菜单管理', '1', '3', 'menu', 'system/menu/index', '', 1, 0, 'C', '0', '0', 'system:menu:list', 'tree-table', 103, 1, sysdate, null, null, '菜单管理菜单');
  394. insert into sys_menu values('103', '部门管理', '1', '4', 'dept', 'system/dept/index', '', 1, 0, 'C', '0', '0', 'system:dept:list', 'tree', 103, 1, sysdate, null, null, '部门管理菜单');
  395. insert into sys_menu values('104', '岗位管理', '1', '5', 'post', 'system/post/index', '', 1, 0, 'C', '0', '0', 'system:post:list', 'post', 103, 1, sysdate, null, null, '岗位管理菜单');
  396. insert into sys_menu values('105', '字典管理', '1', '6', 'dict', 'system/dict/index', '', 1, 0, 'C', '0', '0', 'system:dict:list', 'dict', 103, 1, sysdate, null, null, '字典管理菜单');
  397. insert into sys_menu values('106', '参数设置', '1', '7', 'config', 'system/config/index', '', 1, 0, 'C', '0', '0', 'system:config:list', 'edit', 103, 1, sysdate, null, null, '参数设置菜单');
  398. insert into sys_menu values('107', '通知公告', '1', '8', 'notice', 'system/notice/index', '', 1, 0, 'C', '0', '0', 'system:notice:list', 'message', 103, 1, sysdate, null, null, '通知公告菜单');
  399. insert into sys_menu values('108', '日志管理', '1', '9', 'log', '', '', 1, 0, 'M', '0', '0', '', 'log', 103, 1, sysdate, null, null, '日志管理菜单');
  400. insert into sys_menu values('109', '在线用户', '2', '1', 'online', 'monitor/online/index', '', 1, 0, 'C', '0', '0', 'monitor:online:list', 'online', 103, 1, sysdate, null, null, '在线用户菜单');
  401. insert into sys_menu values('113', '缓存监控', '2', '5', 'cache', 'monitor/cache/index', '', 1, 0, 'C', '0', '0', 'monitor:cache:list', 'redis', 103, 1, sysdate, null, null, '缓存监控菜单');
  402. insert into sys_menu values('114', '表单构建', '3', '1', 'build', 'tool/build/index', '', 1, 0, 'C', '0', '0', 'tool:build:list', 'build', 103, 1, sysdate, null, null, '表单构建菜单');
  403. insert into sys_menu values('115', '代码生成', '3', '2', 'gen', 'tool/gen/index', '', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code', 103, 1, sysdate, null, null, '代码生成菜单');
  404. insert into sys_menu values('121', '租户管理', '6', '1', 'tenant', 'system/tenant/index', '', 1, 0, 'C', '0', '0', 'system:tenant:list', 'list', 103, 1, sysdate, null, null, '租户管理菜单');
  405. insert into sys_menu values('122', '租户套餐管理', '6', '2', 'tenantPackage', 'system/tenantPackage/index', '', 1, 0, 'C', '0', '0', 'system:tenantPackage:list', 'form', 103, 1, sysdate, null, null, '租户套餐管理菜单');
  406. insert into sys_menu values('123', '客户端管理', '1', '11', 'client', 'system/client/index', '', 1, 0, 'C', '0', '0', 'system:client:list', 'international', 103, 1, sysdate, null, null, '客户端管理菜单');
  407. -- springboot-admin监控
  408. insert into sys_menu values('117', 'Admin监控', '2', '5', 'Admin', 'monitor/admin/index', '', 1, 0, 'C', '0', '0', 'monitor:admin:list', 'dashboard', 103, 1, sysdate, null, null, 'Admin监控菜单');
  409. -- oss菜单
  410. insert into sys_menu values('118', '文件管理', '1', '10', 'oss', 'system/oss/index', '', 1, 0, 'C', '0', '0', 'system:oss:list', 'upload', 103, 1, sysdate, null, null, '文件管理菜单');
  411. -- powerjob server控制台
  412. insert into sys_menu values('120', '任务调度中心', '2', '5', 'powerjob', 'monitor/powerjob/index', '', 1, 0, 'C', '0', '0', 'monitor:powerjob:list', 'job', 103, 1, sysdate, null, null, 'PowerJob控制台菜单');
  413. -- 三级菜单
  414. insert into sys_menu values('500', '操作日志', '108', '1', 'operlog', 'monitor/operlog/index', '', 1, 0, 'C', '0', '0', 'monitor:operlog:list', 'form', 103, 1, sysdate, null, null, '操作日志菜单');
  415. insert into sys_menu values('501', '登录日志', '108', '2', 'logininfor', 'monitor/logininfor/index', '', 1, 0, 'C', '0', '0', 'monitor:logininfor:list', 'logininfor', 103, 1, sysdate, null, null, '登录日志菜单');
  416. -- 用户管理按钮
  417. insert into sys_menu values('1001', '用户查询', '100', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:user:query', '#', 103, 1, sysdate, null, null, '');
  418. insert into sys_menu values('1002', '用户新增', '100', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:user:add', '#', 103, 1, sysdate, null, null, '');
  419. insert into sys_menu values('1003', '用户修改', '100', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:user:edit', '#', 103, 1, sysdate, null, null, '');
  420. insert into sys_menu values('1004', '用户删除', '100', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:user:remove', '#', 103, 1, sysdate, null, null, '');
  421. insert into sys_menu values('1005', '用户导出', '100', '5', '', '', '', 1, 0, 'F', '0', '0', 'system:user:export', '#', 103, 1, sysdate, null, null, '');
  422. insert into sys_menu values('1006', '用户导入', '100', '6', '', '', '', 1, 0, 'F', '0', '0', 'system:user:import', '#', 103, 1, sysdate, null, null, '');
  423. insert into sys_menu values('1007', '重置密码', '100', '7', '', '', '', 1, 0, 'F', '0', '0', 'system:user:resetPwd', '#', 103, 1, sysdate, null, null, '');
  424. -- 角色管理按钮
  425. insert into sys_menu values('1008', '角色查询', '101', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:role:query', '#', 103, 1, sysdate, null, null, '');
  426. insert into sys_menu values('1009', '角色新增', '101', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:role:add', '#', 103, 1, sysdate, null, null, '');
  427. insert into sys_menu values('1010', '角色修改', '101', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:role:edit', '#', 103, 1, sysdate, null, null, '');
  428. insert into sys_menu values('1011', '角色删除', '101', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:role:remove', '#', 103, 1, sysdate, null, null, '');
  429. insert into sys_menu values('1012', '角色导出', '101', '5', '', '', '', 1, 0, 'F', '0', '0', 'system:role:export', '#', 103, 1, sysdate, null, null, '');
  430. -- 菜单管理按钮
  431. insert into sys_menu values('1013', '菜单查询', '102', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:query', '#', 103, 1, sysdate, null, null, '');
  432. insert into sys_menu values('1014', '菜单新增', '102', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:add', '#', 103, 1, sysdate, null, null, '');
  433. insert into sys_menu values('1015', '菜单修改', '102', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:edit', '#', 103, 1, sysdate, null, null, '');
  434. insert into sys_menu values('1016', '菜单删除', '102', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:remove', '#', 103, 1, sysdate, null, null, '');
  435. -- 部门管理按钮
  436. insert into sys_menu values('1017', '部门查询', '103', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:query', '#', 103, 1, sysdate, null, null, '');
  437. insert into sys_menu values('1018', '部门新增', '103', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:add', '#', 103, 1, sysdate, null, null, '');
  438. insert into sys_menu values('1019', '部门修改', '103', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:edit', '#', 103, 1, sysdate, null, null, '');
  439. insert into sys_menu values('1020', '部门删除', '103', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:remove', '#', 103, 1, sysdate, null, null, '');
  440. -- 岗位管理按钮
  441. insert into sys_menu values('1021', '岗位查询', '104', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:post:query', '#', 103, 1, sysdate, null, null, '');
  442. insert into sys_menu values('1022', '岗位新增', '104', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:post:add', '#', 103, 1, sysdate, null, null, '');
  443. insert into sys_menu values('1023', '岗位修改', '104', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:post:edit', '#', 103, 1, sysdate, null, null, '');
  444. insert into sys_menu values('1024', '岗位删除', '104', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:post:remove', '#', 103, 1, sysdate, null, null, '');
  445. insert into sys_menu values('1025', '岗位导出', '104', '5', '', '', '', 1, 0, 'F', '0', '0', 'system:post:export', '#', 103, 1, sysdate, null, null, '');
  446. -- 字典管理按钮
  447. insert into sys_menu values('1026', '字典查询', '105', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:query', '#', 103, 1, sysdate, null, null, '');
  448. insert into sys_menu values('1027', '字典新增', '105', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:add', '#', 103, 1, sysdate, null, null, '');
  449. insert into sys_menu values('1028', '字典修改', '105', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:edit', '#', 103, 1, sysdate, null, null, '');
  450. insert into sys_menu values('1029', '字典删除', '105', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:remove', '#', 103, 1, sysdate, null, null, '');
  451. insert into sys_menu values('1030', '字典导出', '105', '5', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:export', '#', 103, 1, sysdate, null, null, '');
  452. -- 参数设置按钮
  453. insert into sys_menu values('1031', '参数查询', '106', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:query', '#', 103, 1, sysdate, null, null, '');
  454. insert into sys_menu values('1032', '参数新增', '106', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:add', '#', 103, 1, sysdate, null, null, '');
  455. insert into sys_menu values('1033', '参数修改', '106', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:edit', '#', 103, 1, sysdate, null, null, '');
  456. insert into sys_menu values('1034', '参数删除', '106', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:remove', '#', 103, 1, sysdate, null, null, '');
  457. insert into sys_menu values('1035', '参数导出', '106', '5', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:export', '#', 103, 1, sysdate, null, null, '');
  458. -- 通知公告按钮
  459. insert into sys_menu values('1036', '公告查询', '107', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:query', '#', 103, 1, sysdate, null, null, '');
  460. insert into sys_menu values('1037', '公告新增', '107', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:add', '#', 103, 1, sysdate, null, null, '');
  461. insert into sys_menu values('1038', '公告修改', '107', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:edit', '#', 103, 1, sysdate, null, null, '');
  462. insert into sys_menu values('1039', '公告删除', '107', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:remove', '#', 103, 1, sysdate, null, null, '');
  463. -- 操作日志按钮
  464. insert into sys_menu values('1040', '操作查询', '500', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:query', '#', 103, 1, sysdate, null, null, '');
  465. insert into sys_menu values('1041', '操作删除', '500', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:remove', '#', 103, 1, sysdate, null, null, '');
  466. insert into sys_menu values('1042', '日志导出', '500', '4', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:export', '#', 103, 1, sysdate, null, null, '');
  467. -- 登录日志按钮
  468. insert into sys_menu values('1043', '登录查询', '501', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:query', '#', 103, 1, sysdate, null, null, '');
  469. insert into sys_menu values('1044', '登录删除', '501', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:remove', '#', 103, 1, sysdate, null, null, '');
  470. insert into sys_menu values('1045', '日志导出', '501', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:export', '#', 103, 1, sysdate, null, null, '');
  471. insert into sys_menu values('1050', '账户解锁', '501', '4', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:unlock', '#', 103, 1, sysdate, null, null, '');
  472. -- 在线用户按钮
  473. insert into sys_menu values('1046', '在线查询', '109', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:query', '#', 103, 1, sysdate, null, null, '');
  474. insert into sys_menu values('1047', '批量强退', '109', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:batchLogout', '#', 103, 1, sysdate, null, null, '');
  475. insert into sys_menu values('1048', '单条强退', '109', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:forceLogout', '#', 103, 1, sysdate, null, null, '');
  476. -- 代码生成按钮
  477. insert into sys_menu values('1055', '生成查询', '115', '1', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:query', '#', 103, 1, sysdate, null, null, '');
  478. insert into sys_menu values('1056', '生成修改', '115', '2', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:edit', '#', 103, 1, sysdate, null, null, '');
  479. insert into sys_menu values('1057', '生成删除', '115', '3', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:remove', '#', 103, 1, sysdate, null, null, '');
  480. insert into sys_menu values('1058', '导入代码', '115', '2', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:import', '#', 103, 1, sysdate, null, null, '');
  481. insert into sys_menu values('1059', '预览代码', '115', '4', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:preview', '#', 103, 1, sysdate, null, null, '');
  482. insert into sys_menu values('1060', '生成代码', '115', '5', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:code', '#', 103, 1, sysdate, null, null, '');
  483. -- oss相关按钮
  484. insert into sys_menu values('1600', '文件查询', '118', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:oss:query', '#', 103, 1, sysdate, null, null, '');
  485. insert into sys_menu values('1601', '文件上传', '118', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:oss:upload', '#', 103, 1, sysdate, null, null, '');
  486. insert into sys_menu values('1602', '文件下载', '118', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:oss:download', '#', 103, 1, sysdate, null, null, '');
  487. insert into sys_menu values('1603', '文件删除', '118', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:oss:remove', '#', 103, 1, sysdate, null, null, '');
  488. insert into sys_menu values('1620', '配置列表', '118', '5', '#', '', '', 1, 0, 'F', '0', '0', 'system:ossConfig:list', '#', 103, 1, sysdate, null, null, '');
  489. insert into sys_menu values('1621', '配置添加', '118', '6', '#', '', '', 1, 0, 'F', '0', '0', 'system:ossConfig:add', '#', 103, 1, sysdate, null, null, '');
  490. insert into sys_menu values('1622', '配置编辑', '118', '6', '#', '', '', 1, 0, 'F', '0', '0', 'system:ossConfig:edit', '#', 103, 1, sysdate, null, null, '');
  491. insert into sys_menu values('1623', '配置删除', '118', '6', '#', '', '', 1, 0, 'F', '0', '0', 'system:ossConfig:remove', '#', 103, 1, sysdate, null, null, '');
  492. -- 租户管理相关按钮
  493. insert into sys_menu values('1606', '租户查询', '121', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenant:query', '#', 103, 1, sysdate, null, null, '');
  494. insert into sys_menu values('1607', '租户新增', '121', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenant:add', '#', 103, 1, sysdate, null, null, '');
  495. insert into sys_menu values('1608', '租户修改', '121', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenant:edit', '#', 103, 1, sysdate, null, null, '');
  496. insert into sys_menu values('1609', '租户删除', '121', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenant:remove', '#', 103, 1, sysdate, null, null, '');
  497. insert into sys_menu values('1610', '租户导出', '121', '5', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenant:export', '#', 103, 1, sysdate, null, null, '');
  498. -- 租户套餐管理相关按钮
  499. insert into sys_menu values('1611', '租户套餐查询', '122', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenantPackage:query', '#', 103, 1, sysdate, null, null, '');
  500. insert into sys_menu values('1612', '租户套餐新增', '122', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenantPackage:add', '#', 103, 1, sysdate, null, null, '');
  501. insert into sys_menu values('1613', '租户套餐修改', '122', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenantPackage:edit', '#', 103, 1, sysdate, null, null, '');
  502. insert into sys_menu values('1614', '租户套餐删除', '122', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenantPackage:remove', '#', 103, 1, sysdate, null, null, '');
  503. insert into sys_menu values('1615', '租户套餐导出', '122', '5', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenantPackage:export', '#', 103, 1, sysdate, null, null, '');
  504. -- 客户端管理按钮
  505. insert into sys_menu values('1061', '客户端管理查询', '123', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:client:query', '#', 103, 1, sysdate, null, null, '');
  506. insert into sys_menu values('1062', '客户端管理新增', '123', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:client:add', '#', 103, 1, sysdate, null, null, '');
  507. insert into sys_menu values('1063', '客户端管理修改', '123', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:client:edit', '#', 103, 1, sysdate, null, null, '');
  508. insert into sys_menu values('1064', '客户端管理删除', '123', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:client:remove', '#', 103, 1, sysdate, null, null, '');
  509. insert into sys_menu values('1065', '客户端管理导出', '123', '5', '#', '', '', 1, 0, 'F', '0', '0', 'system:client:export', '#', 103, 1, sysdate, null, null, '');
  510. -- ----------------------------
  511. -- 6、用户和角色关联表 用户N-1角色
  512. -- ----------------------------
  513. create table sys_user_role (
  514. user_id number(20) not null,
  515. role_id number(20) not null
  516. );
  517. alter table sys_user_role add constraint pk_sys_user_role primary key (user_id, role_id);
  518. comment on table sys_user_role is '用户和角色关联表';
  519. comment on column sys_user_role.user_id is '用户ID';
  520. comment on column sys_user_role.role_id is '角色ID';
  521. -- ----------------------------
  522. -- 初始化-用户和角色关联表数据
  523. -- ----------------------------
  524. insert into sys_user_role values ('1', '1');
  525. insert into sys_user_role values ('2', '2');
  526. -- ----------------------------
  527. -- 7、角色和菜单关联表 角色1-N菜单
  528. -- ----------------------------
  529. create table sys_role_menu (
  530. role_id number(20) not null,
  531. menu_id number(20) not null
  532. );
  533. alter table sys_role_menu add constraint pk_sys_role_menu primary key (role_id, menu_id);
  534. comment on table sys_role_menu is '角色和菜单关联表';
  535. comment on column sys_role_menu.role_id is '角色ID';
  536. comment on column sys_role_menu.menu_id is '菜单ID';
  537. -- ----------------------------
  538. -- 初始化-角色和菜单关联表数据
  539. -- ----------------------------
  540. insert into sys_role_menu values ('2', '1');
  541. insert into sys_role_menu values ('2', '2');
  542. insert into sys_role_menu values ('2', '3');
  543. insert into sys_role_menu values ('2', '4');
  544. insert into sys_role_menu values ('2', '100');
  545. insert into sys_role_menu values ('2', '101');
  546. insert into sys_role_menu values ('2', '102');
  547. insert into sys_role_menu values ('2', '103');
  548. insert into sys_role_menu values ('2', '104');
  549. insert into sys_role_menu values ('2', '105');
  550. insert into sys_role_menu values ('2', '106');
  551. insert into sys_role_menu values ('2', '107');
  552. insert into sys_role_menu values ('2', '108');
  553. insert into sys_role_menu values ('2', '109');
  554. insert into sys_role_menu values ('2', '110');
  555. insert into sys_role_menu values ('2', '111');
  556. insert into sys_role_menu values ('2', '112');
  557. insert into sys_role_menu values ('2', '113');
  558. insert into sys_role_menu values ('2', '114');
  559. insert into sys_role_menu values ('2', '115');
  560. insert into sys_role_menu values ('2', '116');
  561. insert into sys_role_menu values ('2', '500');
  562. insert into sys_role_menu values ('2', '501');
  563. insert into sys_role_menu values ('2', '1000');
  564. insert into sys_role_menu values ('2', '1001');
  565. insert into sys_role_menu values ('2', '1002');
  566. insert into sys_role_menu values ('2', '1003');
  567. insert into sys_role_menu values ('2', '1004');
  568. insert into sys_role_menu values ('2', '1005');
  569. insert into sys_role_menu values ('2', '1006');
  570. insert into sys_role_menu values ('2', '1007');
  571. insert into sys_role_menu values ('2', '1008');
  572. insert into sys_role_menu values ('2', '1009');
  573. insert into sys_role_menu values ('2', '1010');
  574. insert into sys_role_menu values ('2', '1011');
  575. insert into sys_role_menu values ('2', '1012');
  576. insert into sys_role_menu values ('2', '1013');
  577. insert into sys_role_menu values ('2', '1014');
  578. insert into sys_role_menu values ('2', '1015');
  579. insert into sys_role_menu values ('2', '1016');
  580. insert into sys_role_menu values ('2', '1017');
  581. insert into sys_role_menu values ('2', '1018');
  582. insert into sys_role_menu values ('2', '1019');
  583. insert into sys_role_menu values ('2', '1020');
  584. insert into sys_role_menu values ('2', '1021');
  585. insert into sys_role_menu values ('2', '1022');
  586. insert into sys_role_menu values ('2', '1023');
  587. insert into sys_role_menu values ('2', '1024');
  588. insert into sys_role_menu values ('2', '1025');
  589. insert into sys_role_menu values ('2', '1026');
  590. insert into sys_role_menu values ('2', '1027');
  591. insert into sys_role_menu values ('2', '1028');
  592. insert into sys_role_menu values ('2', '1029');
  593. insert into sys_role_menu values ('2', '1030');
  594. insert into sys_role_menu values ('2', '1031');
  595. insert into sys_role_menu values ('2', '1032');
  596. insert into sys_role_menu values ('2', '1033');
  597. insert into sys_role_menu values ('2', '1034');
  598. insert into sys_role_menu values ('2', '1035');
  599. insert into sys_role_menu values ('2', '1036');
  600. insert into sys_role_menu values ('2', '1037');
  601. insert into sys_role_menu values ('2', '1038');
  602. insert into sys_role_menu values ('2', '1039');
  603. insert into sys_role_menu values ('2', '1040');
  604. insert into sys_role_menu values ('2', '1041');
  605. insert into sys_role_menu values ('2', '1042');
  606. insert into sys_role_menu values ('2', '1043');
  607. insert into sys_role_menu values ('2', '1044');
  608. insert into sys_role_menu values ('2', '1045');
  609. insert into sys_role_menu values ('2', '1050');
  610. insert into sys_role_menu values ('2', '1046');
  611. insert into sys_role_menu values ('2', '1047');
  612. insert into sys_role_menu values ('2', '1048');
  613. insert into sys_role_menu values ('2', '1055');
  614. insert into sys_role_menu values ('2', '1056');
  615. insert into sys_role_menu values ('2', '1057');
  616. insert into sys_role_menu values ('2', '1058');
  617. insert into sys_role_menu values ('2', '1059');
  618. insert into sys_role_menu values ('2', '1060');
  619. insert into sys_role_menu values ('2', '1061');
  620. insert into sys_role_menu values ('2', '1062');
  621. insert into sys_role_menu values ('2', '1063');
  622. insert into sys_role_menu values ('2', '1064');
  623. insert into sys_role_menu values ('2', '1065');
  624. -- ----------------------------
  625. -- 8、角色和部门关联表 角色1-N部门
  626. -- ----------------------------
  627. create table sys_role_dept (
  628. role_id number(20) not null,
  629. dept_id number(20) not null
  630. );
  631. alter table sys_role_dept add constraint pk_sys_role_dept primary key (role_id, dept_id);
  632. comment on table sys_role_dept is '角色和部门关联表';
  633. comment on column sys_role_dept.role_id is '角色ID';
  634. comment on column sys_role_dept.dept_id is '部门ID';
  635. -- ----------------------------
  636. -- 初始化-角色和部门关联表数据
  637. -- ----------------------------
  638. insert into sys_role_dept values ('2', '100');
  639. insert into sys_role_dept values ('2', '101');
  640. insert into sys_role_dept values ('2', '105');
  641. -- ----------------------------
  642. -- 9、用户与岗位关联表 用户1-N岗位
  643. -- ----------------------------
  644. create table sys_user_post (
  645. user_id number(20) not null,
  646. post_id number(20) not null
  647. );
  648. alter table sys_user_post add constraint pk_sys_user_post primary key (user_id, post_id);
  649. comment on table sys_user_post is '用户与岗位关联表';
  650. comment on column sys_user_post.user_id is '用户ID';
  651. comment on column sys_user_post.post_id is '岗位ID';
  652. -- ----------------------------
  653. -- 初始化-用户与岗位关联表数据
  654. -- ----------------------------
  655. insert into sys_user_post values ('1', '1');
  656. insert into sys_user_post values ('2', '2');
  657. -- ----------------------------
  658. -- 10、操作日志记录
  659. -- ----------------------------
  660. create table sys_oper_log (
  661. oper_id number(20) not null,
  662. tenant_id varchar2(20) default '000000',
  663. title varchar2(50) default '',
  664. business_type number(2) default 0,
  665. method varchar2(100) default '',
  666. request_method varchar2(10) default '',
  667. operator_type number(1) default 0,
  668. oper_name varchar2(50) default '',
  669. dept_name varchar2(50) default '',
  670. oper_url varchar2(255) default '',
  671. oper_ip varchar2(128) default '',
  672. oper_location varchar2(255) default '',
  673. oper_param varchar2(2100) default '',
  674. json_result varchar2(2100) default '',
  675. status number(1) default 0,
  676. error_msg varchar2(2100) default '',
  677. oper_time date,
  678. cost_time number(20) default 0
  679. );
  680. alter table sys_oper_log add constraint pk_sys_oper_log primary key (oper_id);
  681. create index idx_sys_oper_log_bt on sys_oper_log (business_type);
  682. create index idx_sys_oper_log_s on sys_oper_log (status);
  683. create index idx_sys_oper_log_ot on sys_oper_log (oper_time);
  684. comment on table sys_oper_log is '操作日志记录';
  685. comment on column sys_oper_log.oper_id is '日志主键';
  686. comment on column sys_oper_log.tenant_id is '租户编号';
  687. comment on column sys_oper_log.title is '模块标题';
  688. comment on column sys_oper_log.business_type is '业务类型(0其它 1新增 2修改 3删除)';
  689. comment on column sys_oper_log.method is '方法名称';
  690. comment on column sys_oper_log.request_method is '请求方式';
  691. comment on column sys_oper_log.operator_type is '操作类别(0其它 1后台用户 2手机端用户)';
  692. comment on column sys_oper_log.oper_name is '操作人员';
  693. comment on column sys_oper_log.dept_name is '部门名称';
  694. comment on column sys_oper_log.oper_url is '请求URL';
  695. comment on column sys_oper_log.oper_ip is '主机地址';
  696. comment on column sys_oper_log.oper_location is '操作地点';
  697. comment on column sys_oper_log.oper_param is '请求参数';
  698. comment on column sys_oper_log.json_result is '返回参数';
  699. comment on column sys_oper_log.status is '操作状态(0正常 1异常)';
  700. comment on column sys_oper_log.error_msg is '错误消息';
  701. comment on column sys_oper_log.oper_time is '操作时间';
  702. comment on column sys_oper_log.cost_time is '消耗时间';
  703. -- ----------------------------
  704. -- 11、字典类型表
  705. -- ----------------------------
  706. create table sys_dict_type (
  707. dict_id number(20) not null,
  708. tenant_id varchar2(20) default '000000',
  709. dict_name varchar2(100) default '',
  710. dict_type varchar2(100) default '',
  711. create_dept number(20) default null,
  712. create_by number(20) default null,
  713. create_time date,
  714. update_by number(20) default null,
  715. update_time date,
  716. remark varchar2(500) default null
  717. );
  718. alter table sys_dict_type add constraint pk_sys_dict_type primary key (dict_id);
  719. create unique index sys_dict_type_index1 on sys_dict_type (tenant_id, dict_type);
  720. comment on table sys_dict_type is '字典类型表';
  721. comment on column sys_dict_type.dict_id is '字典主键';
  722. comment on column sys_dict_type.tenant_id is '租户编号';
  723. comment on column sys_dict_type.dict_name is '字典名称';
  724. comment on column sys_dict_type.dict_type is '字典类型';
  725. comment on column sys_dict_type.create_dept is '创建部门';
  726. comment on column sys_dict_type.create_by is '创建者';
  727. comment on column sys_dict_type.create_time is '创建时间';
  728. comment on column sys_dict_type.update_by is '更新者';
  729. comment on column sys_dict_type.update_time is '更新时间';
  730. comment on column sys_dict_type.remark is '备注';
  731. insert into sys_dict_type values(1, '000000', '用户性别', 'sys_user_sex', 103, 1, sysdate, null, null, '用户性别列表');
  732. insert into sys_dict_type values(2, '000000', '菜单状态', 'sys_show_hide', 103, 1, sysdate, null, null, '菜单状态列表');
  733. insert into sys_dict_type values(3, '000000', '系统开关', 'sys_normal_disable', 103, 1, sysdate, null, null, '系统开关列表');
  734. insert into sys_dict_type values(6, '000000', '系统是否', 'sys_yes_no', 103, 1, sysdate, null, null, '系统是否列表');
  735. insert into sys_dict_type values(7, '000000', '通知类型', 'sys_notice_type', 103, 1, sysdate, null, null, '通知类型列表');
  736. insert into sys_dict_type values(8, '000000', '通知状态', 'sys_notice_status', 103, 1, sysdate, null, null, '通知状态列表');
  737. insert into sys_dict_type values(9, '000000', '操作类型', 'sys_oper_type', 103, 1, sysdate, null, null, '操作类型列表');
  738. insert into sys_dict_type values(10, '000000', '系统状态', 'sys_common_status', 103, 1, sysdate, null, null, '登录状态列表');
  739. insert into sys_dict_type values(11, '000000', '授权类型', 'sys_grant_type', 103, 1, sysdate, null, null, '认证授权类型');
  740. insert into sys_dict_type values(12, '000000', '设备类型', 'sys_device_type', 103, 1, sysdate, null, null, '客户端设备类型');
  741. -- ----------------------------
  742. -- 12、字典数据表
  743. -- ----------------------------
  744. create table sys_dict_data (
  745. dict_code number(20) not null,
  746. tenant_id varchar2(20) default '000000',
  747. dict_sort number(4) default 0,
  748. dict_label varchar2(100) default '',
  749. dict_value varchar2(100) default '',
  750. dict_type varchar2(100) default '',
  751. css_class varchar2(100) default null,
  752. list_class varchar2(100) default null,
  753. is_default char(1) default 'N',
  754. create_dept number(20) default null,
  755. create_by number(20) default null,
  756. create_time date,
  757. update_by number(20) default null,
  758. update_time date,
  759. remark varchar2(500) default null
  760. );
  761. alter table sys_dict_data add constraint pk_sys_dict_data primary key (dict_code);
  762. comment on table sys_dict_data is '字典数据表';
  763. comment on column sys_dict_data.dict_code is '字典主键';
  764. comment on column sys_dict_data.tenant_id is '租户编号';
  765. comment on column sys_dict_data.dict_sort is '字典排序';
  766. comment on column sys_dict_data.dict_label is '字典标签';
  767. comment on column sys_dict_data.dict_value is '字典键值';
  768. comment on column sys_dict_data.dict_type is '字典类型';
  769. comment on column sys_dict_data.css_class is '样式属性(其他样式扩展)';
  770. comment on column sys_dict_data.list_class is '表格回显样式';
  771. comment on column sys_dict_data.is_default is '是否默认(Y是 N否)';
  772. comment on column sys_dict_data.create_dept is '创建部门';
  773. comment on column sys_dict_data.create_by is '创建者';
  774. comment on column sys_dict_data.create_time is '创建时间';
  775. comment on column sys_dict_data.update_by is '更新者';
  776. comment on column sys_dict_data.update_time is '更新时间';
  777. comment on column sys_dict_data.remark is '备注';
  778. insert into sys_dict_data values(1, '000000', 1, '男', '0', 'sys_user_sex', '', '', 'Y', 103, 1, sysdate, null, null, '性别男');
  779. insert into sys_dict_data values(2, '000000', 2, '女', '1', 'sys_user_sex', '', '', 'N', 103, 1, sysdate, null, null, '性别女');
  780. insert into sys_dict_data values(3, '000000', 3, '未知', '2', 'sys_user_sex', '', '', 'N', 103, 1, sysdate, null, null, '性别未知');
  781. insert into sys_dict_data values(4, '000000', 1, '显示', '0', 'sys_show_hide', '', 'primary', 'Y', 103, 1, sysdate, null, null, '显示菜单');
  782. insert into sys_dict_data values(5, '000000', 2, '隐藏', '1', 'sys_show_hide', '', 'danger', 'N', 103, 1, sysdate, null, null, '隐藏菜单');
  783. insert into sys_dict_data values(6, '000000', 1, '正常', '0', 'sys_normal_disable', '', 'primary', 'Y', 103, 1, sysdate, null, null, '正常状态');
  784. insert into sys_dict_data values(7, '000000', 2, '停用', '1', 'sys_normal_disable', '', 'danger', 'N', 103, 1, sysdate, null, null, '停用状态');
  785. insert into sys_dict_data values(12, '000000', 1, '是', 'Y', 'sys_yes_no', '', 'primary', 'Y', 103, 1, sysdate, null, null, '系统默认是');
  786. insert into sys_dict_data values(13, '000000', 2, '否', 'N', 'sys_yes_no', '', 'danger', 'N', 103, 1, sysdate, null, null, '系统默认否');
  787. insert into sys_dict_data values(14, '000000', 1, '通知', '1', 'sys_notice_type', '', 'warning', 'Y', 103, 1, sysdate, null, null, '通知');
  788. insert into sys_dict_data values(15, '000000', 2, '公告', '2', 'sys_notice_type', '', 'success', 'N', 103, 1, sysdate, null, null, '公告');
  789. insert into sys_dict_data values(16, '000000', 1, '正常', '0', 'sys_notice_status', '', 'primary', 'Y', 103, 1, sysdate, null, null, '正常状态');
  790. insert into sys_dict_data values(17, '000000', 2, '关闭', '1', 'sys_notice_status', '', 'danger', 'N', 103, 1, sysdate, null, null, '关闭状态');
  791. insert into sys_dict_data values(29, '000000', 99, '其他', '0', 'sys_oper_type', '', 'info', 'N', 103, 1, sysdate, null, null, '其他操作');
  792. insert into sys_dict_data values(18, '000000', 1, '新增', '1', 'sys_oper_type', '', 'info', 'N', 103, 1, sysdate, null, null, '新增操作');
  793. insert into sys_dict_data values(19, '000000', 2, '修改', '2', 'sys_oper_type', '', 'info', 'N', 103, 1, sysdate, null, null, '修改操作');
  794. insert into sys_dict_data values(20, '000000', 3, '删除', '3', 'sys_oper_type', '', 'danger', 'N', 103, 1, sysdate, null, null, '删除操作');
  795. insert into sys_dict_data values(21, '000000', 4, '授权', '4', 'sys_oper_type', '', 'primary', 'N', 103, 1, sysdate, null, null, '授权操作');
  796. insert into sys_dict_data values(22, '000000', 5, '导出', '5', 'sys_oper_type', '', 'warning', 'N', 103, 1, sysdate, null, null, '导出操作');
  797. insert into sys_dict_data values(23, '000000', 6, '导入', '6', 'sys_oper_type', '', 'warning', 'N', 103, 1, sysdate, null, null, '导入操作');
  798. insert into sys_dict_data values(24, '000000', 7, '强退', '7', 'sys_oper_type', '', 'danger', 'N', 103, 1, sysdate, null, null, '强退操作');
  799. insert into sys_dict_data values(25, '000000', 8, '生成代码', '8', 'sys_oper_type', '', 'warning', 'N', 103, 1, sysdate, null, null, '生成操作');
  800. insert into sys_dict_data values(26, '000000', 9, '清空数据', '9', 'sys_oper_type', '', 'danger', 'N', 103, 1, sysdate, null, null, '清空操作');
  801. insert into sys_dict_data values(27, '000000', 1, '成功', '0', 'sys_common_status', '', 'primary', 'N', 103, 1, sysdate, null, null, '正常状态');
  802. insert into sys_dict_data values(28, '000000', 2, '失败', '1', 'sys_common_status', '', 'danger', 'N', 103, 1, sysdate, null, null, '停用状态');
  803. insert into sys_dict_data values(30, '000000', 0, '密码认证', 'password', 'sys_grant_type', '', 'default', 'N', 103, 1, sysdate, null, null, '密码认证');
  804. insert into sys_dict_data values(31, '000000', 0, '短信认证', 'sms', 'sys_grant_type', '', 'default', 'N', 103, 1, sysdate, null, null, '短信认证');
  805. insert into sys_dict_data values(32, '000000', 0, '邮件认证', 'email', 'sys_grant_type', '', 'default', 'N', 103, 1, sysdate, null, null, '邮件认证');
  806. insert into sys_dict_data values(33, '000000', 0, '小程序认证', 'xcx', 'sys_grant_type', '', 'default', 'N', 103, 1, sysdate, null, null, '小程序认证');
  807. insert into sys_dict_data values(34, '000000', 0, '三方登录认证', 'social', 'sys_grant_type', '', 'default', 'N', 103, 1, sysdate, null, null, '三方登录认证');
  808. insert into sys_dict_data values(35, '000000', 0, 'PC', 'pc', 'sys_device_type', '', 'default', 'N', 103, 1, sysdate, null, null, 'PC');
  809. insert into sys_dict_data values(36, '000000', 0, '安卓', 'android', 'sys_device_type', '', 'default', 'N', 103, 1, sysdate, null, null, '安卓');
  810. insert into sys_dict_data values(37, '000000', 0, 'iOS', 'ios', 'sys_device_type', '', 'default', 'N', 103, 1, sysdate, null, null, 'iOS');
  811. insert into sys_dict_data values(38, '000000', 0, '小程序', 'xcx', 'sys_device_type', '', 'default', 'N', 103, 1, sysdate, null, null, '小程序');
  812. -- ----------------------------
  813. -- 13、参数配置表
  814. -- ----------------------------
  815. create table sys_config (
  816. config_id number(20) not null,
  817. tenant_id varchar2(20) default '000000',
  818. config_name varchar2(100) default '',
  819. config_key varchar2(100) default '',
  820. config_value varchar2(100) default '',
  821. config_type char(1) default 'N',
  822. create_dept number(20) default null,
  823. create_by number(20) default null,
  824. create_time date,
  825. update_by number(20) default null,
  826. update_time date,
  827. remark varchar2(500) default null
  828. );
  829. alter table sys_config add constraint pk_sys_config primary key (config_id);
  830. comment on table sys_config is '参数配置表';
  831. comment on column sys_config.config_id is '参数主键';
  832. comment on column sys_config.tenant_id is '租户编号';
  833. comment on column sys_config.config_name is '参数名称';
  834. comment on column sys_config.config_key is '参数键名';
  835. comment on column sys_config.config_value is '参数键值';
  836. comment on column sys_config.config_type is '系统内置(Y是 N否)';
  837. comment on column sys_config.create_dept is '创建部门';
  838. comment on column sys_config.create_by is '创建者';
  839. comment on column sys_config.create_time is '创建时间';
  840. comment on column sys_config.update_by is '更新者';
  841. comment on column sys_config.update_time is '更新时间';
  842. comment on column sys_config.remark is '备注';
  843. insert into sys_config values(1, '000000', '主框架页-默认皮肤样式名称', 'sys.index.skinName', 'skin-blue', 'Y', 103, 1, sysdate, null, null, '蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow' );
  844. insert into sys_config values(2, '000000', '用户管理-账号初始密码', 'sys.user.initPassword', '123456', 'Y', 103, 1, sysdate, null, null, '初始化密码 123456' );
  845. insert into sys_config values(3, '000000', '主框架页-侧边栏主题', 'sys.index.sideTheme', 'theme-dark', 'Y', 103, 1, sysdate, null, null, '深色主题theme-dark,浅色主题theme-light' );
  846. insert into sys_config values(5, '000000', '账号自助-是否开启用户注册功能', 'sys.account.registerUser', 'false', 'Y', 103, 1, sysdate, null, null, '是否开启注册用户功能(true开启,false关闭)');
  847. insert into sys_config values(11, '000000', 'OSS预览列表资源开关', 'sys.oss.previewListResource', 'true', 'Y', 103, 1, sysdate, null, null, 'true:开启, false:关闭');
  848. -- ----------------------------
  849. -- 14、系统访问记录
  850. -- ----------------------------
  851. create table sys_logininfor (
  852. info_id number(20) not null,
  853. tenant_id varchar2(20) default '000000',
  854. user_name varchar2(50) default '',
  855. client_key varchar2(32) default '',
  856. device_type varchar2(32) default '',
  857. ipaddr varchar2(128) default '',
  858. login_location varchar2(255) default '',
  859. browser varchar2(50) default '',
  860. os varchar2(50) default '',
  861. status char(1) default '0',
  862. msg varchar2(255) default '',
  863. login_time date
  864. );
  865. alter table sys_logininfor add constraint pk_sys_logininfor primary key (info_id);
  866. create index idx_sys_logininfor_s on sys_logininfor (status);
  867. create index idx_sys_logininfor_lt on sys_logininfor (login_time);
  868. comment on table sys_logininfor is '系统访问记录';
  869. comment on column sys_logininfor.info_id is '访问ID';
  870. comment on column sys_logininfor.tenant_id is '租户编号';
  871. comment on column sys_logininfor.user_name is '登录账号';
  872. comment on column sys_logininfor.client_key is '客户端';
  873. comment on column sys_logininfor.device_type is '设备类型';
  874. comment on column sys_logininfor.ipaddr is '登录IP地址';
  875. comment on column sys_logininfor.login_location is '登录地点';
  876. comment on column sys_logininfor.browser is '浏览器类型';
  877. comment on column sys_logininfor.os is '操作系统';
  878. comment on column sys_logininfor.status is '登录状态(0成功 1失败)';
  879. comment on column sys_logininfor.msg is '提示消息';
  880. comment on column sys_logininfor.login_time is '访问时间';
  881. -- ----------------------------
  882. -- 17、通知公告表
  883. -- ----------------------------
  884. create table sys_notice (
  885. notice_id number(20) not null,
  886. tenant_id varchar2(20) default '000000',
  887. notice_title varchar2(50) not null,
  888. notice_type char(1) not null,
  889. notice_content clob default null,
  890. status char(1) default '0',
  891. create_dept number(20) default null,
  892. create_by number(20) default null,
  893. create_time date,
  894. update_by number(20) default null,
  895. update_time date,
  896. remark varchar2(255) default null
  897. );
  898. alter table sys_notice add constraint pk_sys_notice primary key (notice_id);
  899. comment on table sys_notice is '通知公告表';
  900. comment on column sys_notice.notice_id is '公告主键';
  901. comment on column sys_notice.tenant_id is '租户编号';
  902. comment on column sys_notice.notice_title is '公告标题';
  903. comment on column sys_notice.notice_type is '公告类型(1通知 2公告)';
  904. comment on column sys_notice.notice_content is '公告内容';
  905. comment on column sys_notice.status is '公告状态(0正常 1关闭)';
  906. comment on column sys_notice.create_dept is '创建部门';
  907. comment on column sys_notice.create_by is '创建者';
  908. comment on column sys_notice.create_time is '创建时间';
  909. comment on column sys_notice.update_by is '更新者';
  910. comment on column sys_notice.update_time is '更新时间';
  911. comment on column sys_notice.remark is '备注';
  912. -- ----------------------------
  913. -- 初始化-公告信息表数据
  914. -- ----------------------------
  915. insert into sys_notice values('1', '000000', '温馨提醒:2018-07-01 新版本发布啦', '2', '新版本内容', '0', 103, 1, sysdate, null, null, '管理员');
  916. insert into sys_notice values('2', '000000', '维护通知:2018-07-01 系统凌晨维护', '1', '维护内容', '0', 103, 1, sysdate, null, null, '管理员');
  917. -- ----------------------------
  918. -- 18、代码生成业务表
  919. -- ----------------------------
  920. create table gen_table (
  921. table_id number(20) not null,
  922. data_name varchar2(200) default '',
  923. table_name varchar2(200) default '',
  924. table_comment varchar2(500) default '',
  925. sub_table_name varchar2(64) default null,
  926. sub_table_fk_name varchar2(64) default null,
  927. class_name varchar2(100) default '',
  928. tpl_category varchar2(200) default 'crud',
  929. package_name varchar2(100),
  930. module_name varchar2(30),
  931. business_name varchar2(30),
  932. function_name varchar2(50),
  933. function_author varchar2(50),
  934. gen_type char(1) default '0',
  935. gen_path varchar2(200) default '/',
  936. options varchar2(1000),
  937. create_dept number(20) default null,
  938. create_by number(20) default null,
  939. create_time date,
  940. update_by number(20) default null,
  941. update_time date,
  942. remark varchar2(500) default null
  943. );
  944. alter table gen_table add constraint pk_gen_table primary key (table_id);
  945. comment on table gen_table is '代码生成业务表';
  946. comment on column gen_table.table_id is '编号';
  947. comment on column gen_table.data_name is '数据源名称';
  948. comment on column gen_table.table_name is '表名称';
  949. comment on column gen_table.table_comment is '表描述';
  950. comment on column gen_table.sub_table_name is '关联子表的表名';
  951. comment on column gen_table.sub_table_fk_name is '子表关联的外键名';
  952. comment on column gen_table.class_name is '实体类名称';
  953. comment on column gen_table.tpl_category is '使用的模板(crud单表操作 tree树表操作)';
  954. comment on column gen_table.package_name is '生成包路径';
  955. comment on column gen_table.module_name is '生成模块名';
  956. comment on column gen_table.business_name is '生成业务名';
  957. comment on column gen_table.function_name is '生成功能名';
  958. comment on column gen_table.function_author is '生成功能作者';
  959. comment on column gen_table.gen_type is '生成代码方式(0zip压缩包 1自定义路径)';
  960. comment on column gen_table.gen_path is '生成路径(不填默认项目路径)';
  961. comment on column gen_table.options is '其它生成选项';
  962. comment on column gen_table.create_dept is '创建部门';
  963. comment on column gen_table.create_by is '创建者';
  964. comment on column gen_table.create_time is '创建时间';
  965. comment on column gen_table.update_by is '更新者';
  966. comment on column gen_table.update_time is '更新时间';
  967. comment on column gen_table.remark is '备注';
  968. -- ----------------------------
  969. -- 19、代码生成业务表字段
  970. -- ----------------------------
  971. create table gen_table_column (
  972. column_id number(20) not null,
  973. table_id number(20),
  974. column_name varchar2(200),
  975. column_comment varchar2(500),
  976. column_type varchar2(100),
  977. java_type varchar2(500),
  978. java_field varchar2(200),
  979. is_pk char(1),
  980. is_increment char(1),
  981. is_required char(1),
  982. is_insert char(1),
  983. is_edit char(1),
  984. is_list char(1),
  985. is_query char(1),
  986. query_type varchar2(200) default 'EQ',
  987. html_type varchar2(200),
  988. dict_type varchar2(200) default '',
  989. sort number(4),
  990. create_dept number(20) default null,
  991. create_by number(20) default null,
  992. create_time date ,
  993. update_by number(20) default null,
  994. update_time date
  995. );
  996. alter table gen_table_column add constraint pk_gen_table_column primary key (column_id);
  997. comment on table gen_table_column is '代码生成业务表字段';
  998. comment on column gen_table_column.column_id is '编号';
  999. comment on column gen_table_column.table_id is '归属表编号';
  1000. comment on column gen_table_column.column_name is '列名称';
  1001. comment on column gen_table_column.column_comment is '列描述';
  1002. comment on column gen_table_column.column_type is '列类型';
  1003. comment on column gen_table_column.java_type is 'JAVA类型';
  1004. comment on column gen_table_column.java_field is 'JAVA字段名';
  1005. comment on column gen_table_column.is_pk is '是否主键(1是)';
  1006. comment on column gen_table_column.is_increment is '是否自增(1是)';
  1007. comment on column gen_table_column.is_required is '是否必填(1是)';
  1008. comment on column gen_table_column.is_insert is '是否为插入字段(1是)';
  1009. comment on column gen_table_column.is_edit is '是否编辑字段(1是)';
  1010. comment on column gen_table_column.is_list is '是否列表字段(1是)';
  1011. comment on column gen_table_column.is_query is '是否查询字段(1是)';
  1012. comment on column gen_table_column.query_type is '查询方式(等于、不等于、大于、小于、范围)';
  1013. comment on column gen_table_column.html_type is '显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)';
  1014. comment on column gen_table_column.dict_type is '字典类型';
  1015. comment on column gen_table_column.sort is '排序';
  1016. comment on column gen_table_column.create_dept is '创建部门';
  1017. comment on column gen_table_column.create_by is '创建者';
  1018. comment on column gen_table_column.create_time is '创建时间';
  1019. comment on column gen_table_column.update_by is '更新者';
  1020. comment on column gen_table_column.update_time is '更新时间';
  1021. -- ----------------------------
  1022. -- OSS对象存储表
  1023. -- ----------------------------
  1024. create table sys_oss (
  1025. oss_id number(20) not null,
  1026. tenant_id varchar2(20) default '000000',
  1027. file_name varchar2(255) not null,
  1028. original_name varchar2(255) not null,
  1029. file_suffix varchar2(10) not null,
  1030. url varchar2(500) not null,
  1031. service varchar2(20) default 'minio' not null,
  1032. create_dept number(20) default null,
  1033. create_by number(20) default null,
  1034. create_time date,
  1035. update_by number(20) default null,
  1036. update_time date
  1037. );
  1038. alter table sys_oss add constraint pk_sys_oss primary key (oss_id);
  1039. comment on table sys_oss is 'OSS对象存储表';
  1040. comment on column sys_oss.oss_id is '对象存储主键';
  1041. comment on column sys_oss.tenant_id is '租户编码';
  1042. comment on column sys_oss.file_name is '文件名';
  1043. comment on column sys_oss.original_name is '原名';
  1044. comment on column sys_oss.file_suffix is '文件后缀名';
  1045. comment on column sys_oss.url is 'URL地址';
  1046. comment on column sys_oss.service is '服务商';
  1047. comment on column sys_oss.create_dept is '创建部门';
  1048. comment on column sys_oss.create_time is '创建时间';
  1049. comment on column sys_oss.create_by is '上传者';
  1050. comment on column sys_oss.update_time is '更新时间';
  1051. comment on column sys_oss.update_by is '更新者';
  1052. -- ----------------------------
  1053. -- OSS对象存储动态配置表
  1054. -- ----------------------------
  1055. create table sys_oss_config (
  1056. oss_config_id number(20) not null,
  1057. tenant_id varchar2(20) default '000000',
  1058. config_key varchar2(20) not null,
  1059. access_key varchar2(255) default '',
  1060. secret_key varchar2(255) default '',
  1061. bucket_name varchar2(255) default '',
  1062. prefix varchar2(255) default '',
  1063. endpoint varchar2(255) default '',
  1064. domain varchar2(255) default '',
  1065. is_https char(1) default 'N',
  1066. region varchar2(255) default '',
  1067. access_policy char(1) default '1' not null,
  1068. status char(1) default '1',
  1069. ext1 varchar2(255) default '',
  1070. remark varchar2(500) default null,
  1071. create_dept number(20) default null,
  1072. create_by number(20) default null,
  1073. create_time date,
  1074. update_by number(20) default null,
  1075. update_time date
  1076. );
  1077. alter table sys_oss_config add constraint pk_sys_oss_config primary key (oss_config_id);
  1078. comment on table sys_oss_config is '对象存储配置表';
  1079. comment on column sys_oss_config.oss_config_id is '主建';
  1080. comment on column sys_oss_config.tenant_id is '租户编码';
  1081. comment on column sys_oss_config.config_key is '配置key';
  1082. comment on column sys_oss_config.access_key is 'accesskey';
  1083. comment on column sys_oss_config.secret_key is '秘钥';
  1084. comment on column sys_oss_config.bucket_name is '桶名称';
  1085. comment on column sys_oss_config.prefix is '前缀';
  1086. comment on column sys_oss_config.endpoint is '访问站点';
  1087. comment on column sys_oss_config.domain is '自定义域名';
  1088. comment on column sys_oss_config.is_https is '是否https(Y=是,N=否)';
  1089. comment on column sys_oss_config.region is '域';
  1090. comment on column sys_oss_config.access_policy is '桶权限类型(0=private 1=public 2=custom)';
  1091. comment on column sys_oss_config.status is '是否默认(0=是,1=否)';
  1092. comment on column sys_oss_config.ext1 is '扩展字段';
  1093. comment on column sys_oss_config.remark is '备注';
  1094. comment on column sys_oss_config.create_dept is '创建部门';
  1095. comment on column sys_oss_config.create_by is '创建者';
  1096. comment on column sys_oss_config.create_time is '创建时间';
  1097. comment on column sys_oss_config.update_by is '更新者';
  1098. comment on column sys_oss_config.update_time is '更新时间';
  1099. insert into sys_oss_config values (1, '000000', 'minio', 'ruoyi', 'ruoyi123', 'ruoyi', '', '127.0.0.1:9000', '','N', '', '1', '0', '', NULL, 103, 1, sysdate, 1, sysdate);
  1100. insert into sys_oss_config values (2, '000000', 'qiniu', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 's3-cn-north-1.qiniucs.com', '','N', '', '1', '1', '', NULL, 103, 1, sysdate, 1, sysdate);
  1101. insert into sys_oss_config values (3, '000000', 'aliyun', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 'oss-cn-beijing.aliyuncs.com', '','N', '', '1', '1', '', NULL, 103, 1, sysdate, 1, sysdate);
  1102. insert into sys_oss_config values (4, '000000', 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1250000000', '', 'cos.ap-beijing.myqcloud.com', '','N', 'ap-beijing', '1', '1', '', NULL, 103, 1, sysdate, 1, sysdate);
  1103. insert into sys_oss_config values (5, '000000', 'image', 'ruoyi', 'ruoyi123', 'ruoyi', 'image', '127.0.0.1:9000', '','N', '', '1', '1', '', NULL, 103, 1, sysdate, 1, sysdate);
  1104. -- ----------------------------
  1105. -- 系统授权表
  1106. -- ----------------------------
  1107. create table sys_client (
  1108. id number(20) not null,
  1109. client_id varchar2(64) default null,
  1110. client_key varchar2(32) default null,
  1111. client_secret varchar2(255) default null,
  1112. grant_type varchar2(255) default null,
  1113. device_type varchar2(32) default null,
  1114. active_timeout number(11) default 1800,
  1115. timeout number(11) default 604800,
  1116. status char(1) default '0',
  1117. del_flag char(1) default '0',
  1118. create_dept number(20) default null,
  1119. create_by number(20) default null,
  1120. create_time date,
  1121. update_by number(20) default null,
  1122. update_time date
  1123. );
  1124. alter table sys_client add constraint pk_sys_client primary key (id);
  1125. comment on table sys_client is '系统授权表';
  1126. comment on column sys_client.id is '主建';
  1127. comment on column sys_client.client_id is '客户端id';
  1128. comment on column sys_client.client_key is '客户端key';
  1129. comment on column sys_client.client_secret is '客户端秘钥';
  1130. comment on column sys_client.grant_type is '授权类型';
  1131. comment on column sys_client.device_type is '设备类型';
  1132. comment on column sys_client.active_timeout is 'token活跃超时时间';
  1133. comment on column sys_client.timeout is 'token固定超时';
  1134. comment on column sys_client.status is '状态(0正常 1停用)';
  1135. comment on column sys_client.del_flag is '删除标志(0代表存在 2代表删除)';
  1136. comment on column sys_client.create_dept is '创建部门';
  1137. comment on column sys_client.create_by is '创建者';
  1138. comment on column sys_client.create_time is '创建时间';
  1139. comment on column sys_client.update_by is '更新者';
  1140. comment on column sys_client.update_time is '更新时间';
  1141. insert into sys_client values (1, 'e5cd7e4891bf95d1d19206ce24a7b32e', 'pc', 'pc123', 'password,social', 'pc', 1800, 604800, 0, 0, 103, 1, sysdate, 1, sysdate);
  1142. insert into sys_client values (2, '428a8310cd442757ae699df5d894f051', 'app', 'app123', 'password,sms,social', 'android', 1800, 604800, 0, 0, 103, 1, sysdate, 1, sysdate);
  1143. -- ----------------------------
  1144. -- 钩子 ,用于session连接之后 自动设置默认的date类型格式化 简化时间查询
  1145. -- 如需设置其它配置 可在此钩子内任意增加处理语句
  1146. -- 例如: SELECT * FROM sys_user WHERE create_time BETWEEN '2022-03-01 00:00:00' AND '2022-04-01 00:00:00'
  1147. -- ----------------------------
  1148. create or replace trigger login_trg
  1149. after logon on database
  1150. begin
  1151. execute immediate 'alter session set nls_date_format=''YYYY-MM-DD HH24:MI:SS''';
  1152. end;