sx.sql 294 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890
  1. /*
  2. Navicat Premium Dump SQL
  3. Source Server : 121.43.228.102 hn02le.34lkdLKD
  4. Source Server Type : MySQL
  5. Source Server Version : 50736 (5.7.36)
  6. Source Host : 121.43.228.102:3306
  7. Source Schema : sx
  8. Target Server Type : MySQL
  9. Target Server Version : 50736 (5.7.36)
  10. File Encoding : 65001
  11. Date: 30/05/2026 13:56:15
  12. */
  13. SET NAMES utf8mb4;
  14. SET FOREIGN_KEY_CHECKS = 0;
  15. -- ----------------------------
  16. -- Table structure for bx_advance_apply
  17. -- ----------------------------
  18. DROP TABLE IF EXISTS `bx_advance_apply`;
  19. CREATE TABLE `bx_advance_apply` (
  20. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  21. `apply_code` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '申请单号(如 BYJ20260424001)',
  22. `applicant_id` bigint(20) NOT NULL COMMENT '申请人用户ID',
  23. `applicant_name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '申请人姓名(冗余)',
  24. `reason` varchar(1024) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '申请原因',
  25. `purpose` varchar(1024) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '申请目的',
  26. `expense_item_id` bigint(20) DEFAULT NULL COMMENT '费用项目ID',
  27. `amount` decimal(14,2) NOT NULL COMMENT '申请金额',
  28. `status` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'draft' COMMENT '状态:draft-草稿 pending-待审批 approved-审批通过 rejected-审批驳回 issued-已发放',
  29. `current_node` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '当前审批节点名称',
  30. `wf_id` bigint(20) DEFAULT NULL COMMENT '关联工作流定义ID',
  31. `issue_status` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '发放状态:unissued-未发放 issued-已发放',
  32. `issue_time` datetime DEFAULT NULL COMMENT '发放时间',
  33. `issue_user_id` bigint(20) DEFAULT NULL COMMENT '发放操作人ID',
  34. `issue_user_name` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '发放操作人姓名',
  35. `issue_remark` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '发放备注',
  36. `actual_amount` decimal(14,2) DEFAULT NULL COMMENT '实际发放金额',
  37. `remark` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
  38. `create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
  39. `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  40. `update_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
  41. `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  42. `del_flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '删除标记:0-正常 1-已删除',
  43. PRIMARY KEY (`id`) USING BTREE,
  44. UNIQUE KEY `uk_apply_code` (`apply_code`) USING BTREE,
  45. KEY `idx_applicant_id` (`applicant_id`) USING BTREE,
  46. KEY `idx_status` (`status`) USING BTREE
  47. ) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='备用金申请单';
  48. -- ----------------------------
  49. -- Table structure for bx_advance_approval
  50. -- ----------------------------
  51. DROP TABLE IF EXISTS `bx_advance_approval`;
  52. CREATE TABLE `bx_advance_approval` (
  53. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  54. `apply_id` bigint(20) NOT NULL COMMENT '备用金申请单ID',
  55. `node_order` int(11) NOT NULL COMMENT '节点顺序',
  56. `node_name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '节点名称',
  57. `approver_id` bigint(20) NOT NULL COMMENT '审批人用户ID',
  58. `approver_name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '审批人姓名',
  59. `approval_status` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '审批结果:approved-通过 rejected-驳回',
  60. `approval_opinion` varchar(1024) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '审批意见',
  61. `approval_time` datetime NOT NULL COMMENT '审批时间',
  62. PRIMARY KEY (`id`) USING BTREE,
  63. KEY `idx_apply_id` (`apply_id`) USING BTREE
  64. ) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='备用金审批记录表';
  65. -- ----------------------------
  66. -- Table structure for bx_attachment
  67. -- ----------------------------
  68. DROP TABLE IF EXISTS `bx_attachment`;
  69. CREATE TABLE `bx_attachment` (
  70. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  71. `biz_type` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '业务类型:advance-备用金 reimburse-报销 advance_issue-备用金发放',
  72. `biz_id` bigint(20) NOT NULL COMMENT '业务单据ID',
  73. `file_name` varchar(256) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '文件名',
  74. `file_path` varchar(512) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '文件存储路径',
  75. `file_type` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  76. `file_size` bigint(20) DEFAULT NULL COMMENT '文件大小(字节)',
  77. `attach_type` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT 'attachment' COMMENT '附件类型:invoice-发票 attachment-普通附件 issue_proof-发放截图',
  78. `sort_order` int(11) NOT NULL DEFAULT '0' COMMENT '排序号',
  79. `create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
  80. `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  81. `del_flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '删除标记:0-正常 1-已删除',
  82. PRIMARY KEY (`id`) USING BTREE,
  83. KEY `idx_biz` (`biz_type`,`biz_id`) USING BTREE
  84. ) ENGINE=InnoDB AUTO_INCREMENT=150 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='附件表';
  85. -- ----------------------------
  86. -- Table structure for bx_expense_item
  87. -- ----------------------------
  88. DROP TABLE IF EXISTS `bx_expense_item`;
  89. CREATE TABLE `bx_expense_item` (
  90. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  91. `parent_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '父级项目ID(0为一级项目)',
  92. `item_name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '项目名称',
  93. `item_code` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '项目编码',
  94. `level` tinyint(4) NOT NULL DEFAULT '1' COMMENT '层级:1-一级 2-二级',
  95. `sort_order` int(11) NOT NULL DEFAULT '0' COMMENT '排序号',
  96. `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态:1-启用 0-禁用',
  97. `remark` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
  98. `create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
  99. `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  100. `update_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
  101. `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  102. `del_flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '删除标记:0-正常 1-已删除',
  103. PRIMARY KEY (`id`) USING BTREE,
  104. KEY `idx_parent_id` (`parent_id`) USING BTREE
  105. ) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='费用项目表';
  106. -- ----------------------------
  107. -- Table structure for bx_menu
  108. -- ----------------------------
  109. DROP TABLE IF EXISTS `bx_menu`;
  110. CREATE TABLE `bx_menu` (
  111. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  112. `parent_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '父级菜单ID(0为顶级)',
  113. `menu_name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '菜单名称',
  114. `menu_code` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '菜单编码(前端路由标识)',
  115. `menu_type` tinyint(4) NOT NULL COMMENT '菜单类型:1-目录 2-菜单页 3-按钮/操作',
  116. `path` varchar(256) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '路由路径',
  117. `icon` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '菜单图标',
  118. `sort_order` int(11) NOT NULL DEFAULT '0' COMMENT '排序号',
  119. `visible` tinyint(4) NOT NULL DEFAULT '1' COMMENT '是否可见:1-可见 0-隐藏',
  120. `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态:1-启用 0-禁用',
  121. `remark` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
  122. `create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
  123. `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  124. `update_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
  125. `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  126. `del_flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '删除标记:0-正常 1-已删除',
  127. PRIMARY KEY (`id`) USING BTREE,
  128. KEY `idx_parent_id` (`parent_id`) USING BTREE
  129. ) ENGINE=InnoDB AUTO_INCREMENT=405 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='报销系统菜单表';
  130. -- ----------------------------
  131. -- Table structure for bx_menu_role
  132. -- ----------------------------
  133. DROP TABLE IF EXISTS `bx_menu_role`;
  134. CREATE TABLE `bx_menu_role` (
  135. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  136. `menu_id` bigint(20) NOT NULL COMMENT '菜单ID',
  137. `role_id` bigint(20) NOT NULL COMMENT '角色ID',
  138. `create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
  139. `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  140. PRIMARY KEY (`id`) USING BTREE,
  141. UNIQUE KEY `uk_menu_role` (`menu_id`,`role_id`) USING BTREE,
  142. KEY `idx_role_id` (`role_id`) USING BTREE
  143. ) ENGINE=InnoDB AUTO_INCREMENT=108 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='菜单-角色关联表';
  144. -- ----------------------------
  145. -- Table structure for bx_reimburse_apply
  146. -- ----------------------------
  147. DROP TABLE IF EXISTS `bx_reimburse_apply`;
  148. CREATE TABLE `bx_reimburse_apply` (
  149. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  150. `apply_code` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '报销单号(如 BX20260424001)',
  151. `title` varchar(256) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '报销标题',
  152. `applicant_id` bigint(20) NOT NULL COMMENT '申请人用户ID',
  153. `applicant_name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '申请人姓名(冗余)',
  154. `expense_id` bigint(20) NOT NULL COMMENT '费用项目ID(二级项目)',
  155. `expense_name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '费用项目名称(冗余)',
  156. `amount` decimal(14,2) NOT NULL COMMENT '报销金额',
  157. `invoice_count` int(11) NOT NULL DEFAULT '0' COMMENT '发票数量',
  158. `attach_count` int(11) NOT NULL DEFAULT '0' COMMENT '附件数量',
  159. `status` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'draft' COMMENT '状态:draft-草稿 pending-待审批 approved-审批通过 rejected-审批驳回 paid-已发放 offset-已冲抵',
  160. `current_node` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '当前审批节点名称',
  161. `wf_id` bigint(20) DEFAULT NULL COMMENT '关联工作流定义ID',
  162. `pay_status` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '支付状态:unpaid-未支付 paid-已发放 offset-已冲抵',
  163. `pay_time` datetime DEFAULT NULL COMMENT '支付时间',
  164. `pay_user_id` bigint(20) DEFAULT NULL COMMENT '支付操作人ID',
  165. `pay_user_name` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '支付操作人姓名',
  166. `actual_amount` decimal(14,2) DEFAULT NULL COMMENT '实际发放金额',
  167. `offset_advance_id` bigint(20) DEFAULT NULL COMMENT '冲抵关联的备用金单ID',
  168. `offset_amount` decimal(14,2) DEFAULT NULL COMMENT '冲抵金额',
  169. `remark` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注说明',
  170. `create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
  171. `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  172. `update_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
  173. `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  174. `del_flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '删除标记:0-正常 1-已删除',
  175. PRIMARY KEY (`id`) USING BTREE,
  176. UNIQUE KEY `uk_apply_code` (`apply_code`) USING BTREE,
  177. KEY `idx_applicant_id` (`applicant_id`) USING BTREE,
  178. KEY `idx_status` (`status`) USING BTREE,
  179. KEY `idx_expense_id` (`expense_id`) USING BTREE
  180. ) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='报销申请单';
  181. -- ----------------------------
  182. -- Table structure for bx_reimburse_approval
  183. -- ----------------------------
  184. DROP TABLE IF EXISTS `bx_reimburse_approval`;
  185. CREATE TABLE `bx_reimburse_approval` (
  186. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  187. `apply_id` bigint(20) NOT NULL COMMENT '报销申请单ID',
  188. `node_order` int(11) NOT NULL COMMENT '节点顺序',
  189. `node_name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '节点名称',
  190. `approver_id` bigint(20) NOT NULL COMMENT '审批人用户ID',
  191. `approver_name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '审批人姓名',
  192. `approval_status` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '审批结果:approved-通过 rejected-驳回',
  193. `approval_opinion` varchar(1024) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '审批意见',
  194. `approval_time` datetime NOT NULL COMMENT '审批时间',
  195. PRIMARY KEY (`id`) USING BTREE,
  196. KEY `idx_apply_id` (`apply_id`) USING BTREE
  197. ) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='报销审批记录表';
  198. -- ----------------------------
  199. -- Table structure for bx_reimburse_detail
  200. -- ----------------------------
  201. DROP TABLE IF EXISTS `bx_reimburse_detail`;
  202. CREATE TABLE `bx_reimburse_detail` (
  203. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  204. `reimburse_id` bigint(20) NOT NULL COMMENT '报销单ID',
  205. `expense_id` bigint(20) NOT NULL COMMENT '费用项目ID',
  206. `expense_name` varchar(128) NOT NULL COMMENT '费用项目名称',
  207. `amount` decimal(14,2) NOT NULL COMMENT '报销金额',
  208. `remark` varchar(512) DEFAULT NULL COMMENT '备注',
  209. `del_flag` smallint(6) NOT NULL DEFAULT '0',
  210. `create_by` varchar(64) DEFAULT NULL,
  211. `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  212. `update_by` varchar(64) DEFAULT NULL,
  213. `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  214. PRIMARY KEY (`id`) USING BTREE,
  215. KEY `idx_reimburse_id` (`reimburse_id`) USING BTREE
  216. ) ENGINE=InnoDB AUTO_INCREMENT=53 DEFAULT CHARSET=utf8mb4 COMMENT='报销明细';
  217. -- ----------------------------
  218. -- Table structure for bx_reimburse_offset
  219. -- ----------------------------
  220. DROP TABLE IF EXISTS `bx_reimburse_offset`;
  221. CREATE TABLE `bx_reimburse_offset` (
  222. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  223. `reimburse_id` bigint(20) NOT NULL COMMENT '报销申请单ID',
  224. `advance_id` bigint(20) NOT NULL COMMENT '备用金申请单ID',
  225. `offset_amount` decimal(14,2) NOT NULL COMMENT '冲抵金额',
  226. `remark` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
  227. `create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
  228. `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  229. PRIMARY KEY (`id`) USING BTREE,
  230. KEY `idx_reimburse_id` (`reimburse_id`) USING BTREE,
  231. KEY `idx_advance_id` (`advance_id`) USING BTREE
  232. ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='报销单-备用金冲抵关联表';
  233. -- ----------------------------
  234. -- Table structure for bx_role
  235. -- ----------------------------
  236. DROP TABLE IF EXISTS `bx_role`;
  237. CREATE TABLE `bx_role` (
  238. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  239. `role_name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '角色名称',
  240. `role_code` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '角色编码(如 ADMIN、FINANCE、EMPLOYEE)',
  241. `sort_order` int(11) NOT NULL DEFAULT '0' COMMENT '排序号',
  242. `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态:1-启用 0-禁用',
  243. `remark` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
  244. `create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
  245. `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  246. `update_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
  247. `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  248. `del_flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '删除标记:0-正常 1-已删除',
  249. PRIMARY KEY (`id`) USING BTREE,
  250. UNIQUE KEY `uk_role_code` (`role_code`) USING BTREE
  251. ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='角色表';
  252. -- ----------------------------
  253. -- Table structure for bx_role_user
  254. -- ----------------------------
  255. DROP TABLE IF EXISTS `bx_role_user`;
  256. CREATE TABLE `bx_role_user` (
  257. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  258. `role_id` bigint(20) NOT NULL COMMENT '角色ID',
  259. `user_id` bigint(20) NOT NULL COMMENT '用户ID',
  260. `create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
  261. `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  262. PRIMARY KEY (`id`) USING BTREE,
  263. UNIQUE KEY `uk_role_user` (`role_id`,`user_id`) USING BTREE,
  264. KEY `idx_user_id` (`user_id`) USING BTREE
  265. ) ENGINE=InnoDB AUTO_INCREMENT=62 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='角色-用户关联表';
  266. -- ----------------------------
  267. -- Table structure for bx_user
  268. -- ----------------------------
  269. DROP TABLE IF EXISTS `bx_user`;
  270. CREATE TABLE `bx_user` (
  271. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  272. `username` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户名(登录账号)',
  273. `password` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '密码(加密存储)',
  274. `real_name` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '真实姓名',
  275. `phone` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '手机号',
  276. `email` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '邮箱',
  277. `avatar` varchar(256) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '头像URL',
  278. `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态:1-启用 0-禁用',
  279. `remark` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
  280. `create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
  281. `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  282. `update_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
  283. `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  284. `del_flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '删除标记:0-正常 1-已删除',
  285. PRIMARY KEY (`id`) USING BTREE,
  286. UNIQUE KEY `uk_username` (`username`) USING BTREE
  287. ) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户表';
  288. -- ----------------------------
  289. -- Table structure for bx_workflow_def
  290. -- ----------------------------
  291. DROP TABLE IF EXISTS `bx_workflow_def`;
  292. CREATE TABLE `bx_workflow_def` (
  293. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  294. `biz_type` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '业务类型:advance-备用金 reimburse-报销单',
  295. `wf_name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '工作流名称',
  296. `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态:1-启用 0-禁用',
  297. `remark` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
  298. `create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
  299. `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  300. `update_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
  301. `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  302. `del_flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '删除标记:0-正常 1-已删除',
  303. PRIMARY KEY (`id`) USING BTREE,
  304. KEY `idx_biz_type` (`biz_type`) USING BTREE
  305. ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='工作流定义表';
  306. -- ----------------------------
  307. -- Table structure for bx_workflow_node
  308. -- ----------------------------
  309. DROP TABLE IF EXISTS `bx_workflow_node`;
  310. CREATE TABLE `bx_workflow_node` (
  311. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  312. `wf_id` bigint(20) NOT NULL COMMENT '工作流定义ID',
  313. `node_name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '节点名称(如:主管审批、财务复核)',
  314. `node_order` int(11) NOT NULL DEFAULT '0' COMMENT '节点顺序(从小到大执行)',
  315. `approver_id` bigint(20) DEFAULT NULL COMMENT '审批人用户ID',
  316. `approver_name` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '审批人姓名(冗余)',
  317. `create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
  318. `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  319. `update_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
  320. `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  321. PRIMARY KEY (`id`) USING BTREE,
  322. KEY `idx_wf_id` (`wf_id`) USING BTREE
  323. ) ENGINE=InnoDB AUTO_INCREMENT=92 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='工作流节点表';
  324. -- ----------------------------
  325. -- Table structure for crm_clue
  326. -- ----------------------------
  327. DROP TABLE IF EXISTS `crm_clue`;
  328. CREATE TABLE `crm_clue` (
  329. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  330. `clue_name` varchar(100) NOT NULL COMMENT '线索姓名',
  331. `mobile` varchar(20) NOT NULL COMMENT '手机号',
  332. `company` varchar(200) DEFAULT NULL COMMENT '公司名称',
  333. `customer_type` varchar(20) DEFAULT NULL COMMENT '客户类型(company-企业/person-个人)',
  334. `telephone` varchar(30) DEFAULT NULL COMMENT '固定电话',
  335. `email` varchar(100) DEFAULT NULL COMMENT '邮箱',
  336. `title` varchar(10) DEFAULT NULL COMMENT '称呼(先生/女士/其他)',
  337. `position` varchar(50) DEFAULT NULL COMMENT '职位',
  338. `source` varchar(20) NOT NULL COMMENT '线索来源(网站留言/电话咨询/展会/市场活动/老客户推荐/广告投放/社交媒体/其他)',
  339. `level` varchar(10) DEFAULT 'unrated' COMMENT '线索等级(A/B/C/unrated)',
  340. `industry` varchar(50) DEFAULT NULL COMMENT '所属行业',
  341. `park_area` varchar(100) DEFAULT NULL COMMENT '所在园区',
  342. `province` varchar(50) DEFAULT NULL COMMENT '省',
  343. `city` varchar(50) DEFAULT NULL COMMENT '市',
  344. `district` varchar(50) DEFAULT NULL COMMENT '区',
  345. `address` varchar(255) DEFAULT NULL COMMENT '详细地址',
  346. `website` varchar(500) DEFAULT NULL COMMENT '客户网站',
  347. `intent_products` varchar(500) DEFAULT NULL COMMENT '意向产品(多个用逗号分隔)',
  348. `expect_time` date DEFAULT NULL COMMENT '预计购买时间',
  349. `budget` varchar(20) DEFAULT NULL COMMENT '预算范围(1万以下/1-5万/5-10万/10-50万/50万以上/未知)',
  350. `requirement` text COMMENT '需求描述',
  351. `status` varchar(20) DEFAULT 'new' COMMENT '线索状态(new-新线索/follow-跟进中/invalid-无效/converted-已转化)',
  352. `owner_user_id` bigint(20) DEFAULT NULL COMMENT '负责人ID',
  353. `owner_user_name` varchar(50) DEFAULT NULL COMMENT '负责人姓名(冗余字段)',
  354. `last_time` datetime DEFAULT NULL COMMENT '最后跟进时间',
  355. `next_time` datetime DEFAULT NULL COMMENT '下次联系时间',
  356. `follow_count` int(11) DEFAULT '0' COMMENT '跟进次数',
  357. `is_converted` tinyint(1) DEFAULT '0' COMMENT '是否已转化(0-否 1-是)',
  358. `converted_time` datetime DEFAULT NULL COMMENT '转化时间',
  359. `customer_id` bigint(20) DEFAULT NULL COMMENT '转化的客户ID',
  360. `converted_by` bigint(20) DEFAULT NULL COMMENT '转化操作人',
  361. `assign_time` datetime DEFAULT NULL COMMENT '分配时间',
  362. `assign_by` bigint(20) DEFAULT NULL COMMENT '分配人',
  363. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  364. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  365. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  366. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  367. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  368. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  369. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  370. `version` int(11) DEFAULT '0' COMMENT '版本号',
  371. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  372. PRIMARY KEY (`id`) USING BTREE,
  373. KEY `idx_mobile` (`mobile`) USING BTREE,
  374. KEY `idx_owner` (`owner_user_id`) USING BTREE,
  375. KEY `idx_status` (`status`) USING BTREE,
  376. KEY `idx_level` (`level`) USING BTREE,
  377. KEY `idx_source` (`source`) USING BTREE,
  378. KEY `idx_create_time` (`create_time`) USING BTREE,
  379. KEY `idx_next_time` (`next_time`) USING BTREE,
  380. KEY `idx_tenant` (`tenant_id`) USING BTREE,
  381. KEY `idx_park_area` (`park_area`) USING BTREE
  382. ) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-线索主表';
  383. -- ----------------------------
  384. -- Table structure for crm_clue_follow
  385. -- ----------------------------
  386. DROP TABLE IF EXISTS `crm_clue_follow`;
  387. CREATE TABLE `crm_clue_follow` (
  388. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  389. `clue_id` bigint(20) NOT NULL COMMENT '线索ID',
  390. `clue_name` varchar(100) DEFAULT NULL COMMENT '线索姓名(冗余)',
  391. `follow_type` varchar(20) NOT NULL COMMENT '跟进方式(电话/微信/邮件/拜访/其他)',
  392. `follow_content` text NOT NULL COMMENT '跟进内容',
  393. `next_time` datetime DEFAULT NULL COMMENT '下次联系时间',
  394. `attachments` varchar(1000) DEFAULT NULL COMMENT '附件(多个用逗号分隔)',
  395. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  396. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  397. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者(跟进人)',
  398. `create_by_name` varchar(50) DEFAULT NULL COMMENT '跟进人姓名(冗余)',
  399. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间(跟进时间)',
  400. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  401. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  402. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  403. `version` int(11) DEFAULT '0' COMMENT '版本号',
  404. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  405. PRIMARY KEY (`id`) USING BTREE,
  406. KEY `idx_clue_id` (`clue_id`) USING BTREE,
  407. KEY `idx_create_by` (`create_by`) USING BTREE,
  408. KEY `idx_create_time` (`create_time`) USING BTREE,
  409. KEY `idx_next_time` (`next_time`) USING BTREE,
  410. KEY `idx_tenant` (`tenant_id`) USING BTREE
  411. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-线索跟进记录表';
  412. -- ----------------------------
  413. -- Table structure for crm_contact
  414. -- ----------------------------
  415. DROP TABLE IF EXISTS `crm_contact`;
  416. CREATE TABLE `crm_contact` (
  417. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  418. `customer_id` bigint(20) NOT NULL COMMENT '客户ID',
  419. `customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余)',
  420. `contact_name` varchar(100) NOT NULL COMMENT '联系人姓名',
  421. `gender` varchar(10) DEFAULT NULL COMMENT '性别(male-男/female-女)',
  422. `mobile` varchar(20) DEFAULT NULL COMMENT '手机号',
  423. `telephone` varchar(30) DEFAULT NULL COMMENT '固定电话',
  424. `email` varchar(100) DEFAULT NULL COMMENT '邮箱',
  425. `wechat` varchar(100) DEFAULT NULL COMMENT '微信号',
  426. `qq` varchar(20) DEFAULT NULL COMMENT 'QQ号',
  427. `department` varchar(100) DEFAULT NULL COMMENT '部门',
  428. `position` varchar(50) DEFAULT NULL COMMENT '职位',
  429. `role` varchar(20) DEFAULT NULL COMMENT '角色(decision-决策人/manager-管理者/user-使用者/other-其他)',
  430. `birthday` date DEFAULT NULL COMMENT '生日',
  431. `address` varchar(255) DEFAULT NULL COMMENT '住址',
  432. `is_key` tinyint(1) DEFAULT '0' COMMENT '是否关键决策人(0-否 1-是)',
  433. `is_primary` tinyint(1) DEFAULT '0' COMMENT '是否主要联系人(0-否 1-是)',
  434. `status` varchar(20) DEFAULT 'active' COMMENT '状态(active-在职/leave-离职)',
  435. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  436. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  437. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  438. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  439. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  440. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  441. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  442. `version` int(11) DEFAULT '0' COMMENT '版本号',
  443. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  444. PRIMARY KEY (`id`) USING BTREE,
  445. KEY `idx_customer_id` (`customer_id`) USING BTREE,
  446. KEY `idx_mobile` (`mobile`) USING BTREE,
  447. KEY `idx_is_key` (`is_key`) USING BTREE,
  448. KEY `idx_tenant` (`tenant_id`) USING BTREE
  449. ) ENGINE=InnoDB AUTO_INCREMENT=2060210419503165443 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-联系人表';
  450. -- ----------------------------
  451. -- Table structure for crm_contract
  452. -- ----------------------------
  453. DROP TABLE IF EXISTS `crm_contract`;
  454. CREATE TABLE `crm_contract` (
  455. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  456. `contract_no` varchar(50) NOT NULL COMMENT '合同编号(CON+yyyyMMdd+4位流水号)',
  457. `contract_name` varchar(200) NOT NULL COMMENT '合同名称',
  458. `customer_id` bigint(20) NOT NULL COMMENT '客户ID',
  459. `customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余字段)',
  460. `opportunity_id` bigint(20) DEFAULT NULL COMMENT '商机ID',
  461. `quote_id` bigint(20) DEFAULT NULL COMMENT '报价单ID',
  462. `parent_contract_id` bigint(20) DEFAULT NULL COMMENT '原合同ID(续签时关联)',
  463. `renewal_count` int(11) DEFAULT '0' COMMENT '续签次数',
  464. `template_id` bigint(20) DEFAULT NULL COMMENT '合同模板ID',
  465. `contract_template` varchar(50) DEFAULT 'shanxia' COMMENT '合同模版(shanxia-山峡模版/customer-客户模版)',
  466. `contact_id` bigint(20) DEFAULT NULL COMMENT '联系人ID',
  467. `contact_name` varchar(50) DEFAULT NULL COMMENT '联系人姓名(冗余字段)',
  468. `contact_mobile` varchar(20) DEFAULT NULL COMMENT '联系人手机(冗余字段)',
  469. `contract_type` varchar(20) NOT NULL DEFAULT 'sale' COMMENT '合同类型(sale-销售合同/service-服务合同/lease-租赁合同/other-其他)',
  470. `contract_nature` varchar(20) DEFAULT 'new' COMMENT '合同性质(new-新签/renewal-续签/change-变更)',
  471. `amount` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '合同金额',
  472. `currency` varchar(10) DEFAULT 'CNY' COMMENT '币种(CNY-人民币/USD-美元/EUR-欧元)',
  473. `tax_rate` decimal(5,2) DEFAULT '6.00' COMMENT '税率(%)',
  474. `amount_with_tax` decimal(15,2) DEFAULT '0.00' COMMENT '含税金额',
  475. `sign_date` date DEFAULT NULL COMMENT '签订日期',
  476. `actual_sign_date` date DEFAULT NULL COMMENT '实际签订日期',
  477. `start_date` date DEFAULT NULL COMMENT '开始日期',
  478. `end_date` date DEFAULT NULL COMMENT '结束日期',
  479. `contract_period` int(11) DEFAULT NULL COMMENT '合同期限(月)',
  480. `status` varchar(20) NOT NULL DEFAULT 'draft' COMMENT '合同状态(draft-草稿/approving-审批中/approved-已审批/executing-执行中/finished-已完成/invalid-已作废)',
  481. `performance_status` varchar(20) DEFAULT 'normal' COMMENT '履约状态(normal-正常/delayed-延期/abnormal-异常/completed-已完成)',
  482. `performance_rate` decimal(5,2) DEFAULT '0.00' COMMENT '履约完成度(%)',
  483. `customer_satisfaction` int(11) DEFAULT NULL COMMENT '客户满意度(1-5星)',
  484. `approval_status` varchar(20) DEFAULT NULL COMMENT '审批状态(pending-待审批/approved-已通过/rejected-已驳回)',
  485. `approval_flow_id` bigint(20) DEFAULT NULL COMMENT '审批流程ID(关联工作流)',
  486. `contract_file` varchar(500) DEFAULT NULL COMMENT '合同文件路径(扫描件或电子版)',
  487. `attachment_files` varchar(1000) DEFAULT NULL COMMENT '附件文件(多个文件用逗号分隔)',
  488. `owner_user_id` bigint(20) NOT NULL COMMENT '负责人ID',
  489. `owner_user_name` varchar(50) DEFAULT NULL COMMENT '负责人姓名(冗余字段)',
  490. `received_amount` decimal(15,2) DEFAULT '0.00' COMMENT '已回款金额',
  491. `unreceived_amount` decimal(15,2) DEFAULT '0.00' COMMENT '未回款金额',
  492. `invoice_amount` decimal(15,2) DEFAULT '0.00' COMMENT '已开票金额',
  493. `uninvoice_amount` decimal(15,2) DEFAULT '0.00' COMMENT '未开票金额',
  494. `party_a` varchar(200) DEFAULT NULL COMMENT '甲方(客户方)',
  495. `party_a_address` varchar(255) DEFAULT NULL COMMENT '甲方地址',
  496. `party_a_contact` varchar(50) DEFAULT NULL COMMENT '甲方联系人',
  497. `party_a_mobile` varchar(20) DEFAULT NULL COMMENT '甲方联系电话',
  498. `party_a_legal_person` varchar(50) DEFAULT NULL COMMENT '甲方法定代表人',
  499. `party_a_agent` varchar(50) DEFAULT NULL COMMENT '甲方代理人',
  500. `party_a_phone_fax` varchar(50) DEFAULT NULL COMMENT '甲方电话/传真',
  501. `party_a_bank` varchar(100) DEFAULT NULL COMMENT '甲方开户银行',
  502. `party_a_account` varchar(50) DEFAULT NULL COMMENT '甲方银行账号',
  503. `party_b` varchar(200) DEFAULT NULL COMMENT '乙方(我方)',
  504. `party_b_address` varchar(255) DEFAULT NULL COMMENT '乙方地址',
  505. `party_b_contact` varchar(50) DEFAULT NULL COMMENT '乙方联系人',
  506. `party_b_mobile` varchar(20) DEFAULT NULL COMMENT '乙方联系电话',
  507. `party_b_legal_person` varchar(100) DEFAULT NULL COMMENT '乙方法定代表人',
  508. `party_b_agent` varchar(100) DEFAULT NULL COMMENT '乙方代理人',
  509. `party_b_phone_fax` varchar(100) DEFAULT NULL COMMENT '乙方电话/传真',
  510. `party_b_bank` varchar(200) DEFAULT NULL COMMENT '乙方开户银行',
  511. `party_b_account` varchar(100) DEFAULT NULL COMMENT '乙方银行账号',
  512. `payment_terms` text COMMENT '付款条款',
  513. `delivery_terms` text COMMENT '交付条款',
  514. `contract_terms` text COMMENT '合同条款',
  515. `invalid_reason` varchar(500) DEFAULT NULL COMMENT '作废原因',
  516. `invalid_time` datetime DEFAULT NULL COMMENT '作废时间',
  517. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  518. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  519. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  520. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  521. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  522. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  523. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  524. `version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
  525. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  526. `template_content` longtext COMMENT '合同模板内容(富文本HTML)',
  527. `settlement_clause_drafts` longtext COMMENT '第五条结算方式草稿(按结算方式区分的JSON)',
  528. `supplier_id` bigint(20) DEFAULT NULL COMMENT '供方主体ID(关联crm_supplier_info表)',
  529. `settlement_method` varchar(50) DEFAULT NULL COMMENT '结算方式(arrive_payment-货到付款,advance_payment-款到发货)',
  530. PRIMARY KEY (`id`) USING BTREE,
  531. UNIQUE KEY `uk_contract_no_del_flag` (`contract_no`,`del_flag`) USING BTREE,
  532. KEY `idx_customer_id` (`customer_id`) USING BTREE,
  533. KEY `idx_opportunity_id` (`opportunity_id`) USING BTREE,
  534. KEY `idx_quote_id` (`quote_id`) USING BTREE,
  535. KEY `idx_owner_user_id` (`owner_user_id`) USING BTREE,
  536. KEY `idx_status` (`status`) USING BTREE,
  537. KEY `idx_approval_status` (`approval_status`) USING BTREE,
  538. KEY `idx_sign_date` (`sign_date`) USING BTREE,
  539. KEY `idx_end_date` (`end_date`) USING BTREE,
  540. KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
  541. KEY `idx_create_time` (`create_time`) USING BTREE,
  542. KEY `idx_contract_nature` (`contract_nature`) USING BTREE,
  543. KEY `idx_parent_contract_id` (`parent_contract_id`) USING BTREE,
  544. KEY `idx_performance_status` (`performance_status`) USING BTREE,
  545. KEY `idx_supplier_id` (`supplier_id`)
  546. ) ENGINE=InnoDB AUTO_INCREMENT=2060286352016764930 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-合同主表';
  547. -- ----------------------------
  548. -- Table structure for crm_contract_approval
  549. -- ----------------------------
  550. DROP TABLE IF EXISTS `crm_contract_approval`;
  551. CREATE TABLE `crm_contract_approval` (
  552. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  553. `contract_id` bigint(20) NOT NULL COMMENT '合同ID',
  554. `flow_id` bigint(20) DEFAULT NULL COMMENT '审批流程ID(关联工作流)',
  555. `step` int(11) NOT NULL DEFAULT '1' COMMENT '审批步骤(第几步)',
  556. `step_name` varchar(100) DEFAULT NULL COMMENT '步骤名称',
  557. `approver_id` bigint(20) NOT NULL COMMENT '审批人ID',
  558. `approver_name` varchar(50) DEFAULT NULL COMMENT '审批人姓名',
  559. `approver_dept` varchar(100) DEFAULT NULL COMMENT '审批人部门',
  560. `approval_result` varchar(20) DEFAULT 'pending' COMMENT '审批结果(pending-待审批/approved-已通过/rejected-已驳回)',
  561. `approval_opinion` text COMMENT '审批意见',
  562. `approval_time` datetime DEFAULT NULL COMMENT '审批时间',
  563. `approval_duration` int(11) DEFAULT NULL COMMENT '审批耗时(小时)',
  564. `attachments` varchar(1000) DEFAULT NULL COMMENT '附件',
  565. `is_current` tinyint(1) DEFAULT '1' COMMENT '是否当前步骤(0否 1是)',
  566. `sort` int(11) DEFAULT '0' COMMENT '排序号',
  567. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  568. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  569. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  570. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  571. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  572. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  573. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  574. `version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
  575. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  576. PRIMARY KEY (`id`) USING BTREE,
  577. KEY `idx_contract_id` (`contract_id`) USING BTREE,
  578. KEY `idx_approver_id` (`approver_id`) USING BTREE,
  579. KEY `idx_approval_result` (`approval_result`) USING BTREE,
  580. KEY `idx_is_current` (`is_current`) USING BTREE,
  581. KEY `idx_tenant_id` (`tenant_id`) USING BTREE
  582. ) ENGINE=InnoDB AUTO_INCREMENT=2056245436624879618 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-合同审批记录表';
  583. -- ----------------------------
  584. -- Table structure for crm_contract_change
  585. -- ----------------------------
  586. DROP TABLE IF EXISTS `crm_contract_change`;
  587. CREATE TABLE `crm_contract_change` (
  588. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  589. `contract_id` bigint(20) NOT NULL COMMENT '合同ID',
  590. `contract_no` varchar(50) DEFAULT NULL COMMENT '合同编号(冗余)',
  591. `change_type` varchar(50) NOT NULL COMMENT '变更类型(amount-金额变更/period-期限变更/product-产品变更/terms-条款变更/other-其他)',
  592. `change_reason` varchar(500) NOT NULL COMMENT '变更原因',
  593. `change_content` text COMMENT '变更内容描述',
  594. `old_value` text COMMENT '变更前值(JSON格式)',
  595. `new_value` text COMMENT '变更后值(JSON格式)',
  596. `change_amount` decimal(15,2) DEFAULT NULL COMMENT '变更金额(用于金额变更)',
  597. `approval_status` varchar(20) DEFAULT 'pending' COMMENT '审批状态(pending-待审批/approved-已通过/rejected-已驳回)',
  598. `approver_id` bigint(20) DEFAULT NULL COMMENT '审批人ID',
  599. `approver_name` varchar(50) DEFAULT NULL COMMENT '审批人姓名',
  600. `approval_time` datetime DEFAULT NULL COMMENT '审批时间',
  601. `approval_opinion` varchar(500) DEFAULT NULL COMMENT '审批意见',
  602. `attachment_files` varchar(1000) DEFAULT NULL COMMENT '附件文件(变更协议等)',
  603. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  604. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  605. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  606. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  607. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  608. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  609. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  610. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  611. PRIMARY KEY (`id`) USING BTREE,
  612. KEY `idx_contract_id` (`contract_id`) USING BTREE,
  613. KEY `idx_change_type` (`change_type`) USING BTREE,
  614. KEY `idx_approval_status` (`approval_status`) USING BTREE,
  615. KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
  616. KEY `idx_create_time` (`create_time`) USING BTREE
  617. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-合同变更记录表';
  618. -- ----------------------------
  619. -- Table structure for crm_contract_product
  620. -- ----------------------------
  621. DROP TABLE IF EXISTS `crm_contract_product`;
  622. CREATE TABLE `crm_contract_product` (
  623. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  624. `contract_id` bigint(20) NOT NULL COMMENT '合同ID',
  625. `product_id` bigint(20) NOT NULL COMMENT '产品ID',
  626. `product_name` varchar(200) NOT NULL COMMENT '产品名称',
  627. `product_no` varchar(50) DEFAULT NULL COMMENT '产品编号',
  628. `category_id` bigint(20) DEFAULT NULL COMMENT '产品分类ID',
  629. `category_name` varchar(100) DEFAULT NULL COMMENT '产品分类名称',
  630. `model` varchar(100) DEFAULT NULL COMMENT '规格型号',
  631. `unit` varchar(20) DEFAULT '件' COMMENT '单位',
  632. `quantity` decimal(20,4) NOT NULL COMMENT '数量',
  633. `price` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '单价',
  634. `discount` decimal(5,2) DEFAULT '0.00' COMMENT '折扣(百分比)',
  635. `tax_rate` decimal(5,2) DEFAULT '6.00' COMMENT '税率(%)',
  636. `tax_amount` decimal(15,2) DEFAULT '0.00' COMMENT '税费金额',
  637. `subtotal` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '小计金额',
  638. `delivery_date` date DEFAULT NULL COMMENT '交付日期',
  639. `delivery_status` varchar(20) DEFAULT 'pending' COMMENT '交付状态(pending-待交付/partial-部分交付/delivered-已交付)',
  640. `delivered_quantity` decimal(20,4) DEFAULT '0.0000' COMMENT '已交付数量',
  641. `description` varchar(1000) DEFAULT NULL COMMENT '产品描述',
  642. `package_spec` varchar(200) DEFAULT NULL COMMENT '包装规格',
  643. `delivery_method` varchar(100) DEFAULT NULL COMMENT '送货方式',
  644. `sort` int(11) DEFAULT '0' COMMENT '排序号',
  645. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  646. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  647. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  648. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  649. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  650. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  651. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  652. `version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
  653. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  654. PRIMARY KEY (`id`) USING BTREE,
  655. KEY `idx_contract_id` (`contract_id`) USING BTREE,
  656. KEY `idx_product_id` (`product_id`) USING BTREE,
  657. KEY `idx_delivery_status` (`delivery_status`) USING BTREE,
  658. KEY `idx_tenant_id` (`tenant_id`) USING BTREE
  659. ) ENGINE=InnoDB AUTO_INCREMENT=2060288831366328322 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-合同产品明细表';
  660. -- ----------------------------
  661. -- Table structure for crm_contract_product_price_tier
  662. -- ----------------------------
  663. DROP TABLE IF EXISTS `crm_contract_product_price_tier`;
  664. CREATE TABLE `crm_contract_product_price_tier` (
  665. `id` bigint(20) NOT NULL COMMENT '主键ID',
  666. `contract_id` bigint(20) NOT NULL COMMENT '合同ID',
  667. `contract_product_id` bigint(20) NOT NULL COMMENT '合同产品明细ID',
  668. `start_date` date NOT NULL COMMENT '区间开始日期',
  669. `end_date` date NOT NULL COMMENT '区间结束日期',
  670. `price` decimal(15,2) NOT NULL COMMENT '含税单价',
  671. `letter_oss_ids` varchar(4000) DEFAULT NULL COMMENT '调价函OSS ID列表(JSON字符串数组,如["id1","id2"])',
  672. `letter_oss_id` bigint(20) DEFAULT NULL COMMENT '调价函单附件OSS ID(废弃,请使用 letter_oss_ids)',
  673. `sort` int(11) DEFAULT '0' COMMENT '排序号',
  674. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  675. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  676. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  677. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  678. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  679. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  680. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  681. PRIMARY KEY (`id`),
  682. KEY `idx_contract_id` (`contract_id`),
  683. KEY `idx_contract_product_id` (`contract_product_id`)
  684. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-框架合同产品调价区间';
  685. -- ----------------------------
  686. -- Table structure for crm_contract_template
  687. -- ----------------------------
  688. DROP TABLE IF EXISTS `crm_contract_template`;
  689. CREATE TABLE `crm_contract_template` (
  690. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  691. `template_no` varchar(50) NOT NULL COMMENT '模板编号',
  692. `template_name` varchar(200) NOT NULL COMMENT '模板名称',
  693. `contract_type` varchar(20) DEFAULT NULL COMMENT '适用合同类型(sale-销售/service-服务等)',
  694. `template_content` text COMMENT '模板内容(富文本)',
  695. `payment_terms` text COMMENT '付款条款模板',
  696. `delivery_terms` text COMMENT '交付条款模板',
  697. `contract_terms` text COMMENT '合同条款模板',
  698. `party_b` varchar(200) DEFAULT NULL COMMENT '乙方(我方)默认名称',
  699. `party_b_address` varchar(255) DEFAULT NULL COMMENT '乙方地址',
  700. `party_b_contact` varchar(50) DEFAULT NULL COMMENT '乙方联系人',
  701. `party_b_mobile` varchar(20) DEFAULT NULL COMMENT '乙方联系电话',
  702. `default_currency` varchar(10) DEFAULT 'CNY' COMMENT '默认币种',
  703. `default_tax_rate` decimal(5,2) DEFAULT '6.00' COMMENT '默认税率(%)',
  704. `default_period` int(11) DEFAULT '12' COMMENT '默认合同期限(月)',
  705. `is_active` tinyint(1) DEFAULT '1' COMMENT '是否启用(0-停用 1-启用)',
  706. `usage_count` int(11) DEFAULT '0' COMMENT '使用次数',
  707. `sort` int(11) DEFAULT '0' COMMENT '排序号',
  708. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  709. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  710. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  711. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  712. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  713. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  714. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  715. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  716. PRIMARY KEY (`id`) USING BTREE,
  717. UNIQUE KEY `uk_template_no` (`template_no`) USING BTREE,
  718. KEY `idx_contract_type` (`contract_type`) USING BTREE,
  719. KEY `idx_is_active` (`is_active`) USING BTREE,
  720. KEY `idx_tenant_id` (`tenant_id`) USING BTREE
  721. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-合同模板表';
  722. -- ----------------------------
  723. -- Table structure for crm_customer
  724. -- ----------------------------
  725. DROP TABLE IF EXISTS `crm_customer`;
  726. CREATE TABLE `crm_customer` (
  727. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  728. `customer_no` varchar(50) NOT NULL COMMENT '客户编号(唯一)',
  729. `customer_name` varchar(200) NOT NULL COMMENT '客户名称',
  730. `short_name` varchar(100) DEFAULT NULL COMMENT '客户简称',
  731. `customer_type` varchar(20) DEFAULT 'company' COMMENT '客户类型(company-企业/person-个人)',
  732. `mobile` varchar(20) DEFAULT NULL COMMENT '手机号',
  733. `telephone` varchar(30) DEFAULT NULL COMMENT '固定电话',
  734. `email` varchar(100) DEFAULT NULL COMMENT '邮箱',
  735. `website` varchar(500) DEFAULT NULL COMMENT '客户网站',
  736. `level` varchar(20) DEFAULT 'normal' COMMENT '客户级别(key-重点/normal-普通/potential-潜在)',
  737. `source` varchar(20) DEFAULT NULL COMMENT '客户来源',
  738. `industry` varchar(50) DEFAULT NULL COMMENT '所属行业',
  739. `park_area` varchar(100) DEFAULT NULL COMMENT '所在园区',
  740. `payment_terms` varchar(500) DEFAULT NULL COMMENT '收付款条件(如:预付30%、账期30天等)',
  741. `scale` varchar(20) DEFAULT NULL COMMENT '企业规模(1-50人/50-200人/200-500人/500人以上)',
  742. `province` varchar(50) DEFAULT NULL COMMENT '省',
  743. `city` varchar(50) DEFAULT NULL COMMENT '市',
  744. `district` varchar(50) DEFAULT NULL COMMENT '区',
  745. `address` varchar(255) DEFAULT NULL COMMENT '详细地址',
  746. `status` varchar(20) DEFAULT 'normal' COMMENT '客户状态(normal-正常/pool-公海/invalid-无效)',
  747. `deal_status` varchar(20) DEFAULT 'not_deal' COMMENT '成交状态(not_deal-未成交/dealed-已成交/lost-已流失)',
  748. `owner_user_id` bigint(20) DEFAULT NULL COMMENT '负责人ID',
  749. `owner_user_name` varchar(50) DEFAULT NULL COMMENT '负责人姓名(冗余)',
  750. `last_time` datetime DEFAULT NULL COMMENT '最后跟进时间',
  751. `next_time` datetime DEFAULT NULL COMMENT '下次联系时间',
  752. `follow_count` int(11) DEFAULT '0' COMMENT '跟进次数',
  753. `deal_time` datetime DEFAULT NULL COMMENT '成交时间',
  754. `deal_amount` decimal(15,2) DEFAULT '0.00' COMMENT '累计成交金额',
  755. `contact_count` int(11) DEFAULT '0' COMMENT '联系人数量',
  756. `opportunity_count` int(11) DEFAULT '0' COMMENT '商机数量',
  757. `contract_count` int(11) DEFAULT '0' COMMENT '合同数量',
  758. `into_pool_time` datetime DEFAULT NULL COMMENT '进入公海时间',
  759. `into_pool_by` bigint(20) DEFAULT NULL COMMENT '进入公海操作人ID',
  760. `into_pool_reason` varchar(500) DEFAULT NULL COMMENT '进入公海原因',
  761. `claim_time` datetime DEFAULT NULL COMMENT '领取时间',
  762. `assign_time` datetime DEFAULT NULL COMMENT '分配时间',
  763. `assign_by` bigint(20) DEFAULT NULL COMMENT '分配人ID',
  764. `protect_time` datetime DEFAULT NULL COMMENT '保护到期时间',
  765. `clue_id` bigint(20) DEFAULT NULL COMMENT '关联线索ID(从线索转化)',
  766. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  767. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  768. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  769. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  770. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  771. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  772. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  773. `version` int(11) DEFAULT '0' COMMENT '版本号',
  774. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  775. `business_license_images` varchar(1000) DEFAULT NULL COMMENT '营业执照图片OSS ID(多个用逗号分隔)',
  776. `business_permit_images` varchar(1000) DEFAULT NULL COMMENT '经营许可证图片OSS ID(多个用逗号分隔)',
  777. `other_cert_images` varchar(1000) DEFAULT NULL COMMENT '其他证件图片OSS ID(多个用逗号分隔)',
  778. PRIMARY KEY (`id`) USING BTREE,
  779. UNIQUE KEY `uk_customer_no_del_flag` (`customer_no`,`del_flag`) USING BTREE,
  780. KEY `idx_mobile` (`mobile`) USING BTREE,
  781. KEY `idx_owner` (`owner_user_id`) USING BTREE,
  782. KEY `idx_status` (`status`) USING BTREE,
  783. KEY `idx_level` (`level`) USING BTREE,
  784. KEY `idx_deal_status` (`deal_status`) USING BTREE,
  785. KEY `idx_source` (`source`) USING BTREE,
  786. KEY `idx_create_time` (`create_time`) USING BTREE,
  787. KEY `idx_next_time` (`next_time`) USING BTREE,
  788. KEY `idx_clue` (`clue_id`) USING BTREE,
  789. KEY `idx_tenant` (`tenant_id`) USING BTREE,
  790. KEY `idx_park_area` (`park_area`) USING BTREE
  791. ) ENGINE=InnoDB AUTO_INCREMENT=2060210343636594690 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-客户主表';
  792. -- ----------------------------
  793. -- Table structure for crm_customer_follow
  794. -- ----------------------------
  795. DROP TABLE IF EXISTS `crm_customer_follow`;
  796. CREATE TABLE `crm_customer_follow` (
  797. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  798. `customer_id` bigint(20) NOT NULL COMMENT '客户ID',
  799. `customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余)',
  800. `contact_id` bigint(20) DEFAULT NULL COMMENT '联系人ID',
  801. `contact_name` varchar(100) DEFAULT NULL COMMENT '联系人姓名(冗余)',
  802. `follow_type` varchar(20) NOT NULL COMMENT '跟进方式(电话/微信/邮件/拜访/其他)',
  803. `follow_content` text NOT NULL COMMENT '跟进内容',
  804. `next_time` datetime DEFAULT NULL COMMENT '下次联系时间',
  805. `attachments` varchar(1000) DEFAULT NULL COMMENT '附件(多个用逗号分隔)',
  806. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  807. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  808. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者(跟进人)',
  809. `create_by_name` varchar(50) DEFAULT NULL COMMENT '跟进人姓名(冗余)',
  810. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间(跟进时间)',
  811. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  812. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  813. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  814. `version` int(11) DEFAULT '0' COMMENT '版本号',
  815. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  816. PRIMARY KEY (`id`) USING BTREE,
  817. KEY `idx_customer_id` (`customer_id`) USING BTREE,
  818. KEY `idx_contact_id` (`contact_id`) USING BTREE,
  819. KEY `idx_create_by` (`create_by`) USING BTREE,
  820. KEY `idx_create_time` (`create_time`) USING BTREE,
  821. KEY `idx_next_time` (`next_time`) USING BTREE,
  822. KEY `idx_tenant` (`tenant_id`) USING BTREE
  823. ) ENGINE=InnoDB AUTO_INCREMENT=1985641912854016003 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-客户跟进记录表';
  824. -- ----------------------------
  825. -- Table structure for crm_customer_pool
  826. -- ----------------------------
  827. DROP TABLE IF EXISTS `crm_customer_pool`;
  828. CREATE TABLE `crm_customer_pool` (
  829. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  830. `customer_id` bigint(20) NOT NULL COMMENT '客户ID',
  831. `customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余)',
  832. `operation_type` varchar(20) NOT NULL COMMENT '操作类型(into-进入公海/claim-领取/assign-分配/recycle-回收)',
  833. `from_user_id` bigint(20) DEFAULT NULL COMMENT '原负责人ID',
  834. `from_user_name` varchar(50) DEFAULT NULL COMMENT '原负责人姓名(冗余)',
  835. `to_user_id` bigint(20) DEFAULT NULL COMMENT '新负责人ID',
  836. `to_user_name` varchar(50) DEFAULT NULL COMMENT '新负责人姓名(冗余)',
  837. `reason` varchar(500) DEFAULT NULL COMMENT '操作原因',
  838. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  839. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  840. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者(操作人)',
  841. `create_by_name` varchar(50) DEFAULT NULL COMMENT '操作人姓名(冗余)',
  842. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间(操作时间)',
  843. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  844. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  845. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  846. `version` int(11) DEFAULT '0' COMMENT '版本号',
  847. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  848. PRIMARY KEY (`id`) USING BTREE,
  849. KEY `idx_customer_id` (`customer_id`) USING BTREE,
  850. KEY `idx_operation_type` (`operation_type`) USING BTREE,
  851. KEY `idx_from_user` (`from_user_id`) USING BTREE,
  852. KEY `idx_to_user` (`to_user_id`) USING BTREE,
  853. KEY `idx_create_time` (`create_time`) USING BTREE,
  854. KEY `idx_tenant` (`tenant_id`) USING BTREE
  855. ) ENGINE=InnoDB AUTO_INCREMENT=1991718802157080578 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-客户公海池记录表';
  856. -- ----------------------------
  857. -- Table structure for crm_customer_pool_rule
  858. -- ----------------------------
  859. DROP TABLE IF EXISTS `crm_customer_pool_rule`;
  860. CREATE TABLE `crm_customer_pool_rule` (
  861. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  862. `pool_name` varchar(100) NOT NULL COMMENT '规则名称',
  863. `rule_type` varchar(20) NOT NULL COMMENT '规则类型(no_follow-未跟进/no_deal-未成交)',
  864. `timeout_days` int(11) NOT NULL COMMENT '超时天数(多少天未跟进/未成交)',
  865. `protect_days` int(11) NOT NULL DEFAULT '0' COMMENT '保护期天数(领取后保护多少天)',
  866. `status` varchar(20) DEFAULT 'enable' COMMENT '状态(enable-启用/disable-禁用)',
  867. `sort` int(11) DEFAULT '0' COMMENT '排序号',
  868. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  869. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  870. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  871. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  872. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  873. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  874. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  875. `version` int(11) DEFAULT '0' COMMENT '版本号',
  876. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  877. PRIMARY KEY (`id`) USING BTREE,
  878. KEY `idx_status` (`status`) USING BTREE,
  879. KEY `idx_rule_type` (`rule_type`) USING BTREE,
  880. KEY `idx_sort` (`sort`) USING BTREE,
  881. KEY `idx_tenant` (`tenant_id`) USING BTREE
  882. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-客户公海池规则表';
  883. -- ----------------------------
  884. -- Table structure for crm_customer_tag
  885. -- ----------------------------
  886. DROP TABLE IF EXISTS `crm_customer_tag`;
  887. CREATE TABLE `crm_customer_tag` (
  888. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  889. `tag_name` varchar(50) NOT NULL COMMENT '标签名称',
  890. `tag_color` varchar(20) DEFAULT '#409EFF' COMMENT '标签颜色(十六进制颜色值)',
  891. `tag_type` varchar(20) DEFAULT 'custom' COMMENT '标签类型(system-系统预设/custom-自定义)',
  892. `sort_order` int(11) DEFAULT '0' COMMENT '排序号',
  893. `share_scope` varchar(20) DEFAULT 'private' COMMENT '共享范围(private-个人/dept-部门/company-公司)',
  894. `create_user_id` bigint(20) DEFAULT NULL COMMENT '创建人ID',
  895. `create_user_name` varchar(50) DEFAULT NULL COMMENT '创建人姓名',
  896. `use_count` int(11) DEFAULT '0' COMMENT '使用次数',
  897. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  898. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  899. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  900. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  901. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  902. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  903. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  904. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  905. PRIMARY KEY (`id`) USING BTREE,
  906. UNIQUE KEY `uk_tag_name` (`tag_name`,`tenant_id`,`del_flag`) USING BTREE,
  907. KEY `idx_tag_type` (`tag_type`) USING BTREE,
  908. KEY `idx_share_scope` (`share_scope`) USING BTREE,
  909. KEY `idx_create_user` (`create_user_id`) USING BTREE,
  910. KEY `idx_tenant` (`tenant_id`) USING BTREE
  911. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-客户标签表';
  912. -- ----------------------------
  913. -- Table structure for crm_customer_tag_relation
  914. -- ----------------------------
  915. DROP TABLE IF EXISTS `crm_customer_tag_relation`;
  916. CREATE TABLE `crm_customer_tag_relation` (
  917. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  918. `customer_id` bigint(20) NOT NULL COMMENT '客户ID',
  919. `customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余)',
  920. `tag_id` bigint(20) NOT NULL COMMENT '标签ID',
  921. `tag_name` varchar(50) DEFAULT NULL COMMENT '标签名称(冗余)',
  922. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  923. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者(打标签的人)',
  924. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  925. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  926. PRIMARY KEY (`id`) USING BTREE,
  927. UNIQUE KEY `uk_customer_tag` (`customer_id`,`tag_id`,`del_flag`) USING BTREE,
  928. KEY `idx_customer_id` (`customer_id`) USING BTREE,
  929. KEY `idx_tag_id` (`tag_id`) USING BTREE,
  930. KEY `idx_tenant` (`tenant_id`) USING BTREE
  931. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-客户标签关联表';
  932. -- ----------------------------
  933. -- Table structure for crm_invoice
  934. -- ----------------------------
  935. DROP TABLE IF EXISTS `crm_invoice`;
  936. CREATE TABLE `crm_invoice` (
  937. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  938. `invoice_no` varchar(50) NOT NULL COMMENT '发票编号(INV+yyyyMMdd+4位流水号)',
  939. `invoice_code` varchar(50) DEFAULT NULL COMMENT '发票代码(税务发票代码)',
  940. `invoice_number` varchar(50) DEFAULT NULL COMMENT '发票号码(税务发票号码)',
  941. `contract_id` bigint(20) NOT NULL COMMENT '合同ID',
  942. `contract_no` varchar(50) DEFAULT NULL COMMENT '合同编号(冗余字段)',
  943. `customer_id` bigint(20) NOT NULL COMMENT '客户ID',
  944. `customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余字段)',
  945. `payment_id` bigint(20) DEFAULT NULL COMMENT '回款ID',
  946. `payment_no` varchar(50) DEFAULT NULL COMMENT '回款编号(冗余字段)',
  947. `invoice_type` varchar(20) NOT NULL DEFAULT 'special' COMMENT '发票类型(special-增值税专用发票/normal-增值税普通发票/electronic-电子发票)',
  948. `invoice_title` varchar(200) NOT NULL COMMENT '发票抬头',
  949. `tax_no` varchar(50) NOT NULL COMMENT '纳税人识别号',
  950. `company_address` varchar(255) DEFAULT NULL COMMENT '企业地址',
  951. `company_phone` varchar(50) DEFAULT NULL COMMENT '企业电话',
  952. `bank_name` varchar(100) DEFAULT NULL COMMENT '开户银行',
  953. `bank_account` varchar(100) DEFAULT NULL COMMENT '银行账号',
  954. `amount` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '开票金额(不含税)',
  955. `tax_rate` decimal(5,2) NOT NULL DEFAULT '6.00' COMMENT '税率(百分比,如6.00表示6%)',
  956. `is_tax_included` tinyint(1) DEFAULT '0' COMMENT '是否含税: 0-不含税 1-含税',
  957. `tax_amount` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '税额',
  958. `total_amount` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '价税合计',
  959. `invoice_content` varchar(200) DEFAULT NULL COMMENT '开票内容',
  960. `invoice_date` date DEFAULT NULL COMMENT '开票日期',
  961. `status` varchar(20) NOT NULL DEFAULT 'applying' COMMENT '发票状态(applying-申请中/approved-已审批/invoiced-已开票/delivered-已寄出/received-已签收/rejected-已驳回/invalid-已作废)',
  962. `reject_reason` varchar(500) DEFAULT NULL COMMENT '驳回原因',
  963. `invalid_reason` varchar(500) DEFAULT NULL COMMENT '作废原因',
  964. `invalid_time` datetime DEFAULT NULL COMMENT '作废时间',
  965. `invoice_file` varchar(500) DEFAULT NULL COMMENT '发票PDF文件',
  966. `invoice_image` varchar(500) DEFAULT NULL COMMENT '发票图片(扫描件)',
  967. `express_company` varchar(50) DEFAULT NULL COMMENT '快递公司',
  968. `express_no` varchar(100) DEFAULT NULL COMMENT '快递单号',
  969. `express_status` varchar(20) DEFAULT 'no' COMMENT '快递状态(no-未寄出/sent-已寄出/received-已签收)',
  970. `express_time` datetime DEFAULT NULL COMMENT '寄出时间',
  971. `receive_time` datetime DEFAULT NULL COMMENT '签收时间',
  972. `mail_address` varchar(255) DEFAULT NULL COMMENT '邮寄地址',
  973. `mail_contact` varchar(50) DEFAULT NULL COMMENT '收件人',
  974. `mail_mobile` varchar(20) DEFAULT NULL COMMENT '收件电话',
  975. `owner_user_id` bigint(20) NOT NULL COMMENT '负责人ID',
  976. `owner_user_name` varchar(50) DEFAULT NULL COMMENT '负责人姓名(冗余字段)',
  977. `apply_by` bigint(20) DEFAULT NULL COMMENT '申请人ID',
  978. `apply_by_name` varchar(50) DEFAULT NULL COMMENT '申请人姓名',
  979. `apply_time` datetime DEFAULT NULL COMMENT '申请时间',
  980. `approve_by` bigint(20) DEFAULT NULL COMMENT '审批人ID',
  981. `approve_by_name` varchar(50) DEFAULT NULL COMMENT '审批人姓名',
  982. `approve_time` datetime DEFAULT NULL COMMENT '审批时间',
  983. `invoice_by` bigint(20) DEFAULT NULL COMMENT '开票人ID',
  984. `invoice_by_name` varchar(50) DEFAULT NULL COMMENT '开票人姓名',
  985. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  986. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  987. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  988. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  989. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  990. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  991. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  992. `version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
  993. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  994. PRIMARY KEY (`id`) USING BTREE,
  995. UNIQUE KEY `uk_invoice_no_del_flag` (`invoice_no`,`del_flag`) USING BTREE,
  996. KEY `uk_invoice_number` (`invoice_number`) USING BTREE,
  997. KEY `idx_contract_id` (`contract_id`) USING BTREE,
  998. KEY `idx_customer_id` (`customer_id`) USING BTREE,
  999. KEY `idx_payment_id` (`payment_id`) USING BTREE,
  1000. KEY `idx_owner_user_id` (`owner_user_id`) USING BTREE,
  1001. KEY `idx_status` (`status`) USING BTREE,
  1002. KEY `idx_invoice_date` (`invoice_date`) USING BTREE,
  1003. KEY `idx_express_status` (`express_status`) USING BTREE,
  1004. KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
  1005. KEY `idx_create_time` (`create_time`) USING BTREE
  1006. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-发票主表';
  1007. -- ----------------------------
  1008. -- Table structure for crm_invoice_info
  1009. -- ----------------------------
  1010. DROP TABLE IF EXISTS `crm_invoice_info`;
  1011. CREATE TABLE `crm_invoice_info` (
  1012. `id` bigint(20) NOT NULL COMMENT '主键ID',
  1013. `customer_id` bigint(20) NOT NULL COMMENT '客户ID',
  1014. `company_name` varchar(200) DEFAULT NULL COMMENT '单位名称(章)',
  1015. `company_address` varchar(500) DEFAULT NULL COMMENT '单位地址',
  1016. `legal_representative` varchar(100) DEFAULT NULL COMMENT '法定代表人',
  1017. `agent` varchar(100) DEFAULT NULL COMMENT '代理人',
  1018. `phone_fax` varchar(100) DEFAULT NULL COMMENT '电话/传真',
  1019. `bank_name` varchar(200) DEFAULT NULL COMMENT '开户银行',
  1020. `bank_account` varchar(100) DEFAULT NULL COMMENT '账号',
  1021. `is_default` char(1) DEFAULT '0' COMMENT '是否默认(0否 1是)',
  1022. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  1023. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1024. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  1025. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  1026. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  1027. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  1028. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  1029. `del_flag` int(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  1030. PRIMARY KEY (`id`) USING BTREE,
  1031. KEY `idx_customer_id` (`customer_id`) USING BTREE,
  1032. KEY `idx_tenant_id` (`tenant_id`) USING BTREE
  1033. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='客户开票信息表';
  1034. -- ----------------------------
  1035. -- Table structure for crm_invoice_item
  1036. -- ----------------------------
  1037. DROP TABLE IF EXISTS `crm_invoice_item`;
  1038. CREATE TABLE `crm_invoice_item` (
  1039. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  1040. `invoice_id` bigint(20) NOT NULL COMMENT '发票ID',
  1041. `item_name` varchar(200) NOT NULL COMMENT '项目名称',
  1042. `spec` varchar(100) DEFAULT NULL COMMENT '规格型号',
  1043. `unit` varchar(50) DEFAULT NULL COMMENT '单位',
  1044. `quantity` decimal(15,2) DEFAULT '0.00' COMMENT '数量',
  1045. `unit_price` decimal(15,2) DEFAULT '0.00' COMMENT '单价',
  1046. `amount` decimal(15,2) DEFAULT '0.00' COMMENT '金额',
  1047. `tax_rate` decimal(5,2) DEFAULT '0.00' COMMENT '税率(百分比)',
  1048. `tax_amount` decimal(15,2) DEFAULT '0.00' COMMENT '税额',
  1049. `total_amount` decimal(15,2) DEFAULT '0.00' COMMENT '价税合计',
  1050. `sort` int(11) DEFAULT '0' COMMENT '排序',
  1051. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1052. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  1053. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1054. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  1055. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  1056. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  1057. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  1058. PRIMARY KEY (`id`) USING BTREE,
  1059. KEY `idx_invoice_id` (`invoice_id`) USING BTREE,
  1060. KEY `idx_tenant_id` (`tenant_id`) USING BTREE
  1061. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-发票明细表';
  1062. -- ----------------------------
  1063. -- Table structure for crm_opportunity
  1064. -- ----------------------------
  1065. DROP TABLE IF EXISTS `crm_opportunity`;
  1066. CREATE TABLE `crm_opportunity` (
  1067. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  1068. `opportunity_no` varchar(50) NOT NULL COMMENT '商机编号(OPP+yyyyMMdd+4位流水号)',
  1069. `opportunity_name` varchar(200) NOT NULL COMMENT '商机名称',
  1070. `customer_id` bigint(20) NOT NULL COMMENT '客户ID',
  1071. `customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余字段)',
  1072. `contact_id` bigint(20) DEFAULT NULL COMMENT '联系人ID',
  1073. `contact_name` varchar(50) DEFAULT NULL COMMENT '联系人姓名(冗余字段)',
  1074. `amount` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '商机金额',
  1075. `stage` varchar(20) NOT NULL DEFAULT 'initial' COMMENT '商机阶段(initial-初步接触/requirement-需求分析/solution-方案制定/quote-报价/negotiate-谈判审核/contract-合同签订/won-赢单)',
  1076. `stage_percent` int(11) DEFAULT '10' COMMENT '阶段进度百分比(10/20/40/60/80/90/100)',
  1077. `status` varchar(20) NOT NULL DEFAULT 'following' COMMENT '商机状态(following-跟进中/won-赢单/lost-输单/invalid-无效)',
  1078. `win_rate` decimal(5,2) DEFAULT '50.00' COMMENT '赢单率(百分比,如50.00表示50%)',
  1079. `expect_deal_date` date DEFAULT NULL COMMENT '预计成交日期',
  1080. `actual_deal_date` date DEFAULT NULL COMMENT '实际成交日期',
  1081. `lost_reason` varchar(500) DEFAULT NULL COMMENT '输单原因',
  1082. `owner_user_id` bigint(20) NOT NULL COMMENT '负责人ID(销售人员)',
  1083. `owner_user_name` varchar(50) DEFAULT NULL COMMENT '负责人姓名(冗余字段)',
  1084. `product_count` int(11) DEFAULT '0' COMMENT '产品数量(冗余字段)',
  1085. `last_time` datetime DEFAULT NULL COMMENT '最后跟进时间',
  1086. `next_time` datetime DEFAULT NULL COMMENT '下次联系时间',
  1087. `follow_count` int(11) DEFAULT '0' COMMENT '跟进次数(冗余字段)',
  1088. `contract_id` bigint(20) DEFAULT NULL COMMENT '关联合同ID(赢单后生成)',
  1089. `source` varchar(20) DEFAULT NULL COMMENT '商机来源(同线索来源)',
  1090. `type` varchar(20) DEFAULT NULL COMMENT '商机类型(new_customer-新客户新业务/renewal-老客户续约/upgrade-老客户升级)',
  1091. `description` text COMMENT '商机描述(详细说明商机背景、客户需求等)',
  1092. `competitors` varchar(500) DEFAULT NULL COMMENT '竞争对手(多个竞争对手用逗号分隔)',
  1093. `key_factors` varchar(500) DEFAULT NULL COMMENT '关键决策因素(客户关注的核心要素)',
  1094. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1095. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  1096. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  1097. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1098. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  1099. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  1100. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  1101. `version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
  1102. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  1103. PRIMARY KEY (`id`) USING BTREE,
  1104. UNIQUE KEY `uk_opportunity_no_del_flag` (`opportunity_no`,`del_flag`) USING BTREE,
  1105. KEY `idx_customer_id` (`customer_id`) USING BTREE,
  1106. KEY `idx_owner_user_id` (`owner_user_id`) USING BTREE,
  1107. KEY `idx_stage` (`stage`) USING BTREE,
  1108. KEY `idx_status` (`status`) USING BTREE,
  1109. KEY `idx_expect_deal_date` (`expect_deal_date`) USING BTREE,
  1110. KEY `idx_next_time` (`next_time`) USING BTREE,
  1111. KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
  1112. KEY `idx_create_time` (`create_time`) USING BTREE
  1113. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-商机主表';
  1114. -- ----------------------------
  1115. -- Table structure for crm_opportunity_follow
  1116. -- ----------------------------
  1117. DROP TABLE IF EXISTS `crm_opportunity_follow`;
  1118. CREATE TABLE `crm_opportunity_follow` (
  1119. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  1120. `opportunity_id` bigint(20) NOT NULL COMMENT '商机ID',
  1121. `follow_type` varchar(20) NOT NULL COMMENT '跟进方式(phone-电话/wechat-微信/email-邮件/visit-拜访/meeting-会议/other-其他)',
  1122. `follow_content` text NOT NULL COMMENT '跟进内容',
  1123. `follow_time` datetime DEFAULT NULL COMMENT '跟进时间',
  1124. `stage` varchar(20) DEFAULT NULL COMMENT '当前商机阶段',
  1125. `stage_percent` int(11) DEFAULT NULL COMMENT '阶段进度百分比',
  1126. `next_time` datetime DEFAULT NULL COMMENT '下次联系时间',
  1127. `next_content` varchar(500) DEFAULT NULL COMMENT '下次联系计划',
  1128. `attachments` varchar(1000) DEFAULT NULL COMMENT '附件(多个文件用逗号分隔)',
  1129. `contact_id` bigint(20) DEFAULT NULL COMMENT '联系人ID',
  1130. `contact_name` varchar(50) DEFAULT NULL COMMENT '联系人姓名',
  1131. `location` varchar(200) DEFAULT NULL COMMENT '跟进地点(拜访时填写)',
  1132. `duration` int(11) DEFAULT NULL COMMENT '跟进时长(分钟)',
  1133. `follow_by` bigint(20) DEFAULT NULL COMMENT '跟进人ID',
  1134. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1135. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  1136. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者(跟进人)',
  1137. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间(跟进时间)',
  1138. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  1139. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  1140. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  1141. `version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
  1142. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  1143. PRIMARY KEY (`id`) USING BTREE,
  1144. KEY `idx_opportunity_id` (`opportunity_id`) USING BTREE,
  1145. KEY `idx_create_by` (`create_by`) USING BTREE,
  1146. KEY `idx_create_time` (`create_time`) USING BTREE,
  1147. KEY `idx_next_time` (`next_time`) USING BTREE,
  1148. KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
  1149. KEY `idx_follow_time` (`follow_time`) USING BTREE
  1150. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-商机跟进记录表';
  1151. -- ----------------------------
  1152. -- Table structure for crm_opportunity_product
  1153. -- ----------------------------
  1154. DROP TABLE IF EXISTS `crm_opportunity_product`;
  1155. CREATE TABLE `crm_opportunity_product` (
  1156. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  1157. `opportunity_id` bigint(20) NOT NULL COMMENT '商机ID',
  1158. `product_id` bigint(20) NOT NULL COMMENT '产品ID',
  1159. `product_name` varchar(200) DEFAULT NULL COMMENT '产品名称(冗余字段)',
  1160. `product_no` varchar(50) DEFAULT NULL COMMENT '产品编号(冗余字段)',
  1161. `category_id` bigint(20) DEFAULT NULL COMMENT '产品分类ID',
  1162. `category_name` varchar(100) DEFAULT NULL COMMENT '产品分类名称(冗余字段)',
  1163. `model` varchar(100) DEFAULT NULL COMMENT '规格型号',
  1164. `unit` varchar(20) DEFAULT '件' COMMENT '单位',
  1165. `quantity` decimal(20,4) NOT NULL COMMENT '数量',
  1166. `price` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '单价',
  1167. `discount` decimal(5,2) DEFAULT '0.00' COMMENT '折扣(百分比,如10.00表示9折)',
  1168. `subtotal` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '小计金额(数量*单价*折扣后)',
  1169. `sort` int(11) DEFAULT '0' COMMENT '排序号',
  1170. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1171. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  1172. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  1173. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1174. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  1175. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  1176. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  1177. `version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
  1178. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  1179. PRIMARY KEY (`id`) USING BTREE,
  1180. KEY `idx_opportunity_id` (`opportunity_id`) USING BTREE,
  1181. KEY `idx_product_id` (`product_id`) USING BTREE,
  1182. KEY `idx_tenant_id` (`tenant_id`) USING BTREE
  1183. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-商机产品关联表';
  1184. -- ----------------------------
  1185. -- Table structure for crm_opportunity_stage_log
  1186. -- ----------------------------
  1187. DROP TABLE IF EXISTS `crm_opportunity_stage_log`;
  1188. CREATE TABLE `crm_opportunity_stage_log` (
  1189. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  1190. `opportunity_id` bigint(20) NOT NULL COMMENT '商机ID',
  1191. `from_stage` varchar(20) DEFAULT NULL COMMENT '原阶段',
  1192. `from_stage_name` varchar(50) DEFAULT NULL COMMENT '原阶段名称',
  1193. `from_percent` int(11) DEFAULT NULL COMMENT '原进度百分比',
  1194. `to_stage` varchar(20) NOT NULL COMMENT '新阶段',
  1195. `to_stage_name` varchar(50) DEFAULT NULL COMMENT '新阶段名称',
  1196. `to_percent` int(11) DEFAULT NULL COMMENT '新进度百分比',
  1197. `change_type` varchar(20) DEFAULT 'forward' COMMENT '变更类型(forward-推进/backward-后退)',
  1198. `change_reason` varchar(500) DEFAULT NULL COMMENT '变更原因',
  1199. `change_amount` decimal(15,2) DEFAULT NULL COMMENT '变更时的商机金额',
  1200. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1201. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  1202. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者(变更人)',
  1203. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间(变更时间)',
  1204. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  1205. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  1206. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  1207. `version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
  1208. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  1209. `lost_detail` varchar(2000) DEFAULT NULL COMMENT '输单详细说明',
  1210. `competitor_info` varchar(1000) DEFAULT NULL COMMENT '竞争对手信息',
  1211. `improvement` varchar(1000) DEFAULT NULL COMMENT '改进建议',
  1212. `won_remark` varchar(2000) DEFAULT NULL COMMENT '赢单说明',
  1213. PRIMARY KEY (`id`) USING BTREE,
  1214. KEY `idx_opportunity_id` (`opportunity_id`) USING BTREE,
  1215. KEY `idx_create_time` (`create_time`) USING BTREE,
  1216. KEY `idx_tenant_id` (`tenant_id`) USING BTREE
  1217. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-商机阶段变更日志表';
  1218. -- ----------------------------
  1219. -- Table structure for crm_payment
  1220. -- ----------------------------
  1221. DROP TABLE IF EXISTS `crm_payment`;
  1222. CREATE TABLE `crm_payment` (
  1223. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  1224. `payment_no` varchar(50) NOT NULL COMMENT '回款编号(PAY+yyyyMMdd+4位流水号)',
  1225. `contract_id` bigint(20) NOT NULL COMMENT '合同ID',
  1226. `contract_no` varchar(50) DEFAULT NULL COMMENT '合同编号(冗余字段)',
  1227. `customer_id` bigint(20) NOT NULL COMMENT '客户ID',
  1228. `customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余字段)',
  1229. `plan_id` bigint(20) DEFAULT NULL COMMENT '回款计划ID',
  1230. `plan_no` varchar(50) DEFAULT NULL COMMENT '计划编号(冗余字段)',
  1231. `period` int(11) DEFAULT NULL COMMENT '期数(冗余字段)',
  1232. `amount` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '回款金额',
  1233. `payment_date` date NOT NULL COMMENT '回款日期',
  1234. `payment_method` varchar(20) DEFAULT 'bank' COMMENT '付款方式(bank-银行转账/cash-现金/check-支票/alipay-支付宝/wechat-微信/other-其他)',
  1235. `payment_account` varchar(100) DEFAULT NULL COMMENT '付款账户',
  1236. `voucher_no` varchar(100) DEFAULT NULL COMMENT '凭证号(流水号)',
  1237. `voucher_file` varchar(500) DEFAULT NULL COMMENT '凭证文件(回款凭证扫描件)',
  1238. `status` varchar(20) NOT NULL DEFAULT 'pending' COMMENT '回款状态(pending-待确认/confirmed-已确认/invalid-已作废)',
  1239. `confirm_by` bigint(20) DEFAULT NULL COMMENT '确认人ID',
  1240. `confirm_by_name` varchar(50) DEFAULT NULL COMMENT '确认人姓名',
  1241. `confirm_time` datetime DEFAULT NULL COMMENT '确认时间',
  1242. `invalid_reason` varchar(500) DEFAULT NULL COMMENT '作废原因',
  1243. `invalid_time` datetime DEFAULT NULL COMMENT '作废时间',
  1244. `owner_user_id` bigint(20) NOT NULL COMMENT '负责人ID(录入人)',
  1245. `owner_user_name` varchar(50) DEFAULT NULL COMMENT '负责人姓名(冗余字段)',
  1246. `bank_name` varchar(100) DEFAULT NULL COMMENT '收款银行',
  1247. `bank_account` varchar(100) DEFAULT NULL COMMENT '收款账号',
  1248. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1249. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  1250. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  1251. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1252. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  1253. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  1254. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  1255. `version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
  1256. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  1257. PRIMARY KEY (`id`) USING BTREE,
  1258. UNIQUE KEY `uk_payment_no_del_flag` (`payment_no`,`del_flag`) USING BTREE,
  1259. KEY `idx_contract_id` (`contract_id`) USING BTREE,
  1260. KEY `idx_customer_id` (`customer_id`) USING BTREE,
  1261. KEY `idx_plan_id` (`plan_id`) USING BTREE,
  1262. KEY `idx_owner_user_id` (`owner_user_id`) USING BTREE,
  1263. KEY `idx_status` (`status`) USING BTREE,
  1264. KEY `idx_payment_date` (`payment_date`) USING BTREE,
  1265. KEY `idx_confirm_by` (`confirm_by`) USING BTREE,
  1266. KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
  1267. KEY `idx_create_time` (`create_time`) USING BTREE
  1268. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-回款记录表';
  1269. -- ----------------------------
  1270. -- Table structure for crm_payment_collection
  1271. -- ----------------------------
  1272. DROP TABLE IF EXISTS `crm_payment_collection`;
  1273. CREATE TABLE `crm_payment_collection` (
  1274. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  1275. `plan_id` bigint(20) NOT NULL COMMENT '回款计划ID',
  1276. `contract_id` bigint(20) NOT NULL COMMENT '合同ID',
  1277. `contract_no` varchar(50) DEFAULT NULL COMMENT '合同编号(冗余)',
  1278. `customer_id` bigint(20) NOT NULL COMMENT '客户ID',
  1279. `customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余)',
  1280. `collection_date` datetime NOT NULL COMMENT '催收日期时间',
  1281. `collection_method` varchar(20) NOT NULL COMMENT '催收方式(phone/email/message/visit/legal/other)',
  1282. `contact_person` varchar(100) DEFAULT NULL COMMENT '联系人姓名',
  1283. `contact_phone` varchar(20) DEFAULT NULL COMMENT '联系电话',
  1284. `collection_content` text NOT NULL COMMENT '催收内容(最少20字)',
  1285. `customer_feedback` varchar(20) NOT NULL COMMENT '客户反馈类型(promise/processing/difficulty/refuse/no_contact/other)',
  1286. `feedback_detail` varchar(500) DEFAULT NULL COMMENT '反馈详情',
  1287. `promise_date` date DEFAULT NULL COMMENT '承诺付款日期',
  1288. `collector_user_id` bigint(20) NOT NULL COMMENT '催收人ID',
  1289. `collector_user_name` varchar(50) DEFAULT NULL COMMENT '催收人姓名(冗余)',
  1290. `attachment` varchar(500) DEFAULT NULL COMMENT '附件(催收邮件截图等)',
  1291. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1292. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  1293. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  1294. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1295. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  1296. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  1297. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  1298. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  1299. PRIMARY KEY (`id`) USING BTREE,
  1300. KEY `idx_plan_id` (`plan_id`) USING BTREE,
  1301. KEY `idx_contract_id` (`contract_id`) USING BTREE,
  1302. KEY `idx_customer_id` (`customer_id`) USING BTREE,
  1303. KEY `idx_collection_date` (`collection_date`) USING BTREE,
  1304. KEY `idx_collector_user_id` (`collector_user_id`) USING BTREE,
  1305. KEY `idx_tenant_id` (`tenant_id`) USING BTREE
  1306. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-催收记录表';
  1307. -- ----------------------------
  1308. -- Table structure for crm_payment_plan
  1309. -- ----------------------------
  1310. DROP TABLE IF EXISTS `crm_payment_plan`;
  1311. CREATE TABLE `crm_payment_plan` (
  1312. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  1313. `plan_no` varchar(50) NOT NULL COMMENT '计划编号(PLAN+yyyyMMdd+4位流水号)',
  1314. `contract_id` bigint(20) NOT NULL COMMENT '合同ID',
  1315. `contract_no` varchar(50) DEFAULT NULL COMMENT '合同编号(冗余字段)',
  1316. `customer_id` bigint(20) NOT NULL COMMENT '客户ID',
  1317. `customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余字段)',
  1318. `period` int(11) NOT NULL DEFAULT '1' COMMENT '期数(第几期)',
  1319. `plan_amount` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '计划回款金额',
  1320. `plan_date` date NOT NULL COMMENT '计划回款日期',
  1321. `plan_percent` decimal(5,2) DEFAULT NULL COMMENT '计划比例(占合同总金额的百分比)',
  1322. `received_amount` decimal(15,2) DEFAULT '0.00' COMMENT '已回款金额',
  1323. `unreceived_amount` decimal(15,2) DEFAULT '0.00' COMMENT '未回款金额',
  1324. `status` varchar(20) NOT NULL DEFAULT 'pending' COMMENT '状态(pending-待回款/partial-部分回款/finished-已完成/overdue-已逾期)',
  1325. `is_overdue` tinyint(1) DEFAULT '0' COMMENT '是否逾期(0否 1是)',
  1326. `overdue_days` int(11) DEFAULT '0' COMMENT '逾期天数',
  1327. `remind_days` int(11) DEFAULT '7' COMMENT '提前提醒天数(默认7天)',
  1328. `remind_status` varchar(20) DEFAULT 'no' COMMENT '提醒状态(no-未提醒/reminded-已提醒)',
  1329. `last_remind_time` datetime DEFAULT NULL COMMENT '最后提醒时间',
  1330. `owner_user_id` bigint(20) NOT NULL COMMENT '负责人ID',
  1331. `owner_user_name` varchar(50) DEFAULT NULL COMMENT '负责人姓名(冗余字段)',
  1332. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1333. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  1334. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  1335. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1336. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  1337. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  1338. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  1339. `version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
  1340. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  1341. PRIMARY KEY (`id`) USING BTREE,
  1342. UNIQUE KEY `uk_plan_no_del_flag` (`plan_no`,`del_flag`) USING BTREE,
  1343. KEY `idx_contract_id` (`contract_id`) USING BTREE,
  1344. KEY `idx_customer_id` (`customer_id`) USING BTREE,
  1345. KEY `idx_owner_user_id` (`owner_user_id`) USING BTREE,
  1346. KEY `idx_status` (`status`) USING BTREE,
  1347. KEY `idx_plan_date` (`plan_date`) USING BTREE,
  1348. KEY `idx_is_overdue` (`is_overdue`) USING BTREE,
  1349. KEY `idx_tenant_id` (`tenant_id`) USING BTREE
  1350. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-回款计划表';
  1351. -- ----------------------------
  1352. -- Table structure for crm_product
  1353. -- ----------------------------
  1354. DROP TABLE IF EXISTS `crm_product`;
  1355. CREATE TABLE `crm_product` (
  1356. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  1357. `product_no` varchar(50) NOT NULL COMMENT '产品编号(唯一)',
  1358. `product_name` varchar(200) NOT NULL COMMENT '产品名称',
  1359. `category_id` bigint(20) DEFAULT NULL COMMENT '分类ID',
  1360. `category_name` varchar(100) DEFAULT NULL COMMENT '分类名称(冗余)',
  1361. `model` varchar(100) DEFAULT NULL COMMENT '型号/规格',
  1362. `unit` varchar(20) DEFAULT '个' COMMENT '单位',
  1363. `barcode` varchar(100) DEFAULT NULL COMMENT '条码',
  1364. `price` decimal(15,2) DEFAULT '0.00' COMMENT '标准价格',
  1365. `cost` decimal(15,2) DEFAULT '0.00' COMMENT '成本价',
  1366. `min_price` decimal(15,2) DEFAULT NULL COMMENT '最低价格',
  1367. `stock` int(11) DEFAULT '0' COMMENT '库存数量',
  1368. `low_stock` int(11) DEFAULT '10' COMMENT '库存预警值',
  1369. `status` varchar(20) DEFAULT 'on' COMMENT '状态(on-上架/off-下架)',
  1370. `tax_rate` decimal(5,2) NOT NULL DEFAULT '13.00' COMMENT '税率(百分比)',
  1371. `description` text COMMENT '产品描述',
  1372. `images` varchar(1000) DEFAULT NULL COMMENT '产品图片(多个用逗号分隔)',
  1373. `sale_count` int(11) DEFAULT '0' COMMENT '销售次数',
  1374. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1375. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  1376. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  1377. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1378. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  1379. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  1380. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  1381. `version` int(11) DEFAULT '0' COMMENT '版本号',
  1382. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  1383. PRIMARY KEY (`id`) USING BTREE,
  1384. UNIQUE KEY `uk_product_no_del_flag` (`product_no`,`del_flag`) USING BTREE,
  1385. KEY `idx_category` (`category_id`) USING BTREE,
  1386. KEY `idx_status` (`status`) USING BTREE,
  1387. KEY `idx_tenant` (`tenant_id`) USING BTREE
  1388. ) ENGINE=InnoDB AUTO_INCREMENT=2060282814905675778 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-产品主表';
  1389. -- ----------------------------
  1390. -- Table structure for crm_product_attachment
  1391. -- ----------------------------
  1392. DROP TABLE IF EXISTS `crm_product_attachment`;
  1393. CREATE TABLE `crm_product_attachment` (
  1394. `id` bigint(20) NOT NULL COMMENT '主键ID',
  1395. `product_id` bigint(20) NOT NULL COMMENT '产品ID',
  1396. `file_name` varchar(200) NOT NULL COMMENT '文件名称',
  1397. `file_path` varchar(500) NOT NULL COMMENT '文件路径',
  1398. `file_type` varchar(50) DEFAULT NULL COMMENT '文件类型(pdf/doc/xls/ppt/jpg等)',
  1399. `file_size` bigint(20) DEFAULT NULL COMMENT '文件大小(字节)',
  1400. `attachment_type` varchar(50) DEFAULT 'other' COMMENT '资料类型(manual-产品手册/whitepaper-技术白皮书/guide-用户指南/demo-演示PPT/case-案例资料/video-视频教程/other-其他)',
  1401. `download_count` int(11) DEFAULT '0' COMMENT '下载次数',
  1402. `sort` int(11) DEFAULT '0' COMMENT '显示顺序',
  1403. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  1404. `del_flag` int(11) DEFAULT '0' COMMENT '逻辑删除标志(0存在 1删除)',
  1405. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  1406. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  1407. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  1408. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  1409. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1410. PRIMARY KEY (`id`) USING BTREE,
  1411. KEY `idx_product_id` (`product_id`) USING BTREE,
  1412. KEY `idx_attachment_type` (`attachment_type`) USING BTREE,
  1413. KEY `idx_tenant_id` (`tenant_id`) USING BTREE
  1414. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='产品附件表';
  1415. -- ----------------------------
  1416. -- Table structure for crm_product_category
  1417. -- ----------------------------
  1418. DROP TABLE IF EXISTS `crm_product_category`;
  1419. CREATE TABLE `crm_product_category` (
  1420. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  1421. `category_name` varchar(100) NOT NULL COMMENT '分类名称',
  1422. `parent_id` bigint(20) DEFAULT '0' COMMENT '父级ID(0为顶级)',
  1423. `ancestors` varchar(500) DEFAULT NULL COMMENT '祖级列表(如: 0,1,2)',
  1424. `sort` int(11) DEFAULT '0' COMMENT '显示顺序',
  1425. `status` varchar(10) DEFAULT '0' COMMENT '状态(0-正常 1-停用)',
  1426. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1427. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  1428. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  1429. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1430. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  1431. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  1432. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  1433. `version` int(11) DEFAULT '0' COMMENT '版本号',
  1434. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  1435. PRIMARY KEY (`id`) USING BTREE,
  1436. KEY `idx_parent_id` (`parent_id`) USING BTREE,
  1437. KEY `idx_tenant` (`tenant_id`) USING BTREE
  1438. ) ENGINE=InnoDB AUTO_INCREMENT=1975766650771238914 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-产品分类表';
  1439. -- ----------------------------
  1440. -- Table structure for crm_product_price
  1441. -- ----------------------------
  1442. DROP TABLE IF EXISTS `crm_product_price`;
  1443. CREATE TABLE `crm_product_price` (
  1444. `id` bigint(20) NOT NULL COMMENT '主键ID',
  1445. `product_id` bigint(20) NOT NULL COMMENT '产品ID',
  1446. `price_type` varchar(20) NOT NULL COMMENT '价格类型(standard/cost/minimum/vip/wholesale/promotion)',
  1447. `price` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '价格',
  1448. `start_date` datetime DEFAULT NULL COMMENT '生效日期',
  1449. `end_date` datetime DEFAULT NULL COMMENT '失效日期',
  1450. `status` varchar(10) DEFAULT 'active' COMMENT '状态(active-生效中/inactive-已失效)',
  1451. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  1452. `del_flag` int(11) DEFAULT '0' COMMENT '逻辑删除标志(0存在 1删除)',
  1453. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  1454. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  1455. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  1456. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  1457. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  1458. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1459. PRIMARY KEY (`id`) USING BTREE,
  1460. KEY `idx_product_id` (`product_id`) USING BTREE,
  1461. KEY `idx_price_type` (`price_type`) USING BTREE,
  1462. KEY `idx_status` (`status`) USING BTREE,
  1463. KEY `idx_tenant_id` (`tenant_id`) USING BTREE
  1464. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='产品价格表';
  1465. -- ----------------------------
  1466. -- Table structure for crm_product_price_history
  1467. -- ----------------------------
  1468. DROP TABLE IF EXISTS `crm_product_price_history`;
  1469. CREATE TABLE `crm_product_price_history` (
  1470. `id` bigint(20) NOT NULL COMMENT '主键ID',
  1471. `product_id` bigint(20) NOT NULL COMMENT '产品ID',
  1472. `price_type` varchar(20) NOT NULL COMMENT '价格类型',
  1473. `old_price` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '调整前价格',
  1474. `new_price` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '调整后价格',
  1475. `price_change` decimal(12,2) DEFAULT '0.00' COMMENT '调整金额',
  1476. `change_percent` decimal(5,2) DEFAULT '0.00' COMMENT '调整百分比',
  1477. `adjust_reason` varchar(500) DEFAULT NULL COMMENT '调价原因',
  1478. `effective_date` datetime DEFAULT NULL COMMENT '生效日期',
  1479. `create_by` bigint(20) DEFAULT NULL COMMENT '操作人',
  1480. `create_time` datetime DEFAULT NULL COMMENT '操作时间',
  1481. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1482. PRIMARY KEY (`id`) USING BTREE,
  1483. KEY `idx_product_id` (`product_id`) USING BTREE,
  1484. KEY `idx_create_time` (`create_time`) USING BTREE,
  1485. KEY `idx_tenant_id` (`tenant_id`) USING BTREE
  1486. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='产品价格历史表';
  1487. -- ----------------------------
  1488. -- Table structure for crm_product_stock_log
  1489. -- ----------------------------
  1490. DROP TABLE IF EXISTS `crm_product_stock_log`;
  1491. CREATE TABLE `crm_product_stock_log` (
  1492. `id` bigint(20) NOT NULL COMMENT '主键ID',
  1493. `product_id` bigint(20) NOT NULL COMMENT '产品ID',
  1494. `operation_type` varchar(20) NOT NULL COMMENT '操作类型(in-入库/out-出库/adjust-调整/check-盘点)',
  1495. `quantity` int(11) NOT NULL DEFAULT '0' COMMENT '变动数量(正数-增加/负数-减少)',
  1496. `before_stock` int(11) NOT NULL DEFAULT '0' COMMENT '变动前库存',
  1497. `after_stock` int(11) NOT NULL DEFAULT '0' COMMENT '变动后库存',
  1498. `unit_price` decimal(12,2) DEFAULT NULL COMMENT '单价',
  1499. `total_amount` decimal(12,2) DEFAULT NULL COMMENT '总金额',
  1500. `related_no` varchar(100) DEFAULT NULL COMMENT '关联单号(入库单/出库单/合同编号等)',
  1501. `related_type` varchar(50) DEFAULT NULL COMMENT '关联类型(purchase-采购/sale-销售/sample-样品/other-其他)',
  1502. `supplier` varchar(200) DEFAULT NULL COMMENT '供应商(入库时)',
  1503. `operator` varchar(100) DEFAULT NULL COMMENT '操作人',
  1504. `operation_date` datetime DEFAULT NULL COMMENT '操作日期',
  1505. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  1506. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  1507. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  1508. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1509. PRIMARY KEY (`id`) USING BTREE,
  1510. KEY `idx_product_id` (`product_id`) USING BTREE,
  1511. KEY `idx_operation_type` (`operation_type`) USING BTREE,
  1512. KEY `idx_operation_date` (`operation_date`) USING BTREE,
  1513. KEY `idx_tenant_id` (`tenant_id`) USING BTREE
  1514. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='产品库存记录表';
  1515. -- ----------------------------
  1516. -- Table structure for crm_product_tag
  1517. -- ----------------------------
  1518. DROP TABLE IF EXISTS `crm_product_tag`;
  1519. CREATE TABLE `crm_product_tag` (
  1520. `id` bigint(20) NOT NULL COMMENT '主键ID',
  1521. `tag_name` varchar(50) NOT NULL COMMENT '标签名称',
  1522. `tag_color` varchar(20) DEFAULT NULL COMMENT '标签颜色',
  1523. `sort` int(11) DEFAULT '0' COMMENT '显示顺序',
  1524. `status` char(1) DEFAULT '0' COMMENT '状态(0正常 1停用)',
  1525. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  1526. `del_flag` int(11) DEFAULT '0' COMMENT '逻辑删除标志(0存在 1删除)',
  1527. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  1528. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  1529. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  1530. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  1531. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1532. PRIMARY KEY (`id`) USING BTREE,
  1533. UNIQUE KEY `uk_tag_name` (`tag_name`,`tenant_id`) USING BTREE,
  1534. KEY `idx_tenant_id` (`tenant_id`) USING BTREE
  1535. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='产品标签表';
  1536. -- ----------------------------
  1537. -- Table structure for crm_product_tag_relation
  1538. -- ----------------------------
  1539. DROP TABLE IF EXISTS `crm_product_tag_relation`;
  1540. CREATE TABLE `crm_product_tag_relation` (
  1541. `id` bigint(20) NOT NULL COMMENT '主键ID',
  1542. `product_id` bigint(20) NOT NULL COMMENT '产品ID',
  1543. `tag_id` bigint(20) NOT NULL COMMENT '标签ID',
  1544. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  1545. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1546. PRIMARY KEY (`id`) USING BTREE,
  1547. UNIQUE KEY `uk_product_tag` (`product_id`,`tag_id`,`tenant_id`) USING BTREE,
  1548. KEY `idx_product_id` (`product_id`) USING BTREE,
  1549. KEY `idx_tag_id` (`tag_id`) USING BTREE,
  1550. KEY `idx_tenant_id` (`tenant_id`) USING BTREE
  1551. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='产品标签关联表';
  1552. -- ----------------------------
  1553. -- Table structure for crm_quote
  1554. -- ----------------------------
  1555. DROP TABLE IF EXISTS `crm_quote`;
  1556. CREATE TABLE `crm_quote` (
  1557. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  1558. `quote_no` varchar(50) NOT NULL COMMENT '报价单编号(QUO+yyyyMMdd+4位流水号)',
  1559. `quote_title` varchar(200) NOT NULL COMMENT '报价单标题',
  1560. `quote_type` varchar(20) NOT NULL DEFAULT 'sales' COMMENT '报价单类型(sales-销售/purchase-采购)',
  1561. `customer_id` bigint(20) NOT NULL COMMENT '客户ID',
  1562. `customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余字段)',
  1563. `opportunity_id` bigint(20) DEFAULT NULL COMMENT '商机ID',
  1564. `contact_id` bigint(20) DEFAULT NULL COMMENT '联系人ID',
  1565. `contact_name` varchar(50) DEFAULT NULL COMMENT '联系人姓名(冗余字段)',
  1566. `contact_mobile` varchar(20) DEFAULT NULL COMMENT '联系人手机(冗余字段)',
  1567. `contact_email` varchar(100) DEFAULT NULL COMMENT '联系人邮箱(冗余字段)',
  1568. `version` varchar(20) DEFAULT 'V1.0' COMMENT '版本号(如V1.0,V1.1,V2.0)',
  1569. `parent_id` bigint(20) DEFAULT NULL COMMENT '父版本ID(版本管理,0表示首版)',
  1570. `is_latest` tinyint(1) DEFAULT '1' COMMENT '是否最新版本(0否 1是)',
  1571. `total_amount` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '总金额(未折扣前)',
  1572. `discount_rate` decimal(5,2) DEFAULT '0.00' COMMENT '整单折扣率(百分比)',
  1573. `discount_amount` decimal(15,2) DEFAULT '0.00' COMMENT '折扣金额',
  1574. `final_amount` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '最终金额(折扣后)',
  1575. `validity_days` int(11) DEFAULT '30' COMMENT '有效期(天数)',
  1576. `quote_date` date DEFAULT NULL COMMENT '报价日期',
  1577. `expire_date` date DEFAULT NULL COMMENT '到期日期',
  1578. `status` varchar(20) NOT NULL DEFAULT 'draft' COMMENT '状态(draft-草稿/submitted-已提交/accepted-已接受/rejected-已拒绝/expired-已过期/contract-已转合同)',
  1579. `reject_reason` varchar(500) DEFAULT NULL COMMENT '拒绝原因',
  1580. `pdf_url` varchar(500) DEFAULT NULL COMMENT 'PDF文件路径',
  1581. `pdf_generated` tinyint(1) DEFAULT '0' COMMENT 'PDF是否已生成(0否 1是)',
  1582. `share_link` varchar(500) DEFAULT NULL COMMENT '分享链接',
  1583. `share_code` varchar(50) DEFAULT NULL COMMENT '分享码',
  1584. `share_password` varchar(100) DEFAULT NULL COMMENT '分享密码(可选)',
  1585. `share_expire_time` datetime DEFAULT NULL COMMENT '分享链接过期时间',
  1586. `view_count` int(11) DEFAULT '0' COMMENT '查看次数',
  1587. `last_view_time` datetime DEFAULT NULL COMMENT '最后查看时间',
  1588. `owner_user_id` bigint(20) NOT NULL COMMENT '负责人ID',
  1589. `owner_user_name` varchar(50) DEFAULT NULL COMMENT '负责人姓名(冗余字段)',
  1590. `supplier_id` bigint(20) DEFAULT NULL COMMENT '报价主体ID(关联crm_supplier_info表)',
  1591. `supplier_name` varchar(200) DEFAULT NULL COMMENT '报价主体名称(冗余字段)',
  1592. `contract_id` bigint(20) DEFAULT NULL COMMENT '关联合同ID(转合同后)',
  1593. `payment_terms` varchar(500) DEFAULT NULL COMMENT '付款条款',
  1594. `delivery_terms` varchar(500) DEFAULT NULL COMMENT '交付条款',
  1595. `freight` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '运费(元)',
  1596. `attachments` varchar(1000) DEFAULT NULL COMMENT '附件(多个用逗号分隔)',
  1597. `template_content` longtext COMMENT '报价单模板内容(富文本HTML)',
  1598. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1599. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  1600. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  1601. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1602. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  1603. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  1604. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  1605. `version_no` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
  1606. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  1607. PRIMARY KEY (`id`) USING BTREE,
  1608. KEY `idx_customer_id` (`customer_id`) USING BTREE,
  1609. KEY `idx_opportunity_id` (`opportunity_id`) USING BTREE,
  1610. KEY `idx_owner_user_id` (`owner_user_id`) USING BTREE,
  1611. KEY `idx_status` (`status`) USING BTREE,
  1612. KEY `idx_parent_id` (`parent_id`) USING BTREE,
  1613. KEY `idx_expire_date` (`expire_date`) USING BTREE,
  1614. KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
  1615. KEY `idx_create_time` (`create_time`) USING BTREE,
  1616. KEY `idx_share_code` (`share_code`) USING BTREE,
  1617. KEY `idx_supplier_id` (`supplier_id`)
  1618. ) ENGINE=InnoDB AUTO_INCREMENT=2060201834769510402 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-报价单主表';
  1619. -- ----------------------------
  1620. -- Table structure for crm_quote_approval
  1621. -- ----------------------------
  1622. DROP TABLE IF EXISTS `crm_quote_approval`;
  1623. CREATE TABLE `crm_quote_approval` (
  1624. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  1625. `quote_id` bigint(20) NOT NULL COMMENT '报价单ID',
  1626. `quote_no` varchar(50) DEFAULT NULL COMMENT '报价单编号(冗余)',
  1627. `step` int(11) NOT NULL COMMENT '审批步骤(1/2/3...)',
  1628. `approver_id` bigint(20) NOT NULL COMMENT '审批人ID',
  1629. `approver_name` varchar(50) DEFAULT NULL COMMENT '审批人姓名(冗余)',
  1630. `approval_result` varchar(20) DEFAULT 'pending' COMMENT '审批结果(pending-待审批/approved-通过/rejected-拒绝)',
  1631. `approval_opinion` text COMMENT '审批意见',
  1632. `approval_time` datetime DEFAULT NULL COMMENT '审批时间',
  1633. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1634. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  1635. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  1636. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1637. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  1638. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  1639. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  1640. `version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
  1641. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  1642. PRIMARY KEY (`id`) USING BTREE,
  1643. KEY `idx_quote_id` (`quote_id`) USING BTREE,
  1644. KEY `idx_approver_id` (`approver_id`) USING BTREE,
  1645. KEY `idx_approval_time` (`approval_time`) USING BTREE,
  1646. KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
  1647. KEY `idx_approval_result` (`approval_result`) USING BTREE
  1648. ) ENGINE=InnoDB AUTO_INCREMENT=2060201835247661059 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-报价单审批记录表';
  1649. -- ----------------------------
  1650. -- Table structure for crm_quote_product
  1651. -- ----------------------------
  1652. DROP TABLE IF EXISTS `crm_quote_product`;
  1653. CREATE TABLE `crm_quote_product` (
  1654. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  1655. `quote_id` bigint(20) NOT NULL COMMENT '报价单ID',
  1656. `product_id` bigint(20) NOT NULL COMMENT '产品ID',
  1657. `product_name` varchar(200) NOT NULL COMMENT '产品名称',
  1658. `product_no` varchar(50) DEFAULT NULL COMMENT '产品编号',
  1659. `category_id` bigint(20) DEFAULT NULL COMMENT '产品分类ID',
  1660. `category_name` varchar(100) DEFAULT NULL COMMENT '产品分类名称',
  1661. `model` varchar(100) DEFAULT NULL COMMENT '规格型号',
  1662. `unit` varchar(20) DEFAULT '件' COMMENT '单位',
  1663. `quantity` decimal(20,4) NOT NULL COMMENT '数量',
  1664. `price` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '含税单价/元',
  1665. `discount` decimal(5,2) DEFAULT '0.00' COMMENT '折扣(百分比)',
  1666. `subtotal` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '含税总价/元',
  1667. `tax_amount` decimal(15,2) DEFAULT '0.00' COMMENT '税费/元',
  1668. `tax_rate` decimal(5,2) DEFAULT '13.00' COMMENT '税率(%)',
  1669. `package_spec` varchar(200) DEFAULT NULL COMMENT '包装规格',
  1670. `delivery_method` varchar(200) DEFAULT NULL COMMENT '送货方式',
  1671. `description` varchar(1000) DEFAULT NULL COMMENT '产品描述',
  1672. `sort` int(11) DEFAULT '0' COMMENT '排序号',
  1673. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1674. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  1675. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  1676. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1677. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  1678. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  1679. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  1680. `version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
  1681. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  1682. PRIMARY KEY (`id`) USING BTREE,
  1683. KEY `idx_quote_id` (`quote_id`) USING BTREE,
  1684. KEY `idx_product_id` (`product_id`) USING BTREE,
  1685. KEY `idx_tenant_id` (`tenant_id`) USING BTREE
  1686. ) ENGINE=InnoDB AUTO_INCREMENT=2060201834803064834 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-报价单产品明细表';
  1687. -- ----------------------------
  1688. -- Table structure for crm_quote_share_log
  1689. -- ----------------------------
  1690. DROP TABLE IF EXISTS `crm_quote_share_log`;
  1691. CREATE TABLE `crm_quote_share_log` (
  1692. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  1693. `quote_id` bigint(20) NOT NULL COMMENT '报价单ID',
  1694. `share_code` varchar(50) NOT NULL COMMENT '分享码',
  1695. `visit_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '访问时间',
  1696. `ip_address` varchar(50) DEFAULT NULL COMMENT 'IP地址',
  1697. `location` varchar(200) DEFAULT NULL COMMENT '地理位置(省市)',
  1698. `device_type` varchar(50) DEFAULT NULL COMMENT '设备类型(PC/Mobile/Tablet)',
  1699. `browser` varchar(100) DEFAULT NULL COMMENT '浏览器信息',
  1700. `stay_duration` int(11) DEFAULT '0' COMMENT '停留时长(秒)',
  1701. `page_views` int(11) DEFAULT '1' COMMENT '浏览页数',
  1702. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1703. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1704. PRIMARY KEY (`id`) USING BTREE,
  1705. KEY `idx_quote_id` (`quote_id`) USING BTREE,
  1706. KEY `idx_share_code` (`share_code`) USING BTREE,
  1707. KEY `idx_visit_time` (`visit_time`) USING BTREE,
  1708. KEY `idx_tenant_id` (`tenant_id`) USING BTREE
  1709. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-报价单分享访问日志表';
  1710. -- ----------------------------
  1711. -- Table structure for crm_supplier_info
  1712. -- ----------------------------
  1713. DROP TABLE IF EXISTS `crm_supplier_info`;
  1714. CREATE TABLE `crm_supplier_info` (
  1715. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  1716. `supplier_name` varchar(200) NOT NULL COMMENT '供方名称(章)',
  1717. `short_name` varchar(100) DEFAULT NULL COMMENT '简称',
  1718. `supplier_code` varchar(50) DEFAULT NULL COMMENT '编码',
  1719. `supplier_address` varchar(500) DEFAULT NULL COMMENT '单位地址',
  1720. `legal_person` varchar(100) DEFAULT NULL COMMENT '法定代表人',
  1721. `agent` varchar(100) DEFAULT NULL COMMENT '代理人',
  1722. `phone_fax` varchar(100) DEFAULT NULL COMMENT '电话/传真',
  1723. `bank_name` varchar(200) DEFAULT NULL COMMENT '开户银行',
  1724. `bank_account` varchar(100) DEFAULT NULL COMMENT '账号',
  1725. `status` char(1) DEFAULT '0' COMMENT '状态(0正常 1停用)',
  1726. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  1727. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  1728. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  1729. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  1730. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  1731. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  1732. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1733. `del_flag` char(1) DEFAULT '0' COMMENT '逻辑删除标志(0存在 1删除)',
  1734. PRIMARY KEY (`id`),
  1735. KEY `idx_tenant_id` (`tenant_id`),
  1736. KEY `idx_del_flag` (`del_flag`)
  1737. ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='供方信息表';
  1738. -- ----------------------------
  1739. -- Table structure for crm_visit
  1740. -- ----------------------------
  1741. DROP TABLE IF EXISTS `crm_visit`;
  1742. CREATE TABLE `crm_visit` (
  1743. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  1744. `visit_no` varchar(50) NOT NULL COMMENT '回访编号(VIS+yyyyMMdd+4位流水号)',
  1745. `customer_id` bigint(20) NOT NULL COMMENT '客户ID',
  1746. `customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余字段)',
  1747. `contract_id` bigint(20) DEFAULT NULL COMMENT '合同ID',
  1748. `contract_no` varchar(50) DEFAULT NULL COMMENT '合同编号(冗余字段)',
  1749. `contact_id` bigint(20) DEFAULT NULL COMMENT '联系人ID',
  1750. `contact_name` varchar(50) DEFAULT NULL COMMENT '联系人姓名',
  1751. `contact_mobile` varchar(20) DEFAULT NULL COMMENT '联系人手机',
  1752. `visit_type` varchar(20) NOT NULL DEFAULT 'regular' COMMENT '回访类型(contract-合同回访/delivery-交付回访/regular-定期回访/renew-续约回访/complaint-投诉回访/other-其他)',
  1753. `plan_visit_date` datetime DEFAULT NULL COMMENT '计划回访时间',
  1754. `visit_date` datetime NOT NULL COMMENT '实际回访时间(执行回访时填写)',
  1755. `visit_method` varchar(20) NOT NULL DEFAULT 'phone' COMMENT '回访方式(phone-电话/wechat-微信/email-邮件/visit-上门拜访/other-其他)',
  1756. `visit_purpose` text COMMENT '回访目的(多个用逗号分隔: understand_usage,collect_feedback等)',
  1757. `visit_script` text COMMENT '回访话术模板',
  1758. `visit_content` text NOT NULL COMMENT '回访内容',
  1759. `visit_summary` varchar(1000) DEFAULT NULL COMMENT '回访小结',
  1760. `satisfaction` varchar(20) DEFAULT NULL COMMENT '满意度(very_satisfied-非常满意/satisfied-满意/general-一般/dissatisfied-不满意/very_dissatisfied-非常不满意)',
  1761. `satisfaction_score` int(11) DEFAULT NULL COMMENT '满意度评分(1-5分,5分最高)',
  1762. `usage_status` varchar(20) DEFAULT NULL COMMENT '使用情况(normal-正常/occasional-偶尔/rarely-很少/not_used-未使用)',
  1763. `dissatisfaction_reason` varchar(500) DEFAULT NULL COMMENT '不满意原因(满意度<3星时必填)',
  1764. `has_problem` tinyint(1) DEFAULT '0' COMMENT '是否有问题(0否 1是)',
  1765. `problem_count` int(11) DEFAULT '0' COMMENT '问题数量(冗余字段)',
  1766. `problem_summary` varchar(500) DEFAULT NULL COMMENT '问题概述',
  1767. `has_opportunity` tinyint(1) DEFAULT '0' COMMENT '是否有商机(0否 1是)',
  1768. `opportunity_desc` text COMMENT '商机描述',
  1769. `opportunity_amount` decimal(15,2) DEFAULT NULL COMMENT '预估商机金额',
  1770. `next_visit_date` date DEFAULT NULL COMMENT '下次回访日期',
  1771. `next_visit_content` varchar(500) DEFAULT NULL COMMENT '下次回访计划',
  1772. `status` varchar(20) NOT NULL DEFAULT 'pending' COMMENT '回访状态(pending-待回访/visiting-回访中/completed-已完成/cancelled-已取消)',
  1773. `cancel_reason` varchar(500) DEFAULT NULL COMMENT '取消原因',
  1774. `cancel_time` datetime DEFAULT NULL COMMENT '取消时间',
  1775. `owner_user_id` bigint(20) NOT NULL COMMENT '负责人ID(回访人)',
  1776. `owner_user_name` varchar(50) DEFAULT NULL COMMENT '负责人姓名(冗余字段)',
  1777. `duration` int(11) DEFAULT NULL COMMENT '回访时长(分钟)',
  1778. `attachments` varchar(1000) DEFAULT NULL COMMENT '附件(多个文件用逗号分隔)',
  1779. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1780. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  1781. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  1782. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1783. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  1784. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  1785. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  1786. `version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
  1787. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  1788. PRIMARY KEY (`id`) USING BTREE,
  1789. UNIQUE KEY `uk_visit_no_del_flag` (`visit_no`,`del_flag`) USING BTREE,
  1790. KEY `idx_customer_id` (`customer_id`) USING BTREE,
  1791. KEY `idx_contract_id` (`contract_id`) USING BTREE,
  1792. KEY `idx_owner_user_id` (`owner_user_id`) USING BTREE,
  1793. KEY `idx_visit_type` (`visit_type`) USING BTREE,
  1794. KEY `idx_status` (`status`) USING BTREE,
  1795. KEY `idx_visit_date` (`visit_date`) USING BTREE,
  1796. KEY `idx_satisfaction` (`satisfaction`) USING BTREE,
  1797. KEY `idx_has_problem` (`has_problem`) USING BTREE,
  1798. KEY `idx_has_opportunity` (`has_opportunity`) USING BTREE,
  1799. KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
  1800. KEY `idx_create_time` (`create_time`) USING BTREE
  1801. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-回访记录表';
  1802. -- ----------------------------
  1803. -- Table structure for crm_visit_plan
  1804. -- ----------------------------
  1805. DROP TABLE IF EXISTS `crm_visit_plan`;
  1806. CREATE TABLE `crm_visit_plan` (
  1807. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  1808. `rule_name` varchar(200) NOT NULL COMMENT '规则名称',
  1809. `trigger_type` varchar(20) NOT NULL COMMENT '触发类型(contract_signed-合同签订后/last_visit-上次回访后/product_expire-产品到期前/fixed_period-固定周期)',
  1810. `delay_days` int(11) NOT NULL DEFAULT '0' COMMENT '延迟天数(合同签订/上次回访后多少天回访)',
  1811. `visit_type` varchar(20) NOT NULL COMMENT '回访类型(参考crm_visit_type字典)',
  1812. `visit_method` varchar(20) DEFAULT 'phone' COMMENT '回访方式(参考crm_visit_method字典)',
  1813. `visit_content_template` text COMMENT '回访内容模板',
  1814. `status` varchar(20) NOT NULL DEFAULT 'enabled' COMMENT '状态(enabled-启用/disabled-禁用)',
  1815. `execute_count` int(11) DEFAULT '0' COMMENT '执行次数',
  1816. `last_execute_time` datetime DEFAULT NULL COMMENT '最后执行时间',
  1817. `sort` int(11) DEFAULT '0' COMMENT '排序号',
  1818. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1819. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  1820. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  1821. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1822. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  1823. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  1824. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  1825. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  1826. PRIMARY KEY (`id`) USING BTREE,
  1827. KEY `idx_trigger_type` (`trigger_type`) USING BTREE,
  1828. KEY `idx_status` (`status`) USING BTREE,
  1829. KEY `idx_tenant_id` (`tenant_id`) USING BTREE
  1830. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-回访计划规则表';
  1831. -- ----------------------------
  1832. -- Table structure for crm_visit_problem
  1833. -- ----------------------------
  1834. DROP TABLE IF EXISTS `crm_visit_problem`;
  1835. CREATE TABLE `crm_visit_problem` (
  1836. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  1837. `visit_id` bigint(20) NOT NULL COMMENT '回访ID',
  1838. `visit_no` varchar(50) DEFAULT NULL COMMENT '回访编号(冗余字段)',
  1839. `customer_id` bigint(20) NOT NULL COMMENT '客户ID',
  1840. `customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余字段)',
  1841. `problem_type` varchar(20) NOT NULL DEFAULT 'product' COMMENT '问题类型(product-产品问题/service-服务问题/delivery-交付问题/quality-质量问题/price-价格问题/other-其他)',
  1842. `problem_desc` text NOT NULL COMMENT '问题描述',
  1843. `problem_images` varchar(1000) DEFAULT NULL COMMENT '问题图片(多个图片用逗号分隔)',
  1844. `severity` varchar(20) NOT NULL DEFAULT 'medium' COMMENT '严重程度(low-低/medium-中/high-高/urgent-紧急)',
  1845. `solution` text COMMENT '解决方案',
  1846. `status` varchar(20) NOT NULL DEFAULT 'pending' COMMENT '问题状态(pending-待处理/processing-处理中/solved-已解决/closed-已关闭)',
  1847. `solve_by` bigint(20) DEFAULT NULL COMMENT '处理人ID',
  1848. `solve_by_name` varchar(50) DEFAULT NULL COMMENT '处理人姓名',
  1849. `solve_time` datetime DEFAULT NULL COMMENT '处理时间',
  1850. `solve_duration` int(11) DEFAULT NULL COMMENT '处理耗时(小时)',
  1851. `close_by` bigint(20) DEFAULT NULL COMMENT '关闭人ID',
  1852. `close_by_name` varchar(50) DEFAULT NULL COMMENT '关闭人姓名',
  1853. `close_time` datetime DEFAULT NULL COMMENT '关闭时间',
  1854. `close_reason` varchar(500) DEFAULT NULL COMMENT '关闭原因',
  1855. `customer_feedback` text COMMENT '客户反馈',
  1856. `is_satisfied` tinyint(1) DEFAULT NULL COMMENT '客户是否满意(0否 1是)',
  1857. `sort` int(11) DEFAULT '0' COMMENT '排序号',
  1858. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1859. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  1860. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  1861. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1862. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  1863. `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  1864. `del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
  1865. `version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
  1866. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  1867. PRIMARY KEY (`id`) USING BTREE,
  1868. KEY `idx_visit_id` (`visit_id`) USING BTREE,
  1869. KEY `idx_customer_id` (`customer_id`) USING BTREE,
  1870. KEY `idx_problem_type` (`problem_type`) USING BTREE,
  1871. KEY `idx_severity` (`severity`) USING BTREE,
  1872. KEY `idx_status` (`status`) USING BTREE,
  1873. KEY `idx_solve_by` (`solve_by`) USING BTREE,
  1874. KEY `idx_tenant_id` (`tenant_id`) USING BTREE
  1875. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-回访问题记录表';
  1876. -- ----------------------------
  1877. -- Table structure for flow_category
  1878. -- ----------------------------
  1879. DROP TABLE IF EXISTS `flow_category`;
  1880. CREATE TABLE `flow_category` (
  1881. `category_id` bigint(20) NOT NULL COMMENT '流程分类ID',
  1882. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1883. `parent_id` bigint(20) DEFAULT '0' COMMENT '父流程分类id',
  1884. `ancestors` varchar(500) DEFAULT '' COMMENT '祖级列表',
  1885. `category_name` varchar(30) NOT NULL COMMENT '流程分类名称',
  1886. `order_num` int(4) DEFAULT '0' COMMENT '显示顺序',
  1887. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  1888. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  1889. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  1890. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  1891. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  1892. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  1893. PRIMARY KEY (`category_id`) USING BTREE
  1894. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='流程分类';
  1895. -- ----------------------------
  1896. -- Table structure for flow_category_bak
  1897. -- ----------------------------
  1898. DROP TABLE IF EXISTS `flow_category_bak`;
  1899. CREATE TABLE `flow_category_bak` (
  1900. `category_id` bigint(20) NOT NULL COMMENT '流程分类ID',
  1901. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  1902. `parent_id` bigint(20) DEFAULT '0' COMMENT '父流程分类id',
  1903. `ancestors` varchar(500) DEFAULT '' COMMENT '祖级列表',
  1904. `category_name` varchar(30) NOT NULL COMMENT '流程分类名称',
  1905. `order_num` int(4) DEFAULT '0' COMMENT '显示顺序',
  1906. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  1907. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  1908. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  1909. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  1910. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  1911. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  1912. PRIMARY KEY (`category_id`) USING BTREE
  1913. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='流程分类';
  1914. -- ----------------------------
  1915. -- Table structure for flow_definition
  1916. -- ----------------------------
  1917. DROP TABLE IF EXISTS `flow_definition`;
  1918. CREATE TABLE `flow_definition` (
  1919. `id` bigint(20) NOT NULL COMMENT '主键id',
  1920. `flow_code` varchar(40) NOT NULL COMMENT '流程编码',
  1921. `flow_name` varchar(100) NOT NULL COMMENT '流程名称',
  1922. `category` varchar(100) DEFAULT NULL COMMENT '流程类别',
  1923. `version` varchar(20) NOT NULL COMMENT '流程版本',
  1924. `is_publish` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否发布(0未发布 1已发布 9失效)',
  1925. `form_custom` char(1) DEFAULT 'N' COMMENT '审批表单是否自定义(Y是 N否)',
  1926. `form_path` varchar(100) DEFAULT NULL COMMENT '审批表单路径',
  1927. `activity_status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '流程激活状态(0挂起 1激活)',
  1928. `listener_type` varchar(100) DEFAULT NULL COMMENT '监听器类型',
  1929. `listener_path` varchar(400) DEFAULT NULL COMMENT '监听器路径',
  1930. `ext` varchar(500) DEFAULT NULL COMMENT '业务详情 存业务表对象json字符串',
  1931. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  1932. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  1933. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
  1934. `tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
  1935. PRIMARY KEY (`id`) USING BTREE
  1936. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='流程定义表';
  1937. -- ----------------------------
  1938. -- Table structure for flow_definition_bak
  1939. -- ----------------------------
  1940. DROP TABLE IF EXISTS `flow_definition_bak`;
  1941. CREATE TABLE `flow_definition_bak` (
  1942. `id` bigint(20) NOT NULL COMMENT '主键id',
  1943. `flow_code` varchar(40) NOT NULL COMMENT '流程编码',
  1944. `flow_name` varchar(100) NOT NULL COMMENT '流程名称',
  1945. `category` varchar(100) DEFAULT NULL COMMENT '流程类别',
  1946. `version` varchar(20) NOT NULL COMMENT '流程版本',
  1947. `is_publish` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否发布(0未发布 1已发布 9失效)',
  1948. `form_custom` char(1) DEFAULT 'N' COMMENT '审批表单是否自定义(Y是 N否)',
  1949. `form_path` varchar(100) DEFAULT NULL COMMENT '审批表单路径',
  1950. `activity_status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '流程激活状态(0挂起 1激活)',
  1951. `listener_type` varchar(100) DEFAULT NULL COMMENT '监听器类型',
  1952. `listener_path` varchar(400) DEFAULT NULL COMMENT '监听器路径',
  1953. `ext` varchar(500) DEFAULT NULL COMMENT '业务详情 存业务表对象json字符串',
  1954. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  1955. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  1956. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
  1957. `tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
  1958. PRIMARY KEY (`id`) USING BTREE
  1959. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='流程定义表';
  1960. -- ----------------------------
  1961. -- Table structure for flow_his_task
  1962. -- ----------------------------
  1963. DROP TABLE IF EXISTS `flow_his_task`;
  1964. CREATE TABLE `flow_his_task` (
  1965. `id` bigint(20) NOT NULL COMMENT '主键id',
  1966. `definition_id` bigint(20) NOT NULL COMMENT '对应flow_definition表的id',
  1967. `instance_id` bigint(20) NOT NULL COMMENT '对应flow_instance表的id',
  1968. `task_id` bigint(20) NOT NULL COMMENT '对应flow_task表的id',
  1969. `node_code` varchar(100) DEFAULT NULL COMMENT '开始节点编码',
  1970. `node_name` varchar(100) DEFAULT NULL COMMENT '开始节点名称',
  1971. `node_type` tinyint(1) DEFAULT NULL COMMENT '开始节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
  1972. `target_node_code` varchar(200) DEFAULT NULL COMMENT '目标节点编码',
  1973. `target_node_name` varchar(200) DEFAULT NULL COMMENT '结束节点名称',
  1974. `approver` varchar(40) DEFAULT NULL COMMENT '审批者',
  1975. `cooperate_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '协作方式(1审批 2转办 3委派 4会签 5票签 6加签 7减签)',
  1976. `collaborator` varchar(40) DEFAULT NULL COMMENT '协作人',
  1977. `skip_type` varchar(10) NOT NULL COMMENT '流转类型(PASS通过 REJECT退回 NONE无动作)',
  1978. `flow_status` varchar(20) NOT NULL COMMENT '流程状态(0待提交 1审批中 2审批通过 4终止 5作废 6撤销 8已完成 9已退回 10失效 11拿回)',
  1979. `form_custom` char(1) DEFAULT 'N' COMMENT '审批表单是否自定义(Y是 N否)',
  1980. `form_path` varchar(100) DEFAULT NULL COMMENT '审批表单路径',
  1981. `message` varchar(500) DEFAULT NULL COMMENT '审批意见',
  1982. `variable` text COMMENT '任务变量',
  1983. `ext` varchar(500) DEFAULT NULL COMMENT '业务详情 存业务表对象json字符串',
  1984. `create_time` datetime DEFAULT NULL COMMENT '任务开始时间',
  1985. `update_time` datetime DEFAULT NULL COMMENT '审批完成时间',
  1986. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
  1987. `tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
  1988. PRIMARY KEY (`id`) USING BTREE
  1989. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='历史任务记录表';
  1990. -- ----------------------------
  1991. -- Table structure for flow_his_task_bak
  1992. -- ----------------------------
  1993. DROP TABLE IF EXISTS `flow_his_task_bak`;
  1994. CREATE TABLE `flow_his_task_bak` (
  1995. `id` bigint(20) NOT NULL COMMENT '主键id',
  1996. `definition_id` bigint(20) NOT NULL COMMENT '对应flow_definition表的id',
  1997. `instance_id` bigint(20) NOT NULL COMMENT '对应flow_instance表的id',
  1998. `task_id` bigint(20) NOT NULL COMMENT '对应flow_task表的id',
  1999. `node_code` varchar(100) DEFAULT NULL COMMENT '开始节点编码',
  2000. `node_name` varchar(100) DEFAULT NULL COMMENT '开始节点名称',
  2001. `node_type` tinyint(1) DEFAULT NULL COMMENT '开始节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
  2002. `target_node_code` varchar(200) DEFAULT NULL COMMENT '目标节点编码',
  2003. `target_node_name` varchar(200) DEFAULT NULL COMMENT '结束节点名称',
  2004. `approver` varchar(40) DEFAULT NULL COMMENT '审批者',
  2005. `cooperate_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '协作方式(1审批 2转办 3委派 4会签 5票签 6加签 7减签)',
  2006. `collaborator` varchar(40) DEFAULT NULL COMMENT '协作人',
  2007. `skip_type` varchar(10) NOT NULL COMMENT '流转类型(PASS通过 REJECT退回 NONE无动作)',
  2008. `flow_status` varchar(20) NOT NULL COMMENT '流程状态(0待提交 1审批中 2审批通过 4终止 5作废 6撤销 8已完成 9已退回 10失效 11拿回)',
  2009. `form_custom` char(1) DEFAULT 'N' COMMENT '审批表单是否自定义(Y是 N否)',
  2010. `form_path` varchar(100) DEFAULT NULL COMMENT '审批表单路径',
  2011. `message` varchar(500) DEFAULT NULL COMMENT '审批意见',
  2012. `variable` text COMMENT '任务变量',
  2013. `ext` varchar(500) DEFAULT NULL COMMENT '业务详情 存业务表对象json字符串',
  2014. `create_time` datetime DEFAULT NULL COMMENT '任务开始时间',
  2015. `update_time` datetime DEFAULT NULL COMMENT '审批完成时间',
  2016. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
  2017. `tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
  2018. PRIMARY KEY (`id`) USING BTREE
  2019. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='历史任务记录表';
  2020. -- ----------------------------
  2021. -- Table structure for flow_instance
  2022. -- ----------------------------
  2023. DROP TABLE IF EXISTS `flow_instance`;
  2024. CREATE TABLE `flow_instance` (
  2025. `id` bigint(20) NOT NULL COMMENT '主键id',
  2026. `definition_id` bigint(20) NOT NULL COMMENT '对应flow_definition表的id',
  2027. `business_id` varchar(40) NOT NULL COMMENT '业务id',
  2028. `node_type` tinyint(1) NOT NULL COMMENT '节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
  2029. `node_code` varchar(40) NOT NULL COMMENT '流程节点编码',
  2030. `node_name` varchar(100) DEFAULT NULL COMMENT '流程节点名称',
  2031. `variable` text COMMENT '任务变量',
  2032. `flow_status` varchar(20) NOT NULL COMMENT '流程状态(0待提交 1审批中 2审批通过 4终止 5作废 6撤销 8已完成 9已退回 10失效 11拿回)',
  2033. `activity_status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '流程激活状态(0挂起 1激活)',
  2034. `def_json` text COMMENT '流程定义json',
  2035. `create_by` varchar(64) DEFAULT '' COMMENT '创建者',
  2036. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  2037. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  2038. `ext` varchar(500) DEFAULT NULL COMMENT '扩展字段,预留给业务系统使用',
  2039. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
  2040. `tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
  2041. PRIMARY KEY (`id`) USING BTREE
  2042. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='流程实例表';
  2043. -- ----------------------------
  2044. -- Table structure for flow_instance_bak
  2045. -- ----------------------------
  2046. DROP TABLE IF EXISTS `flow_instance_bak`;
  2047. CREATE TABLE `flow_instance_bak` (
  2048. `id` bigint(20) NOT NULL COMMENT '主键id',
  2049. `definition_id` bigint(20) NOT NULL COMMENT '对应flow_definition表的id',
  2050. `business_id` varchar(40) NOT NULL COMMENT '业务id',
  2051. `node_type` tinyint(1) NOT NULL COMMENT '节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
  2052. `node_code` varchar(40) NOT NULL COMMENT '流程节点编码',
  2053. `node_name` varchar(100) DEFAULT NULL COMMENT '流程节点名称',
  2054. `variable` text COMMENT '任务变量',
  2055. `flow_status` varchar(20) NOT NULL COMMENT '流程状态(0待提交 1审批中 2审批通过 4终止 5作废 6撤销 8已完成 9已退回 10失效 11拿回)',
  2056. `activity_status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '流程激活状态(0挂起 1激活)',
  2057. `def_json` text COMMENT '流程定义json',
  2058. `create_by` varchar(64) DEFAULT '' COMMENT '创建者',
  2059. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  2060. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  2061. `ext` varchar(500) DEFAULT NULL COMMENT '扩展字段,预留给业务系统使用',
  2062. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
  2063. `tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
  2064. PRIMARY KEY (`id`) USING BTREE
  2065. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='流程实例表';
  2066. -- ----------------------------
  2067. -- Table structure for flow_node
  2068. -- ----------------------------
  2069. DROP TABLE IF EXISTS `flow_node`;
  2070. CREATE TABLE `flow_node` (
  2071. `id` bigint(20) NOT NULL COMMENT '主键id',
  2072. `node_type` tinyint(1) NOT NULL COMMENT '节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
  2073. `definition_id` bigint(20) NOT NULL COMMENT '流程定义id',
  2074. `node_code` varchar(100) NOT NULL COMMENT '流程节点编码',
  2075. `node_name` varchar(100) DEFAULT NULL COMMENT '流程节点名称',
  2076. `permission_flag` varchar(200) DEFAULT NULL COMMENT '权限标识(权限类型:权限标识,可以多个,用逗号隔开)',
  2077. `node_ratio` decimal(6,3) DEFAULT NULL COMMENT '流程签署比例值',
  2078. `coordinate` varchar(100) DEFAULT NULL COMMENT '坐标',
  2079. `any_node_skip` varchar(100) DEFAULT NULL COMMENT '任意结点跳转',
  2080. `listener_type` varchar(100) DEFAULT NULL COMMENT '监听器类型',
  2081. `listener_path` varchar(400) DEFAULT NULL COMMENT '监听器路径',
  2082. `handler_type` varchar(100) DEFAULT NULL COMMENT '处理器类型',
  2083. `handler_path` varchar(400) DEFAULT NULL COMMENT '处理器路径',
  2084. `form_custom` char(1) DEFAULT 'N' COMMENT '审批表单是否自定义(Y是 N否)',
  2085. `form_path` varchar(100) DEFAULT NULL COMMENT '审批表单路径',
  2086. `version` varchar(20) NOT NULL COMMENT '版本',
  2087. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  2088. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  2089. `ext` text COMMENT '扩展属性',
  2090. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
  2091. `tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
  2092. PRIMARY KEY (`id`) USING BTREE
  2093. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='流程节点表';
  2094. -- ----------------------------
  2095. -- Table structure for flow_node_bak
  2096. -- ----------------------------
  2097. DROP TABLE IF EXISTS `flow_node_bak`;
  2098. CREATE TABLE `flow_node_bak` (
  2099. `id` bigint(20) NOT NULL COMMENT '主键id',
  2100. `node_type` tinyint(1) NOT NULL COMMENT '节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
  2101. `definition_id` bigint(20) NOT NULL COMMENT '流程定义id',
  2102. `node_code` varchar(100) NOT NULL COMMENT '流程节点编码',
  2103. `node_name` varchar(100) DEFAULT NULL COMMENT '流程节点名称',
  2104. `permission_flag` varchar(200) DEFAULT NULL COMMENT '权限标识(权限类型:权限标识,可以多个,用逗号隔开)',
  2105. `node_ratio` decimal(6,3) DEFAULT NULL COMMENT '流程签署比例值',
  2106. `coordinate` varchar(100) DEFAULT NULL COMMENT '坐标',
  2107. `any_node_skip` varchar(100) DEFAULT NULL COMMENT '任意结点跳转',
  2108. `listener_type` varchar(100) DEFAULT NULL COMMENT '监听器类型',
  2109. `listener_path` varchar(400) DEFAULT NULL COMMENT '监听器路径',
  2110. `handler_type` varchar(100) DEFAULT NULL COMMENT '处理器类型',
  2111. `handler_path` varchar(400) DEFAULT NULL COMMENT '处理器路径',
  2112. `form_custom` char(1) DEFAULT 'N' COMMENT '审批表单是否自定义(Y是 N否)',
  2113. `form_path` varchar(100) DEFAULT NULL COMMENT '审批表单路径',
  2114. `version` varchar(20) NOT NULL COMMENT '版本',
  2115. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  2116. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  2117. `ext` text COMMENT '扩展属性',
  2118. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
  2119. `tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
  2120. PRIMARY KEY (`id`) USING BTREE
  2121. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='流程节点表';
  2122. -- ----------------------------
  2123. -- Table structure for flow_skip
  2124. -- ----------------------------
  2125. DROP TABLE IF EXISTS `flow_skip`;
  2126. CREATE TABLE `flow_skip` (
  2127. `id` bigint(20) NOT NULL COMMENT '主键id',
  2128. `definition_id` bigint(20) NOT NULL COMMENT '流程定义id',
  2129. `now_node_code` varchar(100) NOT NULL COMMENT '当前流程节点的编码',
  2130. `now_node_type` tinyint(1) DEFAULT NULL COMMENT '当前节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
  2131. `next_node_code` varchar(100) NOT NULL COMMENT '下一个流程节点的编码',
  2132. `next_node_type` tinyint(1) DEFAULT NULL COMMENT '下一个节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
  2133. `skip_name` varchar(100) DEFAULT NULL COMMENT '跳转名称',
  2134. `skip_type` varchar(40) DEFAULT NULL COMMENT '跳转类型(PASS审批通过 REJECT退回)',
  2135. `skip_condition` varchar(200) DEFAULT NULL COMMENT '跳转条件',
  2136. `coordinate` varchar(100) DEFAULT NULL COMMENT '坐标',
  2137. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  2138. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  2139. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
  2140. `tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
  2141. PRIMARY KEY (`id`) USING BTREE
  2142. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='节点跳转关联表';
  2143. -- ----------------------------
  2144. -- Table structure for flow_skip_bak
  2145. -- ----------------------------
  2146. DROP TABLE IF EXISTS `flow_skip_bak`;
  2147. CREATE TABLE `flow_skip_bak` (
  2148. `id` bigint(20) NOT NULL COMMENT '主键id',
  2149. `definition_id` bigint(20) NOT NULL COMMENT '流程定义id',
  2150. `now_node_code` varchar(100) NOT NULL COMMENT '当前流程节点的编码',
  2151. `now_node_type` tinyint(1) DEFAULT NULL COMMENT '当前节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
  2152. `next_node_code` varchar(100) NOT NULL COMMENT '下一个流程节点的编码',
  2153. `next_node_type` tinyint(1) DEFAULT NULL COMMENT '下一个节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
  2154. `skip_name` varchar(100) DEFAULT NULL COMMENT '跳转名称',
  2155. `skip_type` varchar(40) DEFAULT NULL COMMENT '跳转类型(PASS审批通过 REJECT退回)',
  2156. `skip_condition` varchar(200) DEFAULT NULL COMMENT '跳转条件',
  2157. `coordinate` varchar(100) DEFAULT NULL COMMENT '坐标',
  2158. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  2159. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  2160. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
  2161. `tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
  2162. PRIMARY KEY (`id`) USING BTREE
  2163. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='节点跳转关联表';
  2164. -- ----------------------------
  2165. -- Table structure for flow_task
  2166. -- ----------------------------
  2167. DROP TABLE IF EXISTS `flow_task`;
  2168. CREATE TABLE `flow_task` (
  2169. `id` bigint(20) NOT NULL COMMENT '主键id',
  2170. `definition_id` bigint(20) NOT NULL COMMENT '对应flow_definition表的id',
  2171. `instance_id` bigint(20) NOT NULL COMMENT '对应flow_instance表的id',
  2172. `node_code` varchar(100) NOT NULL COMMENT '节点编码',
  2173. `node_name` varchar(100) DEFAULT NULL COMMENT '节点名称',
  2174. `node_type` tinyint(1) NOT NULL COMMENT '节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
  2175. `flow_status` varchar(20) NOT NULL COMMENT '流程状态(0待提交 1审批中 2审批通过 4终止 5作废 6撤销 8已完成 9已退回 10失效 11拿回)',
  2176. `form_custom` char(1) DEFAULT 'N' COMMENT '审批表单是否自定义(Y是 N否)',
  2177. `form_path` varchar(100) DEFAULT NULL COMMENT '审批表单路径',
  2178. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  2179. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  2180. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
  2181. `tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
  2182. PRIMARY KEY (`id`) USING BTREE
  2183. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='待办任务表';
  2184. -- ----------------------------
  2185. -- Table structure for flow_task_bak
  2186. -- ----------------------------
  2187. DROP TABLE IF EXISTS `flow_task_bak`;
  2188. CREATE TABLE `flow_task_bak` (
  2189. `id` bigint(20) NOT NULL COMMENT '主键id',
  2190. `definition_id` bigint(20) NOT NULL COMMENT '对应flow_definition表的id',
  2191. `instance_id` bigint(20) NOT NULL COMMENT '对应flow_instance表的id',
  2192. `node_code` varchar(100) NOT NULL COMMENT '节点编码',
  2193. `node_name` varchar(100) DEFAULT NULL COMMENT '节点名称',
  2194. `node_type` tinyint(1) NOT NULL COMMENT '节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
  2195. `flow_status` varchar(20) NOT NULL COMMENT '流程状态(0待提交 1审批中 2审批通过 4终止 5作废 6撤销 8已完成 9已退回 10失效 11拿回)',
  2196. `form_custom` char(1) DEFAULT 'N' COMMENT '审批表单是否自定义(Y是 N否)',
  2197. `form_path` varchar(100) DEFAULT NULL COMMENT '审批表单路径',
  2198. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  2199. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  2200. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
  2201. `tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
  2202. PRIMARY KEY (`id`) USING BTREE
  2203. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='待办任务表';
  2204. -- ----------------------------
  2205. -- Table structure for flow_user
  2206. -- ----------------------------
  2207. DROP TABLE IF EXISTS `flow_user`;
  2208. CREATE TABLE `flow_user` (
  2209. `id` bigint(20) NOT NULL COMMENT '主键id',
  2210. `type` char(1) NOT NULL COMMENT '人员类型(1待办任务的审批人权限 2待办任务的转办人权限 3待办任务的委托人权限)',
  2211. `processed_by` varchar(80) DEFAULT NULL COMMENT '权限人',
  2212. `associated` bigint(20) NOT NULL COMMENT '任务表id',
  2213. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  2214. `create_by` varchar(80) DEFAULT NULL COMMENT '创建人',
  2215. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  2216. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
  2217. `tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
  2218. PRIMARY KEY (`id`) USING BTREE,
  2219. KEY `user_processed_type` (`processed_by`,`type`) USING BTREE,
  2220. KEY `user_associated` (`associated`) USING BTREE
  2221. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='流程用户表';
  2222. -- ----------------------------
  2223. -- Table structure for flow_user_bak
  2224. -- ----------------------------
  2225. DROP TABLE IF EXISTS `flow_user_bak`;
  2226. CREATE TABLE `flow_user_bak` (
  2227. `id` bigint(20) NOT NULL COMMENT '主键id',
  2228. `type` char(1) NOT NULL COMMENT '人员类型(1待办任务的审批人权限 2待办任务的转办人权限 3待办任务的委托人权限)',
  2229. `processed_by` varchar(80) DEFAULT NULL COMMENT '权限人',
  2230. `associated` bigint(20) NOT NULL COMMENT '任务表id',
  2231. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  2232. `create_by` varchar(80) DEFAULT NULL COMMENT '创建人',
  2233. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  2234. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
  2235. `tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
  2236. PRIMARY KEY (`id`) USING BTREE,
  2237. KEY `user_processed_type` (`processed_by`,`type`) USING BTREE,
  2238. KEY `user_associated` (`associated`) USING BTREE
  2239. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='流程用户表';
  2240. -- ----------------------------
  2241. -- Table structure for gen_table
  2242. -- ----------------------------
  2243. DROP TABLE IF EXISTS `gen_table`;
  2244. CREATE TABLE `gen_table` (
  2245. `table_id` bigint(20) NOT NULL COMMENT '编号',
  2246. `data_name` varchar(200) DEFAULT '' COMMENT '数据源名称',
  2247. `table_name` varchar(200) DEFAULT '' COMMENT '表名称',
  2248. `table_comment` varchar(500) DEFAULT '' COMMENT '表描述',
  2249. `sub_table_name` varchar(64) DEFAULT NULL COMMENT '关联子表的表名',
  2250. `sub_table_fk_name` varchar(64) DEFAULT NULL COMMENT '子表关联的外键名',
  2251. `class_name` varchar(100) DEFAULT '' COMMENT '实体类名称',
  2252. `tpl_category` varchar(200) DEFAULT 'crud' COMMENT '使用的模板(crud单表操作 tree树表操作)',
  2253. `package_name` varchar(100) DEFAULT NULL COMMENT '生成包路径',
  2254. `module_name` varchar(30) DEFAULT NULL COMMENT '生成模块名',
  2255. `business_name` varchar(30) DEFAULT NULL COMMENT '生成业务名',
  2256. `function_name` varchar(50) DEFAULT NULL COMMENT '生成功能名',
  2257. `function_author` varchar(50) DEFAULT NULL COMMENT '生成功能作者',
  2258. `gen_type` char(1) DEFAULT '0' COMMENT '生成代码方式(0zip压缩包 1自定义路径)',
  2259. `gen_path` varchar(200) DEFAULT '/' COMMENT '生成路径(不填默认项目路径)',
  2260. `options` varchar(1000) DEFAULT NULL COMMENT '其它生成选项',
  2261. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  2262. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  2263. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  2264. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  2265. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  2266. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  2267. PRIMARY KEY (`table_id`) USING BTREE
  2268. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='代码生成业务表';
  2269. -- ----------------------------
  2270. -- Table structure for gen_table_column
  2271. -- ----------------------------
  2272. DROP TABLE IF EXISTS `gen_table_column`;
  2273. CREATE TABLE `gen_table_column` (
  2274. `column_id` bigint(20) NOT NULL COMMENT '编号',
  2275. `table_id` bigint(20) DEFAULT NULL COMMENT '归属表编号',
  2276. `column_name` varchar(200) DEFAULT NULL COMMENT '列名称',
  2277. `column_comment` varchar(500) DEFAULT NULL COMMENT '列描述',
  2278. `column_type` varchar(100) DEFAULT NULL COMMENT '列类型',
  2279. `java_type` varchar(500) DEFAULT NULL COMMENT 'JAVA类型',
  2280. `java_field` varchar(200) DEFAULT NULL COMMENT 'JAVA字段名',
  2281. `is_pk` char(1) DEFAULT NULL COMMENT '是否主键(1是)',
  2282. `is_increment` char(1) DEFAULT NULL COMMENT '是否自增(1是)',
  2283. `is_required` char(1) DEFAULT NULL COMMENT '是否必填(1是)',
  2284. `is_insert` char(1) DEFAULT NULL COMMENT '是否为插入字段(1是)',
  2285. `is_edit` char(1) DEFAULT NULL COMMENT '是否编辑字段(1是)',
  2286. `is_list` char(1) DEFAULT NULL COMMENT '是否列表字段(1是)',
  2287. `is_query` char(1) DEFAULT NULL COMMENT '是否查询字段(1是)',
  2288. `query_type` varchar(200) DEFAULT 'EQ' COMMENT '查询方式(等于、不等于、大于、小于、范围)',
  2289. `html_type` varchar(200) DEFAULT NULL COMMENT '显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)',
  2290. `dict_type` varchar(200) DEFAULT '' COMMENT '字典类型',
  2291. `sort` int(11) DEFAULT NULL COMMENT '排序',
  2292. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  2293. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  2294. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  2295. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  2296. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  2297. PRIMARY KEY (`column_id`) USING BTREE
  2298. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='代码生成业务表字段';
  2299. -- ----------------------------
  2300. -- Table structure for sj_distributed_lock
  2301. -- ----------------------------
  2302. DROP TABLE IF EXISTS `sj_distributed_lock`;
  2303. CREATE TABLE `sj_distributed_lock` (
  2304. `name` varchar(64) NOT NULL COMMENT '锁名称',
  2305. `lock_until` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '锁定时长',
  2306. `locked_at` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '锁定时间',
  2307. `locked_by` varchar(255) NOT NULL COMMENT '锁定者',
  2308. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2309. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  2310. PRIMARY KEY (`name`) USING BTREE
  2311. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='锁定表';
  2312. -- ----------------------------
  2313. -- Table structure for sj_group_config
  2314. -- ----------------------------
  2315. DROP TABLE IF EXISTS `sj_group_config`;
  2316. CREATE TABLE `sj_group_config` (
  2317. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  2318. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  2319. `group_name` varchar(64) NOT NULL DEFAULT '' COMMENT '组名称',
  2320. `description` varchar(256) NOT NULL DEFAULT '' COMMENT '组描述',
  2321. `token` varchar(64) NOT NULL DEFAULT 'SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT' COMMENT 'token',
  2322. `group_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '组状态 0、未启用 1、启用',
  2323. `version` int(11) NOT NULL COMMENT '版本号',
  2324. `group_partition` int(11) NOT NULL COMMENT '分区',
  2325. `id_generator_mode` tinyint(4) NOT NULL DEFAULT '1' COMMENT '唯一id生成模式 默认号段模式',
  2326. `init_scene` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否初始化场景 0:否 1:是',
  2327. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2328. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  2329. PRIMARY KEY (`id`) USING BTREE,
  2330. UNIQUE KEY `uk_namespace_id_group_name` (`namespace_id`,`group_name`) USING BTREE
  2331. ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='组配置';
  2332. -- ----------------------------
  2333. -- Table structure for sj_job
  2334. -- ----------------------------
  2335. DROP TABLE IF EXISTS `sj_job`;
  2336. CREATE TABLE `sj_job` (
  2337. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  2338. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  2339. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  2340. `job_name` varchar(64) NOT NULL COMMENT '名称',
  2341. `args_str` text COMMENT '执行方法参数',
  2342. `args_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '参数类型 ',
  2343. `next_trigger_at` bigint(13) NOT NULL COMMENT '下次触发时间',
  2344. `job_status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '任务状态 0、关闭、1、开启',
  2345. `task_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '任务类型 1、集群 2、广播 3、切片',
  2346. `route_key` tinyint(4) NOT NULL DEFAULT '4' COMMENT '路由策略',
  2347. `executor_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '执行器类型',
  2348. `executor_info` varchar(255) DEFAULT NULL COMMENT '执行器名称',
  2349. `trigger_type` tinyint(4) NOT NULL COMMENT '触发类型 1.CRON 表达式 2. 固定时间',
  2350. `trigger_interval` varchar(255) NOT NULL COMMENT '间隔时长',
  2351. `block_strategy` tinyint(4) NOT NULL DEFAULT '1' COMMENT '阻塞策略 1、丢弃 2、覆盖 3、并行 4、恢复',
  2352. `executor_timeout` int(11) NOT NULL DEFAULT '0' COMMENT '任务执行超时时间,单位秒',
  2353. `max_retry_times` int(11) NOT NULL DEFAULT '0' COMMENT '最大重试次数',
  2354. `parallel_num` int(11) NOT NULL DEFAULT '1' COMMENT '并行数',
  2355. `retry_interval` int(11) NOT NULL DEFAULT '0' COMMENT '重试间隔(s)',
  2356. `bucket_index` int(11) NOT NULL DEFAULT '0' COMMENT 'bucket',
  2357. `resident` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否是常驻任务',
  2358. `notify_ids` varchar(128) NOT NULL DEFAULT '' COMMENT '通知告警场景配置id列表',
  2359. `owner_id` bigint(20) DEFAULT NULL COMMENT '负责人id',
  2360. `description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
  2361. `ext_attrs` varchar(256) DEFAULT '' COMMENT '扩展字段',
  2362. `deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '逻辑删除 1、删除',
  2363. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2364. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  2365. PRIMARY KEY (`id`) USING BTREE,
  2366. KEY `idx_namespace_id_group_name` (`namespace_id`,`group_name`) USING BTREE,
  2367. KEY `idx_job_status_bucket_index` (`job_status`,`bucket_index`) USING BTREE,
  2368. KEY `idx_create_dt` (`create_dt`) USING BTREE
  2369. ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='任务信息';
  2370. -- ----------------------------
  2371. -- Table structure for sj_job_log_message
  2372. -- ----------------------------
  2373. DROP TABLE IF EXISTS `sj_job_log_message`;
  2374. CREATE TABLE `sj_job_log_message` (
  2375. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  2376. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  2377. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  2378. `job_id` bigint(20) NOT NULL COMMENT '任务信息id',
  2379. `task_batch_id` bigint(20) NOT NULL COMMENT '任务批次id',
  2380. `task_id` bigint(20) NOT NULL COMMENT '调度任务id',
  2381. `message` longtext NOT NULL COMMENT '调度信息',
  2382. `log_num` int(11) NOT NULL DEFAULT '1' COMMENT '日志数量',
  2383. `real_time` bigint(13) NOT NULL DEFAULT '0' COMMENT '上报时间',
  2384. `ext_attrs` varchar(256) DEFAULT '' COMMENT '扩展字段',
  2385. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2386. PRIMARY KEY (`id`) USING BTREE,
  2387. KEY `idx_task_batch_id_task_id` (`task_batch_id`,`task_id`) USING BTREE,
  2388. KEY `idx_create_dt` (`create_dt`) USING BTREE,
  2389. KEY `idx_namespace_id_group_name` (`namespace_id`,`group_name`) USING BTREE
  2390. ) ENGINE=InnoDB AUTO_INCREMENT=2574 DEFAULT CHARSET=utf8mb4 COMMENT='调度日志';
  2391. -- ----------------------------
  2392. -- Table structure for sj_job_summary
  2393. -- ----------------------------
  2394. DROP TABLE IF EXISTS `sj_job_summary`;
  2395. CREATE TABLE `sj_job_summary` (
  2396. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  2397. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  2398. `group_name` varchar(64) NOT NULL DEFAULT '' COMMENT '组名称',
  2399. `business_id` bigint(20) NOT NULL COMMENT '业务id (job_id或workflow_id)',
  2400. `system_task_type` tinyint(4) NOT NULL DEFAULT '3' COMMENT '任务类型 3、JOB任务 4、WORKFLOW任务',
  2401. `trigger_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '统计时间',
  2402. `success_num` int(11) NOT NULL DEFAULT '0' COMMENT '执行成功-日志数量',
  2403. `fail_num` int(11) NOT NULL DEFAULT '0' COMMENT '执行失败-日志数量',
  2404. `fail_reason` varchar(512) NOT NULL DEFAULT '' COMMENT '失败原因',
  2405. `stop_num` int(11) NOT NULL DEFAULT '0' COMMENT '执行失败-日志数量',
  2406. `stop_reason` varchar(512) NOT NULL DEFAULT '' COMMENT '失败原因',
  2407. `cancel_num` int(11) NOT NULL DEFAULT '0' COMMENT '执行失败-日志数量',
  2408. `cancel_reason` varchar(512) NOT NULL DEFAULT '' COMMENT '失败原因',
  2409. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2410. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  2411. PRIMARY KEY (`id`) USING BTREE,
  2412. UNIQUE KEY `uk_trigger_at_system_task_type_business_id` (`trigger_at`,`system_task_type`,`business_id`) USING BTREE,
  2413. KEY `idx_namespace_id_group_name_business_id` (`namespace_id`,`group_name`,`business_id`) USING BTREE
  2414. ) ENGINE=InnoDB AUTO_INCREMENT=222 DEFAULT CHARSET=utf8mb4 COMMENT='DashBoard_Job';
  2415. -- ----------------------------
  2416. -- Table structure for sj_job_task
  2417. -- ----------------------------
  2418. DROP TABLE IF EXISTS `sj_job_task`;
  2419. CREATE TABLE `sj_job_task` (
  2420. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  2421. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  2422. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  2423. `job_id` bigint(20) NOT NULL COMMENT '任务信息id',
  2424. `task_batch_id` bigint(20) NOT NULL COMMENT '调度任务id',
  2425. `parent_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '父执行器id',
  2426. `task_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '执行的状态 0、失败 1、成功',
  2427. `retry_count` int(11) NOT NULL DEFAULT '0' COMMENT '重试次数',
  2428. `mr_stage` tinyint(4) DEFAULT NULL COMMENT '动态分片所处阶段 1:map 2:reduce 3:mergeReduce',
  2429. `leaf` tinyint(4) NOT NULL DEFAULT '1' COMMENT '叶子节点',
  2430. `task_name` varchar(255) NOT NULL DEFAULT '' COMMENT '任务名称',
  2431. `client_info` varchar(128) DEFAULT NULL COMMENT '客户端地址 clientId#ip:port',
  2432. `wf_context` text COMMENT '工作流全局上下文',
  2433. `result_message` text NOT NULL COMMENT '执行结果',
  2434. `args_str` text COMMENT '执行方法参数',
  2435. `args_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '参数类型 ',
  2436. `ext_attrs` varchar(256) DEFAULT '' COMMENT '扩展字段',
  2437. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2438. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  2439. PRIMARY KEY (`id`) USING BTREE,
  2440. KEY `idx_task_batch_id_task_status` (`task_batch_id`,`task_status`) USING BTREE,
  2441. KEY `idx_create_dt` (`create_dt`) USING BTREE,
  2442. KEY `idx_namespace_id_group_name` (`namespace_id`,`group_name`) USING BTREE
  2443. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='任务实例';
  2444. -- ----------------------------
  2445. -- Table structure for sj_job_task_batch
  2446. -- ----------------------------
  2447. DROP TABLE IF EXISTS `sj_job_task_batch`;
  2448. CREATE TABLE `sj_job_task_batch` (
  2449. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  2450. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  2451. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  2452. `job_id` bigint(20) NOT NULL COMMENT '任务id',
  2453. `workflow_node_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '工作流节点id',
  2454. `parent_workflow_node_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '工作流任务父批次id',
  2455. `workflow_task_batch_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '工作流任务批次id',
  2456. `task_batch_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '任务批次状态 0、失败 1、成功',
  2457. `operation_reason` tinyint(4) NOT NULL DEFAULT '0' COMMENT '操作原因',
  2458. `execution_at` bigint(13) NOT NULL DEFAULT '0' COMMENT '任务执行时间',
  2459. `system_task_type` tinyint(4) NOT NULL DEFAULT '3' COMMENT '任务类型 3、JOB任务 4、WORKFLOW任务',
  2460. `parent_id` varchar(64) NOT NULL DEFAULT '' COMMENT '父节点',
  2461. `ext_attrs` varchar(256) DEFAULT '' COMMENT '扩展字段',
  2462. `deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '逻辑删除 1、删除',
  2463. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2464. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  2465. PRIMARY KEY (`id`) USING BTREE,
  2466. KEY `idx_job_id_task_batch_status` (`job_id`,`task_batch_status`) USING BTREE,
  2467. KEY `idx_create_dt` (`create_dt`) USING BTREE,
  2468. KEY `idx_namespace_id_group_name` (`namespace_id`,`group_name`) USING BTREE,
  2469. KEY `idx_workflow_task_batch_id_workflow_node_id` (`workflow_task_batch_id`,`workflow_node_id`) USING BTREE
  2470. ) ENGINE=InnoDB AUTO_INCREMENT=103406 DEFAULT CHARSET=utf8mb4 COMMENT='任务批次';
  2471. -- ----------------------------
  2472. -- Table structure for sj_namespace
  2473. -- ----------------------------
  2474. DROP TABLE IF EXISTS `sj_namespace`;
  2475. CREATE TABLE `sj_namespace` (
  2476. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  2477. `name` varchar(64) NOT NULL COMMENT '名称',
  2478. `unique_id` varchar(64) NOT NULL COMMENT '唯一id',
  2479. `description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
  2480. `deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '逻辑删除 1、删除',
  2481. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2482. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  2483. PRIMARY KEY (`id`) USING BTREE,
  2484. UNIQUE KEY `uk_unique_id` (`unique_id`) USING BTREE,
  2485. KEY `idx_name` (`name`) USING BTREE
  2486. ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='命名空间';
  2487. -- ----------------------------
  2488. -- Table structure for sj_notify_config
  2489. -- ----------------------------
  2490. DROP TABLE IF EXISTS `sj_notify_config`;
  2491. CREATE TABLE `sj_notify_config` (
  2492. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  2493. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  2494. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  2495. `notify_name` varchar(64) NOT NULL DEFAULT '' COMMENT '通知名称',
  2496. `system_task_type` tinyint(4) NOT NULL DEFAULT '3' COMMENT '任务类型 1. 重试任务 2. 重试回调 3、JOB任务 4、WORKFLOW任务',
  2497. `notify_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '通知状态 0、未启用 1、启用',
  2498. `recipient_ids` varchar(128) NOT NULL COMMENT '接收人id列表',
  2499. `notify_threshold` int(11) NOT NULL DEFAULT '0' COMMENT '通知阈值',
  2500. `notify_scene` tinyint(4) NOT NULL DEFAULT '0' COMMENT '通知场景',
  2501. `rate_limiter_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '限流状态 0、未启用 1、启用',
  2502. `rate_limiter_threshold` int(11) NOT NULL DEFAULT '0' COMMENT '每秒限流阈值',
  2503. `description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
  2504. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2505. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  2506. PRIMARY KEY (`id`) USING BTREE,
  2507. KEY `idx_namespace_id_group_name_scene_name` (`namespace_id`,`group_name`) USING BTREE
  2508. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='通知配置';
  2509. -- ----------------------------
  2510. -- Table structure for sj_notify_recipient
  2511. -- ----------------------------
  2512. DROP TABLE IF EXISTS `sj_notify_recipient`;
  2513. CREATE TABLE `sj_notify_recipient` (
  2514. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  2515. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  2516. `recipient_name` varchar(64) NOT NULL COMMENT '接收人名称',
  2517. `notify_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '通知类型 1、钉钉 2、邮件 3、企业微信 4 飞书 5 webhook',
  2518. `notify_attribute` varchar(512) NOT NULL COMMENT '配置属性',
  2519. `description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
  2520. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2521. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  2522. PRIMARY KEY (`id`) USING BTREE,
  2523. KEY `idx_namespace_id` (`namespace_id`) USING BTREE
  2524. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='告警通知接收人';
  2525. -- ----------------------------
  2526. -- Table structure for sj_retry
  2527. -- ----------------------------
  2528. DROP TABLE IF EXISTS `sj_retry`;
  2529. CREATE TABLE `sj_retry` (
  2530. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  2531. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  2532. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  2533. `group_id` bigint(20) NOT NULL COMMENT '组Id',
  2534. `scene_name` varchar(64) NOT NULL COMMENT '场景名称',
  2535. `scene_id` bigint(20) NOT NULL COMMENT '场景ID',
  2536. `idempotent_id` varchar(64) NOT NULL COMMENT '幂等id',
  2537. `biz_no` varchar(64) NOT NULL DEFAULT '' COMMENT '业务编号',
  2538. `executor_name` varchar(512) NOT NULL DEFAULT '' COMMENT '执行器名称',
  2539. `args_str` text NOT NULL COMMENT '执行方法参数',
  2540. `ext_attrs` text NOT NULL COMMENT '扩展字段',
  2541. `next_trigger_at` bigint(13) NOT NULL COMMENT '下次触发时间',
  2542. `retry_count` int(11) NOT NULL DEFAULT '0' COMMENT '重试次数',
  2543. `retry_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '重试状态 0、重试中 1、成功 2、最大重试次数',
  2544. `task_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '任务类型 1、重试数据 2、回调数据',
  2545. `bucket_index` int(11) NOT NULL DEFAULT '0' COMMENT 'bucket',
  2546. `parent_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '父节点id',
  2547. `deleted` bigint(20) NOT NULL DEFAULT '0' COMMENT '逻辑删除',
  2548. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2549. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  2550. PRIMARY KEY (`id`) USING BTREE,
  2551. UNIQUE KEY `uk_scene_tasktype_idempotentid_deleted` (`scene_id`,`task_type`,`idempotent_id`,`deleted`) USING BTREE,
  2552. KEY `idx_biz_no` (`biz_no`) USING BTREE,
  2553. KEY `idx_idempotent_id` (`idempotent_id`) USING BTREE,
  2554. KEY `idx_retry_status_bucket_index` (`retry_status`,`bucket_index`) USING BTREE,
  2555. KEY `idx_parent_id` (`parent_id`) USING BTREE,
  2556. KEY `idx_create_dt` (`create_dt`) USING BTREE
  2557. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='重试信息表';
  2558. -- ----------------------------
  2559. -- Table structure for sj_retry_dead_letter
  2560. -- ----------------------------
  2561. DROP TABLE IF EXISTS `sj_retry_dead_letter`;
  2562. CREATE TABLE `sj_retry_dead_letter` (
  2563. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  2564. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  2565. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  2566. `group_id` bigint(20) NOT NULL COMMENT '组Id',
  2567. `scene_name` varchar(64) NOT NULL COMMENT '场景名称',
  2568. `scene_id` bigint(20) NOT NULL COMMENT '场景ID',
  2569. `idempotent_id` varchar(64) NOT NULL COMMENT '幂等id',
  2570. `biz_no` varchar(64) NOT NULL DEFAULT '' COMMENT '业务编号',
  2571. `executor_name` varchar(512) NOT NULL DEFAULT '' COMMENT '执行器名称',
  2572. `args_str` text NOT NULL COMMENT '执行方法参数',
  2573. `ext_attrs` text NOT NULL COMMENT '扩展字段',
  2574. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2575. PRIMARY KEY (`id`) USING BTREE,
  2576. KEY `idx_namespace_id_group_name_scene_name` (`namespace_id`,`group_name`,`scene_name`) USING BTREE,
  2577. KEY `idx_idempotent_id` (`idempotent_id`) USING BTREE,
  2578. KEY `idx_biz_no` (`biz_no`) USING BTREE,
  2579. KEY `idx_create_dt` (`create_dt`) USING BTREE
  2580. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='死信队列表';
  2581. -- ----------------------------
  2582. -- Table structure for sj_retry_scene_config
  2583. -- ----------------------------
  2584. DROP TABLE IF EXISTS `sj_retry_scene_config`;
  2585. CREATE TABLE `sj_retry_scene_config` (
  2586. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  2587. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  2588. `scene_name` varchar(64) NOT NULL COMMENT '场景名称',
  2589. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  2590. `scene_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '组状态 0、未启用 1、启用',
  2591. `max_retry_count` int(11) NOT NULL DEFAULT '5' COMMENT '最大重试次数',
  2592. `back_off` tinyint(4) NOT NULL DEFAULT '1' COMMENT '1、默认等级 2、固定间隔时间 3、CRON 表达式',
  2593. `trigger_interval` varchar(16) NOT NULL DEFAULT '' COMMENT '间隔时长',
  2594. `notify_ids` varchar(128) NOT NULL DEFAULT '' COMMENT '通知告警场景配置id列表',
  2595. `deadline_request` bigint(20) unsigned NOT NULL DEFAULT '60000' COMMENT 'Deadline Request 调用链超时 单位毫秒',
  2596. `executor_timeout` int(11) unsigned NOT NULL DEFAULT '5' COMMENT '任务执行超时时间,单位秒',
  2597. `route_key` tinyint(4) NOT NULL DEFAULT '4' COMMENT '路由策略',
  2598. `block_strategy` tinyint(4) NOT NULL DEFAULT '1' COMMENT '阻塞策略 1、丢弃 2、覆盖 3、并行',
  2599. `cb_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '回调状态 0、不开启 1、开启',
  2600. `cb_trigger_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '1、默认等级 2、固定间隔时间 3、CRON 表达式',
  2601. `cb_max_count` int(11) NOT NULL DEFAULT '16' COMMENT '回调的最大执行次数',
  2602. `cb_trigger_interval` varchar(16) NOT NULL DEFAULT '' COMMENT '回调的最大执行次数',
  2603. `description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
  2604. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2605. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  2606. PRIMARY KEY (`id`) USING BTREE,
  2607. UNIQUE KEY `uk_namespace_id_group_name_scene_name` (`namespace_id`,`group_name`,`scene_name`) USING BTREE
  2608. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='场景配置';
  2609. -- ----------------------------
  2610. -- Table structure for sj_retry_summary
  2611. -- ----------------------------
  2612. DROP TABLE IF EXISTS `sj_retry_summary`;
  2613. CREATE TABLE `sj_retry_summary` (
  2614. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  2615. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  2616. `group_name` varchar(64) NOT NULL DEFAULT '' COMMENT '组名称',
  2617. `scene_name` varchar(50) NOT NULL DEFAULT '' COMMENT '场景名称',
  2618. `trigger_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '统计时间',
  2619. `running_num` int(11) NOT NULL DEFAULT '0' COMMENT '重试中-日志数量',
  2620. `finish_num` int(11) NOT NULL DEFAULT '0' COMMENT '重试完成-日志数量',
  2621. `max_count_num` int(11) NOT NULL DEFAULT '0' COMMENT '重试到达最大次数-日志数量',
  2622. `suspend_num` int(11) NOT NULL DEFAULT '0' COMMENT '暂停重试-日志数量',
  2623. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2624. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  2625. PRIMARY KEY (`id`) USING BTREE,
  2626. UNIQUE KEY `uk_scene_name_trigger_at` (`namespace_id`,`group_name`,`scene_name`,`trigger_at`) USING BTREE,
  2627. KEY `idx_trigger_at` (`trigger_at`) USING BTREE
  2628. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='DashBoard_Retry';
  2629. -- ----------------------------
  2630. -- Table structure for sj_retry_task
  2631. -- ----------------------------
  2632. DROP TABLE IF EXISTS `sj_retry_task`;
  2633. CREATE TABLE `sj_retry_task` (
  2634. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  2635. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  2636. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  2637. `scene_name` varchar(64) NOT NULL COMMENT '场景名称',
  2638. `retry_id` bigint(20) NOT NULL COMMENT '重试信息Id',
  2639. `ext_attrs` text NOT NULL COMMENT '扩展字段',
  2640. `task_status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '重试状态',
  2641. `task_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '任务类型 1、重试数据 2、回调数据',
  2642. `operation_reason` tinyint(4) NOT NULL DEFAULT '0' COMMENT '操作原因',
  2643. `client_info` varchar(128) DEFAULT NULL COMMENT '客户端地址 clientId#ip:port',
  2644. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2645. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  2646. PRIMARY KEY (`id`) USING BTREE,
  2647. KEY `idx_group_name_scene_name` (`namespace_id`,`group_name`,`scene_name`) USING BTREE,
  2648. KEY `task_status` (`task_status`) USING BTREE,
  2649. KEY `idx_create_dt` (`create_dt`) USING BTREE,
  2650. KEY `idx_retry_id` (`retry_id`) USING BTREE
  2651. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='重试任务表';
  2652. -- ----------------------------
  2653. -- Table structure for sj_retry_task_log_message
  2654. -- ----------------------------
  2655. DROP TABLE IF EXISTS `sj_retry_task_log_message`;
  2656. CREATE TABLE `sj_retry_task_log_message` (
  2657. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  2658. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  2659. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  2660. `retry_id` bigint(20) NOT NULL COMMENT '重试信息Id',
  2661. `retry_task_id` bigint(20) NOT NULL COMMENT '重试任务Id',
  2662. `message` longtext NOT NULL COMMENT '异常信息',
  2663. `log_num` int(11) NOT NULL DEFAULT '1' COMMENT '日志数量',
  2664. `real_time` bigint(13) NOT NULL DEFAULT '0' COMMENT '上报时间',
  2665. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2666. PRIMARY KEY (`id`) USING BTREE,
  2667. KEY `idx_namespace_id_group_name_retry_task_id` (`namespace_id`,`group_name`,`retry_task_id`) USING BTREE,
  2668. KEY `idx_create_dt` (`create_dt`) USING BTREE
  2669. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='任务调度日志信息记录表';
  2670. -- ----------------------------
  2671. -- Table structure for sj_sequence_alloc
  2672. -- ----------------------------
  2673. DROP TABLE IF EXISTS `sj_sequence_alloc`;
  2674. CREATE TABLE `sj_sequence_alloc` (
  2675. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  2676. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  2677. `group_name` varchar(64) NOT NULL DEFAULT '' COMMENT '组名称',
  2678. `max_id` bigint(20) NOT NULL DEFAULT '1' COMMENT '最大id',
  2679. `step` int(11) NOT NULL DEFAULT '100' COMMENT '步长',
  2680. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  2681. PRIMARY KEY (`id`) USING BTREE,
  2682. UNIQUE KEY `uk_namespace_id_group_name` (`namespace_id`,`group_name`) USING BTREE
  2683. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='号段模式序号ID分配表';
  2684. -- ----------------------------
  2685. -- Table structure for sj_server_node
  2686. -- ----------------------------
  2687. DROP TABLE IF EXISTS `sj_server_node`;
  2688. CREATE TABLE `sj_server_node` (
  2689. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  2690. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  2691. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  2692. `host_id` varchar(64) NOT NULL COMMENT '主机id',
  2693. `host_ip` varchar(64) NOT NULL COMMENT '机器ip',
  2694. `host_port` int(16) NOT NULL COMMENT '机器端口',
  2695. `expire_at` datetime NOT NULL COMMENT '过期时间',
  2696. `node_type` tinyint(4) NOT NULL COMMENT '节点类型 1、客户端 2、是服务端',
  2697. `ext_attrs` varchar(256) DEFAULT '' COMMENT '扩展字段',
  2698. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2699. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  2700. PRIMARY KEY (`id`) USING BTREE,
  2701. UNIQUE KEY `uk_host_id_host_ip` (`host_id`,`host_ip`) USING BTREE,
  2702. KEY `idx_namespace_id_group_name` (`namespace_id`,`group_name`) USING BTREE,
  2703. KEY `idx_expire_at_node_type` (`expire_at`,`node_type`) USING BTREE
  2704. ) ENGINE=InnoDB AUTO_INCREMENT=805 DEFAULT CHARSET=utf8mb4 COMMENT='服务器节点';
  2705. -- ----------------------------
  2706. -- Table structure for sj_system_user
  2707. -- ----------------------------
  2708. DROP TABLE IF EXISTS `sj_system_user`;
  2709. CREATE TABLE `sj_system_user` (
  2710. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  2711. `username` varchar(64) NOT NULL COMMENT '账号',
  2712. `password` varchar(128) NOT NULL COMMENT '密码',
  2713. `role` tinyint(4) NOT NULL DEFAULT '0' COMMENT '角色:1-普通用户、2-管理员',
  2714. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2715. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  2716. PRIMARY KEY (`id`) USING BTREE,
  2717. UNIQUE KEY `uk_username` (`username`) USING BTREE
  2718. ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='系统用户表';
  2719. -- ----------------------------
  2720. -- Table structure for sj_system_user_permission
  2721. -- ----------------------------
  2722. DROP TABLE IF EXISTS `sj_system_user_permission`;
  2723. CREATE TABLE `sj_system_user_permission` (
  2724. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  2725. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  2726. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  2727. `system_user_id` bigint(20) NOT NULL COMMENT '系统用户id',
  2728. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2729. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  2730. PRIMARY KEY (`id`) USING BTREE,
  2731. UNIQUE KEY `uk_namespace_id_group_name_system_user_id` (`namespace_id`,`group_name`,`system_user_id`) USING BTREE
  2732. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统用户权限表';
  2733. -- ----------------------------
  2734. -- Table structure for sj_workflow
  2735. -- ----------------------------
  2736. DROP TABLE IF EXISTS `sj_workflow`;
  2737. CREATE TABLE `sj_workflow` (
  2738. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  2739. `workflow_name` varchar(64) NOT NULL COMMENT '工作流名称',
  2740. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  2741. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  2742. `workflow_status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '工作流状态 0、关闭、1、开启',
  2743. `trigger_type` tinyint(4) NOT NULL COMMENT '触发类型 1.CRON 表达式 2. 固定时间',
  2744. `trigger_interval` varchar(255) NOT NULL COMMENT '间隔时长',
  2745. `next_trigger_at` bigint(20) NOT NULL COMMENT '下次触发时间',
  2746. `block_strategy` tinyint(4) NOT NULL DEFAULT '1' COMMENT '阻塞策略 1、丢弃 2、覆盖 3、并行',
  2747. `executor_timeout` int(11) NOT NULL DEFAULT '0' COMMENT '任务执行超时时间,单位秒',
  2748. `description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
  2749. `flow_info` text COMMENT '流程信息',
  2750. `wf_context` text COMMENT '上下文',
  2751. `notify_ids` varchar(128) NOT NULL DEFAULT '' COMMENT '通知告警场景配置id列表',
  2752. `bucket_index` int(11) NOT NULL DEFAULT '0' COMMENT 'bucket',
  2753. `version` int(11) NOT NULL COMMENT '版本号',
  2754. `ext_attrs` varchar(256) DEFAULT '' COMMENT '扩展字段',
  2755. `deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '逻辑删除 1、删除',
  2756. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2757. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  2758. PRIMARY KEY (`id`) USING BTREE,
  2759. KEY `idx_create_dt` (`create_dt`) USING BTREE,
  2760. KEY `idx_namespace_id_group_name` (`namespace_id`,`group_name`) USING BTREE
  2761. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='工作流';
  2762. -- ----------------------------
  2763. -- Table structure for sj_workflow_node
  2764. -- ----------------------------
  2765. DROP TABLE IF EXISTS `sj_workflow_node`;
  2766. CREATE TABLE `sj_workflow_node` (
  2767. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  2768. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  2769. `node_name` varchar(64) NOT NULL COMMENT '节点名称',
  2770. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  2771. `job_id` bigint(20) NOT NULL COMMENT '任务信息id',
  2772. `workflow_id` bigint(20) NOT NULL COMMENT '工作流ID',
  2773. `node_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '1、任务节点 2、条件节点',
  2774. `expression_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '1、SpEl、2、Aviator 3、QL',
  2775. `fail_strategy` tinyint(4) NOT NULL DEFAULT '1' COMMENT '失败策略 1、跳过 2、阻塞',
  2776. `workflow_node_status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '工作流节点状态 0、关闭、1、开启',
  2777. `priority_level` int(11) NOT NULL DEFAULT '1' COMMENT '优先级',
  2778. `node_info` text COMMENT '节点信息 ',
  2779. `version` int(11) NOT NULL COMMENT '版本号',
  2780. `ext_attrs` varchar(256) DEFAULT '' COMMENT '扩展字段',
  2781. `deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '逻辑删除 1、删除',
  2782. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2783. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  2784. PRIMARY KEY (`id`) USING BTREE,
  2785. KEY `idx_create_dt` (`create_dt`) USING BTREE,
  2786. KEY `idx_namespace_id_group_name` (`namespace_id`,`group_name`) USING BTREE
  2787. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='工作流节点';
  2788. -- ----------------------------
  2789. -- Table structure for sj_workflow_task_batch
  2790. -- ----------------------------
  2791. DROP TABLE IF EXISTS `sj_workflow_task_batch`;
  2792. CREATE TABLE `sj_workflow_task_batch` (
  2793. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  2794. `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
  2795. `group_name` varchar(64) NOT NULL COMMENT '组名称',
  2796. `workflow_id` bigint(20) NOT NULL COMMENT '工作流任务id',
  2797. `task_batch_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '任务批次状态 0、失败 1、成功',
  2798. `operation_reason` tinyint(4) NOT NULL DEFAULT '0' COMMENT '操作原因',
  2799. `flow_info` text COMMENT '流程信息',
  2800. `wf_context` text COMMENT '全局上下文',
  2801. `execution_at` bigint(13) NOT NULL DEFAULT '0' COMMENT '任务执行时间',
  2802. `ext_attrs` varchar(256) DEFAULT '' COMMENT '扩展字段',
  2803. `version` int(11) NOT NULL DEFAULT '1' COMMENT '版本号',
  2804. `deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '逻辑删除 1、删除',
  2805. `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2806. `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  2807. PRIMARY KEY (`id`) USING BTREE,
  2808. KEY `idx_job_id_task_batch_status` (`workflow_id`,`task_batch_status`) USING BTREE,
  2809. KEY `idx_create_dt` (`create_dt`) USING BTREE,
  2810. KEY `idx_namespace_id_group_name` (`namespace_id`,`group_name`) USING BTREE
  2811. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='工作流批次';
  2812. -- ----------------------------
  2813. -- Table structure for sys_bucket_access_password
  2814. -- ----------------------------
  2815. DROP TABLE IF EXISTS `sys_bucket_access_password`;
  2816. CREATE TABLE `sys_bucket_access_password` (
  2817. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  2818. `bucket_name` varchar(100) NOT NULL COMMENT 'bucket名称',
  2819. `access_password` varchar(255) NOT NULL COMMENT '访问密码(加密存储)',
  2820. `password_salt` varchar(100) NOT NULL COMMENT '密码盐值',
  2821. `is_active` tinyint(4) DEFAULT '1' COMMENT '是否启用(1启用 0禁用)',
  2822. `expire_time` datetime DEFAULT NULL COMMENT '密码过期时间',
  2823. `max_access_count` int(11) DEFAULT '0' COMMENT '最大访问次数(0表示无限制)',
  2824. `current_access_count` int(11) DEFAULT '0' COMMENT '当前访问次数',
  2825. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2826. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  2827. `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  2828. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  2829. `deleted` tinyint(4) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  2830. `tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
  2831. PRIMARY KEY (`id`) USING BTREE,
  2832. UNIQUE KEY `uk_bucket_name` (`bucket_name`) USING BTREE,
  2833. KEY `idx_bucket_access_password_bucket_name` (`bucket_name`) USING BTREE
  2834. ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='bucket访问密码表';
  2835. -- ----------------------------
  2836. -- Table structure for sys_bucket_access_record
  2837. -- ----------------------------
  2838. DROP TABLE IF EXISTS `sys_bucket_access_record`;
  2839. CREATE TABLE `sys_bucket_access_record` (
  2840. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  2841. `bucket_name` varchar(100) NOT NULL COMMENT 'bucket名称',
  2842. `access_password_id` bigint(20) NOT NULL COMMENT '访问密码ID',
  2843. `access_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '访问时间',
  2844. `access_ip` varchar(50) DEFAULT NULL COMMENT '访问IP',
  2845. `access_user_agent` varchar(500) DEFAULT NULL COMMENT '用户代理',
  2846. `access_result` tinyint(4) DEFAULT '1' COMMENT '访问结果(1成功 0失败)',
  2847. `fail_reason` varchar(500) DEFAULT NULL COMMENT '失败原因',
  2848. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2849. PRIMARY KEY (`id`) USING BTREE,
  2850. KEY `idx_bucket_access_record_bucket_name` (`bucket_name`) USING BTREE,
  2851. KEY `idx_bucket_access_record_access_time` (`access_time`) USING BTREE
  2852. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='bucket访问记录表';
  2853. -- ----------------------------
  2854. -- Table structure for sys_client
  2855. -- ----------------------------
  2856. DROP TABLE IF EXISTS `sys_client`;
  2857. CREATE TABLE `sys_client` (
  2858. `id` bigint(20) NOT NULL COMMENT 'id',
  2859. `client_id` varchar(64) DEFAULT NULL COMMENT '客户端id',
  2860. `client_key` varchar(32) DEFAULT NULL COMMENT '客户端key',
  2861. `client_secret` varchar(255) DEFAULT NULL COMMENT '客户端秘钥',
  2862. `grant_type` varchar(255) DEFAULT NULL COMMENT '授权类型',
  2863. `device_type` varchar(32) DEFAULT NULL COMMENT '设备类型',
  2864. `active_timeout` int(11) DEFAULT '1800' COMMENT 'token活跃超时时间',
  2865. `timeout` int(11) DEFAULT '604800' COMMENT 'token固定超时',
  2866. `status` char(1) DEFAULT '0' COMMENT '状态(0正常 1停用)',
  2867. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  2868. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  2869. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  2870. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  2871. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  2872. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  2873. PRIMARY KEY (`id`) USING BTREE
  2874. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统授权表';
  2875. -- ----------------------------
  2876. -- Table structure for sys_config
  2877. -- ----------------------------
  2878. DROP TABLE IF EXISTS `sys_config`;
  2879. CREATE TABLE `sys_config` (
  2880. `config_id` bigint(20) NOT NULL COMMENT '参数主键',
  2881. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  2882. `config_name` varchar(100) DEFAULT '' COMMENT '参数名称',
  2883. `config_key` varchar(100) DEFAULT '' COMMENT '参数键名',
  2884. `config_value` varchar(500) DEFAULT '' COMMENT '参数键值',
  2885. `config_type` char(1) DEFAULT 'N' COMMENT '系统内置(Y是 N否)',
  2886. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  2887. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  2888. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  2889. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  2890. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  2891. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  2892. PRIMARY KEY (`config_id`) USING BTREE
  2893. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='参数配置表';
  2894. -- ----------------------------
  2895. -- Table structure for sys_dept
  2896. -- ----------------------------
  2897. DROP TABLE IF EXISTS `sys_dept`;
  2898. CREATE TABLE `sys_dept` (
  2899. `dept_id` bigint(20) NOT NULL COMMENT '部门id',
  2900. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  2901. `parent_id` bigint(20) DEFAULT '0' COMMENT '父部门id',
  2902. `ancestors` varchar(500) DEFAULT '' COMMENT '祖级列表',
  2903. `dept_name` varchar(30) DEFAULT '' COMMENT '部门名称',
  2904. `dept_category` varchar(100) DEFAULT NULL COMMENT '部门类别编码',
  2905. `order_num` int(4) DEFAULT '0' COMMENT '显示顺序',
  2906. `leader` bigint(20) DEFAULT NULL COMMENT '负责人',
  2907. `phone` varchar(11) DEFAULT NULL COMMENT '联系电话',
  2908. `email` varchar(50) DEFAULT NULL COMMENT '邮箱',
  2909. `status` char(1) DEFAULT '0' COMMENT '部门状态(0正常 1停用)',
  2910. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  2911. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  2912. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  2913. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  2914. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  2915. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  2916. PRIMARY KEY (`dept_id`) USING BTREE
  2917. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='部门表';
  2918. -- ----------------------------
  2919. -- Table structure for sys_dict_data
  2920. -- ----------------------------
  2921. DROP TABLE IF EXISTS `sys_dict_data`;
  2922. CREATE TABLE `sys_dict_data` (
  2923. `dict_code` bigint(20) NOT NULL COMMENT '字典编码',
  2924. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  2925. `dict_sort` int(4) DEFAULT '0' COMMENT '字典排序',
  2926. `dict_label` varchar(100) DEFAULT '' COMMENT '字典标签',
  2927. `dict_value` varchar(100) DEFAULT '' COMMENT '字典键值',
  2928. `dict_type` varchar(100) DEFAULT '' COMMENT '字典类型',
  2929. `css_class` varchar(100) DEFAULT NULL COMMENT '样式属性(其他样式扩展)',
  2930. `list_class` varchar(100) DEFAULT NULL COMMENT '表格回显样式',
  2931. `is_default` char(1) DEFAULT 'N' COMMENT '是否默认(Y是 N否)',
  2932. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  2933. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  2934. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  2935. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  2936. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  2937. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  2938. PRIMARY KEY (`dict_code`) USING BTREE
  2939. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='字典数据表';
  2940. -- ----------------------------
  2941. -- Table structure for sys_dict_type
  2942. -- ----------------------------
  2943. DROP TABLE IF EXISTS `sys_dict_type`;
  2944. CREATE TABLE `sys_dict_type` (
  2945. `dict_id` bigint(20) NOT NULL COMMENT '字典主键',
  2946. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  2947. `dict_name` varchar(100) DEFAULT '' COMMENT '字典名称',
  2948. `dict_type` varchar(100) DEFAULT '' COMMENT '字典类型',
  2949. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  2950. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  2951. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  2952. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  2953. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  2954. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  2955. PRIMARY KEY (`dict_id`) USING BTREE,
  2956. UNIQUE KEY `tenant_id` (`tenant_id`,`dict_type`) USING BTREE
  2957. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='字典类型表';
  2958. -- ----------------------------
  2959. -- Table structure for sys_file_access_log
  2960. -- ----------------------------
  2961. DROP TABLE IF EXISTS `sys_file_access_log`;
  2962. CREATE TABLE `sys_file_access_log` (
  2963. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  2964. `oss_id` bigint(20) NOT NULL COMMENT '文件ID',
  2965. `user_id` bigint(20) NOT NULL COMMENT '访问用户ID',
  2966. `access_type` varchar(20) NOT NULL COMMENT '访问类型:DOWNLOAD, PREVIEW',
  2967. `access_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '访问时间',
  2968. `ip_address` varchar(50) DEFAULT NULL COMMENT '访问IP',
  2969. `user_agent` varchar(500) DEFAULT NULL COMMENT '用户代理',
  2970. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2971. PRIMARY KEY (`id`) USING BTREE,
  2972. KEY `idx_file_access_log_oss_id` (`oss_id`) USING BTREE,
  2973. KEY `idx_file_access_log_user_id` (`user_id`) USING BTREE,
  2974. KEY `idx_file_access_log_access_time` (`access_time`) USING BTREE
  2975. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='文件访问日志表';
  2976. -- ----------------------------
  2977. -- Table structure for sys_file_permission
  2978. -- ----------------------------
  2979. DROP TABLE IF EXISTS `sys_file_permission`;
  2980. CREATE TABLE `sys_file_permission` (
  2981. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  2982. `oss_id` bigint(20) NOT NULL COMMENT '文件ID',
  2983. `user_id` bigint(20) DEFAULT NULL COMMENT '用户ID(为空表示角色权限)',
  2984. `role_id` bigint(20) DEFAULT NULL COMMENT '角色ID(为空表示用户权限)',
  2985. `permission_type` varchar(20) NOT NULL COMMENT '权限类型:READ, WRITE, DELETE',
  2986. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2987. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  2988. `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  2989. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  2990. `deleted` tinyint(4) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  2991. `tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
  2992. PRIMARY KEY (`id`) USING BTREE,
  2993. KEY `idx_file_permission_oss_id` (`oss_id`) USING BTREE,
  2994. KEY `idx_file_permission_user_id` (`user_id`) USING BTREE,
  2995. KEY `idx_file_permission_role_id` (`role_id`) USING BTREE
  2996. ) ENGINE=InnoDB AUTO_INCREMENT=108 DEFAULT CHARSET=utf8mb4 COMMENT='文件权限表';
  2997. -- ----------------------------
  2998. -- Table structure for sys_logininfor
  2999. -- ----------------------------
  3000. DROP TABLE IF EXISTS `sys_logininfor`;
  3001. CREATE TABLE `sys_logininfor` (
  3002. `info_id` bigint(20) NOT NULL COMMENT '访问ID',
  3003. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  3004. `user_name` varchar(50) DEFAULT '' COMMENT '用户账号',
  3005. `client_key` varchar(32) DEFAULT '' COMMENT '客户端',
  3006. `device_type` varchar(32) DEFAULT '' COMMENT '设备类型',
  3007. `ipaddr` varchar(128) DEFAULT '' COMMENT '登录IP地址',
  3008. `login_location` varchar(255) DEFAULT '' COMMENT '登录地点',
  3009. `browser` varchar(50) DEFAULT '' COMMENT '浏览器类型',
  3010. `os` varchar(50) DEFAULT '' COMMENT '操作系统',
  3011. `status` char(1) DEFAULT '0' COMMENT '登录状态(0成功 1失败)',
  3012. `msg` varchar(255) DEFAULT '' COMMENT '提示消息',
  3013. `login_time` datetime DEFAULT NULL COMMENT '访问时间',
  3014. PRIMARY KEY (`info_id`) USING BTREE,
  3015. KEY `idx_sys_logininfor_s` (`status`) USING BTREE,
  3016. KEY `idx_sys_logininfor_lt` (`login_time`) USING BTREE
  3017. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统访问记录';
  3018. -- ----------------------------
  3019. -- Table structure for sys_menu
  3020. -- ----------------------------
  3021. DROP TABLE IF EXISTS `sys_menu`;
  3022. CREATE TABLE `sys_menu` (
  3023. `menu_id` bigint(20) NOT NULL COMMENT '菜单ID',
  3024. `menu_name` varchar(50) NOT NULL COMMENT '菜单名称',
  3025. `parent_id` bigint(20) DEFAULT '0' COMMENT '父菜单ID',
  3026. `order_num` int(4) DEFAULT '0' COMMENT '显示顺序',
  3027. `path` varchar(200) DEFAULT '' COMMENT '路由地址',
  3028. `component` varchar(255) DEFAULT NULL COMMENT '组件路径',
  3029. `query_param` varchar(255) DEFAULT NULL COMMENT '路由参数',
  3030. `is_frame` int(1) DEFAULT '1' COMMENT '是否为外链(0是 1否)',
  3031. `is_cache` int(1) DEFAULT '0' COMMENT '是否缓存(0缓存 1不缓存)',
  3032. `menu_type` char(1) DEFAULT '' COMMENT '菜单类型(M目录 C菜单 F按钮)',
  3033. `visible` char(1) DEFAULT '0' COMMENT '显示状态(0显示 1隐藏)',
  3034. `status` char(1) DEFAULT '0' COMMENT '菜单状态(0正常 1停用)',
  3035. `perms` varchar(100) DEFAULT NULL COMMENT '权限标识',
  3036. `icon` varchar(100) DEFAULT '#' COMMENT '菜单图标',
  3037. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3038. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3039. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3040. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3041. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3042. `remark` varchar(500) DEFAULT '' COMMENT '备注',
  3043. PRIMARY KEY (`menu_id`) USING BTREE
  3044. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='菜单权限表';
  3045. -- ----------------------------
  3046. -- Table structure for sys_menu_20251004
  3047. -- ----------------------------
  3048. DROP TABLE IF EXISTS `sys_menu_20251004`;
  3049. CREATE TABLE `sys_menu_20251004` (
  3050. `menu_id` bigint(20) NOT NULL COMMENT '菜单ID',
  3051. `menu_name` varchar(50) NOT NULL COMMENT '菜单名称',
  3052. `parent_id` bigint(20) DEFAULT '0' COMMENT '父菜单ID',
  3053. `order_num` int(4) DEFAULT '0' COMMENT '显示顺序',
  3054. `path` varchar(200) DEFAULT '' COMMENT '路由地址',
  3055. `component` varchar(255) DEFAULT NULL COMMENT '组件路径',
  3056. `query_param` varchar(255) DEFAULT NULL COMMENT '路由参数',
  3057. `is_frame` int(1) DEFAULT '1' COMMENT '是否为外链(0是 1否)',
  3058. `is_cache` int(1) DEFAULT '0' COMMENT '是否缓存(0缓存 1不缓存)',
  3059. `menu_type` char(1) DEFAULT '' COMMENT '菜单类型(M目录 C菜单 F按钮)',
  3060. `visible` char(1) DEFAULT '0' COMMENT '显示状态(0显示 1隐藏)',
  3061. `status` char(1) DEFAULT '0' COMMENT '菜单状态(0正常 1停用)',
  3062. `perms` varchar(100) DEFAULT NULL COMMENT '权限标识',
  3063. `icon` varchar(100) DEFAULT '#' COMMENT '菜单图标',
  3064. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3065. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3066. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3067. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3068. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3069. `remark` varchar(500) DEFAULT '' COMMENT '备注',
  3070. PRIMARY KEY (`menu_id`) USING BTREE
  3071. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='菜单权限表';
  3072. -- ----------------------------
  3073. -- Table structure for sys_menu_linshi
  3074. -- ----------------------------
  3075. DROP TABLE IF EXISTS `sys_menu_linshi`;
  3076. CREATE TABLE `sys_menu_linshi` (
  3077. `menu_id` bigint(20) NOT NULL COMMENT '菜单ID',
  3078. `menu_name` varchar(50) NOT NULL COMMENT '菜单名称',
  3079. `parent_id` bigint(20) DEFAULT '0' COMMENT '父菜单ID',
  3080. `order_num` int(4) DEFAULT '0' COMMENT '显示顺序',
  3081. `path` varchar(200) DEFAULT '' COMMENT '路由地址',
  3082. `component` varchar(255) DEFAULT NULL COMMENT '组件路径',
  3083. `query_param` varchar(255) DEFAULT NULL COMMENT '路由参数',
  3084. `is_frame` int(1) DEFAULT '1' COMMENT '是否为外链(0是 1否)',
  3085. `is_cache` int(1) DEFAULT '0' COMMENT '是否缓存(0缓存 1不缓存)',
  3086. `menu_type` char(1) DEFAULT '' COMMENT '菜单类型(M目录 C菜单 F按钮)',
  3087. `visible` char(1) DEFAULT '0' COMMENT '显示状态(0显示 1隐藏)',
  3088. `status` char(1) DEFAULT '0' COMMENT '菜单状态(0正常 1停用)',
  3089. `perms` varchar(100) DEFAULT NULL COMMENT '权限标识',
  3090. `icon` varchar(100) DEFAULT '#' COMMENT '菜单图标',
  3091. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3092. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3093. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3094. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3095. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3096. `remark` varchar(500) DEFAULT '' COMMENT '备注',
  3097. PRIMARY KEY (`menu_id`) USING BTREE
  3098. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='菜单权限表';
  3099. -- ----------------------------
  3100. -- Table structure for sys_notice
  3101. -- ----------------------------
  3102. DROP TABLE IF EXISTS `sys_notice`;
  3103. CREATE TABLE `sys_notice` (
  3104. `notice_id` bigint(20) NOT NULL COMMENT '公告ID',
  3105. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  3106. `notice_title` varchar(50) NOT NULL COMMENT '公告标题',
  3107. `notice_type` char(1) NOT NULL COMMENT '公告类型(1通知 2公告)',
  3108. `notice_content` longblob COMMENT '公告内容',
  3109. `status` char(1) DEFAULT '0' COMMENT '公告状态(0正常 1关闭)',
  3110. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3111. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3112. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3113. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3114. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3115. `remark` varchar(255) DEFAULT NULL COMMENT '备注',
  3116. PRIMARY KEY (`notice_id`) USING BTREE
  3117. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='通知公告表';
  3118. -- ----------------------------
  3119. -- Table structure for sys_oper_log
  3120. -- ----------------------------
  3121. DROP TABLE IF EXISTS `sys_oper_log`;
  3122. CREATE TABLE `sys_oper_log` (
  3123. `oper_id` bigint(20) NOT NULL COMMENT '日志主键',
  3124. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  3125. `title` varchar(50) DEFAULT '' COMMENT '模块标题',
  3126. `business_type` int(2) DEFAULT '0' COMMENT '业务类型(0其它 1新增 2修改 3删除)',
  3127. `method` varchar(100) DEFAULT '' COMMENT '方法名称',
  3128. `request_method` varchar(10) DEFAULT '' COMMENT '请求方式',
  3129. `operator_type` int(1) DEFAULT '0' COMMENT '操作类别(0其它 1后台用户 2手机端用户)',
  3130. `oper_name` varchar(50) DEFAULT '' COMMENT '操作人员',
  3131. `dept_name` varchar(50) DEFAULT '' COMMENT '部门名称',
  3132. `oper_url` varchar(255) DEFAULT '' COMMENT '请求URL',
  3133. `oper_ip` varchar(128) DEFAULT '' COMMENT '主机地址',
  3134. `oper_location` varchar(255) DEFAULT '' COMMENT '操作地点',
  3135. `oper_param` varchar(4000) DEFAULT '' COMMENT '请求参数',
  3136. `json_result` varchar(4000) DEFAULT '' COMMENT '返回参数',
  3137. `status` int(1) DEFAULT '0' COMMENT '操作状态(0正常 1异常)',
  3138. `error_msg` varchar(4000) DEFAULT '' COMMENT '错误消息',
  3139. `oper_time` datetime DEFAULT NULL COMMENT '操作时间',
  3140. `cost_time` bigint(20) DEFAULT '0' COMMENT '消耗时间',
  3141. PRIMARY KEY (`oper_id`) USING BTREE,
  3142. KEY `idx_sys_oper_log_bt` (`business_type`) USING BTREE,
  3143. KEY `idx_sys_oper_log_s` (`status`) USING BTREE,
  3144. KEY `idx_sys_oper_log_ot` (`oper_time`) USING BTREE
  3145. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='操作日志记录';
  3146. -- ----------------------------
  3147. -- Table structure for sys_oss
  3148. -- ----------------------------
  3149. DROP TABLE IF EXISTS `sys_oss`;
  3150. CREATE TABLE `sys_oss` (
  3151. `oss_id` bigint(20) NOT NULL COMMENT '对象存储主键',
  3152. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  3153. `file_name` varchar(255) NOT NULL DEFAULT '' COMMENT '文件名',
  3154. `original_name` varchar(255) NOT NULL DEFAULT '' COMMENT '原名',
  3155. `file_suffix` varchar(10) NOT NULL DEFAULT '' COMMENT '文件后缀名',
  3156. `url` varchar(500) NOT NULL COMMENT 'URL地址',
  3157. `ext1` text COMMENT '扩展字段',
  3158. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3159. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3160. `create_by` bigint(20) DEFAULT NULL COMMENT '上传人',
  3161. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3162. `update_by` bigint(20) DEFAULT NULL COMMENT '更新人',
  3163. `service` varchar(20) NOT NULL DEFAULT 'minio' COMMENT '服务商',
  3164. PRIMARY KEY (`oss_id`) USING BTREE
  3165. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='OSS对象存储表';
  3166. -- ----------------------------
  3167. -- Table structure for sys_oss_config
  3168. -- ----------------------------
  3169. DROP TABLE IF EXISTS `sys_oss_config`;
  3170. CREATE TABLE `sys_oss_config` (
  3171. `oss_config_id` bigint(20) NOT NULL COMMENT '主键',
  3172. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  3173. `config_key` varchar(20) NOT NULL DEFAULT '' COMMENT '配置key',
  3174. `access_key` varchar(255) DEFAULT '' COMMENT 'accessKey',
  3175. `secret_key` varchar(255) DEFAULT '' COMMENT '秘钥',
  3176. `bucket_name` varchar(255) DEFAULT '' COMMENT '桶名称',
  3177. `prefix` varchar(255) DEFAULT '' COMMENT '前缀',
  3178. `endpoint` varchar(255) DEFAULT '' COMMENT '访问站点',
  3179. `domain` varchar(255) DEFAULT '' COMMENT '自定义域名',
  3180. `is_https` char(1) DEFAULT 'N' COMMENT '是否https(Y=是,N=否)',
  3181. `region` varchar(255) DEFAULT '' COMMENT '域',
  3182. `access_policy` char(1) NOT NULL DEFAULT '1' COMMENT '桶权限类型(0=private 1=public 2=custom)',
  3183. `status` char(1) DEFAULT '1' COMMENT '是否默认(0=是,1=否)',
  3184. `ext1` varchar(255) DEFAULT '' COMMENT '扩展字段',
  3185. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3186. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3187. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3188. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3189. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3190. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  3191. PRIMARY KEY (`oss_config_id`) USING BTREE
  3192. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='对象存储配置表';
  3193. -- ----------------------------
  3194. -- Table structure for sys_post
  3195. -- ----------------------------
  3196. DROP TABLE IF EXISTS `sys_post`;
  3197. CREATE TABLE `sys_post` (
  3198. `post_id` bigint(20) NOT NULL COMMENT '岗位ID',
  3199. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  3200. `dept_id` bigint(20) NOT NULL COMMENT '部门id',
  3201. `post_code` varchar(64) NOT NULL COMMENT '岗位编码',
  3202. `post_category` varchar(100) DEFAULT NULL COMMENT '岗位类别编码',
  3203. `post_name` varchar(50) NOT NULL COMMENT '岗位名称',
  3204. `post_sort` int(4) NOT NULL COMMENT '显示顺序',
  3205. `status` char(1) NOT NULL COMMENT '状态(0正常 1停用)',
  3206. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3207. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3208. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3209. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3210. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3211. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  3212. PRIMARY KEY (`post_id`) USING BTREE
  3213. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='岗位信息表';
  3214. -- ----------------------------
  3215. -- Table structure for sys_region
  3216. -- ----------------------------
  3217. DROP TABLE IF EXISTS `sys_region`;
  3218. CREATE TABLE `sys_region` (
  3219. `id` bigint(20) NOT NULL COMMENT '主键ID',
  3220. `code` varchar(20) NOT NULL COMMENT '行政区划编码',
  3221. `name` varchar(50) NOT NULL COMMENT '行政区划名称',
  3222. `short_name` varchar(30) DEFAULT NULL COMMENT '行政区划简称',
  3223. `parent_code` bigint(20) DEFAULT '0' COMMENT '父级行政区划编码,顶级为0',
  3224. `level` tinyint(1) NOT NULL COMMENT '层级(1:省,2:市,3:区/县,4:街道/镇)',
  3225. `sort` int(11) DEFAULT '0' COMMENT '排序',
  3226. `status` char(1) DEFAULT '0' COMMENT '状态(0正常 1停用)',
  3227. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  3228. `longitude` decimal(10,7) DEFAULT NULL COMMENT '经度',
  3229. `latitude` decimal(10,7) DEFAULT NULL COMMENT '纬度',
  3230. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3231. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3232. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3233. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3234. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3235. `deleted` tinyint(1) DEFAULT '0' COMMENT '逻辑删除标识(0未删除 1已删除)',
  3236. `tenant_id` bigint(20) DEFAULT NULL COMMENT '租户ID',
  3237. PRIMARY KEY (`id`) USING BTREE,
  3238. UNIQUE KEY `idx_region_code` (`code`,`deleted`,`tenant_id`) USING BTREE,
  3239. KEY `idx_region_parent_code` (`parent_code`) USING BTREE
  3240. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='行政区划表';
  3241. -- ----------------------------
  3242. -- Table structure for sys_role
  3243. -- ----------------------------
  3244. DROP TABLE IF EXISTS `sys_role`;
  3245. CREATE TABLE `sys_role` (
  3246. `role_id` bigint(20) NOT NULL COMMENT '角色ID',
  3247. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  3248. `role_name` varchar(30) NOT NULL COMMENT '角色名称',
  3249. `role_key` varchar(100) NOT NULL COMMENT '角色权限字符串',
  3250. `role_sort` int(4) NOT NULL COMMENT '显示顺序',
  3251. `data_scope` char(1) DEFAULT '1' COMMENT '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限 5:仅本人数据权限 6:部门及以下或本人数据权限)',
  3252. `menu_check_strictly` tinyint(1) DEFAULT '1' COMMENT '菜单树选择项是否关联显示',
  3253. `dept_check_strictly` tinyint(1) DEFAULT '1' COMMENT '部门树选择项是否关联显示',
  3254. `status` char(1) NOT NULL COMMENT '角色状态(0正常 1停用)',
  3255. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  3256. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3257. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3258. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3259. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3260. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3261. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  3262. PRIMARY KEY (`role_id`) USING BTREE
  3263. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色信息表';
  3264. -- ----------------------------
  3265. -- Table structure for sys_role_dept
  3266. -- ----------------------------
  3267. DROP TABLE IF EXISTS `sys_role_dept`;
  3268. CREATE TABLE `sys_role_dept` (
  3269. `role_id` bigint(20) NOT NULL COMMENT '角色ID',
  3270. `dept_id` bigint(20) NOT NULL COMMENT '部门ID',
  3271. PRIMARY KEY (`role_id`,`dept_id`) USING BTREE
  3272. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色和部门关联表';
  3273. -- ----------------------------
  3274. -- Table structure for sys_role_menu
  3275. -- ----------------------------
  3276. DROP TABLE IF EXISTS `sys_role_menu`;
  3277. CREATE TABLE `sys_role_menu` (
  3278. `role_id` bigint(20) NOT NULL COMMENT '角色ID',
  3279. `menu_id` bigint(20) NOT NULL COMMENT '菜单ID',
  3280. PRIMARY KEY (`role_id`,`menu_id`) USING BTREE
  3281. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色和菜单关联表';
  3282. -- ----------------------------
  3283. -- Table structure for sys_social
  3284. -- ----------------------------
  3285. DROP TABLE IF EXISTS `sys_social`;
  3286. CREATE TABLE `sys_social` (
  3287. `id` bigint(20) NOT NULL COMMENT '主键',
  3288. `user_id` bigint(20) NOT NULL COMMENT '用户ID',
  3289. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户id',
  3290. `auth_id` varchar(255) NOT NULL COMMENT '平台+平台唯一id',
  3291. `source` varchar(255) NOT NULL COMMENT '用户来源',
  3292. `open_id` varchar(255) DEFAULT NULL COMMENT '平台编号唯一id',
  3293. `user_name` varchar(30) NOT NULL COMMENT '登录账号',
  3294. `nick_name` varchar(30) DEFAULT '' COMMENT '用户昵称',
  3295. `email` varchar(255) DEFAULT '' COMMENT '用户邮箱',
  3296. `avatar` varchar(500) DEFAULT '' COMMENT '头像地址',
  3297. `access_token` varchar(2000) NOT NULL COMMENT '用户的授权令牌',
  3298. `expire_in` int(11) DEFAULT NULL COMMENT '用户的授权令牌的有效期,部分平台可能没有',
  3299. `refresh_token` varchar(255) DEFAULT NULL COMMENT '刷新令牌,部分平台可能没有',
  3300. `access_code` varchar(2000) DEFAULT NULL COMMENT '平台的授权信息,部分平台可能没有',
  3301. `union_id` varchar(255) DEFAULT NULL COMMENT '用户的 unionid',
  3302. `scope` varchar(255) DEFAULT NULL COMMENT '授予的权限,部分平台可能没有',
  3303. `token_type` varchar(255) DEFAULT NULL COMMENT '个别平台的授权信息,部分平台可能没有',
  3304. `id_token` varchar(2000) DEFAULT NULL COMMENT 'id token,部分平台可能没有',
  3305. `mac_algorithm` varchar(255) DEFAULT NULL COMMENT '小米平台用户的附带属性,部分平台可能没有',
  3306. `mac_key` varchar(255) DEFAULT NULL COMMENT '小米平台用户的附带属性,部分平台可能没有',
  3307. `code` varchar(255) DEFAULT NULL COMMENT '用户的授权code,部分平台可能没有',
  3308. `oauth_token` varchar(255) DEFAULT NULL COMMENT 'Twitter平台用户的附带属性,部分平台可能没有',
  3309. `oauth_token_secret` varchar(255) DEFAULT NULL COMMENT 'Twitter平台用户的附带属性,部分平台可能没有',
  3310. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3311. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3312. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3313. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3314. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3315. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  3316. PRIMARY KEY (`id`) USING BTREE
  3317. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='社会化关系表';
  3318. -- ----------------------------
  3319. -- Table structure for sys_tenant
  3320. -- ----------------------------
  3321. DROP TABLE IF EXISTS `sys_tenant`;
  3322. CREATE TABLE `sys_tenant` (
  3323. `id` bigint(20) NOT NULL COMMENT 'id',
  3324. `tenant_id` varchar(20) NOT NULL COMMENT '租户编号',
  3325. `contact_user_name` varchar(20) DEFAULT NULL COMMENT '联系人',
  3326. `contact_phone` varchar(20) DEFAULT NULL COMMENT '联系电话',
  3327. `company_name` varchar(30) DEFAULT NULL COMMENT '企业名称',
  3328. `license_number` varchar(30) DEFAULT NULL COMMENT '统一社会信用代码',
  3329. `address` varchar(200) DEFAULT NULL COMMENT '地址',
  3330. `intro` varchar(200) DEFAULT NULL COMMENT '企业简介',
  3331. `domain` varchar(200) DEFAULT NULL COMMENT '域名',
  3332. `remark` varchar(200) DEFAULT NULL COMMENT '备注',
  3333. `package_id` bigint(20) DEFAULT NULL COMMENT '租户套餐编号',
  3334. `expire_time` datetime DEFAULT NULL COMMENT '过期时间',
  3335. `account_count` int(11) DEFAULT '-1' COMMENT '用户数量(-1不限制)',
  3336. `status` char(1) DEFAULT '0' COMMENT '租户状态(0正常 1停用)',
  3337. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  3338. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3339. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3340. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3341. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3342. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3343. PRIMARY KEY (`id`) USING BTREE
  3344. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='租户表';
  3345. -- ----------------------------
  3346. -- Table structure for sys_tenant_package
  3347. -- ----------------------------
  3348. DROP TABLE IF EXISTS `sys_tenant_package`;
  3349. CREATE TABLE `sys_tenant_package` (
  3350. `package_id` bigint(20) NOT NULL COMMENT '租户套餐id',
  3351. `package_name` varchar(20) DEFAULT NULL COMMENT '套餐名称',
  3352. `menu_ids` varchar(3000) DEFAULT NULL COMMENT '关联菜单id',
  3353. `remark` varchar(200) DEFAULT NULL COMMENT '备注',
  3354. `menu_check_strictly` tinyint(1) DEFAULT '1' COMMENT '菜单树选择项是否关联显示',
  3355. `status` char(1) DEFAULT '0' COMMENT '状态(0正常 1停用)',
  3356. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  3357. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3358. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3359. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3360. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3361. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3362. PRIMARY KEY (`package_id`) USING BTREE
  3363. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='租户套餐表';
  3364. -- ----------------------------
  3365. -- Table structure for sys_user
  3366. -- ----------------------------
  3367. DROP TABLE IF EXISTS `sys_user`;
  3368. CREATE TABLE `sys_user` (
  3369. `user_id` bigint(20) NOT NULL COMMENT '用户ID',
  3370. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  3371. `dept_id` bigint(20) DEFAULT NULL COMMENT '部门ID',
  3372. `user_name` varchar(30) NOT NULL COMMENT '用户账号',
  3373. `nick_name` varchar(30) NOT NULL COMMENT '用户昵称',
  3374. `user_type` varchar(10) DEFAULT 'sys_user' COMMENT '用户类型(sys_user系统用户)',
  3375. `email` varchar(50) DEFAULT '' COMMENT '用户邮箱',
  3376. `phonenumber` varchar(11) DEFAULT '' COMMENT '手机号码',
  3377. `sex` char(1) DEFAULT '0' COMMENT '用户性别(0男 1女 2未知)',
  3378. `avatar` bigint(20) DEFAULT NULL COMMENT '头像地址',
  3379. `password` varchar(100) DEFAULT '' COMMENT '密码',
  3380. `status` char(1) DEFAULT '0' COMMENT '帐号状态(0正常 1停用)',
  3381. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  3382. `login_ip` varchar(128) DEFAULT '' COMMENT '最后登录IP',
  3383. `login_date` datetime DEFAULT NULL COMMENT '最后登录时间',
  3384. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3385. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3386. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3387. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3388. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3389. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  3390. `account_type` varchar(255) DEFAULT '1' COMMENT '账户类型 1 - 教职工 2- 学生',
  3391. PRIMARY KEY (`user_id`) USING BTREE
  3392. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户信息表';
  3393. -- ----------------------------
  3394. -- Table structure for sys_user_post
  3395. -- ----------------------------
  3396. DROP TABLE IF EXISTS `sys_user_post`;
  3397. CREATE TABLE `sys_user_post` (
  3398. `user_id` bigint(20) NOT NULL COMMENT '用户ID',
  3399. `post_id` bigint(20) NOT NULL COMMENT '岗位ID',
  3400. PRIMARY KEY (`user_id`,`post_id`) USING BTREE
  3401. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户与岗位关联表';
  3402. -- ----------------------------
  3403. -- Table structure for sys_user_role
  3404. -- ----------------------------
  3405. DROP TABLE IF EXISTS `sys_user_role`;
  3406. CREATE TABLE `sys_user_role` (
  3407. `user_id` bigint(20) NOT NULL COMMENT '用户ID',
  3408. `role_id` bigint(20) NOT NULL COMMENT '角色ID',
  3409. PRIMARY KEY (`user_id`,`role_id`) USING BTREE
  3410. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户和角色关联表';
  3411. -- ----------------------------
  3412. -- Table structure for sys_wechat_config
  3413. -- ----------------------------
  3414. DROP TABLE IF EXISTS `sys_wechat_config`;
  3415. CREATE TABLE `sys_wechat_config` (
  3416. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '参数主键',
  3417. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  3418. `config_name` varchar(100) DEFAULT '' COMMENT '参数名称',
  3419. `config_key` varchar(100) DEFAULT '' COMMENT '参数键名',
  3420. `config_value` varchar(500) DEFAULT '' COMMENT '参数键值',
  3421. `config_type` char(1) DEFAULT 'N' COMMENT '系统内置(Y是 N否)',
  3422. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3423. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3424. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3425. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3426. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3427. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  3428. PRIMARY KEY (`id`) USING BTREE
  3429. ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COMMENT='参数配置表';
  3430. -- ----------------------------
  3431. -- Table structure for test_demo
  3432. -- ----------------------------
  3433. DROP TABLE IF EXISTS `test_demo`;
  3434. CREATE TABLE `test_demo` (
  3435. `id` bigint(20) NOT NULL COMMENT '主键',
  3436. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  3437. `dept_id` bigint(20) DEFAULT NULL COMMENT '部门id',
  3438. `user_id` bigint(20) DEFAULT NULL COMMENT '用户id',
  3439. `order_num` int(11) DEFAULT '0' COMMENT '排序号',
  3440. `test_key` varchar(255) DEFAULT NULL COMMENT 'key键',
  3441. `value` varchar(255) DEFAULT NULL COMMENT '值',
  3442. `version` int(11) DEFAULT '0' COMMENT '版本',
  3443. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3444. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3445. `create_by` bigint(20) DEFAULT NULL COMMENT '创建人',
  3446. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3447. `update_by` bigint(20) DEFAULT NULL COMMENT '更新人',
  3448. `del_flag` int(11) DEFAULT '0' COMMENT '删除标志',
  3449. PRIMARY KEY (`id`) USING BTREE
  3450. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='测试单表';
  3451. -- ----------------------------
  3452. -- Table structure for test_leave
  3453. -- ----------------------------
  3454. DROP TABLE IF EXISTS `test_leave`;
  3455. CREATE TABLE `test_leave` (
  3456. `id` bigint(20) NOT NULL COMMENT 'id',
  3457. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  3458. `leave_type` varchar(255) NOT NULL COMMENT '请假类型',
  3459. `start_date` datetime NOT NULL COMMENT '开始时间',
  3460. `end_date` datetime NOT NULL COMMENT '结束时间',
  3461. `leave_days` int(10) NOT NULL COMMENT '请假天数',
  3462. `remark` varchar(255) DEFAULT NULL COMMENT '请假原因',
  3463. `status` varchar(255) DEFAULT NULL COMMENT '状态',
  3464. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3465. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3466. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3467. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3468. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3469. PRIMARY KEY (`id`) USING BTREE
  3470. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='请假申请表';
  3471. -- ----------------------------
  3472. -- Table structure for test_tree
  3473. -- ----------------------------
  3474. DROP TABLE IF EXISTS `test_tree`;
  3475. CREATE TABLE `test_tree` (
  3476. `id` bigint(20) NOT NULL COMMENT '主键',
  3477. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  3478. `parent_id` bigint(20) DEFAULT '0' COMMENT '父id',
  3479. `dept_id` bigint(20) DEFAULT NULL COMMENT '部门id',
  3480. `user_id` bigint(20) DEFAULT NULL COMMENT '用户id',
  3481. `tree_name` varchar(255) DEFAULT NULL COMMENT '值',
  3482. `version` int(11) DEFAULT '0' COMMENT '版本',
  3483. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3484. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3485. `create_by` bigint(20) DEFAULT NULL COMMENT '创建人',
  3486. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3487. `update_by` bigint(20) DEFAULT NULL COMMENT '更新人',
  3488. `del_flag` int(11) DEFAULT '0' COMMENT '删除标志',
  3489. PRIMARY KEY (`id`) USING BTREE
  3490. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='测试树表';
  3491. -- ----------------------------
  3492. -- Table structure for xg_class_msg
  3493. -- ----------------------------
  3494. DROP TABLE IF EXISTS `xg_class_msg`;
  3495. CREATE TABLE `xg_class_msg` (
  3496. `id` bigint(20) NOT NULL COMMENT '主键ID(雪花ID)',
  3497. `tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
  3498. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3499. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3500. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3501. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3502. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3503. `deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  3504. `college_id` bigint(20) DEFAULT NULL COMMENT '学院代码',
  3505. `college_name` varchar(100) DEFAULT NULL COMMENT '学院名称',
  3506. `major_id` bigint(20) DEFAULT NULL COMMENT '专业代码',
  3507. `major_name` varchar(100) DEFAULT NULL COMMENT '专业名称',
  3508. `class_code` varchar(32) NOT NULL COMMENT '班级代码',
  3509. `class_name` varchar(100) NOT NULL COMMENT '班级名称',
  3510. `class_type` varchar(20) DEFAULT '1' COMMENT '班级类型:1-中级工 2-高级工 3-预备技师 4-技师 5-中高职一体',
  3511. `grade` varchar(10) NOT NULL COMMENT '年级',
  3512. `enrollment_year` int(4) NOT NULL COMMENT '入学年份',
  3513. `graduation_year` int(4) DEFAULT NULL COMMENT '毕业年份',
  3514. `training_type` varchar(20) DEFAULT NULL COMMENT '培养方式:全日制,在职,函授,夜大等',
  3515. `degree_type` varchar(20) DEFAULT NULL COMMENT '学位类型:学士,硕士,博士,专科',
  3516. `counselor_id` bigint(20) DEFAULT NULL COMMENT '辅导员ID',
  3517. `counselor_name` varchar(50) DEFAULT NULL COMMENT '辅导员姓名',
  3518. `class_teacher_id` bigint(20) DEFAULT NULL COMMENT '班主任ID',
  3519. `class_teacher_name` varchar(50) DEFAULT NULL COMMENT '班主任姓名',
  3520. `class_advisor_id` bigint(20) DEFAULT NULL COMMENT '班级导师ID',
  3521. `class_advisor_name` varchar(50) DEFAULT NULL COMMENT '班级导师姓名',
  3522. `class_monitor_id` bigint(20) DEFAULT NULL COMMENT '班长ID',
  3523. `class_monitor_name` varchar(50) DEFAULT NULL COMMENT '班长姓名',
  3524. `deputy_monitor_id` bigint(20) DEFAULT NULL COMMENT '副班长ID',
  3525. `deputy_monitor_name` varchar(50) DEFAULT NULL COMMENT '副班长姓名',
  3526. `class_status` char(1) DEFAULT '1' COMMENT '班级状态:1-正常,2-暂停,3-毕业,4-解散',
  3527. `is_graduation` tinyint(1) DEFAULT '0' COMMENT '是否已毕业:0-未毕业,1-已毕业',
  3528. `graduation_date` date DEFAULT NULL COMMENT '毕业日期',
  3529. `planned_capacity` int(11) DEFAULT '50' COMMENT '计划容量',
  3530. `current_student_count` int(11) DEFAULT '0' COMMENT '当前学生人数',
  3531. `max_student_count` int(11) DEFAULT '50' COMMENT '最大学生人数',
  3532. `male_count` int(11) DEFAULT '0' COMMENT '男生人数',
  3533. `female_count` int(11) DEFAULT '0' COMMENT '女生人数',
  3534. `active_count` int(11) DEFAULT '0' COMMENT '在籍人数',
  3535. `transfer_in_count` int(11) DEFAULT '0' COMMENT '转入人数',
  3536. `transfer_out_count` int(11) DEFAULT '0' COMMENT '转出人数',
  3537. `dropout_count` int(11) DEFAULT '0' COMMENT '退学人数',
  3538. `graduate_count` int(11) DEFAULT '0' COMMENT '毕业人数',
  3539. `office_location` varchar(200) DEFAULT NULL COMMENT '班级办公室位置',
  3540. `class_location` varchar(100) DEFAULT NULL COMMENT '班级教室位置',
  3541. `contact_phone` varchar(20) DEFAULT NULL COMMENT '联系电话',
  3542. `qq_group` varchar(20) DEFAULT NULL COMMENT 'QQ群号',
  3543. `wechat_group` varchar(100) DEFAULT NULL COMMENT '微信群',
  3544. `email` varchar(100) DEFAULT NULL COMMENT '班级邮箱',
  3545. `class_schedule` text COMMENT '课程安排(JSON格式)',
  3546. `class_culture` text COMMENT '班级文化建设',
  3547. `class_rules` text COMMENT '班级规章制度',
  3548. `class_description` varchar(500) DEFAULT NULL COMMENT '班级描述',
  3549. `last_count_update` datetime DEFAULT NULL COMMENT '最后统计更新时间',
  3550. `ext_field1` varchar(200) DEFAULT NULL COMMENT '扩展字段1',
  3551. `ext_field2` varchar(200) DEFAULT NULL COMMENT '扩展字段2',
  3552. `ext_field3` varchar(200) DEFAULT NULL COMMENT '扩展字段3',
  3553. `remark` varchar(500) DEFAULT NULL COMMENT '备注信息',
  3554. `school_system` int(11) DEFAULT '4' COMMENT '学制(年)',
  3555. PRIMARY KEY (`id`) USING BTREE,
  3556. KEY `uk_class_code_tenant` (`class_code`,`tenant_id`) USING BTREE,
  3557. KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
  3558. KEY `idx_deleted` (`deleted`) USING BTREE,
  3559. KEY `idx_college_id` (`college_id`) USING BTREE,
  3560. KEY `idx_enrollment_year` (`enrollment_year`) USING BTREE,
  3561. KEY `idx_grade` (`grade`) USING BTREE,
  3562. KEY `idx_major_id` (`major_id`) USING BTREE,
  3563. KEY `idx_counselor_id` (`counselor_id`) USING BTREE,
  3564. KEY `idx_class_teacher_id` (`class_teacher_id`) USING BTREE,
  3565. KEY `idx_class_status` (`class_status`) USING BTREE,
  3566. KEY `idx_college_grade` (`college_id`,`grade`) USING BTREE
  3567. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='班级信息表-新版';
  3568. -- ----------------------------
  3569. -- Table structure for xg_class_pos_dict
  3570. -- ----------------------------
  3571. DROP TABLE IF EXISTS `xg_class_pos_dict`;
  3572. CREATE TABLE `xg_class_pos_dict` (
  3573. `id` bigint(20) NOT NULL COMMENT '主键ID(雪花ID)',
  3574. `tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
  3575. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3576. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3577. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3578. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3579. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3580. `deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  3581. `position_code` varchar(20) NOT NULL COMMENT '职务编码',
  3582. `position_name` varchar(50) NOT NULL COMMENT '职务名称',
  3583. `position_category` varchar(20) DEFAULT 'class' COMMENT '学生职务类别:class-班级干部,party-党团干部,other-其他',
  3584. `position_level` tinyint(1) NOT NULL DEFAULT '9' COMMENT '学生职务级别:1-班长,2-副班长,3-委员,9-普通成员',
  3585. `position_type` varchar(20) DEFAULT 'regular' COMMENT '学生职务类型:regular-常规职务,special-特殊职务,temporary-临时职务',
  3586. `responsibilities` text COMMENT '职责描述',
  3587. `status` char(1) DEFAULT '1' COMMENT '状态:0-启用,1-停用',
  3588. `sort_order` int(11) DEFAULT '0' COMMENT '排序顺序',
  3589. `remark` varchar(500) DEFAULT NULL COMMENT '备注信息',
  3590. PRIMARY KEY (`id`) USING BTREE,
  3591. KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
  3592. KEY `idx_deleted` (`deleted`) USING BTREE,
  3593. KEY `idx_position_level` (`position_level`) USING BTREE,
  3594. KEY `idx_position_category` (`position_category`) USING BTREE,
  3595. KEY `idx_dict_status` (`status`) USING BTREE,
  3596. KEY `idx_sort_order` (`sort_order`) USING BTREE,
  3597. KEY `idx_position_type` (`position_type`) USING BTREE,
  3598. KEY `uk_position_code_tenant` (`position_code`,`tenant_id`) USING BTREE
  3599. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='班级干部职务字典表';
  3600. -- ----------------------------
  3601. -- Table structure for xg_class_pos_msg
  3602. -- ----------------------------
  3603. DROP TABLE IF EXISTS `xg_class_pos_msg`;
  3604. CREATE TABLE `xg_class_pos_msg` (
  3605. `id` bigint(20) NOT NULL COMMENT '主键ID(雪花ID)',
  3606. `tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
  3607. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3608. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3609. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3610. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3611. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3612. `deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  3613. `class_id` bigint(20) NOT NULL COMMENT '班级ID,关联xg_class_msg.id',
  3614. `student_id` bigint(20) NOT NULL COMMENT '学生ID,关联xg_student_msg.id',
  3615. `student_no` varchar(32) NOT NULL COMMENT '学号',
  3616. `student_name` varchar(50) NOT NULL COMMENT '学生姓名(冗余字段)',
  3617. `position_id` bigint(20) NOT NULL COMMENT '职务编码,关联xg_class_pos_dict.id',
  3618. `position_code` varchar(20) NOT NULL COMMENT '职务编码,关联xg_class_pos_dict.position_code',
  3619. `appointment_date` date NOT NULL COMMENT '任职日期',
  3620. `term_start_date` date NOT NULL COMMENT '任期开始日期',
  3621. `term_end_date` date DEFAULT NULL COMMENT '任期结束日期',
  3622. `term_duration` int(11) DEFAULT '12' COMMENT '任期时长(月)',
  3623. `is_current` tinyint(1) DEFAULT '1' COMMENT '是否现任:0-否,1-是',
  3624. `cadre_status` char(1) DEFAULT '1' COMMENT '学生职务任职状态:1-在任,2-到期,3-辞职,4-免职,5-调任,6-休学',
  3625. `appointment_reason` varchar(200) DEFAULT NULL COMMENT '任命原因',
  3626. `appointment_method` varchar(20) DEFAULT 'appointment' COMMENT '学生职务任命方式:appointment-任命,election-选举,recommendation-推荐',
  3627. `dismissal_date` date DEFAULT NULL COMMENT '离任日期',
  3628. `dismissal_reason` varchar(200) DEFAULT NULL COMMENT '离任原因',
  3629. `remark` varchar(500) DEFAULT NULL COMMENT '备注信息',
  3630. PRIMARY KEY (`id`) USING BTREE,
  3631. KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
  3632. KEY `idx_deleted` (`deleted`) USING BTREE,
  3633. KEY `idx_class_id` (`class_id`) USING BTREE,
  3634. KEY `idx_student_id` (`student_id`) USING BTREE,
  3635. KEY `idx_position_code` (`position_code`) USING BTREE,
  3636. KEY `idx_cadre_status` (`cadre_status`) USING BTREE,
  3637. KEY `idx_is_current` (`is_current`) USING BTREE,
  3638. KEY `idx_appointment_date` (`appointment_date`) USING BTREE,
  3639. KEY `idx_term_dates` (`term_start_date`,`term_end_date`) USING BTREE,
  3640. KEY `idx_class_position` (`class_id`,`position_code`,`is_current`) USING BTREE,
  3641. KEY `idx_student_cadre` (`student_id`,`is_current`,`cadre_status`) USING BTREE,
  3642. KEY `uk_class_student_position` (`class_id`,`student_id`,`position_code`,`tenant_id`) USING BTREE
  3643. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='班级干部信息表';
  3644. -- ----------------------------
  3645. -- Table structure for xg_class_teacher_counselor_rel
  3646. -- ----------------------------
  3647. DROP TABLE IF EXISTS `xg_class_teacher_counselor_rel`;
  3648. CREATE TABLE `xg_class_teacher_counselor_rel` (
  3649. `id` bigint(20) NOT NULL COMMENT '主键ID(雪花ID)',
  3650. `tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
  3651. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3652. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3653. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3654. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3655. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3656. `deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  3657. `class_id` bigint(20) NOT NULL COMMENT '班级ID,关联xg_class_msg.id',
  3658. `class_name` varchar(100) DEFAULT NULL COMMENT '班级名称',
  3659. `teacher_id` bigint(20) NOT NULL COMMENT '教师ID,关联sys_user.user_id',
  3660. `teacher_name` varchar(50) DEFAULT NULL COMMENT '教师姓名',
  3661. `teacher_type` varchar(20) NOT NULL COMMENT '教师类型:class_teacher-班主任,counselor-辅导员,advisor-导师',
  3662. `start_date` datetime NOT NULL COMMENT '开始日期',
  3663. `end_date` datetime DEFAULT NULL COMMENT '结束日期',
  3664. `remark` varchar(500) DEFAULT NULL COMMENT '备注信息',
  3665. PRIMARY KEY (`id`) USING BTREE,
  3666. KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
  3667. KEY `idx_deleted` (`deleted`) USING BTREE,
  3668. KEY `idx_class_id` (`class_id`) USING BTREE,
  3669. KEY `idx_teacher_id` (`teacher_id`) USING BTREE,
  3670. KEY `idx_teacher_type` (`teacher_type`) USING BTREE,
  3671. KEY `idx_start_date` (`start_date`) USING BTREE,
  3672. KEY `idx_end_date` (`end_date`) USING BTREE
  3673. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='班级班主任辅导员关联表';
  3674. -- ----------------------------
  3675. -- Table structure for xg_dorm_application
  3676. -- ----------------------------
  3677. DROP TABLE IF EXISTS `xg_dorm_application`;
  3678. CREATE TABLE `xg_dorm_application` (
  3679. `id` bigint(20) NOT NULL COMMENT '主键ID(雪花ID)',
  3680. `application_name` varchar(50) NOT NULL COMMENT '申请名称',
  3681. `application_type` char(1) NOT NULL COMMENT '申请类型(1:调宿申请 2:退宿申请)',
  3682. `application_status` char(20) DEFAULT 'waiting' COMMENT '审批状态:cancel-已撤销 , draft-草稿, waiting-待审核, finish-已完成, invalid-已作废, back-已退回, termination-已终止"',
  3683. `student_id` bigint(20) NOT NULL COMMENT '申请学生ID',
  3684. `student_no` varchar(20) NOT NULL COMMENT '学号',
  3685. `student_name` varchar(50) NOT NULL COMMENT '学生姓名',
  3686. `student_phone` varchar(20) DEFAULT NULL COMMENT '学生联系电话',
  3687. `college_id` bigint(20) NOT NULL COMMENT '学院ID',
  3688. `college_name` varchar(100) DEFAULT NULL COMMENT '学院名称',
  3689. `major_id` bigint(20) DEFAULT NULL COMMENT '专业ID',
  3690. `major_name` varchar(100) DEFAULT NULL COMMENT '专业名称',
  3691. `class_id` bigint(20) DEFAULT NULL COMMENT '班级ID',
  3692. `class_name` varchar(100) DEFAULT NULL COMMENT '班级名称',
  3693. `current_campus_id` bigint(20) DEFAULT NULL COMMENT '当前校区ID',
  3694. `current_campus_name` varchar(100) DEFAULT NULL COMMENT '当前校区名称',
  3695. `current_building_id` bigint(20) DEFAULT NULL COMMENT '当前宿舍楼ID',
  3696. `current_building_name` varchar(100) DEFAULT NULL COMMENT '当前宿舍楼名称',
  3697. `current_room_id` bigint(20) DEFAULT NULL COMMENT '当前房间ID',
  3698. `current_room_no` varchar(20) DEFAULT NULL COMMENT '当前房间号',
  3699. `current_bed_id` bigint(20) DEFAULT NULL COMMENT '当前床位ID',
  3700. `current_bed_no` varchar(10) DEFAULT NULL COMMENT '当前床位号',
  3701. `target_campus_id` bigint(20) DEFAULT NULL COMMENT '目标校区ID',
  3702. `target_campus_name` varchar(100) DEFAULT NULL COMMENT '目标校区名称',
  3703. `target_building_id` bigint(20) DEFAULT NULL COMMENT '目标宿舍楼ID',
  3704. `target_building_name` varchar(100) DEFAULT NULL COMMENT '目标宿舍楼名称',
  3705. `target_room_id` bigint(20) DEFAULT NULL COMMENT '目标房间ID',
  3706. `target_room_no` varchar(20) DEFAULT NULL COMMENT '目标房间号',
  3707. `target_bed_id` bigint(20) DEFAULT NULL COMMENT '目标床位ID',
  3708. `target_bed_no` varchar(10) DEFAULT NULL COMMENT '目标床位号',
  3709. `reason_detail` text COMMENT '详细原因说明',
  3710. `apply_time` datetime NOT NULL COMMENT '申请时间',
  3711. `attachment_oss_ids` varchar(1000) DEFAULT NULL COMMENT '附件OSS文件ID,多个用逗号分隔',
  3712. `remark` varchar(500) DEFAULT NULL COMMENT '备注信息',
  3713. `ext_field1` varchar(200) DEFAULT NULL COMMENT '扩展字段1',
  3714. `ext_field2` varchar(200) DEFAULT NULL COMMENT '扩展字段2',
  3715. `ext_field3` varchar(500) DEFAULT NULL COMMENT '扩展字段3',
  3716. `deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  3717. `tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
  3718. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3719. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3720. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3721. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3722. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3723. PRIMARY KEY (`id`) USING BTREE,
  3724. KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
  3725. KEY `idx_deleted` (`deleted`) USING BTREE,
  3726. KEY `idx_student_id` (`student_id`) USING BTREE,
  3727. KEY `idx_student_no` (`student_no`) USING BTREE,
  3728. KEY `idx_application_type` (`application_type`) USING BTREE,
  3729. KEY `idx_application_status` (`application_status`) USING BTREE,
  3730. KEY `idx_apply_time` (`apply_time`) USING BTREE,
  3731. KEY `idx_college_id` (`college_id`) USING BTREE,
  3732. KEY `idx_current_building_id` (`current_building_id`) USING BTREE,
  3733. KEY `idx_target_building_id` (`target_building_id`) USING BTREE,
  3734. KEY `idx_tenant_deleted_status` (`tenant_id`,`deleted`,`application_status`) USING BTREE
  3735. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='学生宿舍申请单表(调宿+退宿)';
  3736. -- ----------------------------
  3737. -- Table structure for xg_dorm_area
  3738. -- ----------------------------
  3739. DROP TABLE IF EXISTS `xg_dorm_area`;
  3740. CREATE TABLE `xg_dorm_area` (
  3741. `id` bigint(20) NOT NULL COMMENT '主键ID',
  3742. `area_code` varchar(50) NOT NULL COMMENT '宿舍区编码',
  3743. `area_name` varchar(100) NOT NULL COMMENT '宿舍区名称',
  3744. `campus_id` bigint(20) NOT NULL COMMENT '所属校区ID',
  3745. `area_description` varchar(500) DEFAULT NULL COMMENT '宿舍区描述',
  3746. `sort_order` int(11) DEFAULT '0' COMMENT '排序号',
  3747. `deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  3748. `tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
  3749. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3750. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3751. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3752. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3753. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3754. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  3755. PRIMARY KEY (`id`) USING BTREE,
  3756. UNIQUE KEY `uk_area_code` (`area_code`) USING BTREE,
  3757. KEY `idx_campus_id` (`campus_id`) USING BTREE
  3758. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='宿舍区信息表';
  3759. -- ----------------------------
  3760. -- Table structure for xg_dorm_bed
  3761. -- ----------------------------
  3762. DROP TABLE IF EXISTS `xg_dorm_bed`;
  3763. CREATE TABLE `xg_dorm_bed` (
  3764. `id` bigint(20) NOT NULL COMMENT '主键ID',
  3765. `bed_code` varchar(50) NOT NULL COMMENT '床位编号',
  3766. `bed_name` varchar(100) NOT NULL COMMENT '床位名称',
  3767. `room_id` bigint(20) NOT NULL COMMENT '所属房间ID',
  3768. `bed_type` char(1) DEFAULT '1' COMMENT '床位类型(1下铺 2上铺 3中铺 4独立床)',
  3769. `bed_status` char(1) DEFAULT '0' COMMENT '床位状态(0空闲 1已分配 2维修中)',
  3770. `deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  3771. `tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
  3772. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3773. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3774. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3775. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3776. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3777. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  3778. PRIMARY KEY (`id`) USING BTREE,
  3779. KEY `idx_room_id` (`room_id`) USING BTREE,
  3780. KEY `uk_bed_code` (`bed_code`) USING BTREE
  3781. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='宿舍床位信息表';
  3782. -- ----------------------------
  3783. -- Table structure for xg_dorm_bed_student
  3784. -- ----------------------------
  3785. DROP TABLE IF EXISTS `xg_dorm_bed_student`;
  3786. CREATE TABLE `xg_dorm_bed_student` (
  3787. `id` bigint(20) NOT NULL COMMENT '主键ID',
  3788. `college_id` bigint(20) NOT NULL COMMENT '分配学院ID',
  3789. `major_id` bigint(20) DEFAULT NULL COMMENT '分配专业ID',
  3790. `class_id` bigint(20) DEFAULT NULL COMMENT '分配班级ID',
  3791. `student_id` bigint(20) DEFAULT NULL COMMENT '分配学生ID',
  3792. `bed_id` bigint(20) NOT NULL COMMENT '床位ID',
  3793. `room_id` bigint(20) NOT NULL COMMENT '房间ID',
  3794. `building_id` bigint(20) NOT NULL COMMENT '宿舍楼ID',
  3795. `area_id` bigint(20) DEFAULT NULL COMMENT '宿舍区ID',
  3796. `campus_id` bigint(20) NOT NULL COMMENT '校区ID',
  3797. `status` char(1) DEFAULT '0' COMMENT '状态(0正常 1已退宿)',
  3798. `assign_time` datetime NOT NULL COMMENT '分配时间',
  3799. `checkout_time` datetime DEFAULT NULL COMMENT '退宿时间',
  3800. `deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  3801. `tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
  3802. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3803. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3804. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3805. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3806. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3807. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  3808. PRIMARY KEY (`id`) USING BTREE,
  3809. KEY `uk_student_bed` (`student_id`,`bed_id`) USING BTREE,
  3810. KEY `idx_college_id` (`college_id`) USING BTREE,
  3811. KEY `idx_student_id` (`student_id`) USING BTREE,
  3812. KEY `idx_bed_id` (`bed_id`) USING BTREE,
  3813. KEY `idx_room_id` (`room_id`) USING BTREE,
  3814. KEY `idx_building_id` (`building_id`) USING BTREE,
  3815. KEY `idx_area_id` (`area_id`) USING BTREE,
  3816. KEY `idx_campus_id` (`campus_id`) USING BTREE,
  3817. KEY `idx_assign_time` (`assign_time`) USING BTREE
  3818. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='床位学生分配关系表';
  3819. -- ----------------------------
  3820. -- Table structure for xg_dorm_building
  3821. -- ----------------------------
  3822. DROP TABLE IF EXISTS `xg_dorm_building`;
  3823. CREATE TABLE `xg_dorm_building` (
  3824. `id` bigint(20) NOT NULL COMMENT '主键ID',
  3825. `building_code` varchar(50) NOT NULL COMMENT '宿舍楼编码',
  3826. `building_name` varchar(100) NOT NULL COMMENT '宿舍楼名称',
  3827. `area_id` bigint(20) DEFAULT NULL COMMENT '所属宿舍区ID',
  3828. `campus_id` bigint(20) NOT NULL COMMENT '所属校区ID',
  3829. `floors` int(11) NOT NULL DEFAULT '6' COMMENT '总楼层数',
  3830. `building_type` char(1) DEFAULT '1' COMMENT '宿舍楼类型(1男生楼 2女生楼 3混合楼)',
  3831. `building_description` varchar(500) DEFAULT NULL COMMENT '宿舍楼描述',
  3832. `sort_order` int(11) DEFAULT '0' COMMENT '排序号',
  3833. `deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  3834. `tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
  3835. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3836. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3837. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3838. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3839. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3840. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  3841. PRIMARY KEY (`id`) USING BTREE,
  3842. UNIQUE KEY `uk_building_code` (`building_code`) USING BTREE,
  3843. KEY `idx_area_id` (`area_id`) USING BTREE,
  3844. KEY `idx_campus_id` (`campus_id`) USING BTREE
  3845. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='宿舍楼信息表';
  3846. -- ----------------------------
  3847. -- Table structure for xg_dorm_campus
  3848. -- ----------------------------
  3849. DROP TABLE IF EXISTS `xg_dorm_campus`;
  3850. CREATE TABLE `xg_dorm_campus` (
  3851. `id` bigint(20) NOT NULL COMMENT '主键ID',
  3852. `campus_code` varchar(50) NOT NULL COMMENT '校区编码',
  3853. `campus_name` varchar(100) NOT NULL COMMENT '校区名称',
  3854. `campus_description` varchar(500) DEFAULT NULL COMMENT '校区描述',
  3855. `sort_order` int(11) DEFAULT '0' COMMENT '排序号',
  3856. `deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  3857. `tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
  3858. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3859. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3860. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3861. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3862. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3863. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  3864. PRIMARY KEY (`id`) USING BTREE,
  3865. UNIQUE KEY `uk_campus_code` (`campus_code`) USING BTREE
  3866. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='校区信息表';
  3867. -- ----------------------------
  3868. -- Table structure for xg_dorm_college_bed
  3869. -- ----------------------------
  3870. DROP TABLE IF EXISTS `xg_dorm_college_bed`;
  3871. CREATE TABLE `xg_dorm_college_bed` (
  3872. `id` bigint(20) NOT NULL COMMENT '主键ID',
  3873. `college_id` bigint(20) NOT NULL COMMENT '学院ID',
  3874. `bed_id` bigint(20) NOT NULL COMMENT '床位ID',
  3875. `building_id` bigint(20) NOT NULL COMMENT '宿舍楼ID',
  3876. `room_id` bigint(20) NOT NULL COMMENT '房间ID',
  3877. `status` char(1) DEFAULT '0' COMMENT '状态(0正常 1已解除)',
  3878. `assign_time` datetime DEFAULT NULL COMMENT '分配时间',
  3879. `release_time` datetime DEFAULT NULL COMMENT '到期解除时间',
  3880. `deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  3881. `tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
  3882. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3883. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3884. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3885. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3886. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3887. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  3888. PRIMARY KEY (`id`) USING BTREE,
  3889. UNIQUE KEY `uk_college_bed` (`college_id`,`bed_id`) USING BTREE,
  3890. KEY `idx_college_id` (`college_id`) USING BTREE,
  3891. KEY `idx_bed_id` (`bed_id`) USING BTREE,
  3892. KEY `idx_building_id` (`building_id`) USING BTREE,
  3893. KEY `idx_room_id` (`room_id`) USING BTREE
  3894. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='二级学院床位绑定关系表';
  3895. -- ----------------------------
  3896. -- Table structure for xg_dorm_hygiene_check
  3897. -- ----------------------------
  3898. DROP TABLE IF EXISTS `xg_dorm_hygiene_check`;
  3899. CREATE TABLE `xg_dorm_hygiene_check` (
  3900. `id` bigint(20) NOT NULL COMMENT '主键ID',
  3901. `tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
  3902. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3903. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3904. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3905. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3906. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3907. `deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  3908. `check_title` varchar(200) NOT NULL COMMENT '检查标题',
  3909. `check_date` datetime NOT NULL COMMENT '检查日期',
  3910. `checker_id` bigint(20) NOT NULL COMMENT '检查员ID,关联sys_user.id',
  3911. `checker_name` varchar(50) NOT NULL COMMENT '检查员姓名',
  3912. `check_type` char(1) DEFAULT '1' COMMENT '检查类型(1日常检查 2专项检查 3突击检查 4复查)',
  3913. `check_level` char(1) DEFAULT '1' COMMENT '检查级别(1宿管员 2学院 3学校)',
  3914. `room_id` bigint(20) NOT NULL COMMENT '宿舍房间ID,关联xg_dorm_room.id',
  3915. `room_code` varchar(50) NOT NULL COMMENT '房间编号',
  3916. `room_name` varchar(100) NOT NULL COMMENT '房间名称',
  3917. `building_id` bigint(20) NOT NULL COMMENT '宿舍楼ID,关联xg_dorm_building.id',
  3918. `building_name` varchar(100) NOT NULL COMMENT '宿舍楼名称',
  3919. `area_id` bigint(20) DEFAULT NULL COMMENT '宿舍区ID,关联xg_dorm_area.id',
  3920. `area_name` varchar(100) DEFAULT NULL COMMENT '宿舍区名称',
  3921. `campus_id` bigint(20) DEFAULT NULL COMMENT '校区ID,关联xg_dorm_campus.id',
  3922. `campus_name` varchar(100) DEFAULT NULL COMMENT '校区名称',
  3923. `total_score` decimal(5,2) DEFAULT NULL COMMENT '宿舍扣分(0-100分)',
  3924. `hygiene_grade` char(1) DEFAULT NULL COMMENT '卫生等级(A优秀 B良好 C合格 D不合格)',
  3925. `attachment_ids` text COMMENT '附件OSS ID列表,逗号分隔',
  3926. `check_summary` text COMMENT '检查总结',
  3927. `improvement_suggestions` text COMMENT '整改建议',
  3928. `check_remarks` varchar(500) DEFAULT NULL COMMENT '检查备注',
  3929. `discipline_type_id` bigint(20) DEFAULT NULL COMMENT '违纪类型ID,关联xskh_discipline_type.id',
  3930. `discipline_type_name` varchar(255) DEFAULT NULL COMMENT '违纪类型名称',
  3931. PRIMARY KEY (`id`) USING BTREE,
  3932. KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
  3933. KEY `idx_deleted` (`deleted`) USING BTREE,
  3934. KEY `idx_check_date` (`check_date`) USING BTREE,
  3935. KEY `idx_checker_id` (`checker_id`) USING BTREE,
  3936. KEY `idx_room_id` (`room_id`) USING BTREE,
  3937. KEY `idx_building_id` (`building_id`) USING BTREE,
  3938. KEY `idx_area_id` (`area_id`) USING BTREE,
  3939. KEY `idx_campus_id` (`campus_id`) USING BTREE,
  3940. KEY `idx_hygiene_grade` (`hygiene_grade`) USING BTREE,
  3941. KEY `idx_check_type` (`check_type`) USING BTREE,
  3942. KEY `idx_create_time` (`create_time`) USING BTREE,
  3943. KEY `idx_tenant_deleted` (`tenant_id`,`deleted`) USING BTREE
  3944. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='宿舍卫生检查表';
  3945. -- ----------------------------
  3946. -- Table structure for xg_dorm_hygiene_student_score
  3947. -- ----------------------------
  3948. DROP TABLE IF EXISTS `xg_dorm_hygiene_student_score`;
  3949. CREATE TABLE `xg_dorm_hygiene_student_score` (
  3950. `id` bigint(20) NOT NULL COMMENT '主键ID',
  3951. `tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
  3952. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  3953. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  3954. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  3955. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  3956. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  3957. `deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  3958. `hygiene_check_id` bigint(20) NOT NULL COMMENT '卫生检查ID,关联xg_dorm_hygiene_check.id',
  3959. `student_id` bigint(20) NOT NULL COMMENT '学生ID,关联xg_student_msg.id',
  3960. `student_no` varchar(32) NOT NULL COMMENT '学号',
  3961. `student_name` varchar(50) NOT NULL COMMENT '学生姓名',
  3962. `class_id` bigint(20) DEFAULT NULL COMMENT '班级ID',
  3963. `class_name` varchar(100) DEFAULT NULL COMMENT '班级名称',
  3964. `major_id` bigint(20) DEFAULT NULL COMMENT '专业ID',
  3965. `major_name` varchar(100) DEFAULT NULL COMMENT '专业名称',
  3966. `college_id` bigint(20) DEFAULT NULL COMMENT '学院ID',
  3967. `college_name` varchar(100) DEFAULT NULL COMMENT '学院名称',
  3968. `bed_id` bigint(20) DEFAULT NULL COMMENT '床位ID,关联xg_dorm_bed.id',
  3969. `bed_code` varchar(50) DEFAULT NULL COMMENT '床位编号',
  3970. `student_score` decimal(5,2) DEFAULT NULL COMMENT '学生个人扣分(0-100分)',
  3971. `attendance_status` char(1) DEFAULT '1' COMMENT '出勤状态(1在寝 2外出 3请假 4其他)',
  3972. `student_grade` char(1) DEFAULT NULL COMMENT '学生评级(A优秀 B良好 C合格 D不合格)',
  3973. `is_responsible_person` tinyint(1) DEFAULT '0' COMMENT '是否为寝室长(0否 1是)',
  3974. `score_remarks` varchar(500) DEFAULT NULL COMMENT '评分备注',
  3975. `improvement_notes` varchar(500) DEFAULT NULL COMMENT '改进意见',
  3976. PRIMARY KEY (`id`) USING BTREE,
  3977. KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
  3978. KEY `idx_deleted` (`deleted`) USING BTREE,
  3979. KEY `idx_hygiene_check_id` (`hygiene_check_id`) USING BTREE,
  3980. KEY `idx_student_id` (`student_id`) USING BTREE,
  3981. KEY `idx_student_no` (`student_no`) USING BTREE,
  3982. KEY `idx_class_id` (`class_id`) USING BTREE,
  3983. KEY `idx_major_id` (`major_id`) USING BTREE,
  3984. KEY `idx_college_id` (`college_id`) USING BTREE,
  3985. KEY `idx_bed_id` (`bed_id`) USING BTREE,
  3986. KEY `idx_attendance_status` (`attendance_status`) USING BTREE,
  3987. KEY `idx_student_grade` (`student_grade`) USING BTREE,
  3988. KEY `idx_create_time` (`create_time`) USING BTREE,
  3989. KEY `idx_tenant_deleted` (`tenant_id`,`deleted`) USING BTREE
  3990. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='宿舍卫生检查学生评分表';
  3991. -- ----------------------------
  3992. -- Table structure for xg_dorm_manager
  3993. -- ----------------------------
  3994. DROP TABLE IF EXISTS `xg_dorm_manager`;
  3995. CREATE TABLE `xg_dorm_manager` (
  3996. `id` bigint(20) NOT NULL COMMENT '主键ID',
  3997. `manager_name` varchar(100) NOT NULL COMMENT '管理员姓名',
  3998. `manager_type` char(1) NOT NULL COMMENT '管理员类型(1全校管理员 2校区管理员 3宿舍区管理员 4宿舍楼管理员)',
  3999. `manager_level` int(11) DEFAULT '1' COMMENT '管理级别(1-5,1为最高)',
  4000. `user_id` bigint(20) DEFAULT NULL COMMENT '关联用户ID',
  4001. `phone` varchar(20) DEFAULT NULL COMMENT '联系电话',
  4002. `gender` char(1) DEFAULT '0' COMMENT '性别(0男 1女 2未知)',
  4003. `status` char(1) DEFAULT '0' COMMENT '状态(0正常 1停用)',
  4004. `deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  4005. `tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
  4006. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  4007. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  4008. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  4009. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  4010. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  4011. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  4012. PRIMARY KEY (`id`) USING BTREE,
  4013. KEY `idx_user_id` (`user_id`) USING BTREE,
  4014. KEY `idx_manager_type` (`manager_type`) USING BTREE
  4015. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='宿舍管理员信息表';
  4016. -- ----------------------------
  4017. -- Table structure for xg_dorm_manager_source
  4018. -- ----------------------------
  4019. DROP TABLE IF EXISTS `xg_dorm_manager_source`;
  4020. CREATE TABLE `xg_dorm_manager_source` (
  4021. `id` bigint(20) NOT NULL COMMENT '主键ID',
  4022. `manager_id` bigint(20) NOT NULL COMMENT '管理员ID',
  4023. `permission_type` char(1) DEFAULT '1' COMMENT '权限类型(1查看 2编辑 3完全管理)',
  4024. `auth_type` char(1) NOT NULL COMMENT '授权类型(1全校级 2校区级 3宿舍区级 4楼栋级)',
  4025. `auth_source` bigint(20) DEFAULT NULL COMMENT '授权来源ID(对应校区ID或宿舍区ID或楼栋ID)',
  4026. `status` char(1) DEFAULT '0' COMMENT '状态(0有效 1已撤销)',
  4027. `deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  4028. `tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
  4029. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  4030. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  4031. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  4032. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  4033. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  4034. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  4035. PRIMARY KEY (`id`) USING BTREE,
  4036. KEY `idx_manager_id` (`manager_id`) USING BTREE,
  4037. KEY `idx_auth_source` (`auth_source`) USING BTREE
  4038. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='管理员授权关系表';
  4039. -- ----------------------------
  4040. -- Table structure for xg_dorm_room
  4041. -- ----------------------------
  4042. DROP TABLE IF EXISTS `xg_dorm_room`;
  4043. CREATE TABLE `xg_dorm_room` (
  4044. `id` bigint(20) NOT NULL COMMENT '主键ID',
  4045. `room_code` varchar(50) NOT NULL COMMENT '房间编号',
  4046. `room_name` varchar(100) NOT NULL COMMENT '房间名称',
  4047. `building_id` bigint(20) NOT NULL COMMENT '所属宿舍楼ID',
  4048. `floor_num` int(11) NOT NULL COMMENT '楼层',
  4049. `room_type` char(1) DEFAULT '1' COMMENT '房间类型(1标准间 2 单人间 3 套间)',
  4050. `actual_beds` int(11) DEFAULT '4' COMMENT '实际床位数',
  4051. `room_area` decimal(10,2) DEFAULT NULL COMMENT '房间面积(平方米)',
  4052. `room_status` char(1) DEFAULT '0' COMMENT '房间状态(0可用 1维修中 2停用)',
  4053. `sort` int(11) DEFAULT '0' COMMENT '排序号',
  4054. `deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  4055. `tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
  4056. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  4057. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  4058. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  4059. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  4060. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  4061. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  4062. PRIMARY KEY (`id`) USING BTREE,
  4063. KEY `idx_building_id` (`building_id`) USING BTREE,
  4064. KEY `idx_floor_num` (`floor_num`) USING BTREE,
  4065. KEY `uk_room_code` (`room_code`) USING BTREE
  4066. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='宿舍房间信息表';
  4067. -- ----------------------------
  4068. -- Table structure for xg_dorm_violation
  4069. -- ----------------------------
  4070. DROP TABLE IF EXISTS `xg_dorm_violation`;
  4071. CREATE TABLE `xg_dorm_violation` (
  4072. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '违纪记录ID(主键)',
  4073. `student_id` bigint(20) NOT NULL COMMENT '学生ID',
  4074. `student_name` varchar(100) NOT NULL COMMENT '学生姓名',
  4075. `student_no` varchar(50) NOT NULL COMMENT '学号',
  4076. `college_id` bigint(20) DEFAULT NULL COMMENT '学院ID',
  4077. `college_name` varchar(100) DEFAULT NULL COMMENT '学院名称',
  4078. `major_id` bigint(20) DEFAULT NULL COMMENT '专业ID',
  4079. `major_name` varchar(100) DEFAULT NULL COMMENT '专业名称',
  4080. `class_id` bigint(20) DEFAULT NULL COMMENT '班级ID',
  4081. `class_name` varchar(100) DEFAULT NULL COMMENT '班级名称',
  4082. `campus_id` bigint(20) DEFAULT NULL COMMENT '校区ID',
  4083. `campus_name` varchar(100) DEFAULT NULL COMMENT '校区名称',
  4084. `area_id` bigint(20) DEFAULT NULL COMMENT '宿舍区域ID',
  4085. `area_name` varchar(100) DEFAULT NULL COMMENT '宿舍区域名称',
  4086. `building_id` bigint(20) NOT NULL COMMENT '宿舍楼ID',
  4087. `building_name` varchar(100) NOT NULL COMMENT '宿舍楼名称',
  4088. `room_id` bigint(20) NOT NULL COMMENT '宿舍房间ID',
  4089. `room_name` varchar(50) NOT NULL COMMENT '房间名称',
  4090. `bed_id` bigint(20) DEFAULT NULL COMMENT '床位ID',
  4091. `bed_name` varchar(20) DEFAULT NULL COMMENT '床位名称',
  4092. `violation_type` varchar(50) NOT NULL COMMENT '违纪类型',
  4093. `violation_level` char(1) NOT NULL COMMENT '违纪等级:1轻微 2一般 3严重 4特别严重',
  4094. `violation_time` datetime NOT NULL COMMENT '违纪发生时间',
  4095. `violation_description` text NOT NULL COMMENT '违纪行为描述',
  4096. `involved_students` text COMMENT '涉及其他学生信息(JSON格式)',
  4097. `attachment_oss_ids` text COMMENT '附件OSS ID列表(逗号分隔)',
  4098. `deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  4099. `tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
  4100. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  4101. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  4102. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  4103. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  4104. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  4105. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  4106. PRIMARY KEY (`id`) USING BTREE,
  4107. KEY `idx_student_id` (`student_id`) USING BTREE,
  4108. KEY `idx_student_no` (`student_no`) USING BTREE,
  4109. KEY `idx_college_id` (`college_id`) USING BTREE,
  4110. KEY `idx_building_id` (`building_id`) USING BTREE,
  4111. KEY `idx_room_id` (`room_id`) USING BTREE,
  4112. KEY `idx_violation_type` (`violation_type`) USING BTREE,
  4113. KEY `idx_violation_time` (`violation_time`) USING BTREE,
  4114. KEY `idx_violation_level` (`violation_level`) USING BTREE,
  4115. KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
  4116. KEY `idx_deleted` (`deleted`) USING BTREE,
  4117. KEY `idx_college_time` (`college_id`,`violation_time`) USING BTREE,
  4118. KEY `idx_building_level` (`building_id`,`violation_level`) USING BTREE,
  4119. KEY `idx_student_time` (`student_id`,`violation_time`) USING BTREE,
  4120. KEY `idx_type_level` (`violation_type`,`violation_level`) USING BTREE
  4121. ) ENGINE=InnoDB AUTO_INCREMENT=1958884987826626562 DEFAULT CHARSET=utf8mb4 COMMENT='宿舍违纪记录表';
  4122. -- ----------------------------
  4123. -- Table structure for xg_holiday_stay
  4124. -- ----------------------------
  4125. DROP TABLE IF EXISTS `xg_holiday_stay`;
  4126. CREATE TABLE `xg_holiday_stay` (
  4127. `id` bigint(20) NOT NULL COMMENT '主键ID',
  4128. `tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
  4129. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  4130. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  4131. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  4132. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  4133. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  4134. `deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  4135. `student_id` bigint(20) NOT NULL COMMENT '学生ID,关联xg_student_msg.id',
  4136. `student_name` varchar(50) NOT NULL COMMENT '学生姓名',
  4137. `student_no` varchar(20) NOT NULL COMMENT '学号',
  4138. `class_id` bigint(20) DEFAULT NULL COMMENT '班级ID',
  4139. `class_name` varchar(100) DEFAULT NULL COMMENT '班级名称',
  4140. `major_id` bigint(20) DEFAULT NULL COMMENT '专业ID',
  4141. `major_name` varchar(100) DEFAULT NULL COMMENT '专业名称',
  4142. `college_id` bigint(20) DEFAULT NULL COMMENT '学院ID',
  4143. `college_name` varchar(100) DEFAULT NULL COMMENT '学院名称',
  4144. `campus_id` bigint(20) DEFAULT NULL COMMENT '校区ID,关联xg_dorm_campus.id',
  4145. `campus_name` varchar(100) DEFAULT NULL COMMENT '校区名称',
  4146. `area_id` bigint(20) DEFAULT NULL COMMENT '宿舍区ID,关联xg_dorm_area.id',
  4147. `area_name` varchar(100) DEFAULT NULL COMMENT '宿舍区名称',
  4148. `building_id` bigint(20) DEFAULT NULL COMMENT '宿舍楼ID,关联xg_dorm_building.id',
  4149. `building_name` varchar(100) DEFAULT NULL COMMENT '宿舍楼名称',
  4150. `room_id` bigint(20) DEFAULT NULL COMMENT '房间ID,关联xg_dorm_room.id',
  4151. `room_name` varchar(100) DEFAULT NULL COMMENT '房间名称',
  4152. `bed_id` bigint(20) DEFAULT NULL COMMENT '床位ID,关联xg_dorm_bed.id',
  4153. `bed_name` varchar(100) DEFAULT NULL COMMENT '床位名称',
  4154. `holiday_type` varchar(50) NOT NULL COMMENT '假期类型(寒假、暑假、春节假期、国庆假期等)',
  4155. `apply_start_date` datetime NOT NULL COMMENT '申请留宿开始日期',
  4156. `apply_end_date` datetime NOT NULL COMMENT '申请留宿结束日期',
  4157. `stay_reason` text NOT NULL COMMENT '留宿原因(必填)',
  4158. `stay_reason_type` varchar(20) DEFAULT NULL COMMENT '留宿原因类型(学习、实习、家庭困难、其他)',
  4159. `student_phone` varchar(20) NOT NULL COMMENT '学生联系电话',
  4160. `emergency_contact` varchar(50) NOT NULL COMMENT '紧急联系人姓名',
  4161. `emergency_phone` varchar(20) NOT NULL COMMENT '紧急联系人电话',
  4162. `parent_consent` char(1) NOT NULL DEFAULT '1' COMMENT '家长同意(0否 1是)',
  4163. `attachment_oss_ids` varchar(1000) DEFAULT NULL COMMENT '附件OSS文件ID,多个用逗号分隔(申请材料、证明文件等)',
  4164. `ext_field1` varchar(200) DEFAULT NULL COMMENT '扩展字段1',
  4165. `ext_field2` varchar(200) DEFAULT NULL COMMENT '扩展字段2',
  4166. `ext_field3` varchar(500) DEFAULT NULL COMMENT '扩展字段3',
  4167. `remark` varchar(500) DEFAULT NULL COMMENT '备注信息',
  4168. PRIMARY KEY (`id`) USING BTREE,
  4169. KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
  4170. KEY `idx_deleted` (`deleted`) USING BTREE,
  4171. KEY `idx_create_time` (`create_time`) USING BTREE,
  4172. KEY `idx_tenant_deleted` (`tenant_id`,`deleted`) USING BTREE,
  4173. KEY `idx_student_id` (`student_id`) USING BTREE,
  4174. KEY `idx_student_no` (`student_no`) USING BTREE
  4175. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='假期留宿管理表';
  4176. -- ----------------------------
  4177. -- Table structure for xg_hygiene_check_violation
  4178. -- ----------------------------
  4179. DROP TABLE IF EXISTS `xg_hygiene_check_violation`;
  4180. CREATE TABLE `xg_hygiene_check_violation` (
  4181. `id` bigint(20) NOT NULL COMMENT '主键ID',
  4182. `tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
  4183. `hygiene_check_id` bigint(20) NOT NULL COMMENT '宿舍卫生检查ID,关联xg_dorm_hygiene_check.id',
  4184. `discipline_record_id` bigint(20) NOT NULL COMMENT '违纪记录ID,关联xskh_discipline_record.id',
  4185. `student_id` bigint(20) NOT NULL COMMENT '学生ID,关联xg_student_msg.id',
  4186. `student_no` varchar(20) NOT NULL COMMENT '学号',
  4187. `student_name` varchar(50) NOT NULL COMMENT '学生姓名',
  4188. `discipline_type_id` bigint(20) NOT NULL COMMENT '违纪类型ID,关联xskh_discipline_type.id',
  4189. `discipline_type_name` varchar(100) NOT NULL COMMENT '违纪类型名称',
  4190. `violation_source` char(1) DEFAULT '1' COMMENT '违纪来源(1宿舍卫生检查 2其他)',
  4191. `status` char(1) DEFAULT '1' COMMENT '状态(1生效 2已撤销)',
  4192. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  4193. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  4194. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  4195. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  4196. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  4197. `deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0-未删除 1-已删除)',
  4198. PRIMARY KEY (`id`) USING BTREE,
  4199. KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
  4200. KEY `idx_hygiene_check_id` (`hygiene_check_id`) USING BTREE,
  4201. KEY `idx_discipline_record_id` (`discipline_record_id`) USING BTREE,
  4202. KEY `idx_student_id` (`student_id`) USING BTREE,
  4203. KEY `idx_student_no` (`student_no`) USING BTREE,
  4204. KEY `idx_discipline_type_id` (`discipline_type_id`) USING BTREE,
  4205. KEY `idx_violation_source` (`violation_source`) USING BTREE,
  4206. KEY `idx_status` (`status`) USING BTREE,
  4207. KEY `idx_deleted` (`deleted`) USING BTREE,
  4208. KEY `idx_tenant_deleted` (`tenant_id`,`deleted`) USING BTREE
  4209. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='宿舍卫生检查违纪关联表';
  4210. -- ----------------------------
  4211. -- Table structure for xg_leave_type_config
  4212. -- ----------------------------
  4213. DROP TABLE IF EXISTS `xg_leave_type_config`;
  4214. CREATE TABLE `xg_leave_type_config` (
  4215. `id` bigint(20) NOT NULL COMMENT '主键ID(雪花ID)',
  4216. `tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
  4217. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  4218. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  4219. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  4220. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  4221. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  4222. `deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  4223. `leave_type_name` varchar(50) NOT NULL COMMENT '请假类型名称',
  4224. `leave_type_code` varchar(20) NOT NULL COMMENT '请假类型编码',
  4225. `leave_type_desc` varchar(500) DEFAULT NULL COMMENT '请假类型描述',
  4226. `sort_order` int(4) DEFAULT '0' COMMENT '排序号',
  4227. `need_location_on_apply` char(1) NOT NULL DEFAULT '0' COMMENT '请假是否需要上传地理位置:0-否,1-是',
  4228. `need_photo_on_cancel` char(1) NOT NULL DEFAULT '0' COMMENT '销假是否必须上传照片:0-否,1-是',
  4229. `need_location_on_cancel` char(1) NOT NULL DEFAULT '0' COMMENT '销假是否需要上传地理位置:0-否,1-是',
  4230. `need_cancel_for_non_leave` char(1) NOT NULL DEFAULT '0' COMMENT '非离校请假是否需要销假:0-否,1-是',
  4231. `can_apply_in_advance` char(1) NOT NULL DEFAULT '0' COMMENT '是否可以提前请假:0-否,1-是',
  4232. `is_enabled` char(1) NOT NULL DEFAULT '1' COMMENT '是否开启:0-关闭,1-开启',
  4233. `max_apply_duration` decimal(5,2) DEFAULT NULL COMMENT '请假最大申请时长(天)',
  4234. `cancel_overdue_reminder` decimal(5,2) DEFAULT NULL COMMENT '销假逾期多少时长给予提醒(天)',
  4235. PRIMARY KEY (`id`) USING BTREE,
  4236. UNIQUE KEY `uk_leave_type_code` (`leave_type_code`,`tenant_id`) USING BTREE COMMENT '请假类型编码唯一索引',
  4237. KEY `idx_tenant_id` (`tenant_id`) USING BTREE COMMENT '租户索引',
  4238. KEY `idx_is_enabled` (`is_enabled`) USING BTREE COMMENT '启用状态索引',
  4239. KEY `idx_sort_order` (`sort_order`) USING BTREE COMMENT '排序索引'
  4240. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='学生请假类型配置表';
  4241. -- ----------------------------
  4242. -- Table structure for xg_stu_col_batch
  4243. -- ----------------------------
  4244. DROP TABLE IF EXISTS `xg_stu_col_batch`;
  4245. CREATE TABLE `xg_stu_col_batch` (
  4246. `id` bigint(20) NOT NULL COMMENT '批次ID',
  4247. `batch_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '批次名称',
  4248. `description` text COLLATE utf8mb4_unicode_ci COMMENT '批次描述',
  4249. `start_time` datetime NOT NULL COMMENT '开始时间',
  4250. `end_time` datetime NOT NULL COMMENT '结束时间',
  4251. `status` char(1) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0' COMMENT '状态(0正常 1停用)',
  4252. `collection_type` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '收集类型 1 - 新学期收集 2 - 其他',
  4253. `remark` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
  4254. `tenant_id` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '000000' COMMENT '租户编号',
  4255. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  4256. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  4257. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  4258. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  4259. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  4260. `deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  4261. PRIMARY KEY (`id`) USING BTREE,
  4262. KEY `idx_status` (`status`) USING BTREE,
  4263. KEY `idx_start_time` (`start_time`) USING BTREE,
  4264. KEY `idx_end_time` (`end_time`) USING BTREE
  4265. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='学生信息收集批次表';
  4266. -- ----------------------------
  4267. -- Table structure for xg_stu_col_batch_class
  4268. -- ----------------------------
  4269. DROP TABLE IF EXISTS `xg_stu_col_batch_class`;
  4270. CREATE TABLE `xg_stu_col_batch_class` (
  4271. `id` bigint(20) NOT NULL COMMENT '主键ID',
  4272. `batch_id` bigint(20) NOT NULL COMMENT '批次ID',
  4273. `class_id` bigint(20) NOT NULL COMMENT '班级ID',
  4274. `class_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '班级名称',
  4275. `major_id` bigint(20) DEFAULT NULL COMMENT '专业ID',
  4276. `major_name` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '专业名称',
  4277. `college_id` bigint(20) DEFAULT NULL COMMENT '院系ID',
  4278. `college_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '院系名称',
  4279. `remark` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
  4280. `tenant_id` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '000000' COMMENT '租户编号',
  4281. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  4282. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  4283. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  4284. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  4285. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  4286. `deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  4287. PRIMARY KEY (`id`) USING BTREE,
  4288. KEY `idx_batch_id` (`batch_id`) USING BTREE,
  4289. KEY `idx_class_id` (`class_id`) USING BTREE,
  4290. KEY `idx_grade_id` (`major_id`) USING BTREE,
  4291. KEY `idx_department_id` (`college_id`) USING BTREE
  4292. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='学生信息收集批次班级权限表';
  4293. -- ----------------------------
  4294. -- Table structure for xg_student_cancel_leave
  4295. -- ----------------------------
  4296. DROP TABLE IF EXISTS `xg_student_cancel_leave`;
  4297. CREATE TABLE `xg_student_cancel_leave` (
  4298. `id` bigint(20) NOT NULL COMMENT '主键ID(雪花ID)',
  4299. `tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
  4300. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  4301. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  4302. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  4303. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  4304. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  4305. `deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  4306. `student_id` bigint(20) NOT NULL COMMENT '学生ID',
  4307. `student_name` varchar(50) NOT NULL COMMENT '学生姓名',
  4308. `student_no` varchar(20) NOT NULL COMMENT '学号',
  4309. `class_id` bigint(20) DEFAULT NULL COMMENT '班级ID',
  4310. `class_name` varchar(100) DEFAULT NULL COMMENT '班级名称',
  4311. `major_id` bigint(20) DEFAULT NULL COMMENT '专业ID',
  4312. `major_name` varchar(100) DEFAULT NULL COMMENT '专业名称',
  4313. `college_id` bigint(20) DEFAULT NULL COMMENT '学院ID',
  4314. `college_name` varchar(100) DEFAULT NULL COMMENT '学院名称',
  4315. `leave_type_code` varchar(20) NOT NULL COMMENT '请假类型编码',
  4316. `leave_type_name` varchar(50) NOT NULL COMMENT '请假类型名称',
  4317. `start_time` datetime NOT NULL COMMENT '开始时间(年月日时分秒)',
  4318. `end_time` datetime NOT NULL COMMENT '结束时间(年月日时分秒)',
  4319. `leave_duration` decimal(5,2) NOT NULL COMMENT '请假时长(天)',
  4320. `is_leave_school` char(1) NOT NULL DEFAULT '0' COMMENT '是否离校:0-否,1-是',
  4321. `need_cancel` char(1) NOT NULL DEFAULT '1' COMMENT '是否需要销假:0-否,1-是',
  4322. `emergency_contact` varchar(50) DEFAULT NULL COMMENT '紧急联系人',
  4323. `emergency_phone` varchar(20) DEFAULT NULL COMMENT '紧急联系电话',
  4324. `leave_reason` text NOT NULL COMMENT '请假原因',
  4325. `leave_location` varchar(500) DEFAULT NULL COMMENT '请假时地理位置',
  4326. `attachment_oss_ids` text COMMENT '附件OSS文件ID(逗号分隔)',
  4327. `approval_status` char(100) NOT NULL DEFAULT '0' COMMENT '审批状态:"cancel", "已撤销" "draft", "草稿" "waiting", "待审核" "finish", "已完成" "invalid", "已作废" "back", "已退回" "termination", "已终止"',
  4328. `approval_opinion` varchar(500) DEFAULT NULL COMMENT '审批意见',
  4329. `approval_time` datetime DEFAULT NULL COMMENT '审批时间',
  4330. `approval_by` bigint(20) DEFAULT NULL COMMENT '审批人ID',
  4331. `approval_by_name` varchar(50) DEFAULT NULL COMMENT '审批人姓名',
  4332. `cancel_status` char(100) DEFAULT '0' COMMENT '销假状态:0-未销假,1-已销假,2-逾期未销假 3 - 无需销假 "cancel", "已撤销" "draft", "草稿" "waiting", "待审核" "finish", "已完成" "invalid", "已作废" "back", "已退回" "termination", "已终止"',
  4333. `cancel_time` datetime DEFAULT NULL COMMENT '销假时间',
  4334. `cancel_location` varchar(500) DEFAULT NULL COMMENT '销假地理位置',
  4335. `cancel_photo_oss_ids` text COMMENT '销假照片OSS文件ID(逗号分隔)',
  4336. `cancel_remark` varchar(500) DEFAULT NULL COMMENT '销假备注',
  4337. `leave_id` bigint(20) NOT NULL COMMENT '学生请假表id',
  4338. PRIMARY KEY (`id`) USING BTREE,
  4339. KEY `idx_tenant_id` (`tenant_id`) USING BTREE COMMENT '租户索引',
  4340. KEY `idx_student_id` (`student_id`) USING BTREE COMMENT '学生索引',
  4341. KEY `idx_student_no` (`student_no`) USING BTREE COMMENT '学号索引',
  4342. KEY `idx_class_id` (`class_id`) USING BTREE COMMENT '班级索引',
  4343. KEY `idx_college_id` (`college_id`) USING BTREE COMMENT '学院索引',
  4344. KEY `idx_leave_type_code` (`leave_type_code`) USING BTREE COMMENT '请假类型索引',
  4345. KEY `idx_start_time` (`start_time`) USING BTREE COMMENT '开始时间索引',
  4346. KEY `idx_end_time` (`end_time`) USING BTREE COMMENT '结束时间索引',
  4347. KEY `idx_approval_status` (`approval_status`) USING BTREE COMMENT '审批状态索引',
  4348. KEY `idx_cancel_status` (`cancel_status`) USING BTREE COMMENT '销假状态索引',
  4349. KEY `idx_create_time` (`create_time`) USING BTREE COMMENT '创建时间索引',
  4350. KEY `idx_is_leave_school` (`is_leave_school`) USING BTREE COMMENT '离校状态索引',
  4351. KEY `idx_need_cancel` (`need_cancel`) USING BTREE COMMENT '是否需要销假索引',
  4352. KEY `idx_student_time_range` (`student_id`,`start_time`,`end_time`) USING BTREE,
  4353. KEY `idx_class_approval_status` (`class_id`,`approval_status`) USING BTREE,
  4354. KEY `idx_college_leave_type` (`college_id`,`leave_type_code`) USING BTREE,
  4355. KEY `idx_time_approval_status` (`start_time`,`end_time`,`approval_status`) USING BTREE,
  4356. KEY `idx_need_cancel_status` (`need_cancel`,`cancel_status`) USING BTREE
  4357. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='学生销假表';
  4358. -- ----------------------------
  4359. -- Table structure for xg_student_leave
  4360. -- ----------------------------
  4361. DROP TABLE IF EXISTS `xg_student_leave`;
  4362. CREATE TABLE `xg_student_leave` (
  4363. `id` bigint(20) NOT NULL COMMENT '主键ID(雪花ID)',
  4364. `tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
  4365. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  4366. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  4367. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  4368. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  4369. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  4370. `deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  4371. `student_id` bigint(20) NOT NULL COMMENT '学生ID',
  4372. `student_name` varchar(50) NOT NULL COMMENT '学生姓名',
  4373. `student_no` varchar(20) NOT NULL COMMENT '学号',
  4374. `class_id` bigint(20) DEFAULT NULL COMMENT '班级ID',
  4375. `class_name` varchar(100) DEFAULT NULL COMMENT '班级名称',
  4376. `major_id` bigint(20) DEFAULT NULL COMMENT '专业ID',
  4377. `major_name` varchar(100) DEFAULT NULL COMMENT '专业名称',
  4378. `college_id` bigint(20) DEFAULT NULL COMMENT '学院ID',
  4379. `college_name` varchar(100) DEFAULT NULL COMMENT '学院名称',
  4380. `leave_type_code` varchar(20) NOT NULL COMMENT '请假类型编码',
  4381. `leave_type_name` varchar(50) NOT NULL COMMENT '请假类型名称',
  4382. `start_time` datetime NOT NULL COMMENT '开始时间(年月日时分秒)',
  4383. `end_time` datetime NOT NULL COMMENT '结束时间(年月日时分秒)',
  4384. `leave_duration` decimal(5,2) NOT NULL COMMENT '请假时长(天)',
  4385. `is_leave_school` char(1) NOT NULL DEFAULT '0' COMMENT '是否离校:0-否,1-是',
  4386. `need_cancel` char(1) NOT NULL DEFAULT '1' COMMENT '是否需要销假:0-否,1-是',
  4387. `emergency_contact` varchar(50) DEFAULT NULL COMMENT '紧急联系人',
  4388. `emergency_phone` varchar(20) DEFAULT NULL COMMENT '紧急联系电话',
  4389. `leave_reason` text NOT NULL COMMENT '请假原因',
  4390. `leave_location` varchar(500) DEFAULT NULL COMMENT '请假时地理位置',
  4391. `attachment_oss_ids` text COMMENT '附件OSS文件ID(逗号分隔)',
  4392. `approval_status` char(100) NOT NULL DEFAULT '0' COMMENT '审批状态:"cancel", "已撤销" "draft", "草稿" "waiting", "待审核" "finish", "已完成" "invalid", "已作废" "back", "已退回" "termination", "已终止"',
  4393. `approval_opinion` varchar(500) DEFAULT NULL COMMENT '审批意见',
  4394. `approval_time` datetime DEFAULT NULL COMMENT '审批时间',
  4395. `approval_by` bigint(20) DEFAULT NULL COMMENT '审批人ID',
  4396. `approval_by_name` varchar(50) DEFAULT NULL COMMENT '审批人姓名',
  4397. `cancel_status` char(100) DEFAULT '0' COMMENT '销假状态:0-未销假,1-已销假,2-逾期未销假 3 - 无需销假 "cancel", "已撤销" "draft", "草稿" "waiting", "待审核" "finish", "已完成" "invalid", "已作废" "back", "已退回" "termination", "已终止"',
  4398. `cancel_time` datetime DEFAULT NULL COMMENT '销假时间',
  4399. `cancel_location` varchar(500) DEFAULT NULL COMMENT '销假地理位置',
  4400. `cancel_photo_oss_ids` text COMMENT '销假照片OSS文件ID(逗号分隔)',
  4401. `cancel_remark` varchar(500) DEFAULT NULL COMMENT '销假备注',
  4402. PRIMARY KEY (`id`) USING BTREE,
  4403. KEY `idx_tenant_id` (`tenant_id`) USING BTREE COMMENT '租户索引',
  4404. KEY `idx_student_id` (`student_id`) USING BTREE COMMENT '学生索引',
  4405. KEY `idx_student_no` (`student_no`) USING BTREE COMMENT '学号索引',
  4406. KEY `idx_class_id` (`class_id`) USING BTREE COMMENT '班级索引',
  4407. KEY `idx_college_id` (`college_id`) USING BTREE COMMENT '学院索引',
  4408. KEY `idx_leave_type_code` (`leave_type_code`) USING BTREE COMMENT '请假类型索引',
  4409. KEY `idx_start_time` (`start_time`) USING BTREE COMMENT '开始时间索引',
  4410. KEY `idx_end_time` (`end_time`) USING BTREE COMMENT '结束时间索引',
  4411. KEY `idx_approval_status` (`approval_status`) USING BTREE COMMENT '审批状态索引',
  4412. KEY `idx_cancel_status` (`cancel_status`) USING BTREE COMMENT '销假状态索引',
  4413. KEY `idx_create_time` (`create_time`) USING BTREE COMMENT '创建时间索引',
  4414. KEY `idx_is_leave_school` (`is_leave_school`) USING BTREE COMMENT '离校状态索引',
  4415. KEY `idx_need_cancel` (`need_cancel`) USING BTREE COMMENT '是否需要销假索引',
  4416. KEY `idx_student_time_range` (`student_id`,`start_time`,`end_time`) USING BTREE,
  4417. KEY `idx_class_approval_status` (`class_id`,`approval_status`) USING BTREE,
  4418. KEY `idx_college_leave_type` (`college_id`,`leave_type_code`) USING BTREE,
  4419. KEY `idx_time_approval_status` (`start_time`,`end_time`,`approval_status`) USING BTREE,
  4420. KEY `idx_need_cancel_status` (`need_cancel`,`cancel_status`) USING BTREE
  4421. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='学生请假表 - 记录学生的请假申请、审批和销假信息';
  4422. -- ----------------------------
  4423. -- Table structure for xg_student_manager
  4424. -- ----------------------------
  4425. DROP TABLE IF EXISTS `xg_student_manager`;
  4426. CREATE TABLE `xg_student_manager` (
  4427. `id` bigint(20) NOT NULL COMMENT '主键ID',
  4428. `manager_name` varchar(100) NOT NULL COMMENT '管理员姓名',
  4429. `manager_type` char(1) NOT NULL COMMENT '管理员类型(1 全校管理员 2 自定义管理员 3 班主任)',
  4430. `manager_level` int(11) DEFAULT '1' COMMENT '管理级别(1-3,1为最高)',
  4431. `user_id` bigint(20) DEFAULT NULL COMMENT '关联用户ID',
  4432. `phone` varchar(20) DEFAULT NULL COMMENT '联系电话',
  4433. `gender` char(1) DEFAULT '0' COMMENT '性别(0男 1女 2未知)',
  4434. `status` char(1) DEFAULT '0' COMMENT '状态(0正常 1停用)',
  4435. `deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  4436. `tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
  4437. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  4438. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  4439. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  4440. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  4441. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  4442. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  4443. PRIMARY KEY (`id`) USING BTREE,
  4444. KEY `idx_user_id` (`user_id`) USING BTREE,
  4445. KEY `idx_manager_type` (`manager_type`) USING BTREE
  4446. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='学生管理员信息表';
  4447. -- ----------------------------
  4448. -- Table structure for xg_student_manager_source
  4449. -- ----------------------------
  4450. DROP TABLE IF EXISTS `xg_student_manager_source`;
  4451. CREATE TABLE `xg_student_manager_source` (
  4452. `id` bigint(20) NOT NULL COMMENT '主键ID',
  4453. `manager_id` bigint(20) NOT NULL COMMENT '管理员ID',
  4454. `permission_type` char(1) DEFAULT '1' COMMENT '权限类型(1查看 2编辑 3完全管理)',
  4455. `auth_type` char(1) NOT NULL COMMENT '授权类型(1全校级 2自定义 3班主任)',
  4456. `auth_source` bigint(20) DEFAULT NULL COMMENT '授权来源ID(对应班级id)',
  4457. `status` char(1) DEFAULT '0' COMMENT '状态(0有效 1已撤销)',
  4458. `deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  4459. `tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
  4460. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  4461. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  4462. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  4463. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  4464. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  4465. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  4466. PRIMARY KEY (`id`) USING BTREE,
  4467. KEY `idx_manager_id` (`manager_id`) USING BTREE,
  4468. KEY `idx_auth_source` (`auth_source`) USING BTREE
  4469. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='学生管理员授权关系表';
  4470. -- ----------------------------
  4471. -- Table structure for xg_student_msg
  4472. -- ----------------------------
  4473. DROP TABLE IF EXISTS `xg_student_msg`;
  4474. CREATE TABLE `xg_student_msg` (
  4475. `id` bigint(20) NOT NULL COMMENT '主键ID(雪花ID)',
  4476. `tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
  4477. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  4478. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  4479. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  4480. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  4481. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  4482. `deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  4483. `student_no` varchar(32) NOT NULL COMMENT '学号',
  4484. `id_card` varchar(18) DEFAULT NULL COMMENT '身份证号',
  4485. `name` varchar(50) NOT NULL COMMENT '姓名',
  4486. `name_english` varchar(100) DEFAULT NULL COMMENT '英文姓名',
  4487. `former_name` varchar(50) DEFAULT NULL COMMENT '曾用名',
  4488. `gender` char(1) NOT NULL COMMENT '性别:0-男,1-女',
  4489. `birth_date` date DEFAULT NULL COMMENT '出生日期',
  4490. `nationality` varchar(20) DEFAULT NULL COMMENT '民族 ',
  4491. `native_place` varchar(20) DEFAULT NULL COMMENT '籍贯',
  4492. `political_status` varchar(20) DEFAULT NULL COMMENT '政治面貌',
  4493. `hukou_location` varchar(1000) DEFAULT NULL COMMENT '户籍所在地',
  4494. `home_address` varchar(1000) DEFAULT NULL COMMENT '家庭地址',
  4495. `current_address` varchar(1000) DEFAULT NULL COMMENT '现住址',
  4496. `postal_code` varchar(10) DEFAULT NULL COMMENT '邮政编码',
  4497. `photo_url` varchar(500) DEFAULT NULL COMMENT '照片URL',
  4498. `photo_path` varchar(500) DEFAULT NULL COMMENT '学生照片存储路径',
  4499. `phone` varchar(20) DEFAULT NULL COMMENT '手机号码',
  4500. `is_boarder` tinyint(1) DEFAULT '0' COMMENT '是否住校:0-否,1-是',
  4501. `education_level` varchar(20) DEFAULT NULL COMMENT '文化程度',
  4502. `household_register_type` varchar(20) DEFAULT NULL COMMENT '户口类型:农业、非农业',
  4503. `religion` varchar(200) DEFAULT NULL COMMENT '宗教信仰',
  4504. `source_region` varchar(100) DEFAULT NULL COMMENT '生源地区(省市县)',
  4505. `graduate_school` varchar(100) DEFAULT NULL COMMENT '毕业院校',
  4506. `email` varchar(100) DEFAULT NULL COMMENT '电子邮箱',
  4507. `qq` varchar(20) DEFAULT NULL COMMENT 'QQ号码',
  4508. `wechat` varchar(50) DEFAULT NULL COMMENT '微信号',
  4509. `marital_status` varchar(10) DEFAULT NULL COMMENT '婚姻状况:1 未婚、2 已婚、3 离异、4 丧偶 ',
  4510. `emergency_contact_name` varchar(50) DEFAULT NULL COMMENT '紧急联系人姓名',
  4511. `emergency_contact_phone` varchar(20) DEFAULT NULL COMMENT '紧急联系人电话',
  4512. `emergency_contact_relation` varchar(100) DEFAULT NULL COMMENT '紧急联系人关系',
  4513. `is_poor_student` tinyint(1) DEFAULT '0' COMMENT '是否贫困生:0-否,1-是',
  4514. `is_minority` tinyint(1) DEFAULT '0' COMMENT '是否少数民族:0-否,1-是',
  4515. `is_disabled` tinyint(1) DEFAULT '0' COMMENT '是否残疾:0-否,1-是',
  4516. `is_orphan` tinyint(1) DEFAULT '0' COMMENT '是否孤儿:0-否,1-是',
  4517. `is_left_behind_child` tinyint(1) DEFAULT '0' COMMENT '是否留守儿童:0-否,1-是',
  4518. `is_single_child` tinyint(1) DEFAULT '0' COMMENT '是否独生子女:0-否,1-是',
  4519. `is_low_income` tinyint(1) DEFAULT '0' COMMENT '是否低保:0-否,1-是',
  4520. `has_loan` tinyint(1) DEFAULT '0' COMMENT '是否有助学贷款:0-否,1-是',
  4521. `loan_amount` decimal(10,2) DEFAULT NULL COMMENT '助学贷款金额',
  4522. `specialties` text COMMENT '特长爱好',
  4523. `awards` text COMMENT '获奖情况',
  4524. `violations` text COMMENT '违纪记录',
  4525. `social_activities` text COMMENT '社会活动',
  4526. `father_name` varchar(50) DEFAULT NULL COMMENT '父亲姓名',
  4527. `father_phone` varchar(20) DEFAULT NULL COMMENT '父亲电话',
  4528. `father_work_unit` varchar(1000) DEFAULT NULL COMMENT '父亲工作单位',
  4529. `mother_name` varchar(50) DEFAULT NULL COMMENT '母亲姓名',
  4530. `mother_phone` varchar(20) DEFAULT NULL COMMENT '母亲电话',
  4531. `mother_work_unit` varchar(1000) DEFAULT NULL COMMENT '母亲工作单位',
  4532. `guardian_name` varchar(50) DEFAULT NULL COMMENT '监护人姓名',
  4533. `guardian_phone` varchar(20) DEFAULT NULL COMMENT '监护人电话',
  4534. `guardian_relation` varchar(20) DEFAULT NULL COMMENT '监护人关系',
  4535. `family_income` decimal(12,2) DEFAULT NULL COMMENT '家庭年收入',
  4536. `per_capita_income` decimal(12,2) DEFAULT NULL COMMENT '人均收入',
  4537. `income_source` varchar(100) DEFAULT NULL COMMENT '收入来源',
  4538. `family_economic_status` varchar(20) DEFAULT NULL COMMENT '家庭经济状况:富裕、一般、困难、特困',
  4539. `family_members` tinyint(2) DEFAULT NULL COMMENT '家庭成员数量',
  4540. `height` decimal(10,2) DEFAULT NULL COMMENT '身高(cm)',
  4541. `weight` decimal(10,2) DEFAULT NULL COMMENT '体重(kg)',
  4542. `blood_type` varchar(10) DEFAULT NULL COMMENT '血型',
  4543. `health_status` varchar(1000) DEFAULT NULL COMMENT '健康状况',
  4544. `special_condition` varchar(1000) DEFAULT NULL COMMENT '特殊体质或疾病',
  4545. `medical_history` varchar(1000) DEFAULT NULL COMMENT '病史',
  4546. `allergies` varchar(1000) DEFAULT NULL COMMENT '过敏史',
  4547. `disability_type` varchar(50) DEFAULT NULL COMMENT '残疾类型 1 - 视力残疾 2 - 听力残疾 3 - 智力残疾 9 - 其他残疾',
  4548. `disability_level` varchar(20) DEFAULT NULL COMMENT '残疾等级',
  4549. `admission_category` varchar(20) DEFAULT NULL COMMENT '录取类别:统招、自主招生、专项计划等',
  4550. `student_status` char(1) DEFAULT '1' COMMENT '学籍状态:1-在籍,2-休学,3-复学,4-退学,5-毕业',
  4551. `enrollment_year` int(4) DEFAULT NULL COMMENT '入学年份',
  4552. `enrollment_date` date DEFAULT NULL COMMENT '入学日期',
  4553. `bank_card_no` varchar(30) DEFAULT NULL COMMENT '银行卡号',
  4554. `bank_name` varchar(100) DEFAULT NULL COMMENT '开户银行',
  4555. `bank_branch` varchar(100) DEFAULT NULL COMMENT '开户支行',
  4556. `card_holder_name` varchar(50) DEFAULT NULL COMMENT '持卡人姓名',
  4557. `info_status` char(1) DEFAULT '1' COMMENT '信息状态:1-正常,2-待审核,3-审核中,4-已驳回,5-已锁定',
  4558. `data_source` varchar(20) DEFAULT 'manual' COMMENT '数据来源:manual-手工录入,import-批量导入,sync-系统同步',
  4559. `last_batch_id` bigint(20) DEFAULT NULL COMMENT '最后修改批次ID',
  4560. `last_audit_time` datetime DEFAULT NULL COMMENT '最后审核时间',
  4561. `is_complete` tinyint(1) DEFAULT '0' COMMENT '信息是否完整:0-不完整,1-完整',
  4562. `completion_rate` decimal(10,2) DEFAULT '0.00' COMMENT '完整度百分比',
  4563. `school_system` int(2) DEFAULT '4' COMMENT '学制(年)- 预留,数据从班级表关联',
  4564. `academic_level` varchar(20) DEFAULT NULL COMMENT '学历层次 - 预留,数据从班级表关联',
  4565. `training_type` varchar(20) DEFAULT NULL COMMENT '培养方式:全日制、在职、函授、夜大等 - 预留,数据从班级表关联',
  4566. `major_id` varchar(100) DEFAULT NULL COMMENT '专业id - 预留,数据从班级表关联',
  4567. `major_name` varchar(100) DEFAULT NULL COMMENT '专业名称 - 预留,数据从班级表关联',
  4568. `class_id` varchar(100) DEFAULT NULL COMMENT '班级id - 预留,数据从班级表关联',
  4569. `class_name` varchar(100) DEFAULT NULL COMMENT '班级名称 - 预留,数据从班级表关联',
  4570. `grade` varchar(10) DEFAULT NULL COMMENT '年级 - 预留,数据从班级表关联',
  4571. `college_id` varchar(100) DEFAULT NULL COMMENT '学院id - 预留,数据从班级表关联',
  4572. `college_name` varchar(100) DEFAULT NULL COMMENT '学院名称 - 预留,数据从班级表关联',
  4573. `counselor_id` bigint(20) DEFAULT NULL COMMENT '辅导员ID - 预留,数据从班级表关联',
  4574. `counselor_name` varchar(50) DEFAULT NULL COMMENT '辅导员姓名 - 预留,数据从班级表关联',
  4575. `class_teacher_id` bigint(20) DEFAULT NULL COMMENT '班主任ID - 预留,数据从班级表关联',
  4576. `class_teacher_name` varchar(50) DEFAULT NULL COMMENT '班主任姓名 - 预留,数据从班级表关联',
  4577. `dormitory_building` varchar(100) DEFAULT NULL COMMENT '宿舍楼栋 - 预留,数据从班级表关联 楼栋id',
  4578. `dormitory_room` varchar(100) DEFAULT NULL COMMENT '宿舍房间号 - 预留,数据从班级表关联 房间id',
  4579. `ext_field1` varchar(200) DEFAULT NULL COMMENT '扩展字段1 - 床位id',
  4580. `ext_field2` varchar(200) DEFAULT NULL COMMENT '扩展字段2',
  4581. `ext_field3` varchar(200) DEFAULT NULL COMMENT '扩展字段3',
  4582. `ext_field4` varchar(200) DEFAULT NULL COMMENT '扩展字段4',
  4583. `ext_field5` varchar(500) DEFAULT NULL COMMENT '扩展字段5',
  4584. `remark` varchar(500) DEFAULT NULL COMMENT '备注信息',
  4585. PRIMARY KEY (`id`) USING BTREE,
  4586. KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
  4587. KEY `idx_deleted` (`deleted`) USING BTREE,
  4588. KEY `idx_name` (`name`) USING BTREE,
  4589. KEY `idx_student_status` (`student_status`) USING BTREE,
  4590. KEY `idx_info_status` (`info_status`) USING BTREE,
  4591. KEY `idx_enrollment_year` (`enrollment_year`) USING BTREE,
  4592. KEY `idx_last_batch_id` (`last_batch_id`) USING BTREE,
  4593. KEY `idx_phone` (`phone`) USING BTREE,
  4594. KEY `idx_create_time` (`create_time`) USING BTREE,
  4595. KEY `idx_status_filter` (`tenant_id`,`student_status`,`info_status`,`deleted`) USING BTREE,
  4596. KEY `uk_student_no_tenant` (`student_no`,`tenant_id`) USING BTREE,
  4597. KEY `uk_id_card_tenant` (`id_card`,`tenant_id`) USING BTREE
  4598. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='学生信息表';
  4599. -- ----------------------------
  4600. -- Table structure for xg_student_msg_batch
  4601. -- ----------------------------
  4602. DROP TABLE IF EXISTS `xg_student_msg_batch`;
  4603. CREATE TABLE `xg_student_msg_batch` (
  4604. `id` bigint(20) NOT NULL COMMENT '主键ID(雪花ID)',
  4605. `tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
  4606. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  4607. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  4608. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  4609. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  4610. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  4611. `deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  4612. `student_no` varchar(32) NOT NULL COMMENT '学号',
  4613. `id_card` varchar(18) DEFAULT NULL COMMENT '身份证号',
  4614. `name` varchar(50) NOT NULL COMMENT '姓名',
  4615. `name_english` varchar(100) DEFAULT NULL COMMENT '英文姓名',
  4616. `former_name` varchar(50) DEFAULT NULL COMMENT '曾用名',
  4617. `gender` char(1) NOT NULL COMMENT '性别:0-男,1-女',
  4618. `birth_date` date DEFAULT NULL COMMENT '出生日期',
  4619. `nationality` varchar(20) DEFAULT NULL COMMENT '民族 ',
  4620. `native_place` varchar(20) DEFAULT NULL COMMENT '籍贯',
  4621. `political_status` varchar(20) DEFAULT NULL COMMENT '政治面貌',
  4622. `hukou_location` varchar(1000) DEFAULT NULL COMMENT '户籍所在地',
  4623. `home_address` varchar(1000) DEFAULT NULL COMMENT '家庭地址',
  4624. `current_address` varchar(1000) DEFAULT NULL COMMENT '现住址',
  4625. `postal_code` varchar(10) DEFAULT NULL COMMENT '邮政编码',
  4626. `photo_url` varchar(500) DEFAULT NULL COMMENT '照片URL',
  4627. `photo_path` varchar(500) DEFAULT NULL COMMENT '学生照片存储路径',
  4628. `phone` varchar(20) DEFAULT NULL COMMENT '手机号码',
  4629. `is_boarder` tinyint(1) DEFAULT '0' COMMENT '是否住校:0-否,1-是',
  4630. `education_level` varchar(20) DEFAULT NULL COMMENT '文化程度',
  4631. `household_register_type` varchar(20) DEFAULT NULL COMMENT '户口类型:农业、非农业',
  4632. `religion` varchar(200) DEFAULT NULL COMMENT '宗教信仰',
  4633. `source_region` varchar(100) DEFAULT NULL COMMENT '生源地区(省市县)',
  4634. `graduate_school` varchar(100) DEFAULT NULL COMMENT '毕业院校',
  4635. `email` varchar(100) DEFAULT NULL COMMENT '电子邮箱',
  4636. `qq` varchar(20) DEFAULT NULL COMMENT 'QQ号码',
  4637. `wechat` varchar(50) DEFAULT NULL COMMENT '微信号',
  4638. `marital_status` varchar(10) DEFAULT NULL COMMENT '婚姻状况:1 未婚、2 已婚、3 离异、4 丧偶 ',
  4639. `emergency_contact_name` varchar(50) DEFAULT NULL COMMENT '紧急联系人姓名',
  4640. `emergency_contact_phone` varchar(20) DEFAULT NULL COMMENT '紧急联系人电话',
  4641. `emergency_contact_relation` varchar(100) DEFAULT NULL COMMENT '紧急联系人关系',
  4642. `is_poor_student` tinyint(1) DEFAULT '0' COMMENT '是否贫困生:0-否,1-是',
  4643. `is_minority` tinyint(1) DEFAULT '0' COMMENT '是否少数民族:0-否,1-是',
  4644. `is_disabled` tinyint(1) DEFAULT '0' COMMENT '是否残疾:0-否,1-是',
  4645. `is_orphan` tinyint(1) DEFAULT '0' COMMENT '是否孤儿:0-否,1-是',
  4646. `is_left_behind_child` tinyint(1) DEFAULT '0' COMMENT '是否留守儿童:0-否,1-是',
  4647. `is_single_child` tinyint(1) DEFAULT '0' COMMENT '是否独生子女:0-否,1-是',
  4648. `is_low_income` tinyint(1) DEFAULT '0' COMMENT '是否低保:0-否,1-是',
  4649. `has_loan` tinyint(1) DEFAULT '0' COMMENT '是否有助学贷款:0-否,1-是',
  4650. `loan_amount` decimal(10,2) DEFAULT NULL COMMENT '助学贷款金额',
  4651. `specialties` text COMMENT '特长爱好',
  4652. `awards` text COMMENT '获奖情况',
  4653. `violations` text COMMENT '违纪记录',
  4654. `social_activities` text COMMENT '社会活动',
  4655. `father_name` varchar(50) DEFAULT NULL COMMENT '父亲姓名',
  4656. `father_phone` varchar(20) DEFAULT NULL COMMENT '父亲电话',
  4657. `father_work_unit` varchar(1000) DEFAULT NULL COMMENT '父亲工作单位',
  4658. `mother_name` varchar(50) DEFAULT NULL COMMENT '母亲姓名',
  4659. `mother_phone` varchar(20) DEFAULT NULL COMMENT '母亲电话',
  4660. `mother_work_unit` varchar(1000) DEFAULT NULL COMMENT '母亲工作单位',
  4661. `guardian_name` varchar(50) DEFAULT NULL COMMENT '监护人姓名',
  4662. `guardian_phone` varchar(20) DEFAULT NULL COMMENT '监护人电话',
  4663. `guardian_relation` varchar(20) DEFAULT NULL COMMENT '监护人关系',
  4664. `family_income` decimal(12,2) DEFAULT NULL COMMENT '家庭年收入',
  4665. `per_capita_income` decimal(12,2) DEFAULT NULL COMMENT '人均收入',
  4666. `income_source` varchar(100) DEFAULT NULL COMMENT '收入来源',
  4667. `family_economic_status` varchar(20) DEFAULT NULL COMMENT '家庭经济状况:富裕、一般、困难、特困',
  4668. `family_members` tinyint(2) DEFAULT NULL COMMENT '家庭成员数量',
  4669. `height` decimal(10,2) DEFAULT NULL COMMENT '身高(cm)',
  4670. `weight` decimal(10,2) DEFAULT NULL COMMENT '体重(kg)',
  4671. `blood_type` varchar(10) DEFAULT NULL COMMENT '血型',
  4672. `health_status` varchar(1000) DEFAULT NULL COMMENT '健康状况',
  4673. `special_condition` varchar(1000) DEFAULT NULL COMMENT '特殊体质或疾病',
  4674. `medical_history` varchar(1000) DEFAULT NULL COMMENT '病史',
  4675. `allergies` varchar(1000) DEFAULT NULL COMMENT '过敏史',
  4676. `disability_type` varchar(50) DEFAULT NULL COMMENT '残疾类型 1 - 视力残疾 2 - 听力残疾 3 - 智力残疾 9 - 其他残疾',
  4677. `disability_level` varchar(20) DEFAULT NULL COMMENT '残疾等级',
  4678. `admission_category` varchar(20) DEFAULT NULL COMMENT '录取类别:统招、自主招生、专项计划等',
  4679. `student_status` char(1) DEFAULT '1' COMMENT '学籍状态:1-在籍,2-休学,3-复学,4-退学,5-毕业',
  4680. `enrollment_year` int(4) DEFAULT NULL COMMENT '入学年份',
  4681. `enrollment_date` date DEFAULT NULL COMMENT '入学日期',
  4682. `bank_card_no` varchar(30) DEFAULT NULL COMMENT '银行卡号',
  4683. `bank_name` varchar(100) DEFAULT NULL COMMENT '开户银行',
  4684. `bank_branch` varchar(100) DEFAULT NULL COMMENT '开户支行',
  4685. `card_holder_name` varchar(50) DEFAULT NULL COMMENT '持卡人姓名',
  4686. `info_status` char(1) DEFAULT '1' COMMENT '信息状态:1-正常,2-待审核,3-审核中,4-已驳回,5-已锁定',
  4687. `data_source` varchar(20) DEFAULT 'manual' COMMENT '数据来源:manual-手工录入,import-批量导入,sync-系统同步',
  4688. `last_batch_id` bigint(20) DEFAULT NULL COMMENT '最后修改批次ID',
  4689. `last_audit_time` datetime DEFAULT NULL COMMENT '最后审核时间',
  4690. `is_complete` tinyint(1) DEFAULT '0' COMMENT '信息是否完整:0-不完整,1-完整',
  4691. `completion_rate` decimal(10,2) DEFAULT '0.00' COMMENT '完整度百分比',
  4692. `school_system` int(2) DEFAULT '4' COMMENT '学制(年)- 预留,数据从班级表关联',
  4693. `academic_level` varchar(20) DEFAULT NULL COMMENT '学历层次 - 预留,数据从班级表关联',
  4694. `training_type` varchar(20) DEFAULT NULL COMMENT '培养方式:全日制、在职、函授、夜大等 - 预留,数据从班级表关联',
  4695. `major_id` varchar(100) DEFAULT NULL COMMENT '专业id - 预留,数据从班级表关联',
  4696. `major_name` varchar(100) DEFAULT NULL COMMENT '专业名称 - 预留,数据从班级表关联',
  4697. `class_id` varchar(100) DEFAULT NULL COMMENT '班级id - 预留,数据从班级表关联',
  4698. `class_name` varchar(100) DEFAULT NULL COMMENT '班级名称 - 预留,数据从班级表关联',
  4699. `grade` varchar(10) DEFAULT NULL COMMENT '年级 - 预留,数据从班级表关联',
  4700. `college_id` varchar(100) DEFAULT NULL COMMENT '学院id - 预留,数据从班级表关联',
  4701. `college_name` varchar(100) DEFAULT NULL COMMENT '学院名称 - 预留,数据从班级表关联',
  4702. `counselor_id` bigint(20) DEFAULT NULL COMMENT '辅导员ID - 预留,数据从班级表关联',
  4703. `counselor_name` varchar(50) DEFAULT NULL COMMENT '辅导员姓名 - 预留,数据从班级表关联',
  4704. `class_teacher_id` bigint(20) DEFAULT NULL COMMENT '班主任ID - 预留,数据从班级表关联',
  4705. `class_teacher_name` varchar(50) DEFAULT NULL COMMENT '班主任姓名 - 预留,数据从班级表关联',
  4706. `dormitory_building` varchar(100) DEFAULT NULL COMMENT '宿舍楼栋 - 预留,数据从班级表关联 楼栋id',
  4707. `dormitory_room` varchar(100) DEFAULT NULL COMMENT '宿舍房间号 - 预留,数据从班级表关联 房间id',
  4708. `ext_field1` varchar(200) DEFAULT NULL COMMENT '扩展字段1 - 床位id',
  4709. `ext_field2` varchar(200) DEFAULT NULL COMMENT '扩展字段2',
  4710. `ext_field3` varchar(200) DEFAULT NULL COMMENT '扩展字段3',
  4711. `ext_field4` varchar(200) DEFAULT NULL COMMENT '扩展字段4',
  4712. `ext_field5` varchar(500) DEFAULT NULL COMMENT '扩展字段5',
  4713. `remark` varchar(500) DEFAULT NULL COMMENT '备注信息',
  4714. `batch_id` bigint(20) NOT NULL COMMENT '正在进行中的批次id',
  4715. KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
  4716. KEY `idx_deleted` (`deleted`) USING BTREE,
  4717. KEY `idx_name` (`name`) USING BTREE,
  4718. KEY `idx_student_status` (`student_status`) USING BTREE,
  4719. KEY `idx_info_status` (`info_status`) USING BTREE,
  4720. KEY `idx_enrollment_year` (`enrollment_year`) USING BTREE,
  4721. KEY `idx_last_batch_id` (`last_batch_id`) USING BTREE,
  4722. KEY `idx_phone` (`phone`) USING BTREE,
  4723. KEY `idx_create_time` (`create_time`) USING BTREE,
  4724. KEY `idx_status_filter` (`tenant_id`,`student_status`,`info_status`,`deleted`) USING BTREE,
  4725. KEY `uk_student_no_tenant` (`student_no`,`tenant_id`) USING BTREE,
  4726. KEY `uk_id_card_tenant` (`id_card`,`tenant_id`) USING BTREE
  4727. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='学生信息批次收集表';
  4728. SET FOREIGN_KEY_CHECKS = 1;