core.sql 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941
  1. /* Create Tables */
  2. -- 代码生成表
  3. CREATE TABLE [js_gen_table]
  4. (
  5. [table_name] varchar(64) NOT NULL,
  6. [class_name] varchar(100) NOT NULL,
  7. [comments] nvarchar(500) NOT NULL,
  8. [parent_table_name] varchar(64),
  9. [parent_table_fk_name] varchar(64),
  10. [data_source_name] varchar(64),
  11. [tpl_category] varchar(200),
  12. [package_name] varchar(500),
  13. [module_name] varchar(30),
  14. [sub_module_name] varchar(30),
  15. [function_name] nvarchar(200),
  16. [function_name_simple] nvarchar(50),
  17. [function_author] nvarchar(50),
  18. [gen_base_dir] nvarchar(1000),
  19. [options] nvarchar(1000),
  20. [create_by] varchar(64) NOT NULL,
  21. [create_date] datetime NOT NULL,
  22. [update_by] varchar(64) NOT NULL,
  23. [update_date] datetime NOT NULL,
  24. [remarks] nvarchar(500),
  25. PRIMARY KEY ([table_name])
  26. );
  27. -- 代码生成表列
  28. CREATE TABLE [js_gen_table_column]
  29. (
  30. [id] varchar(64) NOT NULL,
  31. [table_name] varchar(64) NOT NULL,
  32. [column_name] varchar(64) NOT NULL,
  33. [column_sort] decimal(10),
  34. [column_type] varchar(100) NOT NULL,
  35. [column_label] nvarchar(50),
  36. [comments] nvarchar(500) NOT NULL,
  37. [attr_name] varchar(200) NOT NULL,
  38. [attr_type] varchar(200) NOT NULL,
  39. [is_pk] char(1),
  40. [is_null] char(1),
  41. [is_insert] char(1),
  42. [is_update] char(1),
  43. [is_list] char(1),
  44. [is_query] char(1),
  45. [query_type] varchar(200),
  46. [is_edit] char(1),
  47. [show_type] varchar(200),
  48. [options] nvarchar(1000),
  49. PRIMARY KEY ([id])
  50. );
  51. -- 行政区划
  52. CREATE TABLE [js_sys_area]
  53. (
  54. [area_code] varchar(100) NOT NULL,
  55. [parent_code] varchar(64) NOT NULL,
  56. [parent_codes] varchar(767) NOT NULL,
  57. [tree_sort] decimal(10) NOT NULL,
  58. [tree_sorts] varchar(767) NOT NULL,
  59. [tree_leaf] char(1) NOT NULL,
  60. [tree_level] decimal(4) NOT NULL,
  61. [tree_names] varchar(767) NOT NULL,
  62. [area_name] nvarchar(100) NOT NULL,
  63. [area_type] char(1),
  64. [status] char(1) DEFAULT '0' NOT NULL,
  65. [create_by] varchar(64) NOT NULL,
  66. [create_date] datetime NOT NULL,
  67. [update_by] varchar(64) NOT NULL,
  68. [update_date] datetime NOT NULL,
  69. [remarks] nvarchar(500),
  70. PRIMARY KEY ([area_code])
  71. );
  72. -- 公司表
  73. CREATE TABLE [js_sys_company]
  74. (
  75. [company_code] varchar(64) NOT NULL,
  76. [parent_code] varchar(64) NOT NULL,
  77. [parent_codes] varchar(767) NOT NULL,
  78. [tree_sort] decimal(10) NOT NULL,
  79. [tree_sorts] varchar(767) NOT NULL,
  80. [tree_leaf] char(1) NOT NULL,
  81. [tree_level] decimal(4) NOT NULL,
  82. [tree_names] varchar(767) NOT NULL,
  83. [view_code] varchar(100) NOT NULL,
  84. [company_name] nvarchar(200) NOT NULL,
  85. [full_name] nvarchar(200) NOT NULL,
  86. [area_code] varchar(100),
  87. [status] char(1) DEFAULT '0' NOT NULL,
  88. [create_by] varchar(64) NOT NULL,
  89. [create_date] datetime NOT NULL,
  90. [update_by] varchar(64) NOT NULL,
  91. [update_date] datetime NOT NULL,
  92. [remarks] nvarchar(500),
  93. [corp_code] varchar(64) DEFAULT '0' NOT NULL,
  94. [corp_name] nvarchar(100) DEFAULT 'JeeSite' NOT NULL,
  95. [extend_s1] nvarchar(500),
  96. [extend_s2] nvarchar(500),
  97. [extend_s3] nvarchar(500),
  98. [extend_s4] nvarchar(500),
  99. [extend_s5] nvarchar(500),
  100. [extend_s6] nvarchar(500),
  101. [extend_s7] nvarchar(500),
  102. [extend_s8] nvarchar(500),
  103. [extend_i1] decimal(19),
  104. [extend_i2] decimal(19),
  105. [extend_i3] decimal(19),
  106. [extend_i4] decimal(19),
  107. [extend_f1] decimal(19,4),
  108. [extend_f2] decimal(19,4),
  109. [extend_f3] decimal(19,4),
  110. [extend_f4] decimal(19,4),
  111. [extend_d1] datetime,
  112. [extend_d2] datetime,
  113. [extend_d3] datetime,
  114. [extend_d4] datetime,
  115. PRIMARY KEY ([company_code])
  116. );
  117. -- 公司部门关联表
  118. CREATE TABLE [js_sys_company_office]
  119. (
  120. [company_code] varchar(64) NOT NULL,
  121. [office_code] varchar(64) NOT NULL,
  122. PRIMARY KEY ([company_code], [office_code])
  123. );
  124. -- 参数配置表
  125. CREATE TABLE [js_sys_config]
  126. (
  127. [id] varchar(64) NOT NULL,
  128. [config_name] nvarchar(100) NOT NULL,
  129. [config_key] varchar(100) NOT NULL,
  130. [config_value] nvarchar(1000),
  131. [is_sys] char(1) NOT NULL,
  132. [create_by] varchar(64) NOT NULL,
  133. [create_date] datetime NOT NULL,
  134. [update_by] varchar(64) NOT NULL,
  135. [update_date] datetime NOT NULL,
  136. [remarks] nvarchar(500),
  137. PRIMARY KEY ([id])
  138. );
  139. -- 字典数据表
  140. CREATE TABLE [js_sys_dict_data]
  141. (
  142. [dict_code] varchar(64) NOT NULL,
  143. [parent_code] varchar(64) NOT NULL,
  144. [parent_codes] varchar(767) NOT NULL,
  145. [tree_sort] decimal(10) NOT NULL,
  146. [tree_sorts] varchar(767) NOT NULL,
  147. [tree_leaf] char(1) NOT NULL,
  148. [tree_level] decimal(4) NOT NULL,
  149. [tree_names] varchar(767) NOT NULL,
  150. [dict_label] nvarchar(100) NOT NULL,
  151. [dict_value] varchar(100) NOT NULL,
  152. [dict_icon] varchar(100),
  153. [dict_type] varchar(100) NOT NULL,
  154. [is_sys] char(1) NOT NULL,
  155. [description] nvarchar(500),
  156. [css_style] nvarchar(500),
  157. [css_class] nvarchar(500),
  158. [status] char(1) DEFAULT '0' NOT NULL,
  159. [create_by] varchar(64) NOT NULL,
  160. [create_date] datetime NOT NULL,
  161. [update_by] varchar(64) NOT NULL,
  162. [update_date] datetime NOT NULL,
  163. [remarks] nvarchar(500),
  164. [corp_code] varchar(64) DEFAULT '0' NOT NULL,
  165. [corp_name] nvarchar(100) DEFAULT 'JeeSite' NOT NULL,
  166. [extend_s1] nvarchar(500),
  167. [extend_s2] nvarchar(500),
  168. [extend_s3] nvarchar(500),
  169. [extend_s4] nvarchar(500),
  170. [extend_s5] nvarchar(500),
  171. [extend_s6] nvarchar(500),
  172. [extend_s7] nvarchar(500),
  173. [extend_s8] nvarchar(500),
  174. [extend_i1] decimal(19),
  175. [extend_i2] decimal(19),
  176. [extend_i3] decimal(19),
  177. [extend_i4] decimal(19),
  178. [extend_f1] decimal(19,4),
  179. [extend_f2] decimal(19,4),
  180. [extend_f3] decimal(19,4),
  181. [extend_f4] decimal(19,4),
  182. [extend_d1] datetime,
  183. [extend_d2] datetime,
  184. [extend_d3] datetime,
  185. [extend_d4] datetime,
  186. PRIMARY KEY ([dict_code])
  187. );
  188. -- 字典类型表
  189. CREATE TABLE [js_sys_dict_type]
  190. (
  191. [id] varchar(64) NOT NULL,
  192. [dict_name] nvarchar(100) NOT NULL,
  193. [dict_type] varchar(100) NOT NULL,
  194. [is_sys] char(1) NOT NULL,
  195. [status] char(1) DEFAULT '0' NOT NULL,
  196. [create_by] varchar(64) NOT NULL,
  197. [create_date] datetime NOT NULL,
  198. [update_by] varchar(64) NOT NULL,
  199. [update_date] datetime NOT NULL,
  200. [remarks] nvarchar(500),
  201. PRIMARY KEY ([id])
  202. );
  203. -- 员工表
  204. CREATE TABLE [js_sys_employee]
  205. (
  206. [emp_code] varchar(64) NOT NULL,
  207. [emp_name] nvarchar(100) NOT NULL,
  208. [emp_name_en] varchar(100),
  209. [emp_no] nvarchar(100),
  210. [office_code] varchar(64) NOT NULL,
  211. [office_name] nvarchar(100) NOT NULL,
  212. [company_code] varchar(64),
  213. [company_name] nvarchar(200),
  214. [status] char(1) NOT NULL,
  215. [create_by] varchar(64) NOT NULL,
  216. [create_date] datetime NOT NULL,
  217. [update_by] varchar(64) NOT NULL,
  218. [update_date] datetime NOT NULL,
  219. [remarks] nvarchar(500),
  220. [corp_code] varchar(64) DEFAULT '0' NOT NULL,
  221. [corp_name] nvarchar(100) DEFAULT 'JeeSite' NOT NULL,
  222. PRIMARY KEY ([emp_code])
  223. );
  224. -- 员工附属机构关系表
  225. CREATE TABLE [js_sys_employee_office]
  226. (
  227. [id] varchar(64) NOT NULL,
  228. [emp_code] varchar(64) NOT NULL,
  229. [office_code] varchar(64) NOT NULL,
  230. [post_code] varchar(64),
  231. PRIMARY KEY ([id])
  232. );
  233. -- 员工与岗位关联表
  234. CREATE TABLE [js_sys_employee_post]
  235. (
  236. [emp_code] varchar(64) NOT NULL,
  237. [post_code] varchar(64) NOT NULL,
  238. PRIMARY KEY ([emp_code], [post_code])
  239. );
  240. -- 文件实体表
  241. CREATE TABLE [js_sys_file_entity]
  242. (
  243. [file_id] varchar(64) NOT NULL,
  244. [file_md5] varchar(64) NOT NULL,
  245. [file_path] nvarchar(1000) NOT NULL,
  246. [file_content_type] varchar(200) NOT NULL,
  247. [file_extension] varchar(100) NOT NULL,
  248. [file_size] decimal(31) NOT NULL,
  249. [file_meta] varchar(255),
  250. [file_preview] char(1),
  251. PRIMARY KEY ([file_id])
  252. );
  253. -- 文件上传表
  254. CREATE TABLE [js_sys_file_upload]
  255. (
  256. [id] varchar(64) NOT NULL,
  257. [file_id] varchar(64) NOT NULL,
  258. [file_name] nvarchar(500) NOT NULL,
  259. [file_type] varchar(20) NOT NULL,
  260. [file_sort] decimal(10),
  261. [biz_key] varchar(64),
  262. [biz_type] varchar(64),
  263. [status] char(1) DEFAULT '0' NOT NULL,
  264. [create_by] varchar(64) NOT NULL,
  265. [create_date] datetime NOT NULL,
  266. [update_by] varchar(64) NOT NULL,
  267. [update_date] datetime NOT NULL,
  268. [remarks] nvarchar(500),
  269. [extend_s1] nvarchar(500),
  270. [extend_s2] nvarchar(500),
  271. [extend_s3] nvarchar(500),
  272. [extend_s4] nvarchar(500),
  273. [extend_s5] nvarchar(500),
  274. [extend_s6] nvarchar(500),
  275. [extend_s7] nvarchar(500),
  276. [extend_s8] nvarchar(500),
  277. [extend_i1] decimal(19),
  278. [extend_i2] decimal(19),
  279. [extend_i3] decimal(19),
  280. [extend_i4] decimal(19),
  281. [extend_f1] decimal(19,4),
  282. [extend_f2] decimal(19,4),
  283. [extend_f3] decimal(19,4),
  284. [extend_f4] decimal(19,4),
  285. [extend_d1] datetime,
  286. [extend_d2] datetime,
  287. [extend_d3] datetime,
  288. [extend_d4] datetime,
  289. PRIMARY KEY ([id])
  290. );
  291. -- 作业调度表
  292. CREATE TABLE [js_sys_job]
  293. (
  294. [job_name] varchar(64) NOT NULL,
  295. [job_group] varchar(64) NOT NULL,
  296. [description] nvarchar(100) NOT NULL,
  297. [invoke_target] nvarchar(1000) NOT NULL,
  298. [cron_expression] varchar(255) NOT NULL,
  299. [misfire_instruction] decimal(1) NOT NULL,
  300. [concurrent] char(1) NOT NULL,
  301. [instance_name] varchar(64) DEFAULT 'JeeSiteScheduler' NOT NULL,
  302. [status] char(1) NOT NULL,
  303. [create_by] varchar(64) NOT NULL,
  304. [create_date] datetime NOT NULL,
  305. [update_by] varchar(64) NOT NULL,
  306. [update_date] datetime NOT NULL,
  307. [remarks] nvarchar(500),
  308. PRIMARY KEY ([job_name], [job_group])
  309. );
  310. -- 作业调度日志表
  311. CREATE TABLE [js_sys_job_log]
  312. (
  313. [id] varchar(64) NOT NULL,
  314. [job_name] varchar(64) NOT NULL,
  315. [job_group] varchar(64) NOT NULL,
  316. [job_type] varchar(50),
  317. [job_event] varchar(200),
  318. [job_message] varchar(500),
  319. [is_exception] char(1),
  320. [exception_info] text,
  321. [create_date] datetime,
  322. PRIMARY KEY ([id])
  323. );
  324. -- 国际化语言
  325. CREATE TABLE [js_sys_lang]
  326. (
  327. [id] varchar(64) NOT NULL,
  328. [module_code] varchar(64) NOT NULL,
  329. [lang_code] nvarchar(500) NOT NULL,
  330. [lang_text] nvarchar(500) NOT NULL,
  331. [lang_type] varchar(50) NOT NULL,
  332. [create_by] varchar(64) NOT NULL,
  333. [create_date] datetime NOT NULL,
  334. [update_by] varchar(64) NOT NULL,
  335. [update_date] datetime NOT NULL,
  336. [remarks] nvarchar(500),
  337. PRIMARY KEY ([id])
  338. );
  339. -- 操作日志表
  340. CREATE TABLE [js_sys_log]
  341. (
  342. [id] varchar(64) NOT NULL,
  343. [log_type] varchar(50) NOT NULL,
  344. [log_title] nvarchar(500) NOT NULL,
  345. [create_by] varchar(64) NOT NULL,
  346. [create_by_name] nvarchar(100) NOT NULL,
  347. [create_date] datetime NOT NULL,
  348. [request_uri] nvarchar(500),
  349. [request_method] varchar(10),
  350. [request_params] text,
  351. [diff_modify_data] text,
  352. [biz_key] varchar(64),
  353. [biz_type] varchar(64),
  354. [remote_addr] varchar(255) NOT NULL,
  355. [server_addr] varchar(255) NOT NULL,
  356. [is_exception] char(1),
  357. [exception_info] text,
  358. [user_agent] nvarchar(500),
  359. [device_name] varchar(100),
  360. [browser_name] varchar(100),
  361. [execute_time] decimal(19),
  362. [corp_code] varchar(64) DEFAULT '0' NOT NULL,
  363. [corp_name] nvarchar(100) DEFAULT 'JeeSite' NOT NULL,
  364. PRIMARY KEY ([id])
  365. );
  366. -- 菜单表
  367. CREATE TABLE [js_sys_menu]
  368. (
  369. [menu_code] varchar(64) NOT NULL,
  370. [parent_code] varchar(64) NOT NULL,
  371. [parent_codes] varchar(767) NOT NULL,
  372. [tree_sort] decimal(10) NOT NULL,
  373. [tree_sorts] varchar(767) NOT NULL,
  374. [tree_leaf] char(1) NOT NULL,
  375. [tree_level] decimal(4) NOT NULL,
  376. [tree_names] varchar(767) NOT NULL,
  377. [menu_name] varchar(100) NOT NULL,
  378. [menu_type] char(1) NOT NULL,
  379. [menu_href] varchar(1000),
  380. [menu_target] varchar(20),
  381. [menu_icon] varchar(100),
  382. [menu_color] varchar(50),
  383. [menu_title] varchar(100),
  384. [permission] varchar(1000),
  385. [weight] decimal(4),
  386. [is_show] char(1) NOT NULL,
  387. [sys_code] varchar(64) NOT NULL,
  388. [module_codes] varchar(500) NOT NULL,
  389. [status] char(1) DEFAULT '0' NOT NULL,
  390. [create_by] varchar(64) NOT NULL,
  391. [create_date] datetime NOT NULL,
  392. [update_by] varchar(64) NOT NULL,
  393. [update_date] datetime NOT NULL,
  394. [remarks] nvarchar(500),
  395. [extend_s1] nvarchar(500),
  396. [extend_s2] nvarchar(500),
  397. [extend_s3] nvarchar(500),
  398. [extend_s4] nvarchar(500),
  399. [extend_s5] nvarchar(500),
  400. [extend_s6] nvarchar(500),
  401. [extend_s7] nvarchar(500),
  402. [extend_s8] nvarchar(500),
  403. [extend_i1] decimal(19),
  404. [extend_i2] decimal(19),
  405. [extend_i3] decimal(19),
  406. [extend_i4] decimal(19),
  407. [extend_f1] decimal(19,4),
  408. [extend_f2] decimal(19,4),
  409. [extend_f3] decimal(19,4),
  410. [extend_f4] decimal(19,4),
  411. [extend_d1] datetime,
  412. [extend_d2] datetime,
  413. [extend_d3] datetime,
  414. [extend_d4] datetime,
  415. PRIMARY KEY ([menu_code])
  416. );
  417. -- 模块表
  418. CREATE TABLE [js_sys_module]
  419. (
  420. [module_code] varchar(64) NOT NULL,
  421. [module_name] varchar(100) NOT NULL,
  422. [description] nvarchar(500),
  423. [main_class_name] varchar(500),
  424. [current_version] varchar(50),
  425. [upgrade_info] varchar(300),
  426. [status] char(1) DEFAULT '0' NOT NULL,
  427. [create_by] varchar(64) NOT NULL,
  428. [create_date] datetime NOT NULL,
  429. [update_by] varchar(64) NOT NULL,
  430. [update_date] datetime NOT NULL,
  431. [remarks] nvarchar(500),
  432. PRIMARY KEY ([module_code])
  433. );
  434. -- 内部消息
  435. CREATE TABLE [js_sys_msg_inner]
  436. (
  437. [id] varchar(64) NOT NULL,
  438. [msg_title] varchar(200) NOT NULL,
  439. [content_level] char(1) NOT NULL,
  440. [content_type] char(1),
  441. [msg_content] text NOT NULL,
  442. [receive_type] char(1) NOT NULL,
  443. [receive_codes] text,
  444. [receive_names] text,
  445. [send_user_code] varchar(64),
  446. [send_user_name] varchar(100),
  447. [send_date] datetime,
  448. [is_attac] char(1),
  449. [notify_types] varchar(100),
  450. [status] char(1) NOT NULL,
  451. [create_by] varchar(64) NOT NULL,
  452. [create_date] datetime NOT NULL,
  453. [update_by] varchar(64) NOT NULL,
  454. [update_date] datetime NOT NULL,
  455. [remarks] nvarchar(500),
  456. PRIMARY KEY ([id])
  457. );
  458. -- 内部消息发送记录表
  459. CREATE TABLE [js_sys_msg_inner_record]
  460. (
  461. [id] varchar(64) NOT NULL,
  462. [msg_inner_id] varchar(64) NOT NULL,
  463. [receive_user_code] varchar(64) NOT NULL,
  464. [receive_user_name] varchar(100) NOT NULL,
  465. [read_status] char(1) NOT NULL,
  466. [read_date] datetime,
  467. [is_star] char(1),
  468. PRIMARY KEY ([id])
  469. );
  470. -- 消息推送表
  471. CREATE TABLE [js_sys_msg_push]
  472. (
  473. [id] varchar(64) NOT NULL,
  474. [msg_type] varchar(16) NOT NULL,
  475. [msg_title] varchar(200) NOT NULL,
  476. [msg_content] text NOT NULL,
  477. [biz_key] varchar(64),
  478. [biz_type] varchar(64),
  479. [receive_code] varchar(64) NOT NULL,
  480. [receive_user_code] varchar(64) NOT NULL,
  481. [receive_user_name] varchar(100) NOT NULL,
  482. [send_user_code] varchar(64) NOT NULL,
  483. [send_user_name] varchar(100) NOT NULL,
  484. [send_date] datetime NOT NULL,
  485. [is_merge_push] char(1),
  486. [plan_push_date] datetime,
  487. [push_number] int,
  488. [push_return_code] varchar(200),
  489. [push_return_msg_id] varchar(200),
  490. [push_return_content] text,
  491. [push_status] char(1),
  492. [push_date] datetime,
  493. [read_status] char(1),
  494. [read_date] datetime,
  495. PRIMARY KEY ([id])
  496. );
  497. -- 消息已推送表
  498. CREATE TABLE [js_sys_msg_pushed]
  499. (
  500. [id] varchar(64) NOT NULL,
  501. [msg_type] varchar(16) NOT NULL,
  502. [msg_title] varchar(200) NOT NULL,
  503. [msg_content] text NOT NULL,
  504. [biz_key] varchar(64),
  505. [biz_type] varchar(64),
  506. [receive_code] varchar(64) NOT NULL,
  507. [receive_user_code] varchar(64) NOT NULL,
  508. [receive_user_name] varchar(100) NOT NULL,
  509. [send_user_code] varchar(64) NOT NULL,
  510. [send_user_name] varchar(100) NOT NULL,
  511. [send_date] datetime NOT NULL,
  512. [is_merge_push] char(1),
  513. [plan_push_date] datetime,
  514. [push_number] int,
  515. [push_return_content] text,
  516. [push_return_code] varchar(200),
  517. [push_return_msg_id] varchar(200),
  518. [push_status] char(1),
  519. [push_date] datetime,
  520. [read_status] char(1),
  521. [read_date] datetime,
  522. PRIMARY KEY ([id])
  523. );
  524. -- 消息模板
  525. CREATE TABLE [js_sys_msg_template]
  526. (
  527. [id] varchar(64) NOT NULL,
  528. [module_code] varchar(64),
  529. [tpl_key] varchar(100) NOT NULL,
  530. [tpl_name] nvarchar(100) NOT NULL,
  531. [tpl_type] varchar(16) NOT NULL,
  532. [tpl_content] text NOT NULL,
  533. [status] char(1) DEFAULT '0' NOT NULL,
  534. [create_by] varchar(64) NOT NULL,
  535. [create_date] datetime NOT NULL,
  536. [update_by] varchar(64) NOT NULL,
  537. [update_date] datetime NOT NULL,
  538. [remarks] nvarchar(500),
  539. PRIMARY KEY ([id])
  540. );
  541. -- 组织机构表
  542. CREATE TABLE [js_sys_office]
  543. (
  544. [office_code] varchar(64) NOT NULL,
  545. [parent_code] varchar(64) NOT NULL,
  546. [parent_codes] varchar(767) NOT NULL,
  547. [tree_sort] decimal(10) NOT NULL,
  548. [tree_sorts] varchar(767) NOT NULL,
  549. [tree_leaf] char(1) NOT NULL,
  550. [tree_level] decimal(4) NOT NULL,
  551. [tree_names] varchar(767) NOT NULL,
  552. [view_code] varchar(100) NOT NULL,
  553. [office_name] nvarchar(100) NOT NULL,
  554. [full_name] varchar(200) NOT NULL,
  555. [office_type] char(1) NOT NULL,
  556. [leader] varchar(100),
  557. [phone] varchar(100),
  558. [address] varchar(255),
  559. [zip_code] varchar(100),
  560. [email] varchar(300),
  561. [status] char(1) DEFAULT '0' NOT NULL,
  562. [create_by] varchar(64) NOT NULL,
  563. [create_date] datetime NOT NULL,
  564. [update_by] varchar(64) NOT NULL,
  565. [update_date] datetime NOT NULL,
  566. [remarks] nvarchar(500),
  567. [corp_code] varchar(64) DEFAULT '0' NOT NULL,
  568. [corp_name] nvarchar(100) DEFAULT 'JeeSite' NOT NULL,
  569. [extend_s1] nvarchar(500),
  570. [extend_s2] nvarchar(500),
  571. [extend_s3] nvarchar(500),
  572. [extend_s4] nvarchar(500),
  573. [extend_s5] nvarchar(500),
  574. [extend_s6] nvarchar(500),
  575. [extend_s7] nvarchar(500),
  576. [extend_s8] nvarchar(500),
  577. [extend_i1] decimal(19),
  578. [extend_i2] decimal(19),
  579. [extend_i3] decimal(19),
  580. [extend_i4] decimal(19),
  581. [extend_f1] decimal(19,4),
  582. [extend_f2] decimal(19,4),
  583. [extend_f3] decimal(19,4),
  584. [extend_f4] decimal(19,4),
  585. [extend_d1] datetime,
  586. [extend_d2] datetime,
  587. [extend_d3] datetime,
  588. [extend_d4] datetime,
  589. PRIMARY KEY ([office_code])
  590. );
  591. -- 员工岗位表
  592. CREATE TABLE [js_sys_post]
  593. (
  594. [post_code] varchar(64) NOT NULL,
  595. [post_name] varchar(100) NOT NULL,
  596. [post_type] varchar(100),
  597. [post_sort] decimal(10),
  598. [status] char(1) DEFAULT '0' NOT NULL,
  599. [create_by] varchar(64) NOT NULL,
  600. [create_date] datetime NOT NULL,
  601. [update_by] varchar(64) NOT NULL,
  602. [update_date] datetime NOT NULL,
  603. [remarks] nvarchar(500),
  604. [corp_code] varchar(64) DEFAULT '0' NOT NULL,
  605. [corp_name] nvarchar(100) DEFAULT 'JeeSite' NOT NULL,
  606. PRIMARY KEY ([post_code])
  607. );
  608. -- 角色表
  609. CREATE TABLE [js_sys_role]
  610. (
  611. [role_code] varchar(64) NOT NULL,
  612. [role_name] varchar(100) NOT NULL,
  613. [role_type] varchar(100),
  614. [role_sort] decimal(10),
  615. [is_sys] char(1),
  616. [user_type] varchar(16),
  617. [data_scope] char(1),
  618. [biz_scope] varchar(255),
  619. [status] char(1) DEFAULT '0' NOT NULL,
  620. [create_by] varchar(64) NOT NULL,
  621. [create_date] datetime NOT NULL,
  622. [update_by] varchar(64) NOT NULL,
  623. [update_date] datetime NOT NULL,
  624. [remarks] nvarchar(500),
  625. [corp_code] varchar(64) DEFAULT '0' NOT NULL,
  626. [corp_name] nvarchar(100) DEFAULT 'JeeSite' NOT NULL,
  627. [extend_s1] nvarchar(500),
  628. [extend_s2] nvarchar(500),
  629. [extend_s3] nvarchar(500),
  630. [extend_s4] nvarchar(500),
  631. [extend_s5] nvarchar(500),
  632. [extend_s6] nvarchar(500),
  633. [extend_s7] nvarchar(500),
  634. [extend_s8] nvarchar(500),
  635. [extend_i1] decimal(19),
  636. [extend_i2] decimal(19),
  637. [extend_i3] decimal(19),
  638. [extend_i4] decimal(19),
  639. [extend_f1] decimal(19,4),
  640. [extend_f2] decimal(19,4),
  641. [extend_f3] decimal(19,4),
  642. [extend_f4] decimal(19,4),
  643. [extend_d1] datetime,
  644. [extend_d2] datetime,
  645. [extend_d3] datetime,
  646. [extend_d4] datetime,
  647. PRIMARY KEY ([role_code])
  648. );
  649. -- 角色数据权限表
  650. CREATE TABLE [js_sys_role_data_scope]
  651. (
  652. [role_code] varchar(64) NOT NULL,
  653. [ctrl_type] varchar(20) NOT NULL,
  654. [ctrl_data] varchar(64) NOT NULL,
  655. [ctrl_permi] varchar(64) NOT NULL,
  656. PRIMARY KEY ([role_code], [ctrl_type], [ctrl_data], [ctrl_permi])
  657. );
  658. -- 角色与菜单关联表
  659. CREATE TABLE [js_sys_role_menu]
  660. (
  661. [role_code] varchar(64) NOT NULL,
  662. [menu_code] varchar(64) NOT NULL,
  663. PRIMARY KEY ([role_code], [menu_code])
  664. );
  665. -- 用户表
  666. CREATE TABLE [js_sys_user]
  667. (
  668. [user_code] varchar(100) NOT NULL,
  669. [login_code] varchar(100) NOT NULL,
  670. [user_name] varchar(100) NOT NULL,
  671. [password] varchar(200) NOT NULL,
  672. [email] varchar(300),
  673. [mobile] varchar(100),
  674. [phone] varchar(100),
  675. [sex] char(1),
  676. [avatar] varchar(1000),
  677. [sign] nvarchar(200),
  678. [wx_openid] varchar(100),
  679. [mobile_imei] varchar(100),
  680. [user_type] varchar(16) NOT NULL,
  681. [ref_code] varchar(64),
  682. [ref_name] varchar(100),
  683. [mgr_type] char(1) NOT NULL,
  684. [pwd_security_level] decimal(1),
  685. [pwd_update_date] datetime,
  686. [pwd_update_record] varchar(1000),
  687. [pwd_question] varchar(200),
  688. [pwd_question_answer] varchar(200),
  689. [pwd_question_2] varchar(200),
  690. [pwd_question_answer_2] varchar(200),
  691. [pwd_question_3] varchar(200),
  692. [pwd_question_answer_3] varchar(200),
  693. [pwd_quest_update_date] datetime,
  694. [last_login_ip] varchar(100),
  695. [last_login_date] datetime,
  696. [freeze_date] datetime,
  697. [freeze_cause] varchar(200),
  698. [user_weight] decimal(8) DEFAULT 0,
  699. [status] char NOT NULL,
  700. [create_by] varchar(64) NOT NULL,
  701. [create_date] datetime NOT NULL,
  702. [update_by] varchar(64) NOT NULL,
  703. [update_date] datetime NOT NULL,
  704. [remarks] nvarchar(500),
  705. [corp_code] varchar(64) DEFAULT '0' NOT NULL,
  706. [corp_name] nvarchar(100) DEFAULT 'JeeSite' NOT NULL,
  707. [extend_s1] nvarchar(500),
  708. [extend_s2] nvarchar(500),
  709. [extend_s3] nvarchar(500),
  710. [extend_s4] nvarchar(500),
  711. [extend_s5] nvarchar(500),
  712. [extend_s6] nvarchar(500),
  713. [extend_s7] nvarchar(500),
  714. [extend_s8] nvarchar(500),
  715. [extend_i1] decimal(19),
  716. [extend_i2] decimal(19),
  717. [extend_i3] decimal(19),
  718. [extend_i4] decimal(19),
  719. [extend_f1] decimal(19,4),
  720. [extend_f2] decimal(19,4),
  721. [extend_f3] decimal(19,4),
  722. [extend_f4] decimal(19,4),
  723. [extend_d1] datetime,
  724. [extend_d2] datetime,
  725. [extend_d3] datetime,
  726. [extend_d4] datetime,
  727. PRIMARY KEY ([user_code])
  728. );
  729. -- 用户数据权限表
  730. CREATE TABLE [js_sys_user_data_scope]
  731. (
  732. [user_code] varchar(100) NOT NULL,
  733. [ctrl_type] varchar(20) NOT NULL,
  734. [ctrl_data] varchar(64) NOT NULL,
  735. [ctrl_permi] varchar(64) NOT NULL,
  736. PRIMARY KEY ([user_code], [ctrl_type], [ctrl_data], [ctrl_permi])
  737. );
  738. -- 用户与角色关联表
  739. CREATE TABLE [js_sys_user_role]
  740. (
  741. [user_code] varchar(100) NOT NULL,
  742. [role_code] varchar(64) NOT NULL,
  743. PRIMARY KEY ([user_code], [role_code])
  744. );
  745. /* Create Indexes */
  746. CREATE INDEX [idx_gen_table_ptn] ON [js_gen_table] ([parent_table_name]);
  747. CREATE INDEX [idx_gen_table_column_tn] ON [js_gen_table_column] ([table_name]);
  748. CREATE INDEX [idx_sys_area_pc] ON [js_sys_area] ([parent_code]);
  749. CREATE INDEX [idx_sys_area_ts] ON [js_sys_area] ([tree_sort]);
  750. CREATE INDEX [idx_sys_area_status] ON [js_sys_area] ([status]);
  751. CREATE INDEX [idx_sys_area_pcs] ON [js_sys_area] ([parent_codes]);
  752. CREATE INDEX [idx_sys_area_tss] ON [js_sys_area] ([tree_sorts]);
  753. CREATE INDEX [idx_sys_company_cc] ON [js_sys_company] ([corp_code]);
  754. CREATE INDEX [idx_sys_company_pc] ON [js_sys_company] ([parent_code]);
  755. CREATE INDEX [idx_sys_company_ts] ON [js_sys_company] ([tree_sort]);
  756. CREATE INDEX [idx_sys_company_status] ON [js_sys_company] ([status]);
  757. CREATE INDEX [idx_sys_company_vc] ON [js_sys_company] ([view_code]);
  758. CREATE INDEX [idx_sys_company_pcs] ON [js_sys_company] ([parent_codes]);
  759. CREATE INDEX [idx_sys_company_tss] ON [js_sys_company] ([tree_sorts]);
  760. CREATE UNIQUE INDEX [idx_sys_config_key] ON [js_sys_config] ([config_key]);
  761. CREATE INDEX [idx_sys_dict_data_cc] ON [js_sys_dict_data] ([corp_code]);
  762. CREATE INDEX [idx_sys_dict_data_dt] ON [js_sys_dict_data] ([dict_type]);
  763. CREATE INDEX [idx_sys_dict_data_pc] ON [js_sys_dict_data] ([parent_code]);
  764. CREATE INDEX [idx_sys_dict_data_status] ON [js_sys_dict_data] ([status]);
  765. CREATE INDEX [idx_sys_dict_data_pcs] ON [js_sys_dict_data] ([parent_codes]);
  766. CREATE INDEX [idx_sys_dict_data_ts] ON [js_sys_dict_data] ([tree_sort]);
  767. CREATE INDEX [idx_sys_dict_data_tss] ON [js_sys_dict_data] ([tree_sorts]);
  768. CREATE INDEX [idx_sys_dict_data_dv] ON [js_sys_dict_data] ([dict_value]);
  769. CREATE INDEX [idx_sys_dict_type_is] ON [js_sys_dict_type] ([is_sys]);
  770. CREATE INDEX [idx_sys_dict_type_status] ON [js_sys_dict_type] ([status]);
  771. CREATE INDEX [idx_sys_employee_cco] ON [js_sys_employee] ([company_code]);
  772. CREATE INDEX [idx_sys_employee_cc] ON [js_sys_employee] ([corp_code]);
  773. CREATE INDEX [idx_sys_employee_ud] ON [js_sys_employee] ([update_date]);
  774. CREATE INDEX [idx_sys_employee_oc] ON [js_sys_employee] ([office_code]);
  775. CREATE INDEX [idx_sys_employee_status] ON [js_sys_employee] ([status]);
  776. CREATE INDEX [idx_sys_file_entity_md5] ON [js_sys_file_entity] ([file_md5]);
  777. CREATE INDEX [idx_sys_file_entity_size] ON [js_sys_file_entity] ([file_size]);
  778. CREATE INDEX [idx_sys_file_biz_ft] ON [js_sys_file_upload] ([file_type]);
  779. CREATE INDEX [idx_sys_file_biz_fi] ON [js_sys_file_upload] ([file_id]);
  780. CREATE INDEX [idx_sys_file_biz_status] ON [js_sys_file_upload] ([status]);
  781. CREATE INDEX [idx_sys_file_biz_cb] ON [js_sys_file_upload] ([create_by]);
  782. CREATE INDEX [idx_sys_file_biz_ud] ON [js_sys_file_upload] ([update_date]);
  783. CREATE INDEX [idx_sys_file_biz_bt] ON [js_sys_file_upload] ([biz_type]);
  784. CREATE INDEX [idx_sys_file_biz_bk] ON [js_sys_file_upload] ([biz_key]);
  785. CREATE INDEX [idx_sys_job_status] ON [js_sys_job] ([status]);
  786. CREATE INDEX [idx_sys_job_log_jn] ON [js_sys_job_log] ([job_name]);
  787. CREATE INDEX [idx_sys_job_log_jg] ON [js_sys_job_log] ([job_group]);
  788. CREATE INDEX [idx_sys_job_log_t] ON [js_sys_job_log] ([job_type]);
  789. CREATE INDEX [idx_sys_job_log_e] ON [js_sys_job_log] ([job_event]);
  790. CREATE INDEX [idx_sys_job_log_ie] ON [js_sys_job_log] ([is_exception]);
  791. CREATE INDEX [idx_sys_lang_code] ON [js_sys_lang] ([lang_code]);
  792. CREATE INDEX [idx_sys_lang_type] ON [js_sys_lang] ([lang_type]);
  793. CREATE INDEX [idx_sys_log_cb] ON [js_sys_log] ([create_by]);
  794. CREATE INDEX [idx_sys_log_cc] ON [js_sys_log] ([corp_code]);
  795. CREATE INDEX [idx_sys_log_lt] ON [js_sys_log] ([log_type]);
  796. CREATE INDEX [idx_sys_log_bk] ON [js_sys_log] ([biz_key]);
  797. CREATE INDEX [idx_sys_log_bt] ON [js_sys_log] ([biz_type]);
  798. CREATE INDEX [idx_sys_log_ie] ON [js_sys_log] ([is_exception]);
  799. CREATE INDEX [idx_sys_log_cd] ON [js_sys_log] ([create_date]);
  800. CREATE INDEX [idx_sys_menu_pc] ON [js_sys_menu] ([parent_code]);
  801. CREATE INDEX [idx_sys_menu_ts] ON [js_sys_menu] ([tree_sort]);
  802. CREATE INDEX [idx_sys_menu_status] ON [js_sys_menu] ([status]);
  803. CREATE INDEX [idx_sys_menu_mt] ON [js_sys_menu] ([menu_type]);
  804. CREATE INDEX [idx_sys_menu_pss] ON [js_sys_menu] ([parent_codes]);
  805. CREATE INDEX [idx_sys_menu_tss] ON [js_sys_menu] ([tree_sorts]);
  806. CREATE INDEX [idx_sys_menu_sc] ON [js_sys_menu] ([sys_code]);
  807. CREATE INDEX [idx_sys_menu_is] ON [js_sys_menu] ([is_show]);
  808. CREATE INDEX [idx_sys_menu_mcs] ON [js_sys_menu] ([module_codes]);
  809. CREATE INDEX [idx_sys_menu_wt] ON [js_sys_menu] ([weight]);
  810. CREATE INDEX [idx_sys_module_status] ON [js_sys_module] ([status]);
  811. CREATE INDEX [idx_sys_msg_inner_cb] ON [js_sys_msg_inner] ([create_by]);
  812. CREATE INDEX [idx_sys_msg_inner_status] ON [js_sys_msg_inner] ([status]);
  813. CREATE INDEX [idx_sys_msg_inner_cl] ON [js_sys_msg_inner] ([content_level]);
  814. CREATE INDEX [idx_sys_msg_inner_sc] ON [js_sys_msg_inner] ([send_user_code]);
  815. CREATE INDEX [idx_sys_msg_inner_sd] ON [js_sys_msg_inner] ([send_date]);
  816. CREATE INDEX [idx_sys_msg_inner_r_mi] ON [js_sys_msg_inner_record] ([msg_inner_id]);
  817. CREATE INDEX [idx_sys_msg_inner_r_ruc] ON [js_sys_msg_inner_record] ([receive_user_code]);
  818. CREATE INDEX [idx_sys_msg_inner_r_stat] ON [js_sys_msg_inner_record] ([read_status]);
  819. CREATE INDEX [idx_sys_msg_inner_r_star] ON [js_sys_msg_inner_record] ([is_star]);
  820. CREATE INDEX [idx_sys_msg_push_type] ON [js_sys_msg_push] ([msg_type]);
  821. CREATE INDEX [idx_sys_msg_push_rc] ON [js_sys_msg_push] ([receive_code]);
  822. CREATE INDEX [idx_sys_msg_push_uc] ON [js_sys_msg_push] ([receive_user_code]);
  823. CREATE INDEX [idx_sys_msg_push_suc] ON [js_sys_msg_push] ([send_user_code]);
  824. CREATE INDEX [idx_sys_msg_push_pd] ON [js_sys_msg_push] ([plan_push_date]);
  825. CREATE INDEX [idx_sys_msg_push_ps] ON [js_sys_msg_push] ([push_status]);
  826. CREATE INDEX [idx_sys_msg_push_rs] ON [js_sys_msg_push] ([read_status]);
  827. CREATE INDEX [idx_sys_msg_push_bk] ON [js_sys_msg_push] ([biz_key]);
  828. CREATE INDEX [idx_sys_msg_push_bt] ON [js_sys_msg_push] ([biz_type]);
  829. CREATE INDEX [idx_sys_msg_push_imp] ON [js_sys_msg_push] ([is_merge_push]);
  830. CREATE INDEX [idx_sys_msg_pushed_type] ON [js_sys_msg_pushed] ([msg_type]);
  831. CREATE INDEX [idx_sys_msg_pushed_rc] ON [js_sys_msg_pushed] ([receive_code]);
  832. CREATE INDEX [idx_sys_msg_pushed_uc] ON [js_sys_msg_pushed] ([receive_user_code]);
  833. CREATE INDEX [idx_sys_msg_pushed_suc] ON [js_sys_msg_pushed] ([send_user_code]);
  834. CREATE INDEX [idx_sys_msg_pushed_pd] ON [js_sys_msg_pushed] ([plan_push_date]);
  835. CREATE INDEX [idx_sys_msg_pushed_ps] ON [js_sys_msg_pushed] ([push_status]);
  836. CREATE INDEX [idx_sys_msg_pushed_rs] ON [js_sys_msg_pushed] ([read_status]);
  837. CREATE INDEX [idx_sys_msg_pushed_bk] ON [js_sys_msg_pushed] ([biz_key]);
  838. CREATE INDEX [idx_sys_msg_pushed_bt] ON [js_sys_msg_pushed] ([biz_type]);
  839. CREATE INDEX [idx_sys_msg_pushed_imp] ON [js_sys_msg_pushed] ([is_merge_push]);
  840. CREATE INDEX [idx_sys_msg_tpl_key] ON [js_sys_msg_template] ([tpl_key]);
  841. CREATE INDEX [idx_sys_msg_tpl_type] ON [js_sys_msg_template] ([tpl_type]);
  842. CREATE INDEX [idx_sys_msg_tpl_status] ON [js_sys_msg_template] ([status]);
  843. CREATE INDEX [idx_sys_office_cc] ON [js_sys_office] ([corp_code]);
  844. CREATE INDEX [idx_sys_office_pc] ON [js_sys_office] ([parent_code]);
  845. CREATE INDEX [idx_sys_office_pcs] ON [js_sys_office] ([parent_codes]);
  846. CREATE INDEX [idx_sys_office_status] ON [js_sys_office] ([status]);
  847. CREATE INDEX [idx_sys_office_ot] ON [js_sys_office] ([office_type]);
  848. CREATE INDEX [idx_sys_office_vc] ON [js_sys_office] ([view_code]);
  849. CREATE INDEX [idx_sys_office_ts] ON [js_sys_office] ([tree_sort]);
  850. CREATE INDEX [idx_sys_office_tss] ON [js_sys_office] ([tree_sorts]);
  851. CREATE INDEX [idx_sys_post_cc] ON [js_sys_post] ([corp_code]);
  852. CREATE INDEX [idx_sys_post_status] ON [js_sys_post] ([status]);
  853. CREATE INDEX [idx_sys_post_ps] ON [js_sys_post] ([post_sort]);
  854. CREATE INDEX [idx_sys_role_cc] ON [js_sys_role] ([corp_code]);
  855. CREATE INDEX [idx_sys_role_is] ON [js_sys_role] ([is_sys]);
  856. CREATE INDEX [idx_sys_role_status] ON [js_sys_role] ([status]);
  857. CREATE INDEX [idx_sys_role_rs] ON [js_sys_role] ([role_sort]);
  858. CREATE INDEX [idx_sys_user_lc] ON [js_sys_user] ([login_code]);
  859. CREATE INDEX [idx_sys_user_email] ON [js_sys_user] ([email]);
  860. CREATE INDEX [idx_sys_user_mobile] ON [js_sys_user] ([mobile]);
  861. CREATE INDEX [idx_sys_user_wo] ON [js_sys_user] ([wx_openid]);
  862. CREATE INDEX [idx_sys_user_imei] ON [js_sys_user] ([mobile_imei]);
  863. CREATE INDEX [idx_sys_user_rt] ON [js_sys_user] ([user_type]);
  864. CREATE INDEX [idx_sys_user_rc] ON [js_sys_user] ([ref_code]);
  865. CREATE INDEX [idx_sys_user_mt] ON [js_sys_user] ([mgr_type]);
  866. CREATE INDEX [idx_sys_user_us] ON [js_sys_user] ([user_weight]);
  867. CREATE INDEX [idx_sys_user_ud] ON [js_sys_user] ([update_date]);
  868. CREATE INDEX [idx_sys_user_status] ON [js_sys_user] ([status]);
  869. CREATE INDEX [idx_sys_user_cc] ON [js_sys_user] ([corp_code]);