1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384 |
- # -*- 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, 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='更新时间')
- 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, 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='更新时间')
- 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, 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='更新时间')
- 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')
- parent_name = Column(String(30), default='', comment='父部门名称')
- ancestors = Column(String(500), default='', comment='祖级列表')
- dept_name = Column(String(30), default='', comment='部门名称')
- dept_category = Column(String(100), default='', comment='部门类别编码')
- order_num = Column(Integer, default=0, comment='显示顺序')
- leader = Column(BigInteger, default=None, comment='负责人')
- leader_name = Column(String(30), default='', comment='负责人姓名')
- phone = Column(String(100), default='', comment='联系电话')
- email = Column(String(100), default='', 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, default=datetime.now, comment='创建时间')
- update_by = Column(BigInteger, default=None, comment='更新者')
- update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间')
- sign = Column(String, server_default='', default='', comment='HMACSM3数值')
- 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')
- dept_name = Column(String(30), default='', comment='部门名称')
- 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, default='0', 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 = Column(Integer, default=0, comment='登录次数')
- login_ip = Column(String(128), default='', comment='最后登录IP')
- login_date = Column(DateTime, default=datetime.now, 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=None, comment='备注')
- yzy_account = Column(String(50), default=None, comment='粤政易账号')
- sign = Column(String, server_default='', default='', comment='HMACSM3数值')
- 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, 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='备注')
- sign = Column(String, server_default='', default='', comment='HMACSM3数值')
- 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(Integer, default=1, comment='菜单树选择项是否关联显示')
- dept_check_strictly = Column(Integer, default=1, 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, 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='备注')
- sign = Column(String, server_default='', default='', comment='HMACSM3数值')
- 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代表删除)')
- sign = Column(String, server_default='', default='', comment='HMACSM3数值')
- 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')
- sign = Column(String, server_default='', default='', comment='HMACSM3数值')
- class Config:
- orm_mode = True
- '''用户和视频关联表'''
- class SysUserVideo(Base):
- __tablename__ = 'sys_user_video'
- __table_args__ = (PrimaryKeyConstraint('video_code_int', 'user_id'),)
- user_id = Column(BigInteger, nullable=True, comment='用户ID')
- video_code_int = Column(String(255), 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')
- sign = Column(String, server_default='', default='', comment='HMACSM3数值')
- 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')
- sign = Column(String, server_default='', default='', comment='HMACSM3数值')
- 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')
- sign = Column(String, server_default='', default='', comment='HMACSM3数值')
- class Config:
- orm_mode = True
- '''菜单权限表'''
- class SysMenuLayer(Base):
- __tablename__ = 'sys_menu_layer'
- 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按钮)')
- layer_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代表删除)')
- layer_template = Column(String(100), default='', comment='图层模板')
- sign = Column(String, server_default='', default='', comment='HMACSM3数值')
- 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, 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代表删除)')
- # 定义唯一性约束条件
- __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, 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='备注')
- 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, 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(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, 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='备注')
- 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, default=datetime.now, comment='创建时间')
- update_by = Column(BigInteger, default=None, comment='更新者')
- update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, 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_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='更新时间')
- 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=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='备注')
- 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=datetime.now, comment='创建时间')
- update_by = Column(BigInteger, default=None, comment='更新者')
- update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, 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_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='更新时间')
- 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_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='更新时间')
- 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, 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='更新时间')
- 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, 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='更新时间')
- # 定义唯一性约束条件
- __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, 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='更新时间')
- 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, 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='备注')
- 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, 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='更新时间')
- 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, 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='更新时间')
- 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
|