init.sql 162 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120
  1. -- ----------------------------
  2. -- 第三方平台授权表
  3. -- ----------------------------
  4. drop table if exists sys_social;
  5. create table sys_social
  6. (
  7. id bigint not null comment '主键',
  8. user_id bigint not null comment '用户ID',
  9. tenant_id varchar(20) default '000000' comment '租户id',
  10. auth_id varchar(255) not null comment '平台+平台唯一id',
  11. source varchar(255) not null comment '用户来源',
  12. open_id varchar(255) default null comment '平台编号唯一id',
  13. user_name varchar(30) not null comment '登录账号',
  14. nick_name varchar(50) default '' comment '用户昵称',
  15. email varchar(255) default '' comment '用户邮箱',
  16. avatar varchar(500) default '' comment '头像地址',
  17. access_token varchar(2000) not null comment '用户的授权令牌',
  18. expire_in int default null comment '用户的授权令牌的有效期,部分平台可能没有',
  19. refresh_token varchar(255) default null comment '刷新令牌,部分平台可能没有',
  20. access_code varchar(2000) default null comment '平台的授权信息,部分平台可能没有',
  21. union_id varchar(255) default null comment '用户的 unionid',
  22. scope varchar(255) default null comment '授予的权限,部分平台可能没有',
  23. token_type varchar(255) default null comment '个别平台的授权信息,部分平台可能没有',
  24. id_token varchar(2000) default null comment 'id token,部分平台可能没有',
  25. mac_algorithm varchar(255) default null comment '小米平台用户的附带属性,部分平台可能没有',
  26. mac_key varchar(255) default null comment '小米平台用户的附带属性,部分平台可能没有',
  27. code varchar(255) default null comment '用户的授权code,部分平台可能没有',
  28. oauth_token varchar(255) default null comment 'Twitter平台用户的附带属性,部分平台可能没有',
  29. oauth_token_secret varchar(255) default null comment 'Twitter平台用户的附带属性,部分平台可能没有',
  30. create_dept bigint(20) comment '创建部门',
  31. create_by bigint(20) comment '创建者',
  32. create_time datetime comment '创建时间',
  33. update_by bigint(20) comment '更新者',
  34. update_time datetime comment '更新时间',
  35. del_flag char(1) default '0' comment '删除标志(0代表存在 1代表删除)',
  36. PRIMARY KEY (id)
  37. ) engine=innodb DEFAULT CHARSET=utf8mb4 comment = '社会化关系表';
  38. -- ----------------------------
  39. -- 租户表
  40. -- ----------------------------
  41. drop table if exists sys_tenant;
  42. create table sys_tenant
  43. (
  44. id bigint(20) not null comment 'id',
  45. tenant_id varchar(20) not null comment '租户编号',
  46. contact_user_name varchar(20) comment '联系人',
  47. contact_phone varchar(20) comment '联系电话',
  48. company_name varchar(30) comment '企业名称',
  49. license_number varchar(30) comment '统一社会信用代码',
  50. address varchar(200) comment '地址',
  51. intro varchar(200) comment '企业简介',
  52. domain varchar(200) comment '域名',
  53. remark varchar(200) comment '备注',
  54. package_id bigint(20) comment '租户套餐编号',
  55. expire_time datetime comment '过期时间',
  56. account_count int default -1 comment '用户数量(-1不限制)',
  57. status char(1) default '0' comment '租户状态(0正常 1停用)',
  58. del_flag char(1) default '0' comment '删除标志(0代表存在 1代表删除)',
  59. create_dept bigint(20) comment '创建部门',
  60. create_by bigint(20) comment '创建者',
  61. create_time datetime comment '创建时间',
  62. update_by bigint(20) comment '更新者',
  63. update_time datetime comment '更新时间',
  64. primary key (id)
  65. ) engine=innodb DEFAULT CHARSET=utf8mb4 comment = '租户表';
  66. -- ----------------------------
  67. -- 初始化-租户表数据
  68. -- ----------------------------
  69. insert into sys_tenant values(1, '000000', '管理组', '15888888888', 'XXX有限公司', null, null, '多租户通用后台管理管理系统', null, null, null, null, -1, '0', '0', 103, 1, sysdate(), null, null);
  70. -- ----------------------------
  71. -- 租户套餐表
  72. -- ----------------------------
  73. drop table if exists sys_tenant_package;
  74. create table sys_tenant_package (
  75. package_id bigint(20) not null comment '租户套餐id',
  76. package_name varchar(20) comment '套餐名称',
  77. menu_ids varchar(3000) comment '关联菜单id',
  78. remark varchar(200) comment '备注',
  79. menu_check_strictly tinyint(1) default 1 comment '菜单树选择项是否关联显示',
  80. status char(1) default '0' comment '状态(0正常 1停用)',
  81. del_flag char(1) default '0' comment '删除标志(0代表存在 1代表删除)',
  82. create_dept bigint(20) comment '创建部门',
  83. create_by bigint(20) comment '创建者',
  84. create_time datetime comment '创建时间',
  85. update_by bigint(20) comment '更新者',
  86. update_time datetime comment '更新时间',
  87. primary key (package_id)
  88. ) engine=innodb DEFAULT CHARSET=utf8mb4 comment = '租户套餐表';
  89. -- ----------------------------
  90. -- 1、部门表
  91. -- ----------------------------
  92. drop table if exists sys_dept;
  93. create table sys_dept (
  94. dept_id bigint(20) not null comment '部门id',
  95. tenant_id varchar(20) default '000000' comment '租户编号',
  96. parent_id bigint(20) default 0 comment '父部门id',
  97. ancestors varchar(500) default '' comment '祖级列表',
  98. dept_name varchar(30) default '' comment '部门名称',
  99. dept_category varchar(100) default null comment '部门类别编码',
  100. order_num int(4) default 0 comment '显示顺序',
  101. leader bigint(20) default null comment '负责人',
  102. phone varchar(11) default null comment '联系电话',
  103. email varchar(50) default null comment '邮箱',
  104. status char(1) default '0' comment '部门状态(0正常 1停用)',
  105. del_flag char(1) default '0' comment '删除标志(0代表存在 1代表删除)',
  106. create_dept bigint(20) default null comment '创建部门',
  107. create_by bigint(20) default null comment '创建者',
  108. create_time datetime comment '创建时间',
  109. update_by bigint(20) default null comment '更新者',
  110. update_time datetime comment '更新时间',
  111. primary key (dept_id)
  112. ) engine=innodb DEFAULT CHARSET=utf8mb4 comment = '部门表';
  113. -- ----------------------------
  114. -- 初始化-部门表数据
  115. -- ----------------------------
  116. insert into sys_dept values(100, '000000', 0, '0', 'XXX科技', null,0, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
  117. insert into sys_dept values(101, '000000', 100, '0,100', '深圳总公司', null,1, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
  118. insert into sys_dept values(102, '000000', 100, '0,100', '长沙分公司', null,2, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
  119. insert into sys_dept values(103, '000000', 101, '0,100,101', '研发部门', null,1, 1, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
  120. insert into sys_dept values(104, '000000', 101, '0,100,101', '市场部门', null,2, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
  121. insert into sys_dept values(105, '000000', 101, '0,100,101', '测试部门', null,3, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
  122. insert into sys_dept values(106, '000000', 101, '0,100,101', '财务部门', null,4, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
  123. insert into sys_dept values(107, '000000', 101, '0,100,101', '运维部门', null,5, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
  124. insert into sys_dept values(108, '000000', 102, '0,100,102', '市场部门', null,1, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
  125. insert into sys_dept values(109, '000000', 102, '0,100,102', '财务部门', null,2, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
  126. -- ----------------------------
  127. -- 2、用户信息表
  128. -- ----------------------------
  129. drop table if exists sys_user;
  130. create table sys_user (
  131. user_id bigint(20) not null comment '用户ID',
  132. tenant_id varchar(20) default '000000' comment '租户编号',
  133. dept_id bigint(20) default null comment '部门ID',
  134. user_name varchar(30) not null comment '用户账号',
  135. nick_name varchar(50) not null comment '用户昵称',
  136. user_type varchar(10) default 'sys_user' comment '用户类型(sys_user系统用户)',
  137. email varchar(50) default '' comment '用户邮箱',
  138. phonenumber varchar(11) default '' comment '手机号码',
  139. sex char(1) default '0' comment '用户性别(0男 1女 2未知)',
  140. avatar bigint(20) comment '头像地址',
  141. password varchar(100) default '' comment '密码',
  142. status char(1) default '0' comment '账号状态(0正常 1停用)',
  143. del_flag char(1) default '0' comment '删除标志(0代表存在 1代表删除)',
  144. login_ip varchar(128) default '' comment '最后登录IP',
  145. login_date datetime comment '最后登录时间',
  146. create_dept bigint(20) default null comment '创建部门',
  147. create_by bigint(20) default null comment '创建者',
  148. create_time datetime comment '创建时间',
  149. update_by bigint(20) default null comment '更新者',
  150. update_time datetime comment '更新时间',
  151. remark varchar(500) default null comment '备注',
  152. primary key (user_id)
  153. ) engine=innodb DEFAULT CHARSET=utf8mb4 comment = '用户信息表';
  154. -- ----------------------------
  155. -- 初始化-用户信息表数据
  156. -- ----------------------------
  157. 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, '管理员');
  158. insert into sys_user 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);
  159. insert into sys_user 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);
  160. -- ----------------------------
  161. -- 3、岗位信息表
  162. -- ----------------------------
  163. drop table if exists sys_post;
  164. create table sys_post
  165. (
  166. post_id bigint(20) not null comment '岗位ID',
  167. tenant_id varchar(20) default '000000' comment '租户编号',
  168. dept_id bigint(20) not null comment '部门id',
  169. post_code varchar(64) not null comment '岗位编码',
  170. post_category varchar(100) default null comment '岗位类别编码',
  171. post_name varchar(50) not null comment '岗位名称',
  172. post_sort int(4) not null comment '显示顺序',
  173. status char(1) not null comment '状态(0正常 1停用)',
  174. create_dept bigint(20) default null comment '创建部门',
  175. create_by bigint(20) default null comment '创建者',
  176. create_time datetime comment '创建时间',
  177. update_by bigint(20) default null comment '更新者',
  178. update_time datetime comment '更新时间',
  179. remark varchar(500) default null comment '备注',
  180. primary key (post_id)
  181. ) engine=innodb DEFAULT CHARSET=utf8mb4 comment = '岗位信息表';
  182. -- ----------------------------
  183. -- 初始化-岗位信息表数据
  184. -- ----------------------------
  185. insert into sys_post values(1, '000000', 103, 'ceo', null, '董事长', 1, '0', 103, 1, sysdate(), null, null, '');
  186. insert into sys_post values(2, '000000', 100, 'se', null, '项目经理', 2, '0', 103, 1, sysdate(), null, null, '');
  187. insert into sys_post values(3, '000000', 100, 'hr', null, '人力资源', 3, '0', 103, 1, sysdate(), null, null, '');
  188. insert into sys_post values(4, '000000', 100, 'user', null, '普通员工', 4, '0', 103, 1, sysdate(), null, null, '');
  189. -- ----------------------------
  190. -- 4、角色信息表
  191. -- ----------------------------
  192. drop table if exists sys_role;
  193. create table sys_role (
  194. role_id bigint(20) not null comment '角色ID',
  195. tenant_id varchar(20) default '000000' comment '租户编号',
  196. role_name varchar(30) not null comment '角色名称',
  197. role_key varchar(100) not null comment '角色权限字符串',
  198. role_sort int(4) not null comment '显示顺序',
  199. data_scope char(1) default '1' comment '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限 5:仅本人数据权限 6:部门及以下或本人数据权限)',
  200. menu_check_strictly tinyint(1) default 1 comment '菜单树选择项是否关联显示',
  201. dept_check_strictly tinyint(1) default 1 comment '部门树选择项是否关联显示',
  202. status char(1) not null comment '角色状态(0正常 1停用)',
  203. del_flag char(1) default '0' comment '删除标志(0代表存在 1代表删除)',
  204. create_dept bigint(20) default null comment '创建部门',
  205. create_by bigint(20) default null comment '创建者',
  206. create_time datetime comment '创建时间',
  207. update_by bigint(20) default null comment '更新者',
  208. update_time datetime comment '更新时间',
  209. remark varchar(500) default null comment '备注',
  210. primary key (role_id)
  211. ) engine=innodb DEFAULT CHARSET=utf8mb4 comment = '角色信息表';
  212. -- ----------------------------
  213. -- 初始化-角色信息表数据
  214. -- ----------------------------
  215. insert into sys_role values(1, '000000', '超级管理员', 'superadmin', 1, 1, 1, 1, '0', '0', 103, 1, sysdate(), null, null, '超级管理员');
  216. insert into sys_role values(3, '000000', '本部门及以下', 'test1', 3, 4, 1, 1, '0', '0', 103, 1, sysdate(), null, null, '');
  217. insert into sys_role values(4, '000000', '仅本人', 'test2', 4, 5, 1, 1, '0', '0', 103, 1, sysdate(), null, null, '');
  218. -- ----------------------------
  219. -- 5、菜单权限表
  220. -- ----------------------------
  221. drop table if exists sys_menu;
  222. create table sys_menu (
  223. menu_id bigint(20) not null comment '菜单ID',
  224. menu_name varchar(50) not null comment '菜单名称',
  225. parent_id bigint(20) default 0 comment '父菜单ID',
  226. order_num int(4) default 0 comment '显示顺序',
  227. path varchar(200) default '' comment '路由地址',
  228. component varchar(255) default null comment '组件路径',
  229. query_param varchar(255) default null comment '路由参数',
  230. is_frame int(1) default 1 comment '是否为外链(0是 1否)',
  231. is_cache int(1) default 0 comment '是否缓存(0缓存 1不缓存)',
  232. menu_type char(1) default '' comment '菜单类型(M目录 C菜单 F按钮)',
  233. visible char(1) default 0 comment '显示状态(0显示 1隐藏)',
  234. status char(1) default 0 comment '菜单状态(0正常 1停用)',
  235. perms varchar(100) default null comment '权限标识',
  236. icon varchar(100) default '#' comment '菜单图标',
  237. create_dept bigint(20) default null comment '创建部门',
  238. create_by bigint(20) default null comment '创建者',
  239. create_time datetime comment '创建时间',
  240. update_by bigint(20) default null comment '更新者',
  241. update_time datetime comment '更新时间',
  242. remark varchar(500) default '' comment '备注',
  243. primary key (menu_id)
  244. ) engine=innodb DEFAULT CHARSET=utf8mb4 comment = '菜单权限表';
  245. -- ----------------------------
  246. -- 初始化-菜单信息表数据
  247. -- ----------------------------
  248. -- 一级菜单
  249. insert into sys_menu values('1', '系统管理', '0', '1', 'system', null, '', 1, 0, 'M', '0', '0', '', 'system', 103, 1, sysdate(), null, null, '系统管理目录');
  250. insert into sys_menu values('6', '租户管理', '0', '2', 'tenant', null, '', 1, 0, 'M', '0', '0', '', 'chart', 103, 1, sysdate(), null, null, '租户管理目录');
  251. insert into sys_menu values('2', '系统监控', '0', '3', 'monitor', null, '', 1, 0, 'M', '0', '0', '', 'monitor', 103, 1, sysdate(), null, null, '系统监控目录');
  252. insert into sys_menu values('3', '系统工具', '0', '4', 'tool', null, '', 1, 0, 'M', '0', '0', '', 'tool', 103, 1, sysdate(), null, null, '系统工具目录');
  253. 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官网地址');
  254. insert into sys_menu values('5', '测试菜单', '0', '5', 'demo', null, '', 1, 0, 'M', '0', '0', '', 'star', 103, 1, sysdate(), null, null, '测试菜单');
  255. -- 二级菜单
  256. 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, '用户管理菜单');
  257. 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, '角色管理菜单');
  258. 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, '菜单管理菜单');
  259. 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, '部门管理菜单');
  260. 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, '岗位管理菜单');
  261. 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, '字典管理菜单');
  262. 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, '参数设置菜单');
  263. 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, '通知公告菜单');
  264. insert into sys_menu values('108', '日志管理', '1', '9', 'log', '', '', 1, 0, 'M', '0', '0', '', 'log', 103, 1, sysdate(), null, null, '日志管理菜单');
  265. 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, '在线用户菜单');
  266. 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, '缓存监控菜单');
  267. 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, '代码生成菜单');
  268. 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, '租户管理菜单');
  269. 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, '租户套餐管理菜单');
  270. 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, '客户端管理菜单');
  271. insert into sys_menu values('116', '修改生成配置', '3', '2', 'gen-edit/index/:tableId', 'tool/gen/editTable', '', 1, 1, 'C', '1', '0', 'tool:gen:edit', '#', 103, 1, sysdate(), null, null, '/tool/gen');
  272. insert into sys_menu values('130', '分配用户', '1', '2', 'role-auth/user/:roleId', 'system/role/authUser', '', 1, 1, 'C', '1', '0', 'system:role:edit', '#', 103, 1, sysdate(), null, null, '/system/role');
  273. insert into sys_menu values('131', '分配角色', '1', '1', 'user-auth/role/:userId', 'system/user/authRole', '', 1, 1, 'C', '1', '0', 'system:user:edit', '#', 103, 1, sysdate(), null, null, '/system/user');
  274. insert into sys_menu values('132', '字典数据', '1', '6', 'dict-data/index/:dictId', 'system/dict/data', '', 1, 1, 'C', '1', '0', 'system:dict:list', '#', 103, 1, sysdate(), null, null, '/system/dict');
  275. insert into sys_menu values('133', '文件配置管理', '1', '10', 'oss-config/index', 'system/oss/config', '', 1, 1, 'C', '1', '0', 'system:ossConfig:list', '#', 103, 1, sysdate(), null, null, '/system/oss');
  276. -- springboot-admin监控
  277. 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监控菜单');
  278. -- oss菜单
  279. 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, '文件管理菜单');
  280. -- snail-job server控制台
  281. insert into sys_menu values('120', '任务调度中心', '2', '6', 'snailjob', 'monitor/snailjob/index', '', 1, 0, 'C', '0', '0', 'monitor:snailjob:list', 'job', 103, 1, sysdate(), null, null, 'SnailJob控制台菜单');
  282. -- 三级菜单
  283. 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, '操作日志菜单');
  284. 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, '登录日志菜单');
  285. -- 用户管理按钮
  286. insert into sys_menu values('1001', '用户查询', '100', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:user:query', '#', 103, 1, sysdate(), null, null, '');
  287. insert into sys_menu values('1002', '用户新增', '100', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:user:add', '#', 103, 1, sysdate(), null, null, '');
  288. insert into sys_menu values('1003', '用户修改', '100', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:user:edit', '#', 103, 1, sysdate(), null, null, '');
  289. insert into sys_menu values('1004', '用户删除', '100', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:user:remove', '#', 103, 1, sysdate(), null, null, '');
  290. insert into sys_menu values('1005', '用户导出', '100', '5', '', '', '', 1, 0, 'F', '0', '0', 'system:user:export', '#', 103, 1, sysdate(), null, null, '');
  291. insert into sys_menu values('1006', '用户导入', '100', '6', '', '', '', 1, 0, 'F', '0', '0', 'system:user:import', '#', 103, 1, sysdate(), null, null, '');
  292. insert into sys_menu values('1007', '重置密码', '100', '7', '', '', '', 1, 0, 'F', '0', '0', 'system:user:resetPwd', '#', 103, 1, sysdate(), null, null, '');
  293. -- 角色管理按钮
  294. insert into sys_menu values('1008', '角色查询', '101', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:role:query', '#', 103, 1, sysdate(), null, null, '');
  295. insert into sys_menu values('1009', '角色新增', '101', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:role:add', '#', 103, 1, sysdate(), null, null, '');
  296. insert into sys_menu values('1010', '角色修改', '101', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:role:edit', '#', 103, 1, sysdate(), null, null, '');
  297. insert into sys_menu values('1011', '角色删除', '101', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:role:remove', '#', 103, 1, sysdate(), null, null, '');
  298. insert into sys_menu values('1012', '角色导出', '101', '5', '', '', '', 1, 0, 'F', '0', '0', 'system:role:export', '#', 103, 1, sysdate(), null, null, '');
  299. -- 菜单管理按钮
  300. insert into sys_menu values('1013', '菜单查询', '102', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:query', '#', 103, 1, sysdate(), null, null, '');
  301. insert into sys_menu values('1014', '菜单新增', '102', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:add', '#', 103, 1, sysdate(), null, null, '');
  302. insert into sys_menu values('1015', '菜单修改', '102', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:edit', '#', 103, 1, sysdate(), null, null, '');
  303. insert into sys_menu values('1016', '菜单删除', '102', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:remove', '#', 103, 1, sysdate(), null, null, '');
  304. -- 部门管理按钮
  305. insert into sys_menu values('1017', '部门查询', '103', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:query', '#', 103, 1, sysdate(), null, null, '');
  306. insert into sys_menu values('1018', '部门新增', '103', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:add', '#', 103, 1, sysdate(), null, null, '');
  307. insert into sys_menu values('1019', '部门修改', '103', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:edit', '#', 103, 1, sysdate(), null, null, '');
  308. insert into sys_menu values('1020', '部门删除', '103', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:remove', '#', 103, 1, sysdate(), null, null, '');
  309. -- 岗位管理按钮
  310. insert into sys_menu values('1021', '岗位查询', '104', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:post:query', '#', 103, 1, sysdate(), null, null, '');
  311. insert into sys_menu values('1022', '岗位新增', '104', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:post:add', '#', 103, 1, sysdate(), null, null, '');
  312. insert into sys_menu values('1023', '岗位修改', '104', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:post:edit', '#', 103, 1, sysdate(), null, null, '');
  313. insert into sys_menu values('1024', '岗位删除', '104', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:post:remove', '#', 103, 1, sysdate(), null, null, '');
  314. insert into sys_menu values('1025', '岗位导出', '104', '5', '', '', '', 1, 0, 'F', '0', '0', 'system:post:export', '#', 103, 1, sysdate(), null, null, '');
  315. -- 字典管理按钮
  316. insert into sys_menu values('1026', '字典查询', '105', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:query', '#', 103, 1, sysdate(), null, null, '');
  317. insert into sys_menu values('1027', '字典新增', '105', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:add', '#', 103, 1, sysdate(), null, null, '');
  318. insert into sys_menu values('1028', '字典修改', '105', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:edit', '#', 103, 1, sysdate(), null, null, '');
  319. insert into sys_menu values('1029', '字典删除', '105', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:remove', '#', 103, 1, sysdate(), null, null, '');
  320. insert into sys_menu values('1030', '字典导出', '105', '5', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:export', '#', 103, 1, sysdate(), null, null, '');
  321. -- 参数设置按钮
  322. insert into sys_menu values('1031', '参数查询', '106', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:query', '#', 103, 1, sysdate(), null, null, '');
  323. insert into sys_menu values('1032', '参数新增', '106', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:add', '#', 103, 1, sysdate(), null, null, '');
  324. insert into sys_menu values('1033', '参数修改', '106', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:edit', '#', 103, 1, sysdate(), null, null, '');
  325. insert into sys_menu values('1034', '参数删除', '106', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:remove', '#', 103, 1, sysdate(), null, null, '');
  326. insert into sys_menu values('1035', '参数导出', '106', '5', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:export', '#', 103, 1, sysdate(), null, null, '');
  327. -- 通知公告按钮
  328. insert into sys_menu values('1036', '公告查询', '107', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:query', '#', 103, 1, sysdate(), null, null, '');
  329. insert into sys_menu values('1037', '公告新增', '107', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:add', '#', 103, 1, sysdate(), null, null, '');
  330. insert into sys_menu values('1038', '公告修改', '107', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:edit', '#', 103, 1, sysdate(), null, null, '');
  331. insert into sys_menu values('1039', '公告删除', '107', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:remove', '#', 103, 1, sysdate(), null, null, '');
  332. -- 操作日志按钮
  333. insert into sys_menu values('1040', '操作查询', '500', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:query', '#', 103, 1, sysdate(), null, null, '');
  334. insert into sys_menu values('1041', '操作删除', '500', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:remove', '#', 103, 1, sysdate(), null, null, '');
  335. insert into sys_menu values('1042', '日志导出', '500', '4', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:export', '#', 103, 1, sysdate(), null, null, '');
  336. -- 登录日志按钮
  337. insert into sys_menu values('1043', '登录查询', '501', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:query', '#', 103, 1, sysdate(), null, null, '');
  338. insert into sys_menu values('1044', '登录删除', '501', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:remove', '#', 103, 1, sysdate(), null, null, '');
  339. insert into sys_menu values('1045', '日志导出', '501', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:export', '#', 103, 1, sysdate(), null, null, '');
  340. insert into sys_menu values('1050', '账户解锁', '501', '4', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:unlock', '#', 103, 1, sysdate(), null, null, '');
  341. -- 在线用户按钮
  342. insert into sys_menu values('1046', '在线查询', '109', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:query', '#', 103, 1, sysdate(), null, null, '');
  343. insert into sys_menu values('1047', '批量强退', '109', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:batchLogout', '#', 103, 1, sysdate(), null, null, '');
  344. insert into sys_menu values('1048', '单条强退', '109', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:forceLogout', '#', 103, 1, sysdate(), null, null, '');
  345. -- 代码生成按钮
  346. insert into sys_menu values('1055', '生成查询', '115', '1', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:query', '#', 103, 1, sysdate(), null, null, '');
  347. insert into sys_menu values('1056', '生成修改', '115', '2', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:edit', '#', 103, 1, sysdate(), null, null, '');
  348. insert into sys_menu values('1057', '生成删除', '115', '3', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:remove', '#', 103, 1, sysdate(), null, null, '');
  349. insert into sys_menu values('1058', '导入代码', '115', '2', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:import', '#', 103, 1, sysdate(), null, null, '');
  350. insert into sys_menu values('1059', '预览代码', '115', '4', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:preview', '#', 103, 1, sysdate(), null, null, '');
  351. insert into sys_menu values('1060', '生成代码', '115', '5', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:code', '#', 103, 1, sysdate(), null, null, '');
  352. -- oss相关按钮
  353. insert into sys_menu values('1600', '文件查询', '118', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:oss:query', '#', 103, 1, sysdate(), null, null, '');
  354. insert into sys_menu values('1601', '文件上传', '118', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:oss:upload', '#', 103, 1, sysdate(), null, null, '');
  355. insert into sys_menu values('1602', '文件下载', '118', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:oss:download', '#', 103, 1, sysdate(), null, null, '');
  356. insert into sys_menu values('1603', '文件删除', '118', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:oss:remove', '#', 103, 1, sysdate(), null, null, '');
  357. insert into sys_menu values('1620', '配置列表', '118', '5', '#', '', '', 1, 0, 'F', '0', '0', 'system:ossConfig:list', '#', 103, 1, sysdate(), null, null, '');
  358. insert into sys_menu values('1621', '配置添加', '118', '6', '#', '', '', 1, 0, 'F', '0', '0', 'system:ossConfig:add', '#', 103, 1, sysdate(), null, null, '');
  359. insert into sys_menu values('1622', '配置编辑', '118', '6', '#', '', '', 1, 0, 'F', '0', '0', 'system:ossConfig:edit', '#', 103, 1, sysdate(), null, null, '');
  360. insert into sys_menu values('1623', '配置删除', '118', '6', '#', '', '', 1, 0, 'F', '0', '0', 'system:ossConfig:remove', '#', 103, 1, sysdate(), null, null, '');
  361. -- 租户管理相关按钮
  362. insert into sys_menu values ('1606', '租户查询', '121', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenant:query', '#', 103, 1, sysdate(), null, null, '');
  363. insert into sys_menu values ('1607', '租户新增', '121', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenant:add', '#', 103, 1, sysdate(), null, null, '');
  364. insert into sys_menu values ('1608', '租户修改', '121', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenant:edit', '#', 103, 1, sysdate(), null, null, '');
  365. insert into sys_menu values ('1609', '租户删除', '121', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenant:remove', '#', 103, 1, sysdate(), null, null, '');
  366. insert into sys_menu values ('1610', '租户导出', '121', '5', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenant:export', '#', 103, 1, sysdate(), null, null, '');
  367. -- 租户套餐管理相关按钮
  368. insert into sys_menu values ('1611', '租户套餐查询', '122', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenantPackage:query', '#', 103, 1, sysdate(), null, null, '');
  369. insert into sys_menu values ('1612', '租户套餐新增', '122', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenantPackage:add', '#', 103, 1, sysdate(), null, null, '');
  370. insert into sys_menu values ('1613', '租户套餐修改', '122', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenantPackage:edit', '#', 103, 1, sysdate(), null, null, '');
  371. insert into sys_menu values ('1614', '租户套餐删除', '122', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenantPackage:remove', '#', 103, 1, sysdate(), null, null, '');
  372. insert into sys_menu values ('1615', '租户套餐导出', '122', '5', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenantPackage:export', '#', 103, 1, sysdate(), null, null, '');
  373. -- 客户端管理按钮
  374. insert into sys_menu values('1061', '客户端管理查询', '123', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:client:query', '#', 103, 1, sysdate(), null, null, '');
  375. insert into sys_menu values('1062', '客户端管理新增', '123', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:client:add', '#', 103, 1, sysdate(), null, null, '');
  376. insert into sys_menu values('1063', '客户端管理修改', '123', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:client:edit', '#', 103, 1, sysdate(), null, null, '');
  377. insert into sys_menu values('1064', '客户端管理删除', '123', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:client:remove', '#', 103, 1, sysdate(), null, null, '');
  378. insert into sys_menu values('1065', '客户端管理导出', '123', '5', '#', '', '', 1, 0, 'F', '0', '0', 'system:client:export', '#', 103, 1, sysdate(), null, null, '');
  379. -- 测试菜单
  380. insert into sys_menu values('1500', '测试单表', '5', '1', 'demo', 'demo/demo/index', '', 1, 0, 'C', '0', '0', 'demo:demo:list', '#', 103, 1, sysdate(), null, null, '测试单表菜单');
  381. insert into sys_menu values('1501', '测试单表查询', '1500', '1', '#', '', '', 1, 0, 'F', '0', '0', 'demo:demo:query', '#', 103, 1, sysdate(), null, null, '');
  382. insert into sys_menu values('1502', '测试单表新增', '1500', '2', '#', '', '', 1, 0, 'F', '0', '0', 'demo:demo:add', '#', 103, 1, sysdate(), null, null, '');
  383. insert into sys_menu values('1503', '测试单表修改', '1500', '3', '#', '', '', 1, 0, 'F', '0', '0', 'demo:demo:edit', '#', 103, 1, sysdate(), null, null, '');
  384. insert into sys_menu values('1504', '测试单表删除', '1500', '4', '#', '', '', 1, 0, 'F', '0', '0', 'demo:demo:remove', '#', 103, 1, sysdate(), null, null, '');
  385. insert into sys_menu values('1505', '测试单表导出', '1500', '5', '#', '', '', 1, 0, 'F', '0', '0', 'demo:demo:export', '#', 103, 1, sysdate(), null, null, '');
  386. insert into sys_menu values('1506', '测试树表', '5', '1', 'tree', 'demo/tree/index', '', 1, 0, 'C', '0', '0', 'demo:tree:list', '#', 103, 1, sysdate(), null, null, '测试树表菜单');
  387. insert into sys_menu values('1507', '测试树表查询', '1506', '1', '#', '', '', 1, 0, 'F', '0', '0', 'demo:tree:query', '#', 103, 1, sysdate(), null, null, '');
  388. insert into sys_menu values('1508', '测试树表新增', '1506', '2', '#', '', '', 1, 0, 'F', '0', '0', 'demo:tree:add', '#', 103, 1, sysdate(), null, null, '');
  389. insert into sys_menu values('1509', '测试树表修改', '1506', '3', '#', '', '', 1, 0, 'F', '0', '0', 'demo:tree:edit', '#', 103, 1, sysdate(), null, null, '');
  390. insert into sys_menu values('1510', '测试树表删除', '1506', '4', '#', '', '', 1, 0, 'F', '0', '0', 'demo:tree:remove', '#', 103, 1, sysdate(), null, null, '');
  391. insert into sys_menu values('1511', '测试树表导出', '1506', '5', '#', '', '', 1, 0, 'F', '0', '0', 'demo:tree:export', '#', 103, 1, sysdate(), null, null, '');
  392. -- ----------------------------
  393. -- 6、用户和角色关联表 用户N-1角色
  394. -- ----------------------------
  395. drop table if exists sys_user_role;
  396. create table sys_user_role (
  397. user_id bigint(20) not null comment '用户ID',
  398. role_id bigint(20) not null comment '角色ID',
  399. primary key(user_id, role_id)
  400. ) engine=innodb DEFAULT CHARSET=utf8mb4 comment = '用户和角色关联表';
  401. -- ----------------------------
  402. -- 初始化-用户和角色关联表数据
  403. -- ----------------------------
  404. insert into sys_user_role values ('1', '1');
  405. insert into sys_user_role values ('3', '3');
  406. insert into sys_user_role values ('4', '4');
  407. -- ----------------------------
  408. -- 7、角色和菜单关联表 角色1-N菜单
  409. -- ----------------------------
  410. drop table if exists sys_role_menu;
  411. create table sys_role_menu (
  412. role_id bigint(20) not null comment '角色ID',
  413. menu_id bigint(20) not null comment '菜单ID',
  414. primary key(role_id, menu_id)
  415. ) engine=innodb DEFAULT CHARSET=utf8mb4 comment = '角色和菜单关联表';
  416. -- ----------------------------
  417. -- 初始化-角色和菜单关联表数据
  418. -- ----------------------------
  419. insert into sys_role_menu values ('3', '1');
  420. insert into sys_role_menu values ('3', '5');
  421. insert into sys_role_menu values ('3', '100');
  422. insert into sys_role_menu values ('3', '101');
  423. insert into sys_role_menu values ('3', '102');
  424. insert into sys_role_menu values ('3', '103');
  425. insert into sys_role_menu values ('3', '104');
  426. insert into sys_role_menu values ('3', '105');
  427. insert into sys_role_menu values ('3', '106');
  428. insert into sys_role_menu values ('3', '107');
  429. insert into sys_role_menu values ('3', '108');
  430. insert into sys_role_menu values ('3', '118');
  431. insert into sys_role_menu values ('3', '123');
  432. insert into sys_role_menu values ('3', '130');
  433. insert into sys_role_menu values ('3', '131');
  434. insert into sys_role_menu values ('3', '132');
  435. insert into sys_role_menu values ('3', '133');
  436. insert into sys_role_menu values ('3', '500');
  437. insert into sys_role_menu values ('3', '501');
  438. insert into sys_role_menu values ('3', '1001');
  439. insert into sys_role_menu values ('3', '1002');
  440. insert into sys_role_menu values ('3', '1003');
  441. insert into sys_role_menu values ('3', '1004');
  442. insert into sys_role_menu values ('3', '1005');
  443. insert into sys_role_menu values ('3', '1006');
  444. insert into sys_role_menu values ('3', '1007');
  445. insert into sys_role_menu values ('3', '1008');
  446. insert into sys_role_menu values ('3', '1009');
  447. insert into sys_role_menu values ('3', '1010');
  448. insert into sys_role_menu values ('3', '1011');
  449. insert into sys_role_menu values ('3', '1012');
  450. insert into sys_role_menu values ('3', '1013');
  451. insert into sys_role_menu values ('3', '1014');
  452. insert into sys_role_menu values ('3', '1015');
  453. insert into sys_role_menu values ('3', '1016');
  454. insert into sys_role_menu values ('3', '1017');
  455. insert into sys_role_menu values ('3', '1018');
  456. insert into sys_role_menu values ('3', '1019');
  457. insert into sys_role_menu values ('3', '1020');
  458. insert into sys_role_menu values ('3', '1021');
  459. insert into sys_role_menu values ('3', '1022');
  460. insert into sys_role_menu values ('3', '1023');
  461. insert into sys_role_menu values ('3', '1024');
  462. insert into sys_role_menu values ('3', '1025');
  463. insert into sys_role_menu values ('3', '1026');
  464. insert into sys_role_menu values ('3', '1027');
  465. insert into sys_role_menu values ('3', '1028');
  466. insert into sys_role_menu values ('3', '1029');
  467. insert into sys_role_menu values ('3', '1030');
  468. insert into sys_role_menu values ('3', '1031');
  469. insert into sys_role_menu values ('3', '1032');
  470. insert into sys_role_menu values ('3', '1033');
  471. insert into sys_role_menu values ('3', '1034');
  472. insert into sys_role_menu values ('3', '1035');
  473. insert into sys_role_menu values ('3', '1036');
  474. insert into sys_role_menu values ('3', '1037');
  475. insert into sys_role_menu values ('3', '1038');
  476. insert into sys_role_menu values ('3', '1039');
  477. insert into sys_role_menu values ('3', '1040');
  478. insert into sys_role_menu values ('3', '1041');
  479. insert into sys_role_menu values ('3', '1042');
  480. insert into sys_role_menu values ('3', '1043');
  481. insert into sys_role_menu values ('3', '1044');
  482. insert into sys_role_menu values ('3', '1045');
  483. insert into sys_role_menu values ('3', '1050');
  484. insert into sys_role_menu values ('3', '1061');
  485. insert into sys_role_menu values ('3', '1062');
  486. insert into sys_role_menu values ('3', '1063');
  487. insert into sys_role_menu values ('3', '1064');
  488. insert into sys_role_menu values ('3', '1065');
  489. insert into sys_role_menu values ('3', '1500');
  490. insert into sys_role_menu values ('3', '1501');
  491. insert into sys_role_menu values ('3', '1502');
  492. insert into sys_role_menu values ('3', '1503');
  493. insert into sys_role_menu values ('3', '1504');
  494. insert into sys_role_menu values ('3', '1505');
  495. insert into sys_role_menu values ('3', '1506');
  496. insert into sys_role_menu values ('3', '1507');
  497. insert into sys_role_menu values ('3', '1508');
  498. insert into sys_role_menu values ('3', '1509');
  499. insert into sys_role_menu values ('3', '1510');
  500. insert into sys_role_menu values ('3', '1511');
  501. insert into sys_role_menu values ('3', '1600');
  502. insert into sys_role_menu values ('3', '1601');
  503. insert into sys_role_menu values ('3', '1602');
  504. insert into sys_role_menu values ('3', '1603');
  505. insert into sys_role_menu values ('3', '1620');
  506. insert into sys_role_menu values ('3', '1621');
  507. insert into sys_role_menu values ('3', '1622');
  508. insert into sys_role_menu values ('3', '1623');
  509. insert into sys_role_menu values ('3', '11616');
  510. insert into sys_role_menu values ('3', '11618');
  511. insert into sys_role_menu values ('3', '11619');
  512. insert into sys_role_menu values ('3', '11622');
  513. insert into sys_role_menu values ('3', '11623');
  514. insert into sys_role_menu values ('3', '11629');
  515. insert into sys_role_menu values ('3', '11632');
  516. insert into sys_role_menu values ('3', '11633');
  517. insert into sys_role_menu values ('3', '11638');
  518. insert into sys_role_menu values ('3', '11639');
  519. insert into sys_role_menu values ('3', '11640');
  520. insert into sys_role_menu values ('3', '11641');
  521. insert into sys_role_menu values ('3', '11642');
  522. insert into sys_role_menu values ('3', '11643');
  523. insert into sys_role_menu values ('3', '11701');
  524. insert into sys_role_menu values ('4', '5');
  525. insert into sys_role_menu values ('4', '1500');
  526. insert into sys_role_menu values ('4', '1501');
  527. insert into sys_role_menu values ('4', '1502');
  528. insert into sys_role_menu values ('4', '1503');
  529. insert into sys_role_menu values ('4', '1504');
  530. insert into sys_role_menu values ('4', '1505');
  531. insert into sys_role_menu values ('4', '1506');
  532. insert into sys_role_menu values ('4', '1507');
  533. insert into sys_role_menu values ('4', '1508');
  534. insert into sys_role_menu values ('4', '1509');
  535. insert into sys_role_menu values ('4', '1510');
  536. insert into sys_role_menu values ('4', '1511');
  537. -- ----------------------------
  538. -- 8、角色和部门关联表 角色1-N部门
  539. -- ----------------------------
  540. drop table if exists sys_role_dept;
  541. create table sys_role_dept (
  542. role_id bigint(20) not null comment '角色ID',
  543. dept_id bigint(20) not null comment '部门ID',
  544. primary key(role_id, dept_id)
  545. ) engine=innodb DEFAULT CHARSET=utf8mb4 comment = '角色和部门关联表';
  546. -- ----------------------------
  547. -- 9、用户与岗位关联表 用户1-N岗位
  548. -- ----------------------------
  549. drop table if exists sys_user_post;
  550. create table sys_user_post
  551. (
  552. user_id bigint(20) not null comment '用户ID',
  553. post_id bigint(20) not null comment '岗位ID',
  554. primary key (user_id, post_id)
  555. ) engine=innodb DEFAULT CHARSET=utf8mb4 comment = '用户与岗位关联表';
  556. -- ----------------------------
  557. -- 初始化-用户与岗位关联表数据
  558. -- ----------------------------
  559. insert into sys_user_post values ('1', '1');
  560. -- ----------------------------
  561. -- 10、操作日志记录
  562. -- ----------------------------
  563. drop table if exists sys_oper_log;
  564. create table sys_oper_log (
  565. oper_id bigint(20) not null comment '日志主键',
  566. tenant_id varchar(20) default '000000' comment '租户编号',
  567. title varchar(50) default '' comment '模块标题',
  568. business_type int(2) default 0 comment '业务类型(0其它 1新增 2修改 3删除)',
  569. method varchar(100) default '' comment '方法名称',
  570. request_method varchar(10) default '' comment '请求方式',
  571. operator_type int(1) default 0 comment '操作类别(0其它 1后台用户 2手机端用户)',
  572. oper_name varchar(50) default '' comment '操作人员',
  573. dept_name varchar(50) default '' comment '部门名称',
  574. oper_url varchar(255) default '' comment '请求URL',
  575. oper_ip varchar(128) default '' comment '主机地址',
  576. oper_location varchar(255) default '' comment '操作地点',
  577. oper_param varchar(4000) default '' comment '请求参数',
  578. json_result varchar(4000) default '' comment '返回参数',
  579. status int(1) default 0 comment '操作状态(0正常 1异常)',
  580. error_msg varchar(4000) default '' comment '错误消息',
  581. oper_time datetime comment '操作时间',
  582. cost_time bigint(20) default 0 comment '消耗时间',
  583. primary key (oper_id),
  584. key idx_sys_oper_log_bt (business_type),
  585. key idx_sys_oper_log_s (status),
  586. key idx_sys_oper_log_ot (oper_time)
  587. ) engine=innodb DEFAULT CHARSET=utf8mb4 comment = '操作日志记录';
  588. -- ----------------------------
  589. -- 11、字典类型表
  590. -- ----------------------------
  591. drop table if exists sys_dict_type;
  592. create table sys_dict_type
  593. (
  594. dict_id bigint(20) not null comment '字典主键',
  595. tenant_id varchar(20) default '000000' comment '租户编号',
  596. dict_name varchar(100) default '' comment '字典名称',
  597. dict_type varchar(100) default '' comment '字典类型',
  598. create_dept bigint(20) default null comment '创建部门',
  599. create_by bigint(20) default null comment '创建者',
  600. create_time datetime comment '创建时间',
  601. update_by bigint(20) default null comment '更新者',
  602. update_time datetime comment '更新时间',
  603. remark varchar(500) default null comment '备注',
  604. primary key (dict_id),
  605. unique (tenant_id, dict_type)
  606. ) engine=innodb DEFAULT CHARSET=utf8mb4 comment = '字典类型表';
  607. insert into sys_dict_type values(1, '000000', '用户性别', 'sys_user_sex', 103, 1, sysdate(), null, null, '用户性别列表');
  608. insert into sys_dict_type values(2, '000000', '菜单状态', 'sys_show_hide', 103, 1, sysdate(), null, null, '菜单状态列表');
  609. insert into sys_dict_type values(3, '000000', '系统开关', 'sys_normal_disable', 103, 1, sysdate(), null, null, '系统开关列表');
  610. insert into sys_dict_type values(6, '000000', '系统是否', 'sys_yes_no', 103, 1, sysdate(), null, null, '系统是否列表');
  611. insert into sys_dict_type values(7, '000000', '通知类型', 'sys_notice_type', 103, 1, sysdate(), null, null, '通知类型列表');
  612. insert into sys_dict_type values(8, '000000', '通知状态', 'sys_notice_status', 103, 1, sysdate(), null, null, '通知状态列表');
  613. insert into sys_dict_type values(9, '000000', '操作类型', 'sys_oper_type', 103, 1, sysdate(), null, null, '操作类型列表');
  614. insert into sys_dict_type values(10, '000000', '系统状态', 'sys_common_status', 103, 1, sysdate(), null, null, '登录状态列表');
  615. insert into sys_dict_type values(11, '000000', '授权类型', 'sys_grant_type', 103, 1, sysdate(), null, null, '认证授权类型');
  616. insert into sys_dict_type values(12, '000000', '设备类型', 'sys_device_type', 103, 1, sysdate(), null, null, '客户端设备类型');
  617. -- ----------------------------
  618. -- 12、字典数据表
  619. -- ----------------------------
  620. drop table if exists sys_dict_data;
  621. create table sys_dict_data
  622. (
  623. dict_code bigint(20) not null comment '字典编码',
  624. tenant_id varchar(20) default '000000' comment '租户编号',
  625. dict_sort int(4) default 0 comment '字典排序',
  626. dict_label varchar(100) default '' comment '字典标签',
  627. dict_value varchar(100) default '' comment '字典键值',
  628. dict_type varchar(100) default '' comment '字典类型',
  629. css_class varchar(100) default null comment '样式属性(其他样式扩展)',
  630. list_class varchar(100) default null comment '表格回显样式',
  631. is_default char(1) default 'N' comment '是否默认(Y是 N否)',
  632. create_dept bigint(20) default null comment '创建部门',
  633. create_by bigint(20) default null comment '创建者',
  634. create_time datetime comment '创建时间',
  635. update_by bigint(20) default null comment '更新者',
  636. update_time datetime comment '更新时间',
  637. remark varchar(500) default null comment '备注',
  638. primary key (dict_code)
  639. ) engine=innodb DEFAULT CHARSET=utf8mb4 comment = '字典数据表';
  640. insert into sys_dict_data values(1, '000000', 1, '男', '0', 'sys_user_sex', '', '', 'Y', 103, 1, sysdate(), null, null, '性别男');
  641. insert into sys_dict_data values(2, '000000', 2, '女', '1', 'sys_user_sex', '', '', 'N', 103, 1, sysdate(), null, null, '性别女');
  642. insert into sys_dict_data values(3, '000000', 3, '未知', '2', 'sys_user_sex', '', '', 'N', 103, 1, sysdate(), null, null, '性别未知');
  643. insert into sys_dict_data values(4, '000000', 1, '显示', '0', 'sys_show_hide', '', 'primary', 'Y', 103, 1, sysdate(), null, null, '显示菜单');
  644. insert into sys_dict_data values(5, '000000', 2, '隐藏', '1', 'sys_show_hide', '', 'danger', 'N', 103, 1, sysdate(), null, null, '隐藏菜单');
  645. insert into sys_dict_data values(6, '000000', 1, '正常', '0', 'sys_normal_disable', '', 'primary', 'Y', 103, 1, sysdate(), null, null, '正常状态');
  646. insert into sys_dict_data values(7, '000000', 2, '停用', '1', 'sys_normal_disable', '', 'danger', 'N', 103, 1, sysdate(), null, null, '停用状态');
  647. insert into sys_dict_data values(12, '000000', 1, '是', 'Y', 'sys_yes_no', '', 'primary', 'Y', 103, 1, sysdate(), null, null, '系统默认是');
  648. insert into sys_dict_data values(13, '000000', 2, '否', 'N', 'sys_yes_no', '', 'danger', 'N', 103, 1, sysdate(), null, null, '系统默认否');
  649. insert into sys_dict_data values(14, '000000', 1, '通知', '1', 'sys_notice_type', '', 'warning', 'Y', 103, 1, sysdate(), null, null, '通知');
  650. insert into sys_dict_data values(15, '000000', 2, '公告', '2', 'sys_notice_type', '', 'success', 'N', 103, 1, sysdate(), null, null, '公告');
  651. insert into sys_dict_data values(16, '000000', 1, '正常', '0', 'sys_notice_status', '', 'primary', 'Y', 103, 1, sysdate(), null, null, '正常状态');
  652. insert into sys_dict_data values(17, '000000', 2, '关闭', '1', 'sys_notice_status', '', 'danger', 'N', 103, 1, sysdate(), null, null, '关闭状态');
  653. insert into sys_dict_data values(29, '000000', 99, '其他', '0', 'sys_oper_type', '', 'info', 'N', 103, 1, sysdate(), null, null, '其他操作');
  654. insert into sys_dict_data values(18, '000000', 1, '新增', '1', 'sys_oper_type', '', 'info', 'N', 103, 1, sysdate(), null, null, '新增操作');
  655. insert into sys_dict_data values(19, '000000', 2, '修改', '2', 'sys_oper_type', '', 'info', 'N', 103, 1, sysdate(), null, null, '修改操作');
  656. insert into sys_dict_data values(20, '000000', 3, '删除', '3', 'sys_oper_type', '', 'danger', 'N', 103, 1, sysdate(), null, null, '删除操作');
  657. insert into sys_dict_data values(21, '000000', 4, '授权', '4', 'sys_oper_type', '', 'primary', 'N', 103, 1, sysdate(), null, null, '授权操作');
  658. insert into sys_dict_data values(22, '000000', 5, '导出', '5', 'sys_oper_type', '', 'warning', 'N', 103, 1, sysdate(), null, null, '导出操作');
  659. insert into sys_dict_data values(23, '000000', 6, '导入', '6', 'sys_oper_type', '', 'warning', 'N', 103, 1, sysdate(), null, null, '导入操作');
  660. insert into sys_dict_data values(24, '000000', 7, '强退', '7', 'sys_oper_type', '', 'danger', 'N', 103, 1, sysdate(), null, null, '强退操作');
  661. insert into sys_dict_data values(25, '000000', 8, '生成代码', '8', 'sys_oper_type', '', 'warning', 'N', 103, 1, sysdate(), null, null, '生成操作');
  662. insert into sys_dict_data values(26, '000000', 9, '清空数据', '9', 'sys_oper_type', '', 'danger', 'N', 103, 1, sysdate(), null, null, '清空操作');
  663. insert into sys_dict_data values(27, '000000', 1, '成功', '0', 'sys_common_status', '', 'primary', 'N', 103, 1, sysdate(), null, null, '正常状态');
  664. insert into sys_dict_data values(28, '000000', 2, '失败', '1', 'sys_common_status', '', 'danger', 'N', 103, 1, sysdate(), null, null, '停用状态');
  665. insert into sys_dict_data values(30, '000000', 0, '密码认证', 'password', 'sys_grant_type', 'el-check-tag', 'default', 'N', 103, 1, sysdate(), null, null, '密码认证');
  666. insert into sys_dict_data values(31, '000000', 0, '短信认证', 'sms', 'sys_grant_type', 'el-check-tag', 'default', 'N', 103, 1, sysdate(), null, null, '短信认证');
  667. insert into sys_dict_data values(32, '000000', 0, '邮件认证', 'email', 'sys_grant_type', 'el-check-tag', 'default', 'N', 103, 1, sysdate(), null, null, '邮件认证');
  668. insert into sys_dict_data values(33, '000000', 0, '小程序认证', 'xcx', 'sys_grant_type', 'el-check-tag', 'default', 'N', 103, 1, sysdate(), null, null, '小程序认证');
  669. insert into sys_dict_data values(34, '000000', 0, '三方登录认证', 'social', 'sys_grant_type', 'el-check-tag', 'default', 'N', 103, 1, sysdate(), null, null, '三方登录认证');
  670. insert into sys_dict_data values(35, '000000', 0, 'PC', 'pc', 'sys_device_type', '', 'default', 'N', 103, 1, sysdate(), null, null, 'PC');
  671. insert into sys_dict_data values(36, '000000', 0, '安卓', 'android', 'sys_device_type', '', 'default', 'N', 103, 1, sysdate(), null, null, '安卓');
  672. insert into sys_dict_data values(37, '000000', 0, 'iOS', 'ios', 'sys_device_type', '', 'default', 'N', 103, 1, sysdate(), null, null, 'iOS');
  673. insert into sys_dict_data values(38, '000000', 0, '小程序', 'xcx', 'sys_device_type', '', 'default', 'N', 103, 1, sysdate(), null, null, '小程序');
  674. -- ----------------------------
  675. -- 13、参数配置表
  676. -- ----------------------------
  677. drop table if exists sys_config;
  678. create table sys_config (
  679. config_id bigint(20) not null comment '参数主键',
  680. tenant_id varchar(20) default '000000' comment '租户编号',
  681. config_name varchar(100) default '' comment '参数名称',
  682. config_key varchar(100) default '' comment '参数键名',
  683. config_value varchar(500) default '' comment '参数键值',
  684. config_type char(1) default 'N' comment '系统内置(Y是 N否)',
  685. create_dept bigint(20) default null comment '创建部门',
  686. create_by bigint(20) default null comment '创建者',
  687. create_time datetime comment '创建时间',
  688. update_by bigint(20) default null comment '更新者',
  689. update_time datetime comment '更新时间',
  690. remark varchar(500) default null comment '备注',
  691. primary key (config_id)
  692. ) engine=innodb DEFAULT CHARSET=utf8mb4 comment = '参数配置表';
  693. 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' );
  694. insert into sys_config values(2, '000000', '用户管理-账号初始密码', 'sys.user.initPassword', '123456', 'Y', 103, 1, sysdate(), null, null, '初始化密码 123456' );
  695. insert into sys_config values(3, '000000', '主框架页-侧边栏主题', 'sys.index.sideTheme', 'theme-dark', 'Y', 103, 1, sysdate(), null, null, '深色主题theme-dark,浅色主题theme-light' );
  696. insert into sys_config values(5, '000000', '账号自助-是否开启用户注册功能', 'sys.account.registerUser', 'false', 'Y', 103, 1, sysdate(), null, null, '是否开启注册用户功能(true开启,false关闭)');
  697. insert into sys_config values(11, '000000', 'OSS预览列表资源开关', 'sys.oss.previewListResource', 'true', 'Y', 103, 1, sysdate(), null, null, 'true:开启, false:关闭');
  698. -- ----------------------------
  699. -- 14、系统访问记录
  700. -- ----------------------------
  701. drop table if exists sys_logininfor;
  702. create table sys_logininfor (
  703. info_id bigint(20) not null comment '访问ID',
  704. tenant_id varchar(20) default '000000' comment '租户编号',
  705. user_name varchar(50) default '' comment '用户账号',
  706. client_key varchar(32) default '' comment '客户端',
  707. device_type varchar(32) default '' comment '设备类型',
  708. ipaddr varchar(128) default '' comment '登录IP地址',
  709. login_location varchar(255) default '' comment '登录地点',
  710. browser varchar(50) default '' comment '浏览器类型',
  711. os varchar(50) default '' comment '操作系统',
  712. status char(1) default '0' comment '登录状态(0成功 1失败)',
  713. msg varchar(255) default '' comment '提示消息',
  714. login_time datetime comment '访问时间',
  715. primary key (info_id),
  716. key idx_sys_logininfor_s (status),
  717. key idx_sys_logininfor_lt (login_time)
  718. ) engine=innodb DEFAULT CHARSET=utf8mb4 comment = '系统访问记录';
  719. -- ----------------------------
  720. -- 17、通知公告表
  721. -- ----------------------------
  722. drop table if exists sys_notice;
  723. create table sys_notice (
  724. notice_id bigint(20) not null comment '公告ID',
  725. tenant_id varchar(20) default '000000' comment '租户编号',
  726. notice_title varchar(50) not null comment '公告标题',
  727. notice_type char(1) not null comment '公告类型(1通知 2公告)',
  728. notice_content longblob default null comment '公告内容',
  729. status char(1) default '0' comment '公告状态(0正常 1关闭)',
  730. create_dept bigint(20) default null comment '创建部门',
  731. create_by bigint(20) default null comment '创建者',
  732. create_time datetime comment '创建时间',
  733. update_by bigint(20) default null comment '更新者',
  734. update_time datetime comment '更新时间',
  735. remark varchar(255) default null comment '备注',
  736. primary key (notice_id)
  737. ) engine=innodb DEFAULT CHARSET=utf8mb4 comment = '通知公告表';
  738. -- ----------------------------
  739. -- 初始化-公告信息表数据
  740. -- ----------------------------
  741. insert into sys_notice values('1', '000000', '温馨提醒:2018-07-01 新版本发布啦', '2', '新版本内容', '0', 103, 1, sysdate(), null, null, '管理员');
  742. insert into sys_notice values('2', '000000', '维护通知:2018-07-01 系统凌晨维护', '1', '维护内容', '0', 103, 1, sysdate(), null, null, '管理员');
  743. -- ----------------------------
  744. -- 18、代码生成业务表
  745. -- ----------------------------
  746. drop table if exists gen_table;
  747. create table gen_table (
  748. table_id bigint(20) not null comment '编号',
  749. data_name varchar(200) default '' comment '数据源名称',
  750. table_name varchar(200) default '' comment '表名称',
  751. table_comment varchar(500) default '' comment '表描述',
  752. sub_table_name varchar(64) default null comment '关联子表的表名',
  753. sub_table_fk_name varchar(64) default null comment '子表关联的外键名',
  754. class_name varchar(100) default '' comment '实体类名称',
  755. tpl_category varchar(200) default 'crud' comment '使用的模板(crud单表操作 tree树表操作)',
  756. package_name varchar(100) comment '生成包路径',
  757. module_name varchar(30) comment '生成模块名',
  758. business_name varchar(30) comment '生成业务名',
  759. function_name varchar(50) comment '生成功能名',
  760. function_author varchar(50) comment '生成功能作者',
  761. gen_type char(1) default '0' comment '生成代码方式(0zip压缩包 1自定义路径)',
  762. gen_path varchar(200) default '/' comment '生成路径(不填默认项目路径)',
  763. options varchar(1000) comment '其它生成选项',
  764. create_dept bigint(20) default null comment '创建部门',
  765. create_by bigint(20) default null comment '创建者',
  766. create_time datetime comment '创建时间',
  767. update_by bigint(20) default null comment '更新者',
  768. update_time datetime comment '更新时间',
  769. remark varchar(500) default null comment '备注',
  770. primary key (table_id)
  771. ) engine=innodb DEFAULT CHARSET=utf8mb4 comment = '代码生成业务表';
  772. -- ----------------------------
  773. -- 19、代码生成业务表字段
  774. -- ----------------------------
  775. drop table if exists gen_table_column;
  776. create table gen_table_column (
  777. column_id bigint(20) not null comment '编号',
  778. table_id bigint(20) comment '归属表编号',
  779. column_name varchar(200) comment '列名称',
  780. column_comment varchar(500) comment '列描述',
  781. column_type varchar(100) comment '列类型',
  782. java_type varchar(500) comment 'JAVA类型',
  783. java_field varchar(200) comment 'JAVA字段名',
  784. is_pk char(1) comment '是否主键(1是)',
  785. is_increment char(1) comment '是否自增(1是)',
  786. is_required char(1) comment '是否必填(1是)',
  787. is_insert char(1) comment '是否为插入字段(1是)',
  788. is_edit char(1) comment '是否编辑字段(1是)',
  789. is_list char(1) comment '是否列表字段(1是)',
  790. is_query char(1) comment '是否查询字段(1是)',
  791. query_type varchar(200) default 'EQ' comment '查询方式(等于、不等于、大于、小于、范围)',
  792. html_type varchar(200) comment '显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)',
  793. dict_type varchar(200) default '' comment '字典类型',
  794. sort int comment '排序',
  795. create_dept bigint(20) default null comment '创建部门',
  796. create_by bigint(20) default null comment '创建者',
  797. create_time datetime comment '创建时间',
  798. update_by bigint(20) default null comment '更新者',
  799. update_time datetime comment '更新时间',
  800. primary key (column_id)
  801. ) engine=innodb DEFAULT CHARSET=utf8mb4 comment = '代码生成业务表字段';
  802. -- ----------------------------
  803. -- OSS对象存储表
  804. -- ----------------------------
  805. drop table if exists sys_oss;
  806. create table sys_oss (
  807. oss_id bigint(20) not null comment '对象存储主键',
  808. tenant_id varchar(20) default '000000' comment '租户编号',
  809. file_name varchar(255) not null default '' comment '文件名',
  810. original_name varchar(255) not null default '' comment '原名',
  811. file_suffix varchar(10) not null default '' comment '文件后缀名',
  812. url varchar(500) not null comment 'URL地址',
  813. ext1 text default null comment '扩展字段',
  814. create_dept bigint(20) default null comment '创建部门',
  815. create_time datetime default null comment '创建时间',
  816. create_by bigint(20) default null comment '上传人',
  817. update_time datetime default null comment '更新时间',
  818. update_by bigint(20) default null comment '更新人',
  819. service varchar(20) not null default 'minio' comment '服务商',
  820. primary key (oss_id)
  821. ) engine=innodb DEFAULT CHARSET=utf8mb4 comment='OSS对象存储表';
  822. -- ----------------------------
  823. -- OSS对象存储动态配置表
  824. -- ----------------------------
  825. drop table if exists sys_oss_config;
  826. create table sys_oss_config (
  827. oss_config_id bigint(20) not null comment '主键',
  828. tenant_id varchar(20) default '000000'comment '租户编号',
  829. config_key varchar(20) not null default '' comment '配置key',
  830. access_key varchar(255) default '' comment 'accessKey',
  831. secret_key varchar(255) default '' comment '秘钥',
  832. bucket_name varchar(255) default '' comment '桶名称',
  833. prefix varchar(255) default '' comment '前缀',
  834. endpoint varchar(255) default '' comment '访问站点',
  835. domain varchar(255) default '' comment '自定义域名',
  836. is_https char(1) default 'N' comment '是否https(Y=是,N=否)',
  837. region varchar(255) default '' comment '域',
  838. access_policy char(1) not null default '1' comment '桶权限类型(0=private 1=public 2=custom)',
  839. status char(1) default '1' comment '是否默认(0=是,1=否)',
  840. ext1 varchar(255) default '' comment '扩展字段',
  841. create_dept bigint(20) default null comment '创建部门',
  842. create_by bigint(20) default null comment '创建者',
  843. create_time datetime default null comment '创建时间',
  844. update_by bigint(20) default null comment '更新者',
  845. update_time datetime default null comment '更新时间',
  846. remark varchar(500) default null comment '备注',
  847. primary key (oss_config_id)
  848. ) engine=innodb DEFAULT CHARSET=utf8mb4 comment='对象存储配置表';
  849. insert into sys_oss_config values (1, '000000', 'minio', 'rjzytest', 'rjzytest', 'rjzytest', '', '106.55.100.207:9000', '','N', '', '1' ,'0', '', 103, 1, sysdate(), 1, sysdate(), null);
  850. insert into sys_oss_config values (2, '000000', 'qiniu', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 's3-cn-north-1.qiniucs.com', '','N', '', '1' ,'1', '', 103, 1, sysdate(), 1, sysdate(), null);
  851. insert into sys_oss_config values (3, '000000', 'aliyun', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 'oss-cn-beijing.aliyuncs.com', '','N', '', '1' ,'1', '', 103, 1, sysdate(), 1, sysdate(), null);
  852. insert into sys_oss_config values (4, '000000', 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1240000000', '', 'cos.ap-beijing.myqcloud.com', '','N', 'ap-beijing', '1' ,'1', '', 103, 1, sysdate(), 1, sysdate(), null);
  853. insert into sys_oss_config values (5, '000000', 'image', 'rjzytest', 'rjzytest', 'rjzytest', 'image', '106.55.100.207:9000', '','N', '', '1' ,'1', '', 103, 1, sysdate(), 1, sysdate(), null);
  854. -- ----------------------------
  855. -- 系统授权表
  856. -- ----------------------------
  857. drop table if exists sys_client;
  858. create table sys_client (
  859. id bigint(20) not null comment 'id',
  860. client_id varchar(64) default null comment '客户端id',
  861. client_key varchar(32) default null comment '客户端key',
  862. client_secret varchar(255) default null comment '客户端秘钥',
  863. grant_type varchar(255) default null comment '授权类型',
  864. device_type varchar(32) default null comment '设备类型',
  865. active_timeout int(11) default 1800 comment 'token活跃超时时间',
  866. timeout int(11) default 604800 comment 'token固定超时',
  867. status char(1) default '0' comment '状态(0正常 1停用)',
  868. del_flag char(1) default '0' comment '删除标志(0代表存在 1代表删除)',
  869. create_dept bigint(20) default null comment '创建部门',
  870. create_by bigint(20) default null comment '创建者',
  871. create_time datetime default null comment '创建时间',
  872. update_by bigint(20) default null comment '更新者',
  873. update_time datetime default null comment '更新时间',
  874. primary key (id)
  875. ) engine=innodb DEFAULT CHARSET=utf8mb4 comment='系统授权表';
  876. insert into sys_client values (1, 'e5cd7e4891bf95d1d19206ce24a7b32e', 'pc', 'pc123', 'password,social', 'pc', 1800, 604800, 0, 0, 103, 1, sysdate(), 1, sysdate());
  877. insert into sys_client values (2, '428a8310cd442757ae699df5d894f051', 'app', 'app123', 'password,sms,social', 'android', 1800, 604800, 0, 0, 103, 1, sysdate(), 1, sysdate());
  878. DROP TABLE IF EXISTS test_demo;
  879. CREATE TABLE test_demo
  880. (
  881. id bigint(0) NOT NULL COMMENT '主键',
  882. tenant_id varchar(20) NULL DEFAULT '000000' COMMENT '租户编号',
  883. dept_id bigint(0) NULL DEFAULT NULL COMMENT '部门id',
  884. user_id bigint(0) NULL DEFAULT NULL COMMENT '用户id',
  885. order_num int(0) NULL DEFAULT 0 COMMENT '排序号',
  886. test_key varchar(255) NULL DEFAULT NULL COMMENT 'key键',
  887. value varchar(255) NULL DEFAULT NULL COMMENT '值',
  888. version int(0) NULL DEFAULT 0 COMMENT '版本',
  889. create_dept bigint(0) NULL DEFAULT NULL COMMENT '创建部门',
  890. create_time datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  891. create_by bigint(0) NULL DEFAULT NULL COMMENT '创建人',
  892. update_time datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  893. update_by bigint(0) NULL DEFAULT NULL COMMENT '更新人',
  894. del_flag int(0) NULL DEFAULT 0 COMMENT '删除标志',
  895. PRIMARY KEY (id) USING BTREE
  896. ) ENGINE = InnoDB COMMENT = '测试单表';
  897. DROP TABLE IF EXISTS test_tree;
  898. CREATE TABLE test_tree
  899. (
  900. id bigint(0) NOT NULL COMMENT '主键',
  901. tenant_id varchar(20) NULL DEFAULT '000000' COMMENT '租户编号',
  902. parent_id bigint(0) NULL DEFAULT 0 COMMENT '父id',
  903. dept_id bigint(0) NULL DEFAULT NULL COMMENT '部门id',
  904. user_id bigint(0) NULL DEFAULT NULL COMMENT '用户id',
  905. tree_name varchar(255) NULL DEFAULT NULL COMMENT '值',
  906. version int(0) NULL DEFAULT 0 COMMENT '版本',
  907. create_dept bigint(0) NULL DEFAULT NULL COMMENT '创建部门',
  908. create_time datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  909. create_by bigint(0) NULL DEFAULT NULL COMMENT '创建人',
  910. update_time datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  911. update_by bigint(0) NULL DEFAULT NULL COMMENT '更新人',
  912. del_flag int(0) NULL DEFAULT 0 COMMENT '删除标志',
  913. PRIMARY KEY (id) USING BTREE
  914. ) ENGINE = InnoDB COMMENT = '测试树表';
  915. INSERT INTO test_demo VALUES (1, '000000', 102, 4, 1, '测试数据权限', '测试', 0, 103, sysdate(), 1, NULL, NULL, 0);
  916. INSERT INTO test_demo VALUES (2, '000000', 102, 3, 2, '子节点1', '111', 0, 103, sysdate(), 1, NULL, NULL, 0);
  917. INSERT INTO test_demo VALUES (3, '000000', 102, 3, 3, '子节点2', '222', 0, 103, sysdate(), 1, NULL, NULL, 0);
  918. INSERT INTO test_demo VALUES (4, '000000', 108, 4, 4, '测试数据', 'demo', 0, 103, sysdate(), 1, NULL, NULL, 0);
  919. INSERT INTO test_demo VALUES (5, '000000', 108, 3, 13, '子节点11', '1111', 0, 103, sysdate(), 1, NULL, NULL, 0);
  920. INSERT INTO test_demo VALUES (6, '000000', 108, 3, 12, '子节点22', '2222', 0, 103, sysdate(), 1, NULL, NULL, 0);
  921. INSERT INTO test_demo VALUES (7, '000000', 108, 3, 11, '子节点33', '3333', 0, 103, sysdate(), 1, NULL, NULL, 0);
  922. INSERT INTO test_demo VALUES (8, '000000', 108, 3, 10, '子节点44', '4444', 0, 103, sysdate(), 1, NULL, NULL, 0);
  923. INSERT INTO test_demo VALUES (9, '000000', 108, 3, 9, '子节点55', '5555', 0, 103, sysdate(), 1, NULL, NULL, 0);
  924. INSERT INTO test_demo VALUES (10, '000000', 108, 3, 8, '子节点66', '6666', 0, 103, sysdate(), 1, NULL, NULL, 0);
  925. INSERT INTO test_demo VALUES (11, '000000', 108, 3, 7, '子节点77', '7777', 0, 103, sysdate(), 1, NULL, NULL, 0);
  926. INSERT INTO test_demo VALUES (12, '000000', 108, 3, 6, '子节点88', '8888', 0, 103, sysdate(), 1, NULL, NULL, 0);
  927. INSERT INTO test_demo VALUES (13, '000000', 108, 3, 5, '子节点99', '9999', 0, 103, sysdate(), 1, NULL, NULL, 0);
  928. INSERT INTO test_tree VALUES (1, '000000', 0, 102, 4, '测试数据权限', 0, 103, sysdate(), 1, NULL, NULL, 0);
  929. INSERT INTO test_tree VALUES (2, '000000', 1, 102, 3, '子节点1', 0, 103, sysdate(), 1, NULL, NULL, 0);
  930. INSERT INTO test_tree VALUES (3, '000000', 2, 102, 3, '子节点2', 0, 103, sysdate(), 1, NULL, NULL, 0);
  931. INSERT INTO test_tree VALUES (4, '000000', 0, 108, 4, '测试树1', 0, 103, sysdate(), 1, NULL, NULL, 0);
  932. INSERT INTO test_tree VALUES (5, '000000', 4, 108, 3, '子节点11', 0, 103, sysdate(), 1, NULL, NULL, 0);
  933. INSERT INTO test_tree VALUES (6, '000000', 4, 108, 3, '子节点22', 0, 103, sysdate(), 1, NULL, NULL, 0);
  934. INSERT INTO test_tree VALUES (7, '000000', 4, 108, 3, '子节点33', 0, 103, sysdate(), 1, NULL, NULL, 0);
  935. INSERT INTO test_tree VALUES (8, '000000', 5, 108, 3, '子节点44', 0, 103, sysdate(), 1, NULL, NULL, 0);
  936. INSERT INTO test_tree VALUES (9, '000000', 6, 108, 3, '子节点55', 0, 103, sysdate(), 1, NULL, NULL, 0);
  937. INSERT INTO test_tree VALUES (10, '000000', 7, 108, 3, '子节点66', 0, 103, sysdate(), 1, NULL, NULL, 0);
  938. INSERT INTO test_tree VALUES (11, '000000', 7, 108, 3, '子节点77', 0, 103, sysdate(), 1, NULL, NULL, 0);
  939. INSERT INTO test_tree VALUES (12, '000000', 10, 108, 3, '子节点88', 0, 103, sysdate(), 1, NULL, NULL, 0);
  940. INSERT INTO test_tree VALUES (13, '000000', 10, 108, 3, '子节点99', 0, 103, sysdate(), 1, NULL, NULL, 0);
  941. -- ============================================================
  942. -- 任务调度模块(SnailJob)
  943. -- ============================================================
  944. SET NAMES utf8mb4;
  945. DROP TABLE IF EXISTS `sj_namespace`;
  946. drop table if exists sj_namespace;
  947. CREATE TABLE `sj_namespace`
  948. (
  949. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  950. `name` varchar(64) NOT NULL COMMENT '名称',
  951. `unique_id` varchar(64) NOT NULL COMMENT '唯一id',
  952. `description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
  953. `deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '逻辑删除 1、删除',
  954. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  955. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  956. PRIMARY KEY (`id`),
  957. KEY `idx_name` (`name`),
  958. UNIQUE KEY `uk_unique_id` (`unique_id`)
  959. ) ENGINE = InnoDB
  960. DEFAULT CHARSET = utf8mb4 COMMENT ='命名空间';
  961. INSERT INTO `sj_namespace` VALUES (1, 'Development', 'dev', '', 0, now(), now());
  962. INSERT INTO `sj_namespace` VALUES (2, 'Production', 'prod', '', 0, now(), now());
  963. DROP TABLE IF EXISTS `sj_group_config`;
  964. drop table if exists sj_group_config;
  965. CREATE TABLE `sj_group_config`
  966. (
  967. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  968. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  969. `group_name` varchar(64) NOT NULL DEFAULT '' COMMENT '组名称',
  970. `description` varchar(256) NOT NULL DEFAULT '' COMMENT '组描述',
  971. `token` varchar(64) NOT NULL DEFAULT 'SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT' COMMENT 'token',
  972. `group_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '组状态 0、未启用 1、启用',
  973. `version` int(11) NOT NULL COMMENT '版本号',
  974. `group_partition` int(11) NOT NULL COMMENT '分区',
  975. `id_generator_mode` tinyint(4) NOT NULL DEFAULT 1 COMMENT '唯一id生成模式 默认号段模式',
  976. `init_scene` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否初始化场景 0:否 1:是',
  977. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  978. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  979. PRIMARY KEY (`id`),
  980. UNIQUE KEY `uk_namespace_id_group_name` (`namespace_id`, `group_name`)
  981. ) ENGINE = InnoDB
  982. AUTO_INCREMENT = 0
  983. DEFAULT CHARSET = utf8mb4 COMMENT ='组配置';
  984. INSERT INTO `sj_group_config` VALUES (1, 'dev', 'ruoyi_group', '', 'SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT', 1, 1, 0, 1, 1, now(), now());
  985. INSERT INTO `sj_group_config` VALUES (2, 'prod', 'ruoyi_group', '', 'SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT', 1, 1, 0, 1, 1, now(), now());
  986. DROP TABLE IF EXISTS `sj_notify_config`;
  987. drop table if exists sj_notify_config;
  988. CREATE TABLE `sj_notify_config`
  989. (
  990. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  991. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  992. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  993. `notify_name` varchar(64) NOT NULL DEFAULT '' COMMENT '通知名称',
  994. `system_task_type` tinyint(4) NOT NULL DEFAULT 3 COMMENT '任务类型 1. 重试任务 2. 重试回调 3、JOB任务 4、WORKFLOW任务',
  995. `notify_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '通知状态 0、未启用 1、启用',
  996. `recipient_ids` varchar(128) NOT NULL COMMENT '接收人id列表',
  997. `notify_threshold` int(11) NOT NULL DEFAULT 0 COMMENT '通知阈值',
  998. `notify_scene` tinyint(4) NOT NULL DEFAULT 0 COMMENT '通知场景',
  999. `rate_limiter_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '限流状态 0、未启用 1、启用',
  1000. `rate_limiter_threshold` int(11) NOT NULL DEFAULT 0 COMMENT '每秒限流阈值',
  1001. `description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
  1002. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1003. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  1004. PRIMARY KEY (`id`),
  1005. KEY `idx_namespace_id_group_name_scene_name` (`namespace_id`, `group_name`)
  1006. ) ENGINE = InnoDB
  1007. AUTO_INCREMENT = 0
  1008. DEFAULT CHARSET = utf8mb4 COMMENT ='通知配置';
  1009. DROP TABLE IF EXISTS `sj_notify_recipient`;
  1010. drop table if exists sj_notify_recipient;
  1011. CREATE TABLE `sj_notify_recipient`
  1012. (
  1013. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  1014. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  1015. `recipient_name` varchar(64) NOT NULL COMMENT '接收人名称',
  1016. `notify_type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '通知类型 1、钉钉 2、邮件 3、企业微信 4 飞书 5 webhook',
  1017. `notify_attribute` varchar(512) NOT NULL COMMENT '配置属性',
  1018. `description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
  1019. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1020. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  1021. PRIMARY KEY (`id`),
  1022. KEY `idx_namespace_id` (`namespace_id`)
  1023. ) ENGINE = InnoDB
  1024. AUTO_INCREMENT = 0
  1025. DEFAULT CHARSET = utf8mb4 COMMENT ='告警通知接收人';
  1026. DROP TABLE IF EXISTS `sj_retry_dead_letter`;
  1027. drop table if exists sj_retry_dead_letter;
  1028. CREATE TABLE `sj_retry_dead_letter`
  1029. (
  1030. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  1031. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  1032. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  1033. `group_id` bigint(20) NOT NULL COMMENT '组Id',
  1034. `scene_name` varchar(64) NOT NULL COMMENT '场景名称',
  1035. `scene_id` bigint(20) NOT NULL COMMENT '场景ID',
  1036. `idempotent_id` varchar(64) NOT NULL COMMENT '幂等id',
  1037. `biz_no` varchar(64) NOT NULL DEFAULT '' COMMENT '业务编号',
  1038. `executor_name` varchar(512) NOT NULL DEFAULT '' COMMENT '执行器名称',
  1039. -- jackson 兼容历史数据 预计1.8.0默认改为fury
  1040. `serializer_name` varchar(32) NOT NULL DEFAULT 'jackson' COMMENT '执行方法参数序列化器名称',
  1041. `args_str` text NOT NULL COMMENT '执行方法参数',
  1042. `ext_attrs` text NOT NULL COMMENT '扩展字段',
  1043. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1044. PRIMARY KEY (`id`),
  1045. KEY `idx_namespace_id_group_name_scene_name` (`namespace_id`, `group_name`, `scene_name`),
  1046. KEY `idx_idempotent_id` (`idempotent_id`),
  1047. KEY `idx_biz_no` (`biz_no`),
  1048. KEY `idx_create_dt` (`create_dt`)
  1049. ) ENGINE = InnoDB
  1050. AUTO_INCREMENT = 0
  1051. DEFAULT CHARSET = utf8mb4 COMMENT ='死信队列表';
  1052. DROP TABLE IF EXISTS `sj_retry`;
  1053. drop table if exists sj_retry;
  1054. CREATE TABLE `sj_retry`
  1055. (
  1056. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  1057. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  1058. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  1059. `group_id` bigint(20) NOT NULL COMMENT '组Id',
  1060. `scene_name` varchar(64) NOT NULL COMMENT '场景名称',
  1061. `scene_id` bigint(20) NOT NULL COMMENT '场景ID',
  1062. `idempotent_id` varchar(64) NOT NULL COMMENT '幂等id',
  1063. `biz_no` varchar(64) NOT NULL DEFAULT '' COMMENT '业务编号',
  1064. `executor_name` varchar(512) NOT NULL DEFAULT '' COMMENT '执行器名称',
  1065. `args_str` text NOT NULL COMMENT '执行方法参数',
  1066. `ext_attrs` text NOT NULL COMMENT '扩展字段',
  1067. -- jackson 兼容历史数据 预计1.8.0默认改为fury
  1068. `serializer_name` varchar(32) NOT NULL DEFAULT 'jackson' COMMENT '执行方法参数序列化器名称',
  1069. `next_trigger_at` bigint(13) NOT NULL COMMENT '下次触发时间',
  1070. `retry_count` int(11) NOT NULL DEFAULT 0 COMMENT '重试次数',
  1071. `retry_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '重试状态 0、重试中 1、成功 2、最大重试次数',
  1072. `task_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '任务类型 1、重试数据 2、回调数据',
  1073. `bucket_index` int(11) NOT NULL DEFAULT 0 COMMENT 'bucket',
  1074. `parent_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '父节点id',
  1075. `deleted` bigint(20) NOT NULL DEFAULT 0 COMMENT '逻辑删除',
  1076. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1077. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  1078. PRIMARY KEY (`id`),
  1079. KEY `idx_biz_no` (`biz_no`),
  1080. KEY `idx_idempotent_id` (`idempotent_id`),
  1081. KEY `idx_retry_status_bucket_index` (`retry_status`, `bucket_index`),
  1082. KEY `idx_parent_id` (`parent_id`),
  1083. KEY `idx_create_dt` (`create_dt`),
  1084. UNIQUE KEY `uk_scene_tasktype_idempotentid_deleted` (`scene_id`, `task_type`, `idempotent_id`, `deleted`)
  1085. ) ENGINE = InnoDB
  1086. AUTO_INCREMENT = 0
  1087. DEFAULT CHARSET = utf8mb4 COMMENT ='重试信息表';
  1088. DROP TABLE IF EXISTS `sj_retry_task`;
  1089. drop table if exists sj_retry_task;
  1090. CREATE TABLE `sj_retry_task`
  1091. (
  1092. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  1093. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  1094. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  1095. `scene_name` varchar(64) NOT NULL COMMENT '场景名称',
  1096. `retry_id` bigint(20) NOT NULL COMMENT '重试信息Id',
  1097. `ext_attrs` text NOT NULL COMMENT '扩展字段',
  1098. `task_status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '重试状态',
  1099. `task_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '任务类型 1、重试数据 2、回调数据',
  1100. `operation_reason` tinyint(4) NOT NULL DEFAULT 0 COMMENT '操作原因',
  1101. `client_info` varchar(128) DEFAULT NULL COMMENT '客户端地址 clientId#ip:port',
  1102. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1103. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  1104. PRIMARY KEY (`id`),
  1105. KEY `idx_group_name_scene_name` (`namespace_id`, `group_name`, `scene_name`),
  1106. KEY `task_status` (`task_status`),
  1107. KEY `idx_create_dt` (`create_dt`),
  1108. KEY `idx_retry_id` (`retry_id`)
  1109. ) ENGINE = InnoDB
  1110. AUTO_INCREMENT = 0
  1111. DEFAULT CHARSET = utf8mb4 COMMENT ='重试任务表';
  1112. DROP TABLE IF EXISTS `sj_retry_task_log_message`;
  1113. drop table if exists sj_retry_task_log_message;
  1114. CREATE TABLE `sj_retry_task_log_message`
  1115. (
  1116. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  1117. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  1118. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  1119. `retry_id` bigint(20) NOT NULL COMMENT '重试信息Id',
  1120. `retry_task_id` bigint(20) NOT NULL COMMENT '重试任务Id',
  1121. `message` longtext NOT NULL COMMENT '异常信息',
  1122. `log_num` int(11) NOT NULL DEFAULT 1 COMMENT '日志数量',
  1123. `real_time` bigint(13) NOT NULL DEFAULT 0 COMMENT '上报时间',
  1124. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1125. PRIMARY KEY (`id`),
  1126. KEY `idx_namespace_id_group_name_retry_task_id` (`namespace_id`, `group_name`, `retry_task_id`),
  1127. KEY `idx_create_dt` (`create_dt`)
  1128. ) ENGINE = InnoDB
  1129. AUTO_INCREMENT = 0
  1130. DEFAULT CHARSET = utf8mb4 COMMENT ='任务调度日志信息记录表';
  1131. DROP TABLE IF EXISTS `sj_retry_scene_config`;
  1132. drop table if exists sj_retry_scene_config;
  1133. CREATE TABLE `sj_retry_scene_config`
  1134. (
  1135. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  1136. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  1137. `scene_name` varchar(64) NOT NULL COMMENT '场景名称',
  1138. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  1139. `scene_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '组状态 0、未启用 1、启用',
  1140. `max_retry_count` int(11) NOT NULL DEFAULT 5 COMMENT '最大重试次数',
  1141. `back_off` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1、默认等级 2、固定间隔时间 3、CRON 表达式',
  1142. `trigger_interval` varchar(16) NOT NULL DEFAULT '' COMMENT '间隔时长',
  1143. `notify_ids` varchar(128) NOT NULL DEFAULT '' COMMENT '通知告警场景配置id列表',
  1144. `deadline_request` bigint(20) unsigned NOT NULL DEFAULT 60000 COMMENT 'Deadline Request 调用链超时 单位毫秒',
  1145. `executor_timeout` int(11) unsigned NOT NULL DEFAULT 5 COMMENT '任务执行超时时间,单位秒',
  1146. `route_key` tinyint(4) NOT NULL DEFAULT 4 COMMENT '路由策略',
  1147. `block_strategy` tinyint(4) NOT NULL DEFAULT 1 COMMENT '阻塞策略 1、丢弃 2、覆盖 3、并行',
  1148. `cb_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '回调状态 0、不开启 1、开启',
  1149. `cb_trigger_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1、默认等级 2、固定间隔时间 3、CRON 表达式',
  1150. `cb_max_count` int(11) NOT NULL DEFAULT 16 COMMENT '回调的最大执行次数',
  1151. `cb_trigger_interval` varchar(16) NOT NULL DEFAULT '' COMMENT '回调的最大执行次数',
  1152. `owner_id` bigint(20) NULL DEFAULT NULL COMMENT '负责人id',
  1153. `labels` varchar(512) NULL DEFAULT '' COMMENT '标签',
  1154. `description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
  1155. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1156. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  1157. PRIMARY KEY (`id`),
  1158. UNIQUE KEY `uk_namespace_id_group_name_scene_name` (`namespace_id`, `group_name`, `scene_name`)
  1159. ) ENGINE = InnoDB
  1160. AUTO_INCREMENT = 0
  1161. DEFAULT CHARSET = utf8mb4 COMMENT ='场景配置';
  1162. DROP TABLE IF EXISTS `sj_server_node`;
  1163. drop table if exists sj_server_node;
  1164. CREATE TABLE `sj_server_node`
  1165. (
  1166. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  1167. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  1168. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  1169. `host_id` varchar(64) NOT NULL COMMENT '主机id',
  1170. `host_ip` varchar(64) NOT NULL COMMENT '机器ip',
  1171. `host_port` int(16) NOT NULL COMMENT '机器端口',
  1172. `expire_at` datetime NOT NULL COMMENT '过期时间',
  1173. `node_type` tinyint(4) NOT NULL COMMENT '节点类型 1、客户端 2、是服务端',
  1174. `ext_attrs` varchar(256) NULL DEFAULT '' COMMENT '扩展字段',
  1175. `labels` varchar(512) NULL DEFAULT '' COMMENT '标签',
  1176. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1177. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  1178. PRIMARY KEY (`id`),
  1179. KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`),
  1180. KEY `idx_expire_at_node_type` (`expire_at`, `node_type`),
  1181. UNIQUE KEY `uk_host_id_host_ip` (`host_id`, `host_ip`)
  1182. ) ENGINE = InnoDB
  1183. AUTO_INCREMENT = 0
  1184. DEFAULT CHARSET = utf8mb4 COMMENT ='服务器节点';
  1185. DROP TABLE IF EXISTS `sj_distributed_lock`;
  1186. drop table if exists sj_distributed_lock;
  1187. CREATE TABLE `sj_distributed_lock`
  1188. (
  1189. `name` varchar(64) NOT NULL COMMENT '锁名称',
  1190. `lock_until` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '锁定时长',
  1191. `locked_at` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '锁定时间',
  1192. `locked_by` varchar(255) NOT NULL COMMENT '锁定者',
  1193. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1194. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  1195. PRIMARY KEY (`name`)
  1196. ) ENGINE = InnoDB
  1197. AUTO_INCREMENT = 0
  1198. DEFAULT CHARSET = utf8mb4 COMMENT ='锁定表';
  1199. DROP TABLE IF EXISTS `sj_system_user`;
  1200. drop table if exists sj_system_user;
  1201. CREATE TABLE `sj_system_user`
  1202. (
  1203. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  1204. `username` varchar(64) NOT NULL COMMENT '账号',
  1205. `password` varchar(128) NOT NULL COMMENT '密码',
  1206. `role` tinyint(4) NOT NULL DEFAULT 0 COMMENT '角色:1-普通用户、2-管理员',
  1207. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1208. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  1209. PRIMARY KEY (`id`),
  1210. UNIQUE KEY `uk_username` (`username`) USING BTREE
  1211. ) ENGINE = InnoDB
  1212. DEFAULT CHARSET = utf8mb4 COMMENT ='系统用户表';
  1213. -- pwd: admin
  1214. INSERT INTO `sj_system_user` (username, password, role)
  1215. VALUES ('admin', '465c194afb65670f38322df087f0a9bb225cc257e43eb4ac5a0c98ef5b3173ac', 2);
  1216. DROP TABLE IF EXISTS `sj_system_user_permission`;
  1217. drop table if exists sj_system_user_permission;
  1218. CREATE TABLE `sj_system_user_permission`
  1219. (
  1220. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  1221. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  1222. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  1223. `system_user_id` bigint(20) NOT NULL COMMENT '系统用户id',
  1224. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1225. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  1226. PRIMARY KEY (`id`),
  1227. UNIQUE KEY `uk_namespace_id_group_name_system_user_id` (`namespace_id`, `group_name`, `system_user_id`)
  1228. ) ENGINE = InnoDB
  1229. DEFAULT CHARSET = utf8mb4 COMMENT ='系统用户权限表';
  1230. -- 分布式调度DDL
  1231. DROP TABLE IF EXISTS `sj_job`;
  1232. drop table if exists sj_job;
  1233. CREATE TABLE `sj_job`
  1234. (
  1235. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  1236. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  1237. `biz_id` varchar(64) NOT NULL COMMENT '业务ID',
  1238. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  1239. `job_name` varchar(64) NOT NULL COMMENT '名称',
  1240. `args_str` text DEFAULT NULL COMMENT '执行方法参数',
  1241. `args_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '参数类型 ',
  1242. `next_trigger_at` bigint(13) NOT NULL COMMENT '下次触发时间',
  1243. `job_status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '任务状态 0、关闭、1、开启',
  1244. `task_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '任务类型 1、集群 2、广播 3、切片',
  1245. `route_key` tinyint(4) NOT NULL DEFAULT 4 COMMENT '路由策略',
  1246. `executor_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '执行器类型',
  1247. `executor_info` varchar(255) DEFAULT NULL COMMENT '执行器名称',
  1248. `trigger_type` tinyint(4) NOT NULL COMMENT '触发类型 1.CRON 表达式 2. 固定时间',
  1249. `trigger_interval` varchar(255) NOT NULL COMMENT '间隔时长',
  1250. `block_strategy` tinyint(4) NOT NULL DEFAULT 1 COMMENT '阻塞策略 1、丢弃 2、覆盖 3、并行 4、恢复',
  1251. `executor_timeout` int(11) NOT NULL DEFAULT 0 COMMENT '任务执行超时时间,单位秒',
  1252. `max_retry_times` int(11) NOT NULL DEFAULT 0 COMMENT '最大重试次数',
  1253. `parallel_num` int(11) NOT NULL DEFAULT 1 COMMENT '并行数',
  1254. `retry_interval` int(11) NOT NULL DEFAULT 0 COMMENT '重试间隔(s)',
  1255. `bucket_index` int(11) NOT NULL DEFAULT 0 COMMENT 'bucket',
  1256. `resident` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否是常驻任务',
  1257. `notify_ids` varchar(128) NOT NULL DEFAULT '' COMMENT '通知告警场景配置id列表',
  1258. `owner_id` bigint(20) NULL DEFAULT NULL COMMENT '负责人id',
  1259. `labels` varchar(512) NULL DEFAULT '' COMMENT '标签',
  1260. `description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
  1261. `ext_attrs` varchar(256) NULL DEFAULT '' COMMENT '扩展字段',
  1262. `deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '逻辑删除 1、删除',
  1263. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1264. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  1265. PRIMARY KEY (`id`),
  1266. KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`),
  1267. KEY `idx_job_status_bucket_index` (`job_status`, `bucket_index`),
  1268. KEY `idx_create_dt` (`create_dt`),
  1269. UNIQUE KEY `uk_sj_job_01` (`namespace_id`, `biz_id`)
  1270. ) ENGINE = InnoDB
  1271. AUTO_INCREMENT = 0
  1272. DEFAULT CHARSET = utf8mb4 COMMENT ='任务信息';
  1273. INSERT INTO `sj_job` VALUES (1, 'dev', 'demo-job', 'ruoyi_group', 'demo-job', null, 1, 1710344035622, 1, 1, 4, 1, 'testJobExecutor', 2, '60', 1, 60, 3, 1, 1, 116, 0, '', 1, '','', '', 0 , now(), now());
  1274. DROP TABLE IF EXISTS `sj_job_log_message`;
  1275. drop table if exists sj_job_log_message;
  1276. CREATE TABLE `sj_job_log_message`
  1277. (
  1278. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  1279. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  1280. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  1281. `job_id` bigint(20) NOT NULL COMMENT '任务信息id',
  1282. `task_batch_id` bigint(20) NOT NULL COMMENT '任务批次id',
  1283. `task_id` bigint(20) NOT NULL COMMENT '调度任务id',
  1284. `message` longtext NOT NULL COMMENT '调度信息',
  1285. `log_num` int(11) NOT NULL DEFAULT 1 COMMENT '日志数量',
  1286. `real_time` bigint(13) NOT NULL DEFAULT 0 COMMENT '上报时间',
  1287. `ext_attrs` varchar(256) NULL DEFAULT '' COMMENT '扩展字段',
  1288. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1289. PRIMARY KEY (`id`),
  1290. KEY `idx_task_batch_id_task_id` (`task_batch_id`, `task_id`),
  1291. KEY `idx_create_dt` (`create_dt`),
  1292. KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`)
  1293. ) ENGINE = InnoDB
  1294. AUTO_INCREMENT = 0
  1295. DEFAULT CHARSET = utf8mb4 COMMENT ='调度日志';
  1296. DROP TABLE IF EXISTS `sj_job_task`;
  1297. drop table if exists sj_job_task;
  1298. CREATE TABLE `sj_job_task`
  1299. (
  1300. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  1301. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  1302. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  1303. `job_id` bigint(20) NOT NULL COMMENT '任务信息id',
  1304. `task_batch_id` bigint(20) NOT NULL COMMENT '调度任务id',
  1305. `parent_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '父执行器id',
  1306. `task_status` tinyint NOT NULL DEFAULT 0 COMMENT '执行的状态 0、失败 1、成功',
  1307. `retry_count` int(11) NOT NULL DEFAULT 0 COMMENT '重试次数',
  1308. `mr_stage` tinyint DEFAULT NULL COMMENT '动态分片所处阶段 1:map 2:reduce 3:mergeReduce',
  1309. `leaf` tinyint NOT NULL DEFAULT '1' COMMENT '叶子节点',
  1310. `task_name` varchar(255) NOT NULL DEFAULT '' COMMENT '任务名称',
  1311. `client_info` varchar(128) DEFAULT NULL COMMENT '客户端地址 clientId#ip:port',
  1312. `wf_context` text DEFAULT NULL COMMENT '工作流全局上下文',
  1313. `result_message` text NOT NULL COMMENT '执行结果',
  1314. `args_str` text DEFAULT NULL COMMENT '执行方法参数',
  1315. `args_type` tinyint NOT NULL DEFAULT 1 COMMENT '参数类型 ',
  1316. `ext_attrs` varchar(256) NULL DEFAULT '' COMMENT '扩展字段',
  1317. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1318. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  1319. PRIMARY KEY (`id`),
  1320. KEY `idx_task_batch_id_task_status` (`task_batch_id`, `task_status`),
  1321. KEY `idx_create_dt` (`create_dt`),
  1322. KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`)
  1323. ) ENGINE = InnoDB
  1324. AUTO_INCREMENT = 0
  1325. DEFAULT CHARSET = utf8mb4 COMMENT ='任务实例';
  1326. DROP TABLE IF EXISTS `sj_job_task_batch`;
  1327. drop table if exists sj_job_task_batch;
  1328. CREATE TABLE `sj_job_task_batch`
  1329. (
  1330. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  1331. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  1332. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  1333. `job_id` bigint(20) NOT NULL COMMENT '任务id',
  1334. `workflow_node_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '工作流节点id',
  1335. `parent_workflow_node_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '工作流任务父批次id',
  1336. `workflow_task_batch_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '工作流任务批次id',
  1337. `task_batch_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '任务批次状态 0、失败 1、成功',
  1338. `operation_reason` tinyint(4) NOT NULL DEFAULT 0 COMMENT '操作原因',
  1339. `execution_at` bigint(13) NOT NULL DEFAULT 0 COMMENT '任务执行时间',
  1340. `system_task_type` tinyint(4) NOT NULL DEFAULT 3 COMMENT '任务类型 3、JOB任务 4、WORKFLOW任务',
  1341. `parent_id` varchar(64) NOT NULL DEFAULT '' COMMENT '父节点',
  1342. `ext_attrs` varchar(256) NULL DEFAULT '' COMMENT '扩展字段',
  1343. `deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '逻辑删除 1、删除',
  1344. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1345. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  1346. PRIMARY KEY (`id`),
  1347. KEY `idx_job_id_task_batch_status` (`job_id`, `task_batch_status`),
  1348. KEY `idx_create_dt` (`create_dt`),
  1349. KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`),
  1350. KEY `idx_workflow_task_batch_id_workflow_node_id` (`workflow_task_batch_id`, `workflow_node_id`)
  1351. ) ENGINE = InnoDB
  1352. AUTO_INCREMENT = 0
  1353. DEFAULT CHARSET = utf8mb4 COMMENT ='任务批次';
  1354. DROP TABLE IF EXISTS `sj_job_summary`;
  1355. drop table if exists sj_job_summary;
  1356. CREATE TABLE `sj_job_summary`
  1357. (
  1358. `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  1359. `namespace_id` VARCHAR(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  1360. `group_name` VARCHAR(64) NOT NULL DEFAULT '' COMMENT '组名称',
  1361. `business_id` bigint NOT NULL COMMENT '业务id (job_id或workflow_id)',
  1362. `system_task_type` tinyint(4) NOT NULL DEFAULT 3 COMMENT '任务类型 3、JOB任务 4、WORKFLOW任务',
  1363. `trigger_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '统计时间',
  1364. `success_num` int NOT NULL DEFAULT 0 COMMENT '执行成功-日志数量',
  1365. `fail_num` int NOT NULL DEFAULT 0 COMMENT '执行失败-日志数量',
  1366. `fail_reason` varchar(512) NOT NULL DEFAULT '' COMMENT '失败原因',
  1367. `stop_num` int NOT NULL DEFAULT 0 COMMENT '执行失败-日志数量',
  1368. `stop_reason` varchar(512) NOT NULL DEFAULT '' COMMENT '失败原因',
  1369. `cancel_num` int NOT NULL DEFAULT 0 COMMENT '执行失败-日志数量',
  1370. `cancel_reason` varchar(512) NOT NULL DEFAULT '' COMMENT '失败原因',
  1371. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1372. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  1373. PRIMARY KEY (`id`),
  1374. KEY `idx_namespace_id_group_name_business_id` (`namespace_id`, `group_name`, business_id),
  1375. UNIQUE KEY `uk_trigger_at_system_task_type_business_id` (`trigger_at`, `system_task_type`, `business_id`) USING BTREE
  1376. ) ENGINE = InnoDB
  1377. AUTO_INCREMENT = 1
  1378. DEFAULT CHARSET = utf8mb4 COMMENT ='DashBoard_Job';
  1379. DROP TABLE IF EXISTS `sj_retry_summary`;
  1380. drop table if exists sj_retry_summary;
  1381. CREATE TABLE `sj_retry_summary`
  1382. (
  1383. `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  1384. `namespace_id` VARCHAR(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  1385. `group_name` VARCHAR(64) NOT NULL DEFAULT '' COMMENT '组名称',
  1386. `scene_name` VARCHAR(64) NOT NULL DEFAULT '' COMMENT '场景名称',
  1387. `trigger_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '统计时间',
  1388. `running_num` int NOT NULL DEFAULT 0 COMMENT '重试中-日志数量',
  1389. `finish_num` int NOT NULL DEFAULT 0 COMMENT '重试完成-日志数量',
  1390. `max_count_num` int NOT NULL DEFAULT 0 COMMENT '重试到达最大次数-日志数量',
  1391. `suspend_num` int NOT NULL DEFAULT 0 COMMENT '暂停重试-日志数量',
  1392. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1393. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  1394. PRIMARY KEY (`id`),
  1395. KEY `idx_trigger_at` (`trigger_at`),
  1396. UNIQUE KEY `uk_scene_name_trigger_at` (`namespace_id`, `group_name`, `scene_name`, `trigger_at`) USING BTREE
  1397. ) ENGINE = InnoDB
  1398. AUTO_INCREMENT = 1
  1399. DEFAULT CHARSET = utf8mb4 COMMENT ='DashBoard_Retry';
  1400. DROP TABLE IF EXISTS `sj_workflow`;
  1401. drop table if exists sj_workflow;
  1402. CREATE TABLE `sj_workflow`
  1403. (
  1404. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  1405. `workflow_name` varchar(64) NOT NULL COMMENT '工作流名称',
  1406. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  1407. `biz_id` varchar(64) NOT NULL COMMENT '业务ID',
  1408. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  1409. `workflow_status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '工作流状态 0、关闭、1、开启',
  1410. `trigger_type` tinyint(4) NOT NULL COMMENT '触发类型 1.CRON 表达式 2. 固定时间',
  1411. `trigger_interval` varchar(255) NOT NULL COMMENT '间隔时长',
  1412. `next_trigger_at` bigint NOT NULL COMMENT '下次触发时间',
  1413. `block_strategy` tinyint(4) NOT NULL DEFAULT 1 COMMENT '阻塞策略 1、丢弃 2、覆盖 3、并行',
  1414. `executor_timeout` int(11) NOT NULL DEFAULT 0 COMMENT '任务执行超时时间,单位秒',
  1415. `description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
  1416. `flow_info` text DEFAULT NULL COMMENT '流程信息',
  1417. `wf_context` text DEFAULT NULL COMMENT '上下文',
  1418. `notify_ids` varchar(128) NOT NULL DEFAULT '' COMMENT '通知告警场景配置id列表',
  1419. `bucket_index` int(11) NOT NULL DEFAULT 0 COMMENT 'bucket',
  1420. `version` int(11) NOT NULL COMMENT '版本号',
  1421. `owner_id` bigint(20) NULL DEFAULT NULL COMMENT '负责人id',
  1422. `ext_attrs` varchar(256) NULL DEFAULT '' COMMENT '扩展字段',
  1423. `deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '逻辑删除 1、删除',
  1424. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1425. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  1426. PRIMARY KEY (`id`),
  1427. KEY `idx_create_dt` (`create_dt`),
  1428. KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`),
  1429. UNIQUE KEY `uk_sj_workflow_01` (`namespace_id`, `biz_id`)
  1430. ) ENGINE = InnoDB
  1431. AUTO_INCREMENT = 0
  1432. DEFAULT CHARSET = utf8mb4 COMMENT ='工作流';
  1433. DROP TABLE IF EXISTS `sj_workflow_node`;
  1434. drop table if exists sj_workflow_node;
  1435. CREATE TABLE `sj_workflow_node`
  1436. (
  1437. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  1438. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  1439. `node_name` varchar(64) NOT NULL COMMENT '节点名称',
  1440. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  1441. `job_id` bigint(20) NOT NULL COMMENT '任务信息id',
  1442. `workflow_id` bigint(20) NOT NULL COMMENT '工作流ID',
  1443. `node_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1、任务节点 2、条件节点',
  1444. `expression_type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '1、SpEl、2、Aviator 3、QL',
  1445. `fail_strategy` tinyint(4) NOT NULL DEFAULT 1 COMMENT '失败策略 1、跳过 2、阻塞',
  1446. `workflow_node_status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '工作流节点状态 0、关闭、1、开启',
  1447. `priority_level` int(11) NOT NULL DEFAULT 1 COMMENT '优先级',
  1448. `node_info` text DEFAULT NULL COMMENT '节点信息 ',
  1449. `version` int(11) NOT NULL COMMENT '版本号',
  1450. `ext_attrs` varchar(256) NULL DEFAULT '' COMMENT '扩展字段',
  1451. `deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '逻辑删除 1、删除',
  1452. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1453. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  1454. PRIMARY KEY (`id`),
  1455. KEY `idx_create_dt` (`create_dt`),
  1456. KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`)
  1457. ) ENGINE = InnoDB
  1458. AUTO_INCREMENT = 0
  1459. DEFAULT CHARSET = utf8mb4 COMMENT ='工作流节点';
  1460. DROP TABLE IF EXISTS `sj_workflow_task_batch`;
  1461. drop table if exists sj_workflow_task_batch;
  1462. CREATE TABLE `sj_workflow_task_batch`
  1463. (
  1464. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  1465. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  1466. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  1467. `workflow_id` bigint(20) NOT NULL COMMENT '工作流任务id',
  1468. `task_batch_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '任务批次状态 0、失败 1、成功',
  1469. `operation_reason` tinyint(4) NOT NULL DEFAULT 0 COMMENT '操作原因',
  1470. `flow_info` text DEFAULT NULL COMMENT '流程信息',
  1471. `wf_context` text DEFAULT NULL COMMENT '全局上下文',
  1472. `execution_at` bigint(13) NOT NULL DEFAULT 0 COMMENT '任务执行时间',
  1473. `ext_attrs` varchar(256) NULL DEFAULT '' COMMENT '扩展字段',
  1474. `version` int(11) NOT NULL DEFAULT 1 COMMENT '版本号',
  1475. `deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '逻辑删除 1、删除',
  1476. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1477. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  1478. PRIMARY KEY (`id`),
  1479. KEY `idx_job_id_task_batch_status` (`workflow_id`, `task_batch_status`),
  1480. KEY `idx_create_dt` (`create_dt`),
  1481. KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`)
  1482. ) ENGINE = InnoDB
  1483. AUTO_INCREMENT = 0
  1484. DEFAULT CHARSET = utf8mb4 COMMENT ='工作流批次';
  1485. DROP TABLE IF EXISTS `sj_job_executor`;
  1486. drop table if exists sj_job_executor;
  1487. CREATE TABLE `sj_job_executor`
  1488. (
  1489. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  1490. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  1491. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  1492. `executor_info` varchar(256) NOT NULL COMMENT '任务执行器名称',
  1493. `executor_type` varchar(3) NOT NULL COMMENT '1:java 2:python 3:go',
  1494. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1495. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  1496. PRIMARY KEY (`id`),
  1497. KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`),
  1498. KEY `idx_create_dt` (`create_dt`)
  1499. ) ENGINE = InnoDB
  1500. AUTO_INCREMENT = 0
  1501. DEFAULT CHARSET = utf8mb4 COMMENT ='任务执行器信息';
  1502. -- ============================================================
  1503. -- 工作流模块(Warm-Flow)
  1504. -- ============================================================
  1505. -- ----------------------------
  1506. -- 0、warm-flow-all.sql,地址:https://gitee.com/dromara/warm-flow/blob/master/sql/mysql/warm-flow-all.sql
  1507. -- ----------------------------
  1508. DROP TABLE IF EXISTS `flow_definition`;
  1509. drop table if exists flow_definition;
  1510. CREATE TABLE `flow_definition`
  1511. (
  1512. `id` bigint NOT NULL COMMENT '主键id',
  1513. `flow_code` varchar(40) NOT NULL COMMENT '流程编码',
  1514. `flow_name` varchar(100) NOT NULL COMMENT '流程名称',
  1515. `model_value` varchar(40) NOT NULL DEFAULT 'CLASSICS' COMMENT '设计器模型(CLASSICS经典模型 MIMIC仿钉钉模型)',
  1516. `category` varchar(100) DEFAULT NULL COMMENT '流程类别',
  1517. `version` varchar(20) NOT NULL COMMENT '流程版本',
  1518. `is_publish` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否发布(0未发布 1已发布 9失效)',
  1519. `form_custom` char(1) DEFAULT 'N' COMMENT '审批表单是否自定义(Y是 N否)',
  1520. `form_path` varchar(100) DEFAULT NULL COMMENT '审批表单路径',
  1521. `activity_status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '流程激活状态(0挂起 1激活)',
  1522. `listener_type` varchar(100) DEFAULT NULL COMMENT '监听器类型',
  1523. `listener_path` varchar(400) DEFAULT NULL COMMENT '监听器路径',
  1524. `ext` varchar(500) DEFAULT NULL COMMENT '业务详情 存业务表对象json字符串',
  1525. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  1526. `create_by` varchar(64) DEFAULT '' COMMENT '创建人',
  1527. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  1528. `update_by` varchar(64) DEFAULT '' COMMENT '更新人',
  1529. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
  1530. `tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
  1531. PRIMARY KEY (`id`) USING BTREE
  1532. ) ENGINE = InnoDB COMMENT ='流程定义表';
  1533. DROP TABLE IF EXISTS `flow_node`;
  1534. drop table if exists flow_node;
  1535. CREATE TABLE `flow_node`
  1536. (
  1537. `id` bigint NOT NULL COMMENT '主键id',
  1538. `node_type` tinyint(1) NOT NULL COMMENT '节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
  1539. `definition_id` bigint NOT NULL COMMENT '流程定义id',
  1540. `node_code` varchar(100) NOT NULL COMMENT '流程节点编码',
  1541. `node_name` varchar(100) DEFAULT NULL COMMENT '流程节点名称',
  1542. `permission_flag` varchar(200) DEFAULT NULL COMMENT '权限标识(权限类型:权限标识,可以多个,用@@隔开)',
  1543. `node_ratio` varchar(200) DEFAULT NULL COMMENT '流程签署比例值',
  1544. `coordinate` varchar(100) DEFAULT NULL COMMENT '坐标',
  1545. `any_node_skip` varchar(100) DEFAULT NULL COMMENT '任意结点跳转',
  1546. `listener_type` varchar(100) DEFAULT NULL COMMENT '监听器类型',
  1547. `listener_path` varchar(400) DEFAULT NULL COMMENT '监听器路径',
  1548. `form_custom` char(1) DEFAULT 'N' COMMENT '审批表单是否自定义(Y是 N否)',
  1549. `form_path` varchar(100) DEFAULT NULL COMMENT '审批表单路径',
  1550. `version` varchar(20) NOT NULL COMMENT '版本',
  1551. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  1552. `create_by` varchar(64) DEFAULT '' COMMENT '创建人',
  1553. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  1554. `update_by` varchar(64) DEFAULT '' COMMENT '更新人',
  1555. `ext` text COMMENT '节点扩展属性',
  1556. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
  1557. `tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
  1558. PRIMARY KEY (`id`) USING BTREE
  1559. ) ENGINE = InnoDB COMMENT ='流程节点表';
  1560. DROP TABLE IF EXISTS `flow_skip`;
  1561. drop table if exists flow_skip;
  1562. CREATE TABLE `flow_skip`
  1563. (
  1564. `id` bigint NOT NULL COMMENT '主键id',
  1565. `definition_id` bigint NOT NULL COMMENT '流程定义id',
  1566. `now_node_code` varchar(100) NOT NULL COMMENT '当前流程节点的编码',
  1567. `now_node_type` tinyint(1) DEFAULT NULL COMMENT '当前节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
  1568. `next_node_code` varchar(100) NOT NULL COMMENT '下一个流程节点的编码',
  1569. `next_node_type` tinyint(1) DEFAULT NULL COMMENT '下一个节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
  1570. `skip_name` varchar(100) DEFAULT NULL COMMENT '跳转名称',
  1571. `skip_type` varchar(40) DEFAULT NULL COMMENT '跳转类型(PASS审批通过 REJECT退回)',
  1572. `skip_condition` varchar(200) DEFAULT NULL COMMENT '跳转条件',
  1573. `coordinate` varchar(100) DEFAULT NULL COMMENT '坐标',
  1574. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  1575. `create_by` varchar(64) DEFAULT '' COMMENT '创建人',
  1576. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  1577. `update_by` varchar(64) DEFAULT '' COMMENT '更新人',
  1578. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
  1579. `tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
  1580. PRIMARY KEY (`id`) USING BTREE
  1581. ) ENGINE = InnoDB COMMENT ='节点跳转关联表';
  1582. DROP TABLE IF EXISTS `flow_instance`;
  1583. drop table if exists flow_instance;
  1584. CREATE TABLE `flow_instance`
  1585. (
  1586. `id` bigint NOT NULL COMMENT '主键id',
  1587. `definition_id` bigint NOT NULL COMMENT '对应flow_definition表的id',
  1588. `business_id` varchar(40) NOT NULL COMMENT '业务id',
  1589. `node_type` tinyint(1) NOT NULL COMMENT '节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
  1590. `node_code` varchar(40) NOT NULL COMMENT '流程节点编码',
  1591. `node_name` varchar(100) DEFAULT NULL COMMENT '流程节点名称',
  1592. `variable` text COMMENT '任务变量',
  1593. `flow_status` varchar(20) NOT NULL COMMENT '流程状态(0待提交 1审批中 2审批通过 4终止 5作废 6撤销 8已完成 9已退回 10失效 11拿回)',
  1594. `activity_status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '流程激活状态(0挂起 1激活)',
  1595. `def_json` text COMMENT '流程定义json',
  1596. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  1597. `create_by` varchar(64) DEFAULT '' COMMENT '创建人',
  1598. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  1599. `update_by` varchar(64) DEFAULT '' COMMENT '更新人',
  1600. `ext` varchar(500) DEFAULT NULL COMMENT '扩展字段,预留给业务系统使用',
  1601. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
  1602. `tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
  1603. PRIMARY KEY (`id`) USING BTREE
  1604. ) ENGINE = InnoDB COMMENT ='流程实例表';
  1605. DROP TABLE IF EXISTS `flow_task`;
  1606. drop table if exists flow_task;
  1607. CREATE TABLE `flow_task`
  1608. (
  1609. `id` bigint NOT NULL COMMENT '主键id',
  1610. `definition_id` bigint NOT NULL COMMENT '对应flow_definition表的id',
  1611. `instance_id` bigint NOT NULL COMMENT '对应flow_instance表的id',
  1612. `node_code` varchar(100) NOT NULL COMMENT '节点编码',
  1613. `node_name` varchar(100) DEFAULT NULL COMMENT '节点名称',
  1614. `node_type` tinyint(1) NOT NULL COMMENT '节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
  1615. `flow_status` varchar(20) NOT NULL COMMENT '流程状态(0待提交 1审批中 2审批通过 4终止 5作废 6撤销 8已完成 9已退回 10失效 11拿回)',
  1616. `form_custom` char(1) DEFAULT 'N' COMMENT '审批表单是否自定义(Y是 N否)',
  1617. `form_path` varchar(100) DEFAULT NULL COMMENT '审批表单路径',
  1618. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  1619. `create_by` varchar(64) DEFAULT '' COMMENT '创建人',
  1620. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  1621. `update_by` varchar(64) DEFAULT '' COMMENT '更新人',
  1622. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
  1623. `tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
  1624. PRIMARY KEY (`id`) USING BTREE
  1625. ) ENGINE = InnoDB COMMENT ='待办任务表';
  1626. DROP TABLE IF EXISTS `flow_his_task`;
  1627. drop table if exists flow_his_task;
  1628. CREATE TABLE `flow_his_task`
  1629. (
  1630. `id` bigint(20) NOT NULL COMMENT '主键id',
  1631. `definition_id` bigint(20) NOT NULL COMMENT '对应flow_definition表的id',
  1632. `instance_id` bigint(20) NOT NULL COMMENT '对应flow_instance表的id',
  1633. `task_id` bigint(20) NOT NULL COMMENT '对应flow_task表的id',
  1634. `node_code` varchar(100) DEFAULT NULL COMMENT '开始节点编码',
  1635. `node_name` varchar(100) DEFAULT NULL COMMENT '开始节点名称',
  1636. `node_type` tinyint(1) DEFAULT NULL COMMENT '开始节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
  1637. `target_node_code` varchar(200) DEFAULT NULL COMMENT '目标节点编码',
  1638. `target_node_name` varchar(200) DEFAULT NULL COMMENT '结束节点名称',
  1639. `approver` varchar(40) DEFAULT NULL COMMENT '审批人',
  1640. `cooperate_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '协作方式(1审批 2转办 3委派 4会签 5票签 6加签 7减签)',
  1641. `collaborator` varchar(500) DEFAULT NULL COMMENT '协作人',
  1642. `skip_type` varchar(10) NOT NULL COMMENT '流转类型(PASS通过 REJECT退回 NONE无动作)',
  1643. `flow_status` varchar(20) NOT NULL COMMENT '流程状态(0待提交 1审批中 2审批通过 4终止 5作废 6撤销 8已完成 9已退回 10失效 11拿回)',
  1644. `form_custom` char(1) DEFAULT 'N' COMMENT '审批表单是否自定义(Y是 N否)',
  1645. `form_path` varchar(100) DEFAULT NULL COMMENT '审批表单路径',
  1646. `message` varchar(500) DEFAULT NULL COMMENT '审批意见',
  1647. `variable` TEXT DEFAULT NULL COMMENT '任务变量',
  1648. `ext` TEXT DEFAULT NULL COMMENT '业务详情 存业务表对象json字符串',
  1649. `create_time` datetime DEFAULT NULL COMMENT '任务开始时间',
  1650. `update_time` datetime DEFAULT NULL COMMENT '审批完成时间',
  1651. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
  1652. `tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
  1653. PRIMARY KEY (`id`) USING BTREE
  1654. ) ENGINE = InnoDB COMMENT ='历史任务记录表';
  1655. DROP TABLE IF EXISTS `flow_user`;
  1656. drop table if exists flow_user;
  1657. CREATE TABLE `flow_user`
  1658. (
  1659. `id` bigint NOT NULL COMMENT '主键id',
  1660. `type` char(1) NOT NULL COMMENT '人员类型(1待办任务的审批人权限 2待办任务的转办人权限 3待办任务的委托人权限)',
  1661. `processed_by` varchar(80) DEFAULT NULL COMMENT '权限人',
  1662. `associated` bigint NOT NULL COMMENT '任务表id',
  1663. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  1664. `create_by` varchar(80) DEFAULT NULL COMMENT '创建人',
  1665. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  1666. `update_by` varchar(64) DEFAULT '' COMMENT '创建人',
  1667. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
  1668. `tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
  1669. PRIMARY KEY (`id`) USING BTREE,
  1670. KEY `user_processed_type` (`processed_by`, `type`),
  1671. KEY `user_associated` (`associated`) USING BTREE
  1672. ) ENGINE = InnoDB COMMENT ='流程用户表';
  1673. -- ----------------------------
  1674. -- 流程分类表
  1675. -- ----------------------------
  1676. drop table if exists flow_category;
  1677. create table flow_category
  1678. (
  1679. category_id bigint(20) not null comment '流程分类ID',
  1680. tenant_id varchar(20) default '000000' comment '租户编号',
  1681. parent_id bigint(20) default 0 comment '父流程分类id',
  1682. ancestors varchar(500) default '' comment '祖级列表',
  1683. category_name varchar(30) not null comment '流程分类名称',
  1684. order_num int(4) default 0 comment '显示顺序',
  1685. del_flag char(1) default '0' comment '删除标志(0代表存在 1代表删除)',
  1686. create_dept bigint(20) null comment '创建部门',
  1687. create_by bigint(20) null comment '创建者',
  1688. create_time datetime null comment '创建时间',
  1689. update_by bigint(20) null comment '更新者',
  1690. update_time datetime null comment '更新时间',
  1691. primary key (category_id)
  1692. ) engine = innodb comment = '流程分类';
  1693. INSERT INTO flow_category values (100, '000000', 0, '0', 'OA审批', 0, '0', 103, 1, sysdate(), null, null);
  1694. INSERT INTO flow_category values (101, '000000', 100, '0,100', '假勤管理', 0, '0', 103, 1, sysdate(), null, null);
  1695. INSERT INTO flow_category values (102, '000000', 100, '0,100', '人事管理', 1, '0', 103, 1, sysdate(), null, null);
  1696. INSERT INTO flow_category values (103, '000000', 101, '0,100,101', '请假', 0, '0', 103, 1, sysdate(), null, null);
  1697. INSERT INTO flow_category values (104, '000000', 101, '0,100,101', '出差', 1, '0', 103, 1, sysdate(), null, null);
  1698. INSERT INTO flow_category values (105, '000000', 101, '0,100,101', '加班', 2, '0', 103, 1, sysdate(), null, null);
  1699. INSERT INTO flow_category values (106, '000000', 101, '0,100,101', '换班', 3, '0', 103, 1, sysdate(), null, null);
  1700. INSERT INTO flow_category values (107, '000000', 101, '0,100,101', '外出', 4, '0', 103, 1, sysdate(), null, null);
  1701. INSERT INTO flow_category values (108, '000000', 102, '0,100,102', '转正', 1, '0', 103, 1, sysdate(), null, null);
  1702. INSERT INTO flow_category values (109, '000000', 102, '0,100,102', '离职', 2, '0', 103, 1, sysdate(), null, null);
  1703. -- ----------------------------
  1704. -- 流程spel表达式定义表
  1705. -- ----------------------------
  1706. drop table if exists flow_spel;
  1707. CREATE TABLE flow_spel (
  1708. id bigint(20) NOT NULL COMMENT '主键id',
  1709. component_name varchar(255) DEFAULT NULL COMMENT '组件名称',
  1710. method_name varchar(255) DEFAULT NULL COMMENT '方法名',
  1711. method_params varchar(255) DEFAULT NULL COMMENT '参数',
  1712. view_spel varchar(255) DEFAULT NULL COMMENT '预览spel表达式',
  1713. remark varchar(255) DEFAULT NULL COMMENT '备注',
  1714. status char(1) DEFAULT '0' COMMENT '状态(0正常 1停用)',
  1715. del_flag char(1) DEFAULT '0' COMMENT '删除标志',
  1716. create_dept bigint(20) DEFAULT NULL COMMENT '创建部门',
  1717. create_by bigint(20) DEFAULT NULL COMMENT '创建者',
  1718. create_time datetime DEFAULT NULL COMMENT '创建时间',
  1719. update_by bigint(20) DEFAULT NULL COMMENT '更新者',
  1720. update_time datetime DEFAULT NULL COMMENT '更新时间',
  1721. PRIMARY KEY (id)
  1722. ) ENGINE = InnoDB COMMENT='流程spel表达式定义表';
  1723. INSERT INTO flow_spel VALUES (1, 'spelRuleComponent', 'selectDeptLeaderById', 'initiatorDeptId', '#{@spelRuleComponent.selectDeptLeaderById(#initiatorDeptId)}', '根据部门id获取部门负责人', '0', '0', 103, 1, sysdate(), 1, sysdate());
  1724. INSERT INTO flow_spel VALUES (2, NULL, NULL, 'initiator', '${initiator}', '流程发起人', '0', '0', 103, 1, sysdate(), 1, sysdate());
  1725. -- ----------------------------
  1726. -- 流程实例业务扩展表
  1727. -- ----------------------------
  1728. drop table if exists flow_instance_biz_ext;
  1729. create table flow_instance_biz_ext (
  1730. id bigint not null comment '主键id',
  1731. tenant_id varchar(20) default '000000' null comment '租户编号',
  1732. create_dept bigint null comment '创建部门',
  1733. create_by bigint null comment '创建者',
  1734. create_time datetime null comment '创建时间',
  1735. update_by bigint null comment '更新者',
  1736. update_time datetime null comment '更新时间',
  1737. business_code varchar(255) null comment '业务编码',
  1738. business_title varchar(1000) null comment '业务标题',
  1739. del_flag char default '0' null comment '删除标志(0代表存在 1代表删除)',
  1740. instance_id bigint null comment '流程实例Id',
  1741. business_id varchar(255) null comment '业务Id',
  1742. PRIMARY KEY (id)
  1743. ) ENGINE = InnoDB COMMENT '流程实例业务扩展表';
  1744. -- ----------------------------
  1745. -- 请假单信息
  1746. -- ----------------------------
  1747. drop table if exists test_leave;
  1748. create table test_leave
  1749. (
  1750. id bigint(20) not null comment 'id',
  1751. tenant_id varchar(20) default '000000' comment '租户编号',
  1752. apply_code varchar(50) not null comment '申请编号',
  1753. leave_type varchar(255) not null comment '请假类型',
  1754. start_date datetime not null comment '开始时间',
  1755. end_date datetime not null comment '结束时间',
  1756. leave_days int(10) not null comment '请假天数',
  1757. remark varchar(255) null comment '请假原因',
  1758. status varchar(255) null comment '状态',
  1759. create_dept bigint null comment '创建部门',
  1760. create_by bigint null comment '创建者',
  1761. create_time datetime null comment '创建时间',
  1762. update_by bigint null comment '更新者',
  1763. update_time datetime null comment '更新时间',
  1764. PRIMARY KEY (id) USING BTREE
  1765. ) ENGINE = InnoDB COMMENT = '请假申请表';
  1766. insert into sys_menu values ('11616', '工作流', '0', '6', 'workflow', '', '', '1', '0', 'M', '0', '0', '', 'workflow', 103, 1, sysdate(),NULL, NULL, '');
  1767. insert into sys_menu values ('11618', '我的任务', '0', '7', 'task', '', '', '1', '0', 'M', '0', '0', '', 'my-task', 103, 1, sysdate(), NULL, NULL, '');
  1768. insert into sys_menu values ('11619', '我的待办', '11618', '2', 'taskWaiting', 'workflow/task/taskWaiting', '', '1', '1', 'C', '0', '0', '', 'waiting', 103, 1, sysdate(), NULL, NULL, '');
  1769. insert into sys_menu values ('11632', '我的已办', '11618', '3', 'taskFinish', 'workflow/task/taskFinish', '', '1', '1', 'C', '0', '0', '', 'finish', 103, 1, sysdate(), NULL, NULL, '');
  1770. insert into sys_menu values ('11633', '我的抄送', '11618', '4', 'taskCopyList', 'workflow/task/taskCopyList', '', '1', '1', 'C', '0', '0', '', 'my-copy', 103, 1, sysdate(), NULL, NULL, '');
  1771. insert into sys_menu values ('11620', '流程定义', '11616', '3', 'processDefinition', 'workflow/processDefinition/index', '', '1', '1', 'C', '0', '0', 'workflow:definition:list', 'process-definition', 103, 1, sysdate(), NULL, NULL, '');
  1772. insert into sys_menu values ('11621', '流程实例', '11630', '1', 'processInstance', 'workflow/processInstance/index', '', '1', '1', 'C', '0', '0', 'workflow:instance:list', 'tree-table', 103, 1, sysdate(), NULL, NULL, '');
  1773. insert into sys_menu values ('11622', '流程分类', '11616', '1', 'category', 'workflow/category/index', '', '1', '0', 'C', '0', '0', 'workflow:category:list', 'category', 103, 1, sysdate(), NULL, NULL, '');
  1774. INSERT INTO sys_menu VALUES ('11801', '流程表达式', '11616', '2', 'spel', 'workflow/spel/index', '', 1, 0, 'C', '0', '0', 'workflow:spel:list', 'input', 103, 1, sysdate(), 1, sysdate(), '流程达式定义菜单');
  1775. insert into sys_menu values ('11629', '我发起的', '11618', '1', 'myDocument', 'workflow/task/myDocument', '', '1', '1', 'C', '0', '0', 'workflow:instance:currentList', 'guide', 103, 1, sysdate(), NULL, NULL, '');
  1776. insert into sys_menu values ('11630', '流程监控', '11616', '4', 'processMonitor', '', '', '1', '0', 'M', '0', '0', '', 'monitor', 103, 1, sysdate(), NULL, NULL, '');
  1777. insert into sys_menu values ('11631', '待办任务', '11630', '2', 'allTaskWaiting', 'workflow/task/allTaskWaiting', '', '1', '1', 'C', '0', '0', '', 'waiting', 103, 1, sysdate(), NULL, NULL, '');
  1778. insert into sys_menu values ('11700', '流程设计', '11616', '5', 'design/index', 'workflow/processDefinition/design', '', 1, 1, 'C', '1', '0', 'workflow:leave:edit', '#', 103, 1, sysdate(), null, null, '/workflow/processDefinition');
  1779. insert into sys_menu values ('11701', '请假申请', '11616', '6', 'leaveEdit/index', 'workflow/leave/leaveEdit', '', 1, 1, 'C', '1', '0', 'workflow:leave:edit', '#', 103, 1, sysdate(), null, null, '');
  1780. -- 流程分类管理相关按钮
  1781. insert into sys_menu values ('11623', '流程分类查询', '11622', '1', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:query', '#', 103, 1,sysdate(), null, null, '');
  1782. insert into sys_menu values ('11624', '流程分类新增', '11622', '2', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:add', '#', 103, 1,sysdate(), null, null, '');
  1783. insert into sys_menu values ('11625', '流程分类修改', '11622', '3', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:edit', '#', 103, 1,sysdate(), null, null, '');
  1784. insert into sys_menu values ('11626', '流程分类删除', '11622', '4', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:remove', '#', 103,1, sysdate(), null, null, '');
  1785. insert into sys_menu values ('11627', '流程分类导出', '11622', '5', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:export', '#', 103,1, sysdate(), null, null, '');
  1786. -- 流程实例管理相关按钮
  1787. insert into sys_menu values ('11653', '流程实例查询', '11621', '1', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:instance:query', '#', 103, 1, sysdate(), null, null, '');
  1788. insert into sys_menu values ('11654', '流程变量查询', '11621', '2', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:instance:variableQuery', '#', 103, 1, sysdate(), null, null, '');
  1789. insert into sys_menu values ('11655', '流程变量修改', '11621', '3', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:instance:variable', '#', 103, 1, sysdate(), null, null, '');
  1790. insert into sys_menu values ('11656', '流程实例激活/挂起', '11621', '4', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:instance:active', '#', 103, 1, sysdate(), null, null, '');
  1791. insert into sys_menu values ('11657', '流程实例删除', '11621', '5', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:instance:remove', '#', 103, 1, sysdate(), null, null, '');
  1792. insert into sys_menu values ('11658', '流程实例作废', '11621', '6', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:instance:invalid', '#', 103, 1, sysdate(), null, null, '');
  1793. insert into sys_menu values ('11659', '流程实例撤销', '11621', '7', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:instance:cancel', '#', 103, 1, sysdate(), null, null, '');
  1794. -- 流程定义管理相关按钮
  1795. insert into sys_menu values ('11644', '流程定义查询', '11620', '1', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:definition:query', '#', 103, 1, sysdate(), null, null, '');
  1796. insert into sys_menu values ('11645', '流程定义新增', '11620', '2', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:definition:add', '#', 103, 1, sysdate(), null, null, '');
  1797. insert into sys_menu values ('11646', '流程定义修改', '11620', '3', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:definition:edit', '#', 103, 1, sysdate(), null, null, '');
  1798. insert into sys_menu values ('11647', '流程定义删除', '11620', '4', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:definition:remove', '#', 103, 1, sysdate(), null, null, '');
  1799. insert into sys_menu values ('11648', '流程定义导出', '11620', '5', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:definition:export', '#', 103, 1, sysdate(), null, null, '');
  1800. insert into sys_menu values ('11649', '流程定义导入', '11620', '6', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:definition:import', '#', 103, 1, sysdate(), null, null, '');
  1801. insert into sys_menu values ('11650', '流程定义发布/取消发布', '11620', '7', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:definition:publish', '#', 103, 1, sysdate(), null, null, '');
  1802. insert into sys_menu values ('11651', '流程定义复制', '11620', '8', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:definition:copy', '#', 103, 1, sysdate(), null, null, '');
  1803. insert into sys_menu values ('11652', '流程定义激活/挂起', '11620', '9', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:definition:active', '#', 103, 1, sysdate(), null, null, '');
  1804. -- 流程表达式管理相关按钮
  1805. INSERT INTO sys_menu VALUES ('11802', '流程达式定义查询', '11801', 1, '#', '', NULL, 1, 0, 'F', '0', '0', 'workflow:spel:query', '#', 103, 1, sysdate(), NULL, NULL, '');
  1806. INSERT INTO sys_menu VALUES ('11803', '流程达式定义新增', '11801', 2, '#', '', NULL, 1, 0, 'F', '0', '0', 'workflow:spel:add', '#', 103, 1, sysdate(), NULL, NULL, '');
  1807. INSERT INTO sys_menu VALUES ('11804', '流程达式定义修改', '11801', 3, '#', '', NULL, 1, 0, 'F', '0', '0', 'workflow:spel:edit', '#', 103, 1, sysdate(), NULL, NULL, '');
  1808. INSERT INTO sys_menu VALUES ('11805', '流程达式定义删除', '11801', 4, '#', '', NULL, 1, 0, 'F', '0', '0', 'workflow:spel:remove', '#', 103, 1, sysdate(), NULL, NULL, '');
  1809. INSERT INTO sys_menu VALUES ('11806', '流程达式定义导出', '11801', 5, '#', '', NULL, 1, 0, 'F', '0', '0', 'workflow:spel:export', '#', 103, 1, sysdate(), NULL, NULL, '');
  1810. -- 请假测试相关按钮
  1811. insert into sys_menu VALUES ('11638', '请假申请', 5, 1, 'leave', 'workflow/leave/index', '', 1, 0, 'C', '0', '0', 'workflow:leave:list', '#', 103, 1, sysdate(), NULL, NULL, '请假申请菜单');
  1812. insert into sys_menu VALUES ('11639', '请假申请查询', '11638', 1, '#', '', '', 1, 0, 'F', '0', '0', 'workflow:leave:query', '#', 103, 1, sysdate(), NULL, NULL, '');
  1813. insert into sys_menu VALUES ('11640', '请假申请新增', '11638', 2, '#', '', '', 1, 0, 'F', '0', '0', 'workflow:leave:add', '#', 103, 1, sysdate(), NULL, NULL, '');
  1814. insert into sys_menu VALUES ('11641', '请假申请修改', '11638', 3, '#', '', '', 1, 0, 'F', '0', '0', 'workflow:leave:edit', '#', 103, 1, sysdate(), NULL, NULL, '');
  1815. insert into sys_menu VALUES ('11642', '请假申请删除', '11638', 4, '#', '', '', 1, 0, 'F', '0', '0', 'workflow:leave:remove', '#', 103, 1, sysdate(), NULL, NULL, '');
  1816. insert into sys_menu VALUES ('11643', '请假申请导出', '11638', 5, '#', '', '', 1, 0, 'F', '0', '0', 'workflow:leave:export', '#', 103, 1, sysdate(), NULL, NULL, '');
  1817. INSERT INTO sys_dict_type VALUES (13, '000000', '业务状态', 'wf_business_status', 103, 1, sysdate(), NULL, NULL, '业务状态列表');
  1818. INSERT INTO sys_dict_type VALUES (14, '000000', '表单类型', 'wf_form_type', 103, 1, sysdate(), NULL, NULL, '表单类型列表');
  1819. INSERT INTO sys_dict_type VALUES (15, '000000', '任务状态', 'wf_task_status', 103, 1, sysdate(), NULL, NULL, '任务状态');
  1820. INSERT INTO sys_dict_data VALUES (39, '000000', 1, '已撤销', 'cancel', 'wf_business_status', '', 'danger', 'N', 103, 1, sysdate(), NULL, NULL,'已撤销');
  1821. INSERT INTO sys_dict_data VALUES (40, '000000', 2, '草稿', 'draft', 'wf_business_status', '', 'info', 'N', 103, 1, sysdate(), NULL, NULL, '草稿');
  1822. INSERT INTO sys_dict_data VALUES (41, '000000', 3, '待审核', 'waiting', 'wf_business_status', '', 'primary', 'N', 103, 1, sysdate(), NULL, NULL,'待审核');
  1823. INSERT INTO sys_dict_data VALUES (42, '000000', 4, '已完成', 'finish', 'wf_business_status', '', 'success', 'N', 103, 1, sysdate(), NULL, NULL,'已完成');
  1824. INSERT INTO sys_dict_data VALUES (43, '000000', 5, '已作废', 'invalid', 'wf_business_status', '', 'danger', 'N', 103, 1, sysdate(), NULL, NULL,'已作废');
  1825. INSERT INTO sys_dict_data VALUES (44, '000000', 6, '已退回', 'back', 'wf_business_status', '', 'danger', 'N', 103, 1, sysdate(), NULL, NULL,'已退回');
  1826. INSERT INTO sys_dict_data VALUES (45, '000000', 7, '已终止', 'termination', 'wf_business_status', '', 'danger', 'N', 103, 1, sysdate(), NULL,NULL, '已终止');
  1827. INSERT INTO sys_dict_data VALUES (46, '000000', 1, '自定义表单', 'static', 'wf_form_type', '', 'success', 'N', 103, 1, sysdate(), NULL, NULL,'自定义表单');
  1828. INSERT INTO sys_dict_data VALUES (47, '000000', 2, '动态表单', 'dynamic', 'wf_form_type', '', 'primary', 'N', 103, 1, sysdate(), NULL, NULL,'动态表单');
  1829. INSERT INTO sys_dict_data VALUES (48, '000000', 1, '撤销', 'cancel', 'wf_task_status', '', 'danger', 'N', 103, 1, sysdate(), NULL, NULL, '撤销');
  1830. INSERT INTO sys_dict_data VALUES (49, '000000', 2, '通过', 'pass', 'wf_task_status', '', 'success', 'N', 103, 1, sysdate(), NULL, NULL, '通过');
  1831. INSERT INTO sys_dict_data VALUES (50, '000000', 3, '待审核', 'waiting', 'wf_task_status', '', 'primary', 'N', 103, 1, sysdate(), NULL, NULL, '待审核');
  1832. INSERT INTO sys_dict_data VALUES (51, '000000', 4, '作废', 'invalid', 'wf_task_status', '', 'danger', 'N', 103, 1, sysdate(), NULL, NULL, '作废');
  1833. INSERT INTO sys_dict_data VALUES (52, '000000', 5, '退回', 'back', 'wf_task_status', '', 'danger', 'N', 103, 1, sysdate(), NULL, NULL, '退回');
  1834. INSERT INTO sys_dict_data VALUES (53, '000000', 6, '终止', 'termination', 'wf_task_status', '', 'danger', 'N', 103, 1, sysdate(), NULL, NULL, '终止');
  1835. INSERT INTO sys_dict_data VALUES (54, '000000', 7, '转办', 'transfer', 'wf_task_status', '', 'primary', 'N', 103, 1, sysdate(), NULL, NULL, '转办');
  1836. INSERT INTO sys_dict_data VALUES (55, '000000', 8, '委托', 'depute', 'wf_task_status', '', 'primary', 'N', 103, 1, sysdate(), NULL, NULL, '委托');
  1837. INSERT INTO sys_dict_data VALUES (56, '000000', 9, '抄送', 'copy', 'wf_task_status', '', 'primary', 'N', 103, 1, sysdate(), NULL, NULL, '抄送');
  1838. INSERT INTO sys_dict_data VALUES (57, '000000', 10, '加签', 'sign', 'wf_task_status', '', 'primary', 'N', 103, 1, sysdate(), NULL, NULL, '加签');
  1839. INSERT INTO sys_dict_data VALUES (58, '000000', 11, '减签', 'sign_off', 'wf_task_status', '', 'danger', 'N', 103, 1, sysdate(), NULL, NULL, '减签');
  1840. INSERT INTO sys_dict_data VALUES (59, '000000', 11, '超时', 'timeout', 'wf_task_status', '', 'danger', 'N', 103, 1, sysdate(), NULL, NULL, '超时');
  1841. -- ============================================================
  1842. -- 风控业务模块
  1843. -- ============================================================
  1844. -- 风控模块建表语句
  1845. -- ----------------------------
  1846. -- 风控规则表
  1847. -- ----------------------------
  1848. drop table if exists risk_rule;
  1849. create table risk_rule (
  1850. rule_id bigint(20) not null auto_increment comment '规则ID',
  1851. rule_name varchar(100) not null comment '规则名称',
  1852. rule_code varchar(64) not null comment '规则编码',
  1853. rule_type varchar(20) not null comment '规则类型(1交易规则 2登录规则 3设备规则 4行为规则)',
  1854. rule_desc varchar(500) default null comment '规则描述',
  1855. rule_script text default null comment '规则脚本/条件',
  1856. risk_level varchar(20) not null comment '风险等级(1低风险 2中风险 3高风险 4极高风险)',
  1857. rule_score decimal(10,2) default 0.00 comment '规则分值',
  1858. action_type varchar(20) not null comment '触发动作(1预警 2拦截 3人工审核 4记录日志)',
  1859. status char(1) default '0' comment '规则状态(0正常 1停用)',
  1860. priority int(11) default 0 comment '优先级',
  1861. del_flag char(1) default '0' comment '删除标志(0代表存在 1代表删除)',
  1862. remark varchar(500) default null comment '备注',
  1863. create_by bigint(20) default null comment '创建者',
  1864. create_time datetime default null comment '创建时间',
  1865. update_by bigint(20) default null comment '更新者',
  1866. update_time datetime default null comment '更新时间',
  1867. primary key (rule_id),
  1868. unique key uk_rule_code (rule_code)
  1869. ) engine=innodb auto_increment=1 DEFAULT CHARSET=utf8mb4 comment = '风控规则表';
  1870. -- ----------------------------
  1871. -- 风控事件表
  1872. -- ----------------------------
  1873. drop table if exists risk_event;
  1874. create table risk_event (
  1875. event_id bigint(20) not null auto_increment comment '事件ID',
  1876. event_no varchar(64) not null comment '事件编号',
  1877. event_type varchar(20) not null comment '事件类型',
  1878. event_source varchar(50) default null comment '事件来源',
  1879. user_id bigint(20) default null comment '用户ID',
  1880. user_name varchar(50) default null comment '用户名称',
  1881. device_id varchar(100) default null comment '设备ID',
  1882. ip_address varchar(50) default null comment 'IP地址',
  1883. location varchar(100) default null comment '地理位置',
  1884. event_data text default null comment '事件数据',
  1885. risk_level varchar(20) default null comment '风险等级',
  1886. risk_score decimal(10,2) default 0.00 comment '风险分值',
  1887. hit_rules varchar(500) default null comment '命中规则',
  1888. action_taken varchar(20) default null comment '已执行动作',
  1889. status char(1) default '0' comment '状态(0待处理 1已处理 2已忽略)',
  1890. remark varchar(500) default null comment '备注',
  1891. event_time datetime default null comment '事件发生时间',
  1892. del_flag char(1) default '0' comment '删除标志(0代表存在 1代表删除)',
  1893. create_by bigint(20) default null comment '创建者',
  1894. create_time datetime default null comment '创建时间',
  1895. update_by bigint(20) default null comment '更新者',
  1896. update_time datetime default null comment '更新时间',
  1897. primary key (event_id),
  1898. unique key uk_event_no (event_no)
  1899. ) engine=innodb auto_increment=1 DEFAULT CHARSET=utf8mb4 comment = '风控事件表';
  1900. -- ----------------------------
  1901. -- 风控案例表
  1902. -- ----------------------------
  1903. drop table if exists risk_case;
  1904. create table risk_case (
  1905. case_id bigint(20) not null auto_increment comment '案例ID',
  1906. case_no varchar(64) not null comment '案例编号',
  1907. case_name varchar(100) not null comment '案例名称',
  1908. case_type varchar(20) not null comment '案例类型',
  1909. case_desc text default null comment '案例描述',
  1910. event_id bigint(20) default null comment '关联事件ID',
  1911. event_no varchar(64) default null comment '关联事件编号',
  1912. user_id bigint(20) default null comment '用户ID',
  1913. user_name varchar(50) default null comment '用户名称',
  1914. risk_level varchar(20) default null comment '风险等级',
  1915. risk_score decimal(10,2) default 0.00 comment '风险分值',
  1916. hit_rules varchar(500) default null comment '命中规则',
  1917. case_result varchar(20) default null comment '案例结果',
  1918. status char(1) default '0' comment '状态(0待处理 1已处理 2已归档)',
  1919. remark varchar(500) default null comment '备注',
  1920. del_flag char(1) default '0' comment '删除标志(0代表存在 1代表删除)',
  1921. create_by bigint(20) default null comment '创建者',
  1922. create_time datetime default null comment '创建时间',
  1923. update_by bigint(20) default null comment '更新者',
  1924. update_time datetime default null comment '更新时间',
  1925. primary key (case_id),
  1926. unique key uk_case_no (case_no)
  1927. ) engine=innodb auto_increment=1 DEFAULT CHARSET=utf8mb4 comment = '风控案例表';
  1928. -- ----------------------------
  1929. -- 黑名单表
  1930. -- ----------------------------
  1931. drop table if exists risk_blacklist;
  1932. create table risk_blacklist (
  1933. black_id bigint(20) not null auto_increment comment '黑名单ID',
  1934. black_type varchar(20) not null comment '黑名单类型(1IP 2手机号 3设备 4用户 5邮箱)',
  1935. black_value varchar(200) not null comment '黑名单值',
  1936. black_name varchar(100) default null comment '黑名单名称',
  1937. reason varchar(500) default null comment '加入原因',
  1938. source varchar(50) default null comment '来源',
  1939. expire_time datetime default null comment '过期时间',
  1940. status char(1) default '0' comment '状态(0正常 1停用)',
  1941. remark varchar(500) default null comment '备注',
  1942. del_flag char(1) default '0' comment '删除标志(0代表存在 1代表删除)',
  1943. create_by bigint(20) default null comment '创建者',
  1944. create_time datetime default null comment '创建时间',
  1945. update_by bigint(20) default null comment '更新者',
  1946. update_time datetime default null comment '更新时间',
  1947. primary key (black_id),
  1948. unique key uk_black_value (black_type, black_value)
  1949. ) engine=innodb auto_increment=1 DEFAULT CHARSET=utf8mb4 comment = '黑名单表';
  1950. -- ----------------------------
  1951. -- 白名单表
  1952. -- ----------------------------
  1953. drop table if exists risk_whitelist;
  1954. create table risk_whitelist (
  1955. white_id bigint(20) not null auto_increment comment '白名单ID',
  1956. white_type varchar(20) not null comment '白名单类型(1IP 2手机号 3设备 4用户 5邮箱)',
  1957. white_value varchar(200) not null comment '白名单值',
  1958. white_name varchar(100) default null comment '白名单名称',
  1959. reason varchar(500) default null comment '加入原因',
  1960. source varchar(50) default null comment '来源',
  1961. expire_time datetime default null comment '过期时间',
  1962. status char(1) default '0' comment '状态(0正常 1停用)',
  1963. remark varchar(500) default null comment '备注',
  1964. del_flag char(1) default '0' comment '删除标志(0代表存在 1代表删除)',
  1965. create_by bigint(20) default null comment '创建者',
  1966. create_time datetime default null comment '创建时间',
  1967. update_by bigint(20) default null comment '更新者',
  1968. update_time datetime default null comment '更新时间',
  1969. primary key (white_id),
  1970. unique key uk_white_value (white_type, white_value)
  1971. ) engine=innodb auto_increment=1 DEFAULT CHARSET=utf8mb4 comment = '白名单表';
  1972. -- ----------------------------
  1973. -- 风险评分表
  1974. -- ----------------------------
  1975. drop table if exists risk_score;
  1976. create table risk_score (
  1977. score_id bigint(20) not null auto_increment comment '评分ID',
  1978. score_no varchar(64) not null comment '评分编号',
  1979. user_id bigint(20) default null comment '用户ID',
  1980. user_name varchar(50) default null comment '用户名称',
  1981. score_type varchar(20) default null comment '评分类型',
  1982. total_score decimal(10,2) default 0.00 comment '总分',
  1983. base_score decimal(10,2) default 0.00 comment '基础分',
  1984. rule_score decimal(10,2) default 0.00 comment '规则分',
  1985. behavior_score decimal(10,2) default 0.00 comment '行为分',
  1986. credit_score decimal(10,2) default 0.00 comment '信用分',
  1987. risk_level varchar(20) default null comment '风险等级',
  1988. evaluation text default null comment '评估说明',
  1989. status char(1) default '0' comment '状态(0正常 1失效)',
  1990. remark varchar(500) default null comment '备注',
  1991. evaluate_time datetime default null comment '评估时间',
  1992. del_flag char(1) default '0' comment '删除标志(0代表存在 1代表删除)',
  1993. create_by bigint(20) default null comment '创建者',
  1994. create_time datetime default null comment '创建时间',
  1995. update_by bigint(20) default null comment '更新者',
  1996. update_time datetime default null comment '更新时间',
  1997. primary key (score_id),
  1998. unique key uk_score_no (score_no)
  1999. ) engine=innodb auto_increment=1 DEFAULT CHARSET=utf8mb4 comment = '风险评分表';