12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331 |
- # -*- coding: utf-8 -*-
- from sqlalchemy import String, Column, Integer,DateTime,Text,BigInteger,Boolean,PrimaryKeyConstraint,Index,UniqueConstraint,CHAR,LargeBinary,TIMESTAMP
- from sqlalchemy.dialects.mysql import TINYINT
- from sqlalchemy.sql import func
- from database import Base
- from datetime import datetime
- '''社会化关系表'''
- class SysSocial(Base):
- __tablename__ = 'sys_social'
- id = Column(BigInteger, primary_key=True,autoincrement=True, comment='主键')
- user_id = Column(BigInteger, nullable=False, comment='用户ID')
- tenant_id = Column(String(20), default=None, comment='租户id')
- auth_id = Column(String(255), nullable=False, comment='平台+平台唯一id')
- source = Column(String(255), nullable=False, comment='用户来源')
- open_id = Column(String(255), default=None, comment='平台编号唯一id')
- user_name = Column(String(30), nullable=False, comment='登录账号')
- nick_name = Column(String(30), default='', comment='用户昵称')
- email = Column(String(255), default='', comment='用户邮箱')
- avatar = Column(String(500), default='', comment='头像地址')
- access_token = Column(String(255), nullable=False, comment='用户的授权令牌')
- expire_in = Column(Integer, default=None, comment='用户的授权令牌的有效期')
- refresh_token = Column(String(255), default=None, comment='刷新令牌')
- access_code = Column(String(255), default=None, comment='平台的授权信息')
- union_id = Column(String(255), default=None, comment='用户的 unionid')
- scope = Column(String(255), default=None, comment='授予的权限')
- token_type = Column(String(255), default=None, comment='个别平台的授权信息')
- id_token = Column(String(2000), default=None, comment='id token')
- mac_algorithm = Column(String(255), default=None, comment='小米平台用户的附带属性')
- mac_key = Column(String(255), default=None, comment='小米平台用户的附带属性')
- code = Column(String(255), default=None, comment='用户的授权code')
- oauth_token = Column(String(255), default=None, comment='Twitter平台用户的附带属性')
- oauth_token_secret = Column(String(255), default=None, comment='Twitter平台用户的附带属性')
- create_dept = Column(BigInteger, comment='创建部门')
- create_by = Column(BigInteger, comment='创建者')
- create_time = Column(DateTime, comment='创建时间')
- update_by = Column(BigInteger, comment='更新者')
- update_time = Column(DateTime, comment='更新时间')
- del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
- class Config:
- orm_mode = True
- '''租户表'''
- class SysTenant(Base):
- __tablename__ = 'sys_tenant'
- id = Column(BigInteger, primary_key=True,autoincrement=True, comment='id')
- tenant_id = Column(String(20), nullable=False, comment='租户编号')
- contact_user_name = Column(String(20), comment='联系人')
- contact_phone = Column(String(20), comment='联系电话')
- company_name = Column(String(50), comment='企业名称')
- license_number = Column(String(30), comment='统一社会信用代码')
- address = Column(String(200), comment='地址')
- intro = Column(String(200), comment='企业简介')
- domain = Column(String(200), comment='域名')
- remark = Column(String(200), comment='备注')
- package_id = Column(BigInteger, comment='租户套餐编号')
- expire_time = Column(DateTime, comment='过期时间')
- account_count = Column(Integer, default=-1, comment='用户数量(-1不限制)')
- status = Column(String(1), default='0', comment='租户状态(0正常 1停用)')
- del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
- create_dept = Column(BigInteger, comment='创建部门')
- create_by = Column(BigInteger, comment='创建者')
- create_time = Column(DateTime, comment='创建时间')
- update_by = Column(BigInteger, comment='更新者')
- update_time = Column(DateTime, comment='更新时间')
- class Config:
- orm_mode = True
- '''租户套餐表'''
- class SysTenantPackage(Base):
- __tablename__ = 'sys_tenant_package'
- package_id = Column(BigInteger, primary_key=True,autoincrement=True, comment='租户套餐id')
- package_name = Column(String(20), comment='套餐名称')
- menu_ids = Column(String(3000), comment='关联菜单id')
- remark = Column(String(200), comment='备注')
- menu_check_strictly = Column(Integer, default=1, comment='菜单树选择项是否关联显示')
- status = Column(String(1), default='0', comment='状态(0正常 1停用)')
- del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
- create_dept = Column(BigInteger, comment='创建部门')
- create_by = Column(BigInteger, comment='创建者')
- create_time = Column(DateTime, comment='创建时间')
- update_by = Column(BigInteger, comment='更新者')
- update_time = Column(DateTime, comment='更新时间')
- class Config:
- orm_mode = True
- '''部门表'''
- class SysDept(Base):
- __tablename__ = 'sys_dept'
- dept_id = Column(BigInteger, primary_key=True,autoincrement=True, comment='部门id')
- tenant_id = Column(String(20), default='000000', comment='租户编号')
- parent_id = Column(BigInteger, default=0, comment='父部门id')
- ancestors = Column(String(500), default='', comment='祖级列表')
- dept_name = Column(String(30), default='', comment='部门名称')
- dept_category = Column(String(100), default=None, comment='部门类别编码')
- order_num = Column(Integer, default=0, comment='显示顺序')
- leader = Column(BigInteger, default=None, comment='负责人')
- phone = Column(String(11), default=None, comment='联系电话')
- email = Column(String(50), default=None, comment='邮箱')
- status = Column(String(1), default='0', comment='部门状态(0正常 1停用)')
- del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
- create_dept = Column(BigInteger, default=None, comment='创建部门')
- create_by = Column(BigInteger, default=None, comment='创建者')
- create_time = Column(DateTime, comment='创建时间')
- update_by = Column(BigInteger, default=None, comment='更新者')
- update_time = Column(DateTime, comment='更新时间')
- class Config:
- orm_mode = True
- '''用户信息表'''
- class SysUser(Base):
- __tablename__ = 'sys_user'
- user_id = Column(BigInteger, primary_key=True,autoincrement=True, comment='用户ID')
- tenant_id = Column(String(20), default='000000', comment='租户编号')
- dept_id = Column(BigInteger, default=None, comment='部门ID')
- user_name = Column(String(30), nullable=False, comment='用户账号')
- nick_name = Column(String(30), nullable=False, comment='用户昵称')
- user_type = Column(String(10), default='sys_user', comment='用户类型(sys_user系统用户)')
- email = Column(String(50), default='', comment='用户邮箱')
- phonenumber = Column(String(11), default='', comment='手机号码')
- sex = Column(String(1), default='0', comment='用户性别(0男 1女 2未知)')
- avatar = Column(BigInteger, comment='头像地址')
- password = Column(String(100), default='', comment='密码')
- status = Column(String(1), default='0', comment='帐号状态(0正常 1停用)')
- del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
- login_ip = Column(String(128), default='', comment='最后登录IP')
- login_date = Column(DateTime, comment='最后登录时间')
- create_dept = Column(BigInteger, default=None, comment='创建部门')
- create_by = Column(BigInteger, default=None, comment='创建者')
- create_time = Column(DateTime, comment='创建时间')
- update_by = Column(BigInteger, default=None, comment='更新者')
- update_time = Column(DateTime, comment='更新时间')
- remark = Column(String(500), default=None, comment='备注')
- class Config:
- orm_mode = True
- '''岗位信息表'''
- class SysPost(Base):
- __tablename__ = 'sys_post'
- post_id = Column(BigInteger, primary_key=True,autoincrement=True, comment='岗位ID')
- tenant_id = Column(String(20), default='000000', comment='租户编号')
- dept_id = Column(BigInteger, nullable=False, comment='部门id')
- post_code = Column(String(64), nullable=False, comment='岗位编码')
- post_category = Column(String(100), default=None, comment='岗位类别编码')
- post_name = Column(String(50), nullable=False, comment='岗位名称')
- post_sort = Column(Integer, nullable=False, comment='显示顺序')
- status = Column(String(1), nullable=False, comment='状态(0正常 1停用)')
- create_dept = Column(BigInteger, default=None, comment='创建部门')
- create_by = Column(BigInteger, default=None, comment='创建者')
- create_time = Column(DateTime, comment='创建时间')
- update_by = Column(BigInteger, default=None, comment='更新者')
- update_time = Column(DateTime, comment='更新时间')
- remark = Column(String(500), default=None, comment='备注')
- class Config:
- orm_mode = True
- '''角色信息表'''
- class SysRole(Base):
- __tablename__ = 'sys_role'
- role_id = Column(BigInteger, primary_key=True,autoincrement=True, comment='角色ID')
- tenant_id = Column(String(20), default='000000', comment='租户编号')
- role_name = Column(String(30), nullable=False, comment='角色名称')
- role_key = Column(String(100), nullable=False, comment='角色权限字符串')
- role_sort = Column(Integer, nullable=False, comment='显示顺序')
- data_scope = Column(String(1), default='1', comment='数据范围')
- menu_check_strictly = Column(Boolean, default=True, comment='菜单树选择项是否关联显示')
- dept_check_strictly = Column(Boolean, default=True, comment='部门树选择项是否关联显示')
- status = Column(String(1), nullable=False, comment='角色状态(0正常 1停用)')
- del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
- create_dept = Column(BigInteger, default=None, comment='创建部门')
- create_by = Column(BigInteger, default=None, comment='创建者')
- create_time = Column(DateTime, comment='创建时间')
- update_by = Column(BigInteger, default=None, comment='更新者')
- update_time = Column(DateTime, comment='更新时间')
- remark = Column(String(500), default=None, comment='备注')
- class Config:
- orm_mode = True
- '''菜单权限表'''
- class SysMenu(Base):
- __tablename__ = 'sys_menu'
- menu_id = Column(BigInteger, primary_key=True,autoincrement=True, comment='菜单ID')
- menu_name = Column(String(50), nullable=False, comment='菜单名称')
- parent_id = Column(BigInteger, default=0, comment='父菜单ID')
- order_num = Column(Integer, default=0, comment='显示顺序')
- path = Column(String(200), default='', comment='路由地址')
- component = Column(String(255), default=None, comment='组件路径')
- query_param = Column(String(255), default=None, comment='路由参数')
- is_frame = Column(Integer, default=1, comment='是否为外链(0是 1否)')
- is_cache = Column(Integer, default=0, comment='是否缓存(0缓存 1不缓存)')
- menu_type = Column(String(1), default='', comment='菜单类型(M目录 C菜单 F按钮)')
- visible = Column(String(1), default='0', comment='显示状态(0显示 1隐藏)')
- status = Column(String(1), default='0', comment='菜单状态(0正常 1停用)')
- perms = Column(String(100), default=None, comment='权限标识')
- icon = Column(String(100), default='#', comment='菜单图标')
- create_dept = Column(BigInteger, default=None, comment='创建部门')
- create_by = Column(BigInteger, default=None, comment='创建者')
- create_time = Column(DateTime, default=datetime.now, comment='创建时间')
- update_by = Column(BigInteger, default=None, comment='更新者')
- update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间')
- remark = Column(String(500), default='', comment='备注')
- del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
- class Config:
- orm_mode = True
- '''用户和角色关联表'''
- class SysUserRole(Base):
- __tablename__ = 'sys_user_role'
- __table_args__ = (PrimaryKeyConstraint('role_id', 'user_id'),)
- user_id = Column(BigInteger, nullable=True, comment='用户ID')
- role_id = Column(BigInteger, nullable=True, comment='角色ID')
- class Config:
- orm_mode = True
- '''角色和菜单关联表'''
- class SysRoleMenu(Base):
- __tablename__ = 'sys_role_menu'
- __table_args__ = (PrimaryKeyConstraint('role_id', 'menu_id'),)
- role_id = Column(BigInteger, nullable=False, comment='角色ID')
- menu_id = Column(BigInteger, nullable=False, comment='菜单ID')
- class Config:
- orm_mode = True
- '''角色和部门关联表'''
- class SysRoleDept(Base):
- __tablename__ = 'sys_role_dept'
- __table_args__ = (PrimaryKeyConstraint('role_id', 'dept_id'),)
- role_id = Column(BigInteger, nullable=False, comment='角色ID')
- dept_id = Column(BigInteger, nullable=False, comment='部门ID')
- class Config:
- orm_mode = True
- '''用户与岗位关联表'''
- class SysUserPost(Base):
- __tablename__ = 'sys_user_post'
- __table_args__ = (PrimaryKeyConstraint('user_id', 'post_id'),)
- user_id = Column(BigInteger, nullable=False, comment='用户ID')
- post_id = Column(BigInteger, nullable=False, comment='岗位ID')
- class Config:
- orm_mode = True
- '''操作日志记录'''
- class SysOperLog(Base):
- __tablename__ = 'sys_oper_log'
- __table_args__ = (
- Index('idx_sys_oper_log_bt', 'business_type'),
- Index('idx_sys_oper_log_s', 'status'),
- Index('idx_sys_oper_log_ot', 'oper_time'),
- )
- oper_id = Column(BigInteger, primary_key=True,autoincrement=True, comment='日志主键')
- tenant_id = Column(String(20), default='000000', comment='租户编号')
- title = Column(String(50), default='', comment='模块标题')
- business_type = Column(Integer, default=0, comment='业务类型(0其它 1新增 2修改 3删除)')
- method = Column(String(100), default='', comment='方法名称')
- request_method = Column(String(10), default='', comment='请求方式')
- operator_type = Column(Integer, default=0, comment='操作类别(0其它 1后台用户 2手机端用户)')
- oper_name = Column(String(50), default='', comment='操作人员')
- dept_name = Column(String(50), default='', comment='部门名称')
- oper_url = Column(String(255), default='', comment='请求URL')
- oper_ip = Column(String(128), default='', comment='主机地址')
- oper_location = Column(String(255), default='', comment='操作地点')
- oper_param = Column(Text, default='', comment='请求参数')
- json_result = Column(Text, default='', comment='返回参数')
- status = Column(Integer, default=0, comment='操作状态(0正常 1异常)')
- error_msg = Column(String(2000), default='', comment='错误消息')
- oper_time = Column(DateTime, comment='操作时间')
- cost_time = Column(BigInteger, default=0, comment='消耗时间')
- class Config:
- orm_mode = True
- '''字典类型表'''
- class SysDictType(Base):
- __tablename__ = 'sys_dict_type'
- dict_id = Column(BigInteger, primary_key=True,autoincrement=True, comment='字典主键')
- tenant_id = Column(String(20), default='000000', comment='租户编号')
- dict_name = Column(String(100), default='', comment='字典名称')
- dict_type = Column(String(100), default='', comment='字典类型')
- create_dept = Column(BigInteger, default=None, comment='创建部门')
- create_by = Column(BigInteger, default=None, comment='创建者')
- create_time = Column(DateTime, comment='创建时间')
- update_by = Column(BigInteger, default=None, comment='更新者')
- update_time = Column(DateTime, comment='更新时间')
- remark = Column(String(500), default=None, comment='备注')
- del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
- # 定义唯一性约束条件
- __table_args__ = (UniqueConstraint('tenant_id', 'dict_type', name='uq_sys_dict_type_tenant_type'),)
- class Config:
- orm_mode = True
- '''字典数据表'''
- class SysDictData(Base):
- __tablename__ = 'sys_dict_data'
- dict_code = Column(BigInteger, primary_key=True,autoincrement=True, comment='字典编码')
- tenant_id = Column(String(20), default='000000', comment='租户编号')
- dict_sort = Column(Integer, default=0, comment='字典排序')
- dict_label = Column(String(100), default='', comment='字典标签')
- dict_value = Column(String(100), default='', comment='字典键值')
- dict_type = Column(String(100), default='', comment='字典类型')
- css_class = Column(String(100), default=None, comment='样式属性(其他样式扩展)')
- list_class = Column(String(100), default=None, comment='表格回显样式')
- is_default = Column(CHAR(1), default='N', comment='是否默认(Y是 N否)')
- create_dept = Column(BigInteger, default=None, comment='创建部门')
- create_by = Column(BigInteger, default=None, comment='创建者')
- create_time = Column(DateTime, default=datetime.now, comment='创建时间')
- update_by = Column(BigInteger, default=None, comment='更新者')
- update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间')
- remark = Column(String(500), default=None, comment='备注')
- del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
- class Config:
- orm_mode = True
- '''参数配置表'''
- class SysConfig(Base):
- __tablename__ = 'sys_config'
- config_id = Column(BigInteger, primary_key=True,autoincrement=True, comment='参数主键')
- tenant_id = Column(String(20), default='000000', comment='租户编号')
- config_name = Column(String(100), default='', comment='参数名称')
- config_key = Column(String(100), default='', comment='参数键名')
- config_value = Column(String(500), default='', comment='参数键值')
- config_type = Column(CHAR(1), default='N', comment='系统内置(Y是 N否)')
- create_dept = Column(BigInteger, default=None, comment='创建部门')
- create_by = Column(BigInteger, default=None, comment='创建者')
- create_time = Column(DateTime, comment='创建时间')
- update_by = Column(BigInteger, default=None, comment='更新者')
- update_time = Column(DateTime, comment='更新时间')
- remark = Column(String(500), default=None, comment='备注')
- class Config:
- orm_mode = True
- '''系统访问记录'''
- class SysLoginInfor(Base):
- __tablename__ = 'sys_logininfor'
- info_id = Column(BigInteger, primary_key=True,autoincrement=True, comment='访问ID')
- tenant_id = Column(String(20), default='000000', comment='租户编号')
- user_name = Column(String(50), default='', comment='用户账号')
- client_key = Column(String(32), default='', comment='客户端')
- device_type = Column(String(32), default='', comment='设备类型')
- ipaddr = Column(String(128), default='', comment='登录IP地址')
- login_location = Column(String(255), default='', comment='登录地点')
- browser = Column(String(50), default='', comment='浏览器类型')
- os = Column(String(50), default='', comment='操作系统')
- status = Column(CHAR(1), default='0', comment='登录状态(0成功 1失败)')
- msg = Column(String(255), default='', comment='提示消息')
- login_time = Column(DateTime, comment='访问时间')
- # 定义表的索引(可选,根据需要添加到Base中)
- __table_args__ = (
- # 假设Base已经包含了索引的创建方式
- Index('idx_sys_logininfor_s', 'status'),
- Index('idx_sys_logininfor_lt', 'login_time'),
- )
- class Config:
- orm_mode = True
- '''通知公告表'''
- class SysNotice(Base):
- __tablename__ = 'sys_notice'
- notice_id = Column(BigInteger, primary_key=True,autoincrement=True, comment='公告ID')
- tenant_id = Column(String(20), default='000000', comment='租户编号')
- notice_title = Column(String(50), nullable=False, comment='公告标题')
- notice_type = Column(CHAR(1), nullable=False, comment='公告类型(1通知 2公告)')
- notice_content = Column(LargeBinary, default=None, comment='公告内容')
- status = Column(CHAR(1), default='0', comment='公告状态(0正常 1关闭)')
- create_dept = Column(BigInteger, default=None, comment='创建部门')
- create_by = Column(BigInteger, default=None, comment='创建者')
- create_time = Column(DateTime, comment='创建时间')
- update_by = Column(BigInteger, default=None, comment='更新者')
- update_time = Column(DateTime, comment='更新时间')
- remark = Column(String(255), default=None, comment='备注')
- class Config:
- orm_mode = True
- '''代码生成业务表'''
- class GenTable(Base):
- __tablename__ = 'gen_table'
- table_id = Column(BigInteger, primary_key=True,autoincrement=True, comment='编号')
- data_name = Column(String(200), default='', comment='数据源名称')
- table_name = Column(String(200), default='', comment='表名称')
- table_comment = Column(String(500), default='', comment='表描述')
- sub_table_name = Column(String(64), default=None, comment='关联子表的表名')
- sub_table_fk_name = Column(String(64), default=None, comment='子表关联的外键名')
- class_name = Column(String(100), default='', comment='实体类名称')
- tpl_category = Column(String(200), default='crud', comment='使用的模板(crud单表操作 tree树表操作)')
- package_name = Column(String(100), comment='生成包路径')
- module_name = Column(String(30), comment='生成模块名')
- business_name = Column(String(30), comment='生成业务名')
- function_name = Column(String(50), comment='生成功能名')
- function_author = Column(String(50), comment='生成功能作者')
- gen_type = Column(CHAR(1), default='0', comment='生成代码方式(0zip压缩包 1自定义路径)')
- gen_path = Column(String(200), default='/', comment='生成路径(不填默认项目路径)')
- options = Column(String(1000), comment='其它生成选项')
- create_dept = Column(BigInteger, default=None, comment='创建部门')
- create_by = Column(BigInteger, default=None, comment='创建者')
- create_time = Column(DateTime, comment='创建时间')
- update_by = Column(BigInteger, default=None, comment='更新者')
- update_time = Column(DateTime, comment='更新时间')
- remark = Column(String(500), default=None, comment='备注')
- class Config:
- orm_mode = True
- '''代码生成业务表字段'''
- class GenTableColumn(Base):
- __tablename__ = 'gen_table_column'
- column_id = Column(BigInteger, primary_key=True,autoincrement=True, comment='编号')
- table_id = Column(BigInteger, comment='归属表编号')
- column_name = Column(String(200), comment='列名称')
- column_comment = Column(String(500), comment='列描述')
- column_type = Column(String(100), comment='列类型')
- java_type = Column(String(500), comment='JAVA类型')
- java_field = Column(String(200), comment='JAVA字段名')
- is_pk = Column(CHAR(1), comment='是否主键(1是)')
- is_increment = Column(CHAR(1), comment='是否自增(1是)')
- is_required = Column(CHAR(1), comment='是否必填(1是)')
- is_insert = Column(CHAR(1), comment='是否为插入字段(1是)')
- is_edit = Column(CHAR(1), comment='是否编辑字段(1是)')
- is_list = Column(CHAR(1), comment='是否列表字段(1是)')
- is_query = Column(CHAR(1), comment='是否查询字段(1是)')
- query_type = Column(String(200), default='EQ', comment='查询方式(等于、不等于、大于、小于、范围)')
- html_type = Column(String(200), comment='显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)')
- dict_type = Column(String(200), default='', comment='字典类型')
- sort = Column(Integer, comment='排序')
- create_dept = Column(BigInteger, default=None, comment='创建部门')
- create_by = Column(BigInteger, default=None, comment='创建者')
- create_time = Column(DateTime, comment='创建时间')
- update_by = Column(BigInteger, default=None, comment='更新者')
- update_time = Column(DateTime, comment='更新时间')
- class Config:
- orm_mode = True
- '''OSS对象存储表'''
- class SysOss(Base):
- __tablename__ = 'sys_oss'
- oss_id = Column(BigInteger, primary_key=True,autoincrement=True, comment='对象存储主键')
- tenant_id = Column(String(20), default='000000', comment='租户编号')
- file_name = Column(String(255), default='', nullable=False, comment='文件名')
- original_name = Column(String(255), default='', nullable=False, comment='原名')
- file_suffix = Column(String(10), default='', nullable=False, comment='文件后缀名')
- url = Column(String(500), nullable=False, comment='URL地址')
- create_dept = Column(BigInteger, default=None, comment='创建部门')
- create_time = Column(DateTime, default=None, comment='创建时间')
- create_by = Column(BigInteger, default=None, comment='上传人')
- update_time = Column(DateTime, default=None, comment='更新时间')
- update_by = Column(BigInteger, default=None, comment='更新人')
- service = Column(String(20), default='minio', nullable=False, comment='服务商')
- class Config:
- orm_mode = True
- '''对象存储配置表'''
- class SysOssConfig(Base):
- __tablename__ = 'sys_oss_config'
- oss_config_id = Column(BigInteger, primary_key=True,autoincrement=True, comment='主键')
- tenant_id = Column(String(20), default='000000', comment='租户编号')
- config_key = Column(String(20), default='', nullable=False, comment='配置key')
- access_key = Column(String(255), default='', comment='accessKey')
- secret_key = Column(String(255), default='', comment='秘钥')
- bucket_name = Column(String(255), default='', comment='桶名称')
- prefix = Column(String(255), default='', comment='前缀')
- endpoint = Column(String(255), default='', comment='访问站点')
- domain = Column(String(255), default='', comment='自定义域名')
- is_https = Column(CHAR(1), default='N', comment='是否https(Y=是,N=否)')
- region = Column(String(255), default='', comment='域')
- access_policy = Column(CHAR(1), nullable=False, default='1', comment='桶权限类型(0=private 1=public 2=custom)')
- status = Column(CHAR(1), default='1', comment='是否默认(0=是,1=否)')
- ext1 = Column(String(255), default='', comment='扩展字段')
- create_dept = Column(BigInteger, default=None, comment='创建部门')
- create_by = Column(BigInteger, default=None, comment='创建者')
- create_time = Column(DateTime, default=None, comment='创建时间')
- update_by = Column(BigInteger, default=None, comment='更新者')
- update_time = Column(DateTime, default=None, comment='更新时间')
- remark = Column(String(500), default=None, comment='备注')
- class Config:
- orm_mode = True
- '''系统授权表'''
- class SysClient(Base):
- __tablename__ = 'sys_client'
- id = Column(BigInteger, primary_key=True,autoincrement=True, comment='id')
- client_id = Column(String(64), default=None, comment='客户端id')
- client_key = Column(String(32), default=None, comment='客户端key')
- client_secret = Column(String(255), default=None, comment='客户端秘钥')
- grant_type = Column(String(255), default=None, comment='授权类型')
- device_type = Column(String(32), default=None, comment='设备类型')
- active_timeout = Column(Integer, default=1800, comment='token活跃超时时间')
- timeout = Column(Integer, default=604800, comment='token固定超时')
- status = Column(CHAR(1), default='0', comment='状态(0正常 1停用)')
- del_flag = Column(CHAR(1), default='0', comment='删除标志(0代表存在 2代表删除)')
- create_dept = Column(BigInteger, default=None, comment='创建部门')
- create_by = Column(BigInteger, default=None, comment='创建者')
- create_time = Column(DateTime, default=None, comment='创建时间')
- update_by = Column(BigInteger, default=None, comment='更新者')
- update_time = Column(DateTime, default=None, comment='更新时间')
- class Config:
- orm_mode = True
- '''测试单表'''
- class TestDemo(Base):
- __tablename__ = 'test_demo'
- id = Column(BigInteger, primary_key=True,autoincrement=True, comment='主键')
- tenant_id = Column(String(20), default='000000', comment='租户编号')
- dept_id = Column(BigInteger, default=None, comment='部门id')
- user_id = Column(BigInteger, default=None, comment='用户id')
- order_num = Column(Integer, default=0, comment='排序号')
- test_key = Column(String(255), default=None, comment='key键')
- value = Column(String(255), default=None, comment='值')
- version = Column(Integer, default=0, comment='版本')
- create_dept = Column(BigInteger, default=None, comment='创建部门')
- create_time = Column(DateTime, default=None, comment='创建时间')
- create_by = Column(BigInteger, default=None, comment='创建人')
- update_time = Column(DateTime, default=None, comment='更新时间')
- update_by = Column(BigInteger, default=None, comment='更新人')
- del_flag = Column(Integer, default=0, comment='删除标志')
- class Config:
- orm_mode = True
- '''测试树表'''
- class TestTree(Base):
- __tablename__ = 'test_tree'
- id = Column(BigInteger, primary_key=True,autoincrement=True, comment='主键')
- tenant_id = Column(String(20), default='000000', comment='租户编号')
- parent_id = Column(BigInteger, default=0, comment='父id')
- dept_id = Column(BigInteger, default=None, comment='部门id')
- user_id = Column(BigInteger, default=None, comment='用户id')
- tree_name = Column(String(255), default=None, comment='树节点名称')
- version = Column(Integer, default=0, comment='版本')
- create_dept = Column(BigInteger, default=None, comment='创建部门')
- create_time = Column(DateTime, default=None, comment='创建时间')
- create_by = Column(BigInteger, default=None, comment='创建人')
- update_time = Column(DateTime, default=None, comment='更新时间')
- update_by = Column(BigInteger, default=None, comment='更新人')
- del_flag = Column(Integer, default=0, comment='删除标志')
- class Config:
- orm_mode = True
- '''flowable'''
- '''请假申请表'''
- class TestLeave(Base):
- __tablename__ = 'test_leave'
- id = Column(BigInteger, primary_key=True, comment='主键')
- leave_type = Column(String(255), nullable=False, comment='请假类型')
- start_date = Column(DateTime, nullable=False, comment='开始时间')
- end_date = Column(DateTime, nullable=False, comment='结束时间')
- leave_days = Column(Integer, nullable=False, comment='请假天数')
- remark = Column(String(255), comment='请假原因')
- status = Column(String(255), comment='状态')
- create_dept = Column(BigInteger, comment='创建部门')
- create_by = Column(BigInteger, comment='创建者')
- create_time = Column(DateTime, comment='创建时间')
- update_by = Column(BigInteger, comment='更新者')
- update_time = Column(DateTime, comment='更新时间')
- tenant_id = Column(String(20), comment='租户编号')
- class Config:
- orm_mode = True
- '''流程分类'''
- class WfCategory(Base):
- __tablename__ = 'wf_category'
- id = Column(BigInteger, primary_key=True, comment='主键')
- category_name = Column(String(255), comment='分类名称')
- category_code = Column(String(255), comment='分类编码')
- parent_id = Column(BigInteger, comment='父级id')
- sort_num = Column(Integer, comment='排序')
- tenant_id = Column(String(20), comment='租户编号')
- create_dept = Column(BigInteger, comment='创建部门')
- create_by = Column(BigInteger, comment='创建者')
- create_time = Column(DateTime, comment='创建时间')
- update_by = Column(BigInteger, comment='更新者')
- update_time = Column(DateTime, comment='更新时间')
- # 定义唯一性约束条件
- __table_args__ = (UniqueConstraint('category_code', name='uni_category_code'),)
- class Config:
- orm_mode = True
- '''节点审批记录'''
- class WfTaskBackNode(Base):
- __tablename__ = 'wf_task_back_node'
- id = Column(BigInteger, primary_key=True, comment='主键')
- node_id = Column(String(255), nullable=False, comment='节点id')
- node_name = Column(String(255), nullable=False, comment='节点名称')
- order_no = Column(Integer, nullable=False, comment='排序')
- instance_id = Column(String(255), comment='流程实例id')
- task_type = Column(String(255), nullable=False, comment='节点类型')
- assignee = Column(String(2000), nullable=False, comment='审批人')
- tenant_id = Column(String(20), comment='租户编号')
- create_dept = Column(BigInteger, comment='创建部门')
- create_by = Column(BigInteger, comment='创建者')
- create_time = Column(DateTime, comment='创建时间')
- update_by = Column(BigInteger, comment='更新者')
- update_time = Column(DateTime, comment='更新时间')
- class Config:
- orm_mode = True
- '''流程定义配置'''
- class WfDefinitionConfig(Base):
- __tablename__ = 'wf_definition_config'
- id = Column(BigInteger, primary_key=True, comment='主键')
- table_name = Column(String(255), nullable=False, comment='表名')
- definition_id = Column(String(255), nullable=False, comment='流程定义ID')
- process_key = Column(String(255), nullable=False, comment='流程KEY')
- version = Column(Integer, nullable=False, comment='流程版本')
- create_dept = Column(BigInteger, comment='创建部门')
- create_by = Column(BigInteger, comment='创建者')
- create_time = Column(DateTime, comment='创建时间')
- update_by = Column(BigInteger, comment='更新者')
- update_time = Column(DateTime, comment='更新时间')
- remark = Column(String(500), default='', comment='备注')
- tenant_id = Column(String(20), comment='租户编号')
- # 定义唯一性约束条件
- __table_args__ = (UniqueConstraint('definition_id', name='uni_definition_id'),)
- class Config:
- orm_mode = True
- '''表单管理'''
- class WfFormManage(Base):
- __tablename__ = 'wf_form_manage'
- id = Column(BigInteger, primary_key=True, comment='主键')
- form_name = Column(String(255), nullable=False, comment='表单名称')
- form_type = Column(String(255), nullable=False, comment='表单类型')
- router = Column(String(255), nullable=False, comment='路由地址/表单ID')
- remark = Column(String(500), comment='备注')
- tenant_id = Column(String(20), comment='租户编号')
- create_dept = Column(BigInteger, comment='创建部门')
- create_by = Column(BigInteger, comment='创建者')
- create_time = Column(DateTime, comment='创建时间')
- update_by = Column(BigInteger, comment='更新者')
- update_time = Column(DateTime, comment='更新时间')
- class Config:
- orm_mode = True
- '''节点配置'''
- class WfNodeConfig(Base):
- __tablename__ = 'wf_node_config'
- id = Column(BigInteger, primary_key=True, comment='主键')
- form_id = Column(BigInteger, comment='表单id')
- form_type = Column(String(255), comment='表单类型')
- node_name = Column(String(255), nullable=False, comment='节点名称')
- node_id = Column(String(255), nullable=False, comment='节点id')
- definition_id = Column(String(255), nullable=False, comment='流程定义id')
- apply_user_task = Column(CHAR(1), default='0', comment='是否为申请人节点(0是 1否)')
- create_dept = Column(BigInteger, comment='创建部门')
- create_by = Column(BigInteger, comment='创建者')
- create_time = Column(DateTime, comment='创建时间')
- update_by = Column(BigInteger, comment='更新者')
- update_time = Column(DateTime, comment='更新时间')
- tenant_id = Column(String(20), comment='租户编号')
- class Config:
- orm_mode = True
- '''snail_job'''
- '''命名空间'''
- class SjNamespace(Base):
- __tablename__ = 'sj_namespace'
- id = Column(BigInteger, primary_key=True, autoincrement=True, comment='主键')
- name = Column(String(64), nullable=False, comment='名称')
- unique_id = Column(String(64), nullable=False, comment='唯一id')
- description = Column(String(256), nullable=False, default='', comment='描述')
- deleted = Column(TINYINT(4), nullable=False, default=0, comment='逻辑删除 1、删除')
- create_dt = Column(DateTime, nullable=False, default=datetime.now, comment='创建时间')
- update_dt = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment='修改时间')
- # 定义索引
- __table_args__ = (
- Index('idx_name', 'name'),
- UniqueConstraint('unique_id', name='uk_unique_id'),
- )
- class Config:
- orm_mode = True
- '''组配置'''
- class SjGroupConfig(Base):
- __tablename__ = 'sj_group_config'
- id = Column(BigInteger, primary_key=True, autoincrement=True, comment='主键')
- namespace_id = Column(String(64), nullable=False, default='764d604ec6fc45f68cd92514c40e9e1a', comment='命名空间id')
- group_name = Column(String(64), nullable=False, default='', comment='组名称')
- description = Column(String(256), nullable=False, default='', comment='组描述')
- token = Column(String(64), nullable=False, default='SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT', comment='token')
- group_status = Column(TINYINT(4), nullable=False, default=0, comment='组状态 0、未启用 1、启用')
- version = Column(Integer, nullable=False, comment='版本号')
- group_partition = Column(Integer, nullable=False, comment='分区')
- id_generator_mode = Column(TINYINT(4), nullable=False, default=1, comment='唯一id生成模式 默认号段模式')
- init_scene = Column(TINYINT(4), nullable=False, default=0, comment='是否初始化场景 0:否 1:是')
- bucket_index = Column(Integer, nullable=False, default=0, comment='bucket')
- create_dt = Column(DateTime, nullable=False, default=datetime.now, comment='创建时间')
- update_dt = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment='修改时间')
- # 定义唯一性约束条件
- __table_args__ = (UniqueConstraint('namespace_id', 'group_name', name='uk_namespace_id_group_name'),)
- class Config:
- orm_mode = True
- '''通知配置'''
- class SjNotifyConfig(Base):
- __tablename__ = 'sj_notify_config'
- id = Column(BigInteger, primary_key=True, autoincrement=True, comment='主键')
- namespace_id = Column(String(64), nullable=False, default='764d604ec6fc45f68cd92514c40e9e1a', comment='命名空间id')
- group_name = Column(String(64), nullable=False, comment='组名称')
- business_id = Column(String(64), nullable=False, comment='业务id (job_id或workflow_id或scene_name)')
- system_task_type = Column(TINYINT(4), nullable=False, default=3, comment='任务类型')
- notify_status = Column(TINYINT(4), nullable=False, default=0, comment='通知状态')
- recipient_ids = Column(String(128), nullable=False, comment='接收人id列表')
- notify_threshold = Column(Integer, nullable=False, default=0, comment='通知阈值')
- notify_scene = Column(TINYINT(4), nullable=False, default=0, comment='通知场景')
- rate_limiter_status = Column(TINYINT(4), nullable=False, default=0, comment='限流状态')
- rate_limiter_threshold = Column(Integer, nullable=False, default=0, comment='每秒限流阈值')
- description = Column(String(256), nullable=False, default='', comment='描述')
- create_dt = Column(DateTime, nullable=False, default=datetime.now, comment='创建时间')
- update_dt = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment='修改时间')
- # 定义索引
- __table_args__ = (
- Index('idx_namespace_id_group_name_scene_name', 'namespace_id', 'group_name', 'business_id'),)
- class Config:
- orm_mode = True
- '''告警通知接收人'''
- class SjNotifyRecipient(Base):
- __tablename__ = 'sj_notify_recipient'
- id = Column(BigInteger, primary_key=True, autoincrement=True, comment='主键')
- namespace_id = Column(String(64), nullable=False, default='764d604ec6fc45f68cd92514c40e9e1a', comment='命名空间id')
- recipient_name = Column(String(64), nullable=False, comment='接收人名称')
- notify_type = Column(TINYINT(4), nullable=False, default=0, comment='通知类型')
- notify_attribute = Column(String(512), nullable=False, comment='配置属性')
- description = Column(String(256), nullable=False, default='', comment='描述')
- create_dt = Column(DateTime, nullable=False, default=datetime.now, comment='创建时间')
- update_dt = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment='修改时间')
- # 定义索引
- __table_args__ = (
- Index('idx_namespace_id', 'namespace_id'),
- )
- class Config:
- orm_mode = True
- '''死信队列表'''
- class SjRetryDeadLetter(Base):
- __tablename__ = 'sj_retry_dead_letter_0'
- id = Column(BigInteger, primary_key=True, autoincrement=True, comment='主键')
- namespace_id = Column(String(64), nullable=False, default='764d604ec6fc45f68cd92514c40e9e1a', comment='命名空间id')
- unique_id = Column(String(64), nullable=False, comment='同组下id唯一')
- group_name = Column(String(64), nullable=False, comment='组名称')
- scene_name = Column(String(64), nullable=False, comment='场景名称')
- idempotent_id = Column(String(64), nullable=False, comment='幂等id')
- biz_no = Column(String(64), nullable=False, default='', comment='业务编号')
- executor_name = Column(String(512), nullable=False, default='', comment='执行器名称')
- args_str = Column(Text, nullable=False, comment='执行方法参数')
- ext_attrs = Column(Text, nullable=False, comment='扩展字段')
- task_type = Column(TINYINT(4), nullable=False, default=1, comment='任务类型')
- create_dt = Column(DateTime, nullable=False, default=datetime.now, comment='创建时间')
- # 定义索引和唯一性约束条件
- __table_args__ = (
- Index('idx_namespace_id_group_name_scene_name', 'namespace_id', 'group_name', 'scene_name'),
- Index('idx_idempotent_id', 'idempotent_id'),
- Index('idx_biz_no', 'biz_no'),
- Index('idx_create_dt', 'create_dt'),
- UniqueConstraint('namespace_id', 'group_name', 'unique_id', name='uk_namespace_id_group_name_unique_id'),
- )
- class Config:
- orm_mode = True
- '''任务表'''
- class SjRetryTask(Base):
- __tablename__ = 'sj_retry_task_0'
- id = Column(BigInteger, primary_key=True, autoincrement=True, comment='主键')
- namespace_id = Column(String(64), nullable=False, default='764d604ec6fc45f68cd92514c40e9e1a', comment='命名空间id')
- unique_id = Column(String(64), nullable=False, comment='同组下id唯一')
- group_name = Column(String(64), nullable=False, comment='组名称')
- scene_name = Column(String(64), nullable=False, comment='场景名称')
- idempotent_id = Column(String(64), nullable=False, comment='幂等id')
- biz_no = Column(String(64), nullable=False, default='', comment='业务编号')
- executor_name = Column(String(512), nullable=False, default='', comment='执行器名称')
- args_str = Column(Text, nullable=False, comment='执行方法参数')
- ext_attrs = Column(Text, nullable=False, comment='扩展字段')
- next_trigger_at = Column(DateTime, nullable=False, comment='下次触发时间')
- retry_count = Column(Integer, nullable=False, default=0, comment='重试次数')
- retry_status = Column(TINYINT(4), nullable=False, default=0, comment='重试状态')
- task_type = Column(TINYINT(4), nullable=False, default=1, comment='任务类型')
- create_dt = Column(DateTime, nullable=False, default=datetime.now, comment='创建时间')
- update_dt = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment='修改时间')
- # 定义索引和唯一性约束条件
- __table_args__ = (
- Index('idx_namespace_id_group_name_scene_name', 'namespace_id', 'group_name', 'scene_name'),
- Index('idx_namespace_id_group_name_task_type', 'namespace_id', 'group_name', 'task_type'),
- Index('idx_namespace_id_group_name_retry_status', 'namespace_id', 'group_name', 'retry_status'),
- Index('idx_idempotent_id', 'idempotent_id'),
- Index('idx_biz_no', 'biz_no'),
- Index('idx_create_dt', 'create_dt'),
- UniqueConstraint('namespace_id', 'group_name', 'unique_id', name='uk_name_unique_id'),
- )
- class Config:
- orm_mode = True
- '''任务日志基础信息表'''
- class SjRetryTaskLog(Base):
- __tablename__ = 'sj_retry_task_log'
- id = Column(BigInteger, primary_key=True, autoincrement=True, comment='主键')
- namespace_id = Column(String(64), nullable=False, default='764d604ec6fc45f68cd92514c40e9e1a', comment='命名空间id')
- unique_id = Column(String(64), nullable=False, comment='同组下id唯一')
- group_name = Column(String(64), nullable=False, comment='组名称')
- scene_name = Column(String(64), nullable=False, comment='场景名称')
- idempotent_id = Column(String(64), nullable=False, comment='幂等id')
- biz_no = Column(String(64), nullable=False, default='', comment='业务编号')
- executor_name = Column(String(512), nullable=False, default='', comment='执行器名称')
- args_str = Column(Text, nullable=False, comment='执行方法参数')
- ext_attrs = Column(Text, nullable=False, comment='扩展字段')
- retry_status = Column(TINYINT(4), nullable=False, default=0, comment='重试状态')
- task_type = Column(TINYINT(4), nullable=False, default=1, comment='任务类型')
- create_dt = Column(DateTime, nullable=False, default=datetime.now, comment='创建时间')
- update_dt = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment='修改时间')
- # 定义索引
- __table_args__ = (
- Index('idx_group_name_scene_name', 'namespace_id', 'group_name', 'scene_name'),
- Index('idx_retry_status', 'retry_status'),
- Index('idx_idempotent_id', 'idempotent_id'),
- Index('idx_unique_id', 'unique_id'),
- Index('idx_biz_no', 'biz_no'),
- Index('idx_create_dt', 'create_dt'),
- )
- class Config:
- orm_mode = True
- '''任务调度日志信息记录表'''
- class SjRetryTaskLogMessage(Base):
- __tablename__ = 'sj_retry_task_log_message'
- id = Column(BigInteger, primary_key=True, autoincrement=True, comment='主键')
- namespace_id = Column(String(64), nullable=False, default='764d604ec6fc45f68cd92514c40e9e1a', comment='命名空间id')
- group_name = Column(String(64), nullable=False, comment='组名称')
- unique_id = Column(String(64), nullable=False, comment='同组下id唯一')
- message = Column(Text, nullable=False, comment='异常信息')
- log_num = Column(Integer, nullable=False, default=1, comment='日志数量')
- real_time = Column(BigInteger, nullable=False, default=0, comment='上报时间')
- create_dt = Column(DateTime, nullable=False, default=datetime.now, comment='创建时间')
- # 定义索引
- __table_args__ = (
- Index('idx_namespace_id_group_name_unique_id', 'namespace_id', 'group_name', 'unique_id'),
- Index('idx_create_dt', 'create_dt'),
- )
- class Config:
- orm_mode = True
- '''场景配置'''
- class SjRetrySceneConfig(Base):
- __tablename__ = 'sj_retry_scene_config'
- id = Column(BigInteger, primary_key=True, autoincrement=True, comment='主键')
- namespace_id = Column(String(64), nullable=False, default='764d604ec6fc45f68cd92514c40e9e1a', comment='命名空间id')
- scene_name = Column(String(64), nullable=False, comment='场景名称')
- group_name = Column(String(64), nullable=False, comment='组名称')
- scene_status = Column(TINYINT(4), nullable=False, default=0, comment='组状态')
- max_retry_count = Column(Integer, nullable=False, default=5, comment='最大重试次数')
- back_off = Column(TINYINT(4), nullable=False, default=1, comment='重试间隔类型')
- trigger_interval = Column(String(16), nullable=False, default='', comment='间隔时长')
- deadline_request = Column(BigInteger, nullable=False, default=60000, comment='Deadline Request 调用链超时 单位毫秒')
- executor_timeout = Column(Integer, nullable=False, default=5, comment='任务执行超时时间,单位秒')
- route_key = Column(TINYINT(4), nullable=False, default=4, comment='路由策略')
- description = Column(String(256), nullable=False, default='', comment='描述')
- create_dt = Column(DateTime, nullable=False, default=datetime.now, comment='创建时间')
- update_dt = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment='修改时间')
- # 定义唯一性约束条件
- __table_args__ = (
- UniqueConstraint('namespace_id', 'group_name', 'scene_name', name='uk_namespace_id_group_name_scene_name'),
- )
- class Config:
- orm_mode = True
- '''服务器节点'''
- class SjServerNode(Base):
- __tablename__ = 'sj_server_node'
- id = Column(BigInteger, primary_key=True, autoincrement=True, comment='主键')
- namespace_id = Column(String(64), nullable=False, default='764d604ec6fc45f68cd92514c40e9e1a', comment='命名空间id')
- group_name = Column(String(64), nullable=False, comment='组名称')
- host_id = Column(String(64), nullable=False, comment='主机id')
- host_ip = Column(String(64), nullable=False, comment='机器ip')
- host_port = Column(Integer, nullable=False, comment='机器端口')
- expire_at = Column(DateTime, nullable=False, comment='过期时间')
- node_type = Column(TINYINT(4), nullable=False, comment='节点类型')
- ext_attrs = Column(String(256), nullable=True, default='', comment='扩展字段')
- create_dt = Column(DateTime, nullable=False, default=datetime.now, comment='创建时间')
- update_dt = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment='修改时间')
- # 定义索引和唯一性约束条件
- __table_args__ = (
- Index('idx_namespace_id_group_name', 'namespace_id', 'group_name'),
- Index('idx_expire_at_node_type', 'expire_at', 'node_type'),
- UniqueConstraint('host_id', 'host_ip', name='uk_host_id_host_ip'),
- )
- class Config:
- orm_mode = True
- '''锁定表'''
- class SjDistributedLock(Base):
- __tablename__ = 'sj_distributed_lock'
- id = Column(BigInteger, primary_key=True, autoincrement=True, comment='主键')
- name = Column(String(64), nullable=False, comment='锁名称')
- lock_until = Column(TIMESTAMP(3), nullable=False, default=datetime.now, onupdate=datetime.now, comment='锁定时长')
- locked_at = Column(TIMESTAMP(3), nullable=False, default=datetime.now, comment='锁定时间')
- locked_by = Column(String(255), nullable=False, comment='锁定者')
- create_dt = Column(DateTime, nullable=False, default=datetime.now, comment='创建时间')
- update_dt = Column(DateTime, nullable=False, default=datetime.now, comment='修改时间')
- # 定义唯一性约束条件
- __table_args__ = (
- UniqueConstraint('name', name='uk_name'),
- )
- class Config:
- orm_mode = True
- '''系统用户表'''
- class SjSystemUser(Base):
- __tablename__ = 'sj_system_user'
- id = Column(BigInteger, primary_key=True, autoincrement=True, comment='主键')
- username = Column(String(64), nullable=False, unique=True, comment='账号') # 唯一约束在 SQLAlchemy 中用 unique=True 表示
- password = Column(String(128), nullable=False, comment='密码')
- role = Column(TINYINT(4), nullable=False, default=0, comment='角色')
- create_dt = Column(DateTime, nullable=False, default=datetime.now, comment='创建时间')
- update_dt = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment='修改时间')
- class Config:
- orm_mode = True
- '''系统用户权限表'''
- class SjSystemUserPermission(Base):
- __tablename__ = 'sj_system_user_permission'
- id = Column(BigInteger, primary_key=True, autoincrement=True, comment='主键')
- group_name = Column(String(64), nullable=False, comment='组名称')
- namespace_id = Column(String(64), nullable=False, default='764d604ec6fc45f68cd92514c40e9e1a', comment='命名空间id')
- system_user_id = Column(BigInteger, nullable=False, comment='系统用户id')
- create_dt = Column(DateTime, nullable=False, default=datetime.now, comment='创建时间')
- update_dt = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment='修改时间')
- # 定义唯一性约束条件
- __table_args__ = (
- UniqueConstraint('namespace_id', 'group_name', 'system_user_id', name='uk_namespace_id_group_name_system_user_id'),
- )
- class Config:
- orm_mode = True
- '''号段模式序号ID分配表'''
- class SjSequenceAlloc(Base):
- __tablename__ = 'sj_sequence_alloc'
- id = Column(BigInteger, primary_key=True, autoincrement=True, comment='主键')
- namespace_id = Column(String(64), nullable=False, default='764d604ec6fc45f68cd92514c40e9e1a', comment='命名空间id')
- group_name = Column(String(64), nullable=False, default='', comment='组名称')
- max_id = Column(BigInteger, nullable=False, default=1, comment='最大id')
- step = Column(Integer, nullable=False, default=100, comment='步长')
- update_dt = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment='更新时间')
- # 定义唯一性约束条件
- __table_args__ = (
- UniqueConstraint('namespace_id', 'group_name', name='uk_namespace_id_group_name'),
- )
- class Config:
- orm_mode = True
- '''任务信息'''
- class SjJob(Base):
- __tablename__ = 'sj_job'
- id = Column(BigInteger, primary_key=True, autoincrement=True, comment='主键')
- namespace_id = Column(String(64), nullable=False, default='764d604ec6fc45f68cd92514c40e9e1a', comment='命名空间id')
- group_name = Column(String(64), nullable=False, comment='组名称')
- job_name = Column(String(64), nullable=False, comment='名称')
- args_str = Column(Text, default=None, comment='执行方法参数')
- args_type = Column(TINYINT(4), nullable=False, default=1, comment='参数类型')
- next_trigger_at = Column(BigInteger, nullable=False, comment='下次触发时间')
- job_status = Column(TINYINT(4), nullable=False, default=1, comment='任务状态')
- task_type = Column(TINYINT(4), nullable=False, default=1, comment='任务类型')
- route_key = Column(TINYINT(4), nullable=False, default=4, comment='路由策略')
- executor_type = Column(TINYINT(4), nullable=False, default=1, comment='执行器类型')
- executor_info = Column(String(255), default=None, comment='执行器名称')
- trigger_type = Column(TINYINT(4), nullable=False, comment='触发类型')
- trigger_interval = Column(String(255), nullable=False, comment='间隔时长')
- block_strategy = Column(TINYINT(4), nullable=False, default=1, comment='阻塞策略')
- executor_timeout = Column(Integer, nullable=False, default=0, comment='任务执行超时时间')
- max_retry_times = Column(Integer, nullable=False, default=0, comment='最大重试次数')
- parallel_num = Column(Integer, nullable=False, default=1, comment='并行数')
- retry_interval = Column(Integer, nullable=False, default=0, comment='重试间隔(s)')
- bucket_index = Column(Integer, nullable=False, default=0, comment='bucket')
- resident = Column(TINYINT(4), nullable=False, default=0, comment='是否是常驻任务')
- description = Column(String(256), nullable=False, default='', comment='描述')
- ext_attrs = Column(String(256), nullable=True, default='', comment='扩展字段')
- deleted = Column(TINYINT(4), nullable=False, default=0, comment='逻辑删除')
- create_dt = Column(DateTime, nullable=False, default=datetime.now, comment='创建时间')
- update_dt = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment='修改时间')
- # 定义索引
- __table_args__ = (
- Index('idx_namespace_id_group_name', 'namespace_id', 'group_name'),
- Index('idx_job_status_bucket_index', 'job_status', 'bucket_index'),
- Index('idx_create_dt', 'create_dt'),
- )
- class Config:
- orm_mode = True
- '''调度日志'''
- class SjJobLogMessage(Base):
- __tablename__ = 'sj_job_log_message'
- id = Column(BigInteger, primary_key=True, autoincrement=True, comment='主键')
- namespace_id = Column(String(64), nullable=False, default='764d604ec6fc45f68cd92514c40e9e1a', comment='命名空间id')
- group_name = Column(String(64), nullable=False, comment='组名称')
- job_id = Column(BigInteger, nullable=False, comment='任务信息id')
- task_batch_id = Column(BigInteger, nullable=False, comment='任务批次id')
- task_id = Column(BigInteger, nullable=False, comment='调度任务id')
- message = Column(Text, nullable=False, comment='调度信息')
- log_num = Column(Integer, nullable=False, default=1, comment='日志数量')
- real_time = Column(BigInteger, nullable=False, default=0, comment='上报时间')
- ext_attrs = Column(String(256), nullable=True, default='', comment='扩展字段')
- create_dt = Column(DateTime, nullable=False, default=datetime.now, comment='创建时间')
- # 定义索引
- __table_args__ = (
- Index('idx_task_batch_id_task_id', 'task_batch_id', 'task_id'),
- Index('idx_create_dt', 'create_dt'),
- Index('idx_namespace_id_group_name', 'namespace_id', 'group_name'),
- )
- class Config:
- orm_mode = True
- '''任务实例'''
- class SjJobTask(Base):
- __tablename__ = 'sj_job_task'
- id = Column(BigInteger, primary_key=True, autoincrement=True, comment='主键')
- namespace_id = Column(String(64), nullable=False, default='764d604ec6fc45f68cd92514c40e9e1a', comment='命名空间id')
- group_name = Column(String(64), nullable=False, comment='组名称')
- job_id = Column(BigInteger, nullable=False, comment='任务信息id')
- task_batch_id = Column(BigInteger, nullable=False, comment='调度任务id')
- parent_id = Column(BigInteger, nullable=False, default=0, comment='父执行器id')
- task_status = Column(TINYINT(4), nullable=False, default=0, comment='执行的状态')
- retry_count = Column(Integer, nullable=False, default=0, comment='重试次数')
- client_info = Column(String(128), default=None, comment='客户端地址')
- result_message = Column(Text, nullable=False, comment='执行结果')
- args_str = Column(Text, default=None, comment='执行方法参数')
- args_type = Column(TINYINT(4), nullable=False, default=1, comment='参数类型')
- ext_attrs = Column(String(256), nullable=True, default='', comment='扩展字段')
- create_dt = Column(DateTime, nullable=False, default=datetime.now, comment='创建时间')
- update_dt = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment='修改时间')
- # 定义索引
- __table_args__ = (
- Index('idx_task_batch_id_task_status', 'task_batch_id', 'task_status'),
- Index('idx_create_dt', 'create_dt'),
- Index('idx_namespace_id_group_name', 'namespace_id', 'group_name'),
- )
- class Config:
- orm_mode = True
- '''任务批次'''
- class SjJobTaskBatch(Base):
- __tablename__ = 'sj_job_task_batch'
- id = Column(BigInteger, primary_key=True, autoincrement=True, comment='主键')
- namespace_id = Column(String(64), nullable=False, default='764d604ec6fc45f68cd92514c40e9e1a', comment='命名空间id')
- group_name = Column(String(64), nullable=False, comment='组名称')
- job_id = Column(BigInteger, nullable=False, comment='任务id')
- workflow_node_id = Column(BigInteger, nullable=False, default=0, comment='工作流节点id')
- parent_workflow_node_id = Column(BigInteger, nullable=False, default=0, comment='工作流任务父批次id')
- workflow_task_batch_id = Column(BigInteger, nullable=False, default=0, comment='工作流任务批次id')
- task_batch_status = Column(TINYINT(4), nullable=False, default=0, comment='任务批次状态')
- operation_reason = Column(TINYINT(4), nullable=False, default=0, comment='操作原因')
- execution_at = Column(BigInteger, nullable=False, default=0, comment='任务执行时间')
- system_task_type = Column(TINYINT(4), nullable=False, default=3, comment='任务类型')
- parent_id = Column(String(64), nullable=False, default='', comment='父节点')
- ext_attrs = Column(String(256), nullable=True, default='', comment='扩展字段')
- deleted = Column(TINYINT(4), nullable=False, default=0, comment='逻辑删除')
- create_dt = Column(DateTime, nullable=False, default=datetime.now, comment='创建时间')
- update_dt = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment='修改时间')
- # 定义索引
- __table_args__ = (
- Index('idx_job_id_task_batch_status', 'job_id', 'task_batch_status'),
- Index('idx_create_dt', 'create_dt'),
- Index('idx_namespace_id_group_name', 'namespace_id', 'group_name'),
- Index('idx_workflow_task_batch_id_workflow_node_id', 'workflow_task_batch_id', 'workflow_node_id'),
- )
- class Config:
- orm_mode = True
- '''DashBoard_Job'''
- class SjJobSummary(Base):
- __tablename__ = 'sj_job_summary'
- id = Column(BigInteger, primary_key=True, autoincrement=True, comment='主键')
- namespace_id = Column(String(64), nullable=False, default='764d604ec6fc45f68cd92514c40e9e1a', comment='命名空间id')
- group_name = Column(String(64), nullable=False, default='', comment='组名称')
- business_id = Column(BigInteger, nullable=False, comment='业务id')
- system_task_type = Column(TINYINT(4), nullable=False, default=3, comment='任务类型')
- trigger_at = Column(DateTime, nullable=False, default=datetime.now, comment='统计时间')
- success_num = Column(Integer, nullable=False, default=0, comment='执行成功-日志数量')
- fail_num = Column(Integer, nullable=False, default=0, comment='执行失败-日志数量')
- fail_reason = Column(String(512), nullable=False, default='', comment='失败原因')
- stop_num = Column(Integer, nullable=False, default=0, comment='执行停止-日志数量')
- stop_reason = Column(String(512), nullable=False, default='', comment='停止原因')
- cancel_num = Column(Integer, nullable=False, default=0, comment='执行取消-日志数量')
- cancel_reason = Column(String(512), nullable=False, default='', comment='取消原因')
- create_dt = Column(DateTime, nullable=False, default=datetime.now, comment='创建时间')
- update_dt = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment='修改时间')
- # 定义索引和唯一性约束条件
- __table_args__ = (
- Index('idx_namespace_id_group_name_business_id', 'namespace_id', 'group_name', 'business_id'),
- UniqueConstraint('trigger_at', 'system_task_type', 'business_id', name='uk_trigger_at_system_task_type_business_id'),
- )
- class Config:
- orm_mode = True
- '''DashBoard_Retry'''
- class SjRetrySummary(Base):
- __tablename__ = 'sj_retry_summary'
- id = Column(BigInteger, primary_key=True, autoincrement=True, comment='主键')
- namespace_id = Column(String(64), nullable=False, default='764d604ec6fc45f68cd92514c40e9e1a', comment='命名空间id')
- group_name = Column(String(64), nullable=False, default='', comment='组名称')
- scene_name = Column(String(50), nullable=False, default='', comment='场景名称')
- trigger_at = Column(DateTime, nullable=False, default=datetime.now, comment='统计时间')
- running_num = Column(Integer, nullable=False, default=0, comment='重试中-日志数量')
- finish_num = Column(Integer, nullable=False, default=0, comment='重试完成-日志数量')
- max_count_num = Column(Integer, nullable=False, default=0, comment='重试到达最大次数-日志数量')
- suspend_num = Column(Integer, nullable=False, default=0, comment='暂停重试-日志数量')
- create_dt = Column(DateTime, nullable=False, default=datetime.now, comment='创建时间')
- update_dt = Column(DateTime, nullable=False, onupdate=datetime.now, comment='修改时间')
- # 定义索引和唯一性约束条件
- __table_args__ = (
- Index('idx_trigger_at', 'trigger_at'),
- UniqueConstraint('namespace_id', 'group_name', 'scene_name', 'trigger_at', name='uk_scene_name_trigger_at'),
- )
- class Config:
- orm_mode = True
- '''工作流'''
- class SjWorkflow(Base):
- __tablename__ = 'sj_workflow'
- id = Column(BigInteger, primary_key=True, autoincrement=True, comment='主键')
- workflow_name = Column(String(64), nullable=False, comment='工作流名称')
- namespace_id = Column(String(64), nullable=False, default='764d604ec6fc45f68cd92514c40e9e1a', comment='命名空间id')
- group_name = Column(String(64), nullable=False, comment='组名称')
- workflow_status = Column(TINYINT(4), nullable=False, default=1, comment='工作流状态')
- trigger_type = Column(TINYINT(4), nullable=False, comment='触发类型')
- trigger_interval = Column(String(255), nullable=False, comment='间隔时长')
- next_trigger_at = Column(BigInteger, nullable=False, comment='下次触发时间')
- block_strategy = Column(TINYINT(4), nullable=False, default=1, comment='阻塞策略')
- executor_timeout = Column(Integer, nullable=False, default=0, comment='任务执行超时时间')
- description = Column(String(256), nullable=False, default='', comment='描述')
- flow_info = Column(Text, default=None, comment='流程信息')
- bucket_index = Column(Integer, nullable=False, default=0, comment='bucket')
- version = Column(Integer, nullable=False, comment='版本号')
- ext_attrs = Column(String(256), nullable=True, default='', comment='扩展字段')
- deleted = Column(TINYINT(4), nullable=False, default=0, comment='逻辑删除')
- create_dt = Column(DateTime, nullable=False, default=datetime.now, comment='创建时间')
- update_dt = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment='修改时间')
- # 定义索引
- __table_args__ = (
- Index('idx_create_dt', 'create_dt'),
- Index('idx_namespace_id_group_name', 'namespace_id', 'group_name'),
- )
- class Config:
- orm_mode = True
- '''工作流节点'''
- class SjWorkflowNode(Base):
- __tablename__ = 'sj_workflow_node'
- id = Column(BigInteger, primary_key=True, autoincrement=True, comment='主键')
- namespace_id = Column(String(64), nullable=False, default='764d604ec6fc45f68cd92514c40e9e1a', comment='命名空间id')
- node_name = Column(String(64), nullable=False, comment='节点名称')
- group_name = Column(String(64), nullable=False, comment='组名称')
- job_id = Column(BigInteger, nullable=False, comment='任务信息id')
- workflow_id = Column(BigInteger, nullable=False, comment='工作流ID')
- node_type = Column(TINYINT(4), nullable=False, default=1, comment='节点类型')
- expression_type = Column(TINYINT(4), nullable=False, default=0, comment='表达式类型')
- fail_strategy = Column(TINYINT(4), nullable=False, default=1, comment='失败策略')
- workflow_node_status = Column(TINYINT(4), nullable=False, default=1, comment='工作流节点状态')
- priority_level = Column(Integer, nullable=False, default=1, comment='优先级')
- node_info = Column(Text, default=None, comment='节点信息')
- version = Column(Integer, nullable=False, comment='版本号')
- ext_attrs = Column(String(256), nullable=True, default='', comment='扩展字段')
- deleted = Column(TINYINT(4), nullable=False, default=0, comment='逻辑删除')
- create_dt = Column(DateTime, nullable=False, default=datetime.now, comment='创建时间')
- update_dt = Column(DateTime, nullable=False, onupdate=datetime.now, comment='修改时间')
- # 定义索引
- __table_args__ = (
- Index('idx_create_dt', 'create_dt'),
- Index('idx_namespace_id_group_name', 'namespace_id', 'group_name'),
- )
- class Config:
- orm_mode = True
- '''工作流批次'''
- class SjWorkflowTaskBatch(Base):
- __tablename__ = 'sj_workflow_task_batch'
- id = Column(BigInteger, primary_key=True, autoincrement=True, comment='主键')
- namespace_id = Column(String(64), nullable=False, default='764d604ec6fc45f68cd92514c40e9e1a', comment='命名空间id')
- group_name = Column(String(64), nullable=False, comment='组名称')
- workflow_id = Column(BigInteger, nullable=False, comment='工作流任务id')
- task_batch_status = Column(TINYINT(4), nullable=False, default=0, comment='任务批次状态')
- operation_reason = Column(TINYINT(4), nullable=False, default=0, comment='操作原因')
- flow_info = Column(Text, default=None, comment='流程信息')
- execution_at = Column(BigInteger, nullable=False, default=0, comment='任务执行时间')
- ext_attrs = Column(String(256), nullable=True, default='', comment='扩展字段')
- deleted = Column(TINYINT(4), nullable=False, default=0, comment='逻辑删除')
- create_dt = Column(DateTime, nullable=False, default=datetime.now, comment='创建时间')
- update_dt = Column(DateTime, nullable=False, onupdate=datetime.now, comment='修改时间')
- # 定义索引
- __table_args__ = (
- Index('idx_workflow_id_task_batch_status', 'workflow_id', 'task_batch_status'),
- Index('idx_create_dt', 'create_dt'),
- Index('idx_namespace_id_group_name', 'namespace_id', 'group_name'),
- )
- class Config:
- orm_mode = True
|