Exemplo n.º 1
0
class Role(db.Model):
    __tablename__ = "role"
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(20))
    flow_infos = db.relationship('FlowInfo', secondary=role_flow, backref=db.backref('role', lazy='dynamic'),
                                 lazy='dynamic')
    flow_action_infos = db.relationship("FlowActionInfo", backref=db.backref("role"))
    create_time = db.Column(db.DateTime, default=datetime.datetime.now())
    enable = db.Column(db.Boolean, default=True)

    def __repr__(self):
        return u'<角色 {}>'.format(self.name)
Exemplo n.º 2
0
class FlowStepInfo(db.Model):
    '''
    流程步骤对应表
    '''
    id=db.Column(db.Integer,primary_key=True)
    name = db.Column(db.String(20))
    flow_info_id=db.Column(db.Integer,db.ForeignKey("flow_info.id"))
    flow_info = db.relationship("FlowInfo",backref=db.backref('flow_step_infos', order_by=id))
    flow_action_info_id=db.Column(db.Integer,db.ForeignKey("flow_action_info.id"))
    flow_action_info=db.relationship("FlowActionInfo",backref=db.backref('flow_step_infos'))
    repeat_no=db.Column(db.Integer,default=1)#重复次数
    order_no=db.Column(db.Integer)           #排序号
    def __repr__(self):
        return u'<FlowStepInfo {}>'.format(self.name)
Exemplo n.º 3
0
class UserFlowInfo(db.Model):
    '''
    用户流程表
    '''
    id=db.Column(db.Integer,primary_key=True)
    user_id=db.Column(db.Integer,db.ForeignKey("user.id"))
    flow_info_id=db.Column(db.Integer,db.ForeignKey("flow_info.id"))
    flow_info=db.relationship('FlowInfo',backref=db.backref('user_flow_infos'))
    step_id=db.Column(db.Integer,db.ForeignKey("flow_step_info.id"))
    step=db.relationship('FlowStepInfo',backref=db.backref('user_flow_infos'))
    next_user_id=db.Column(db.Integer,db.ForeignKey("user.id"))
    is_finish=db.Column(db.Boolean,default=False)
    create_time=db.Column(db.DateTime,default=datetime.datetime.now())

    def __repr__(self):
        return u'<UserFlowInfo {}>'.format(self.id)
Exemplo n.º 4
0
class Company(db.Model):
    __tablename__ = "company"
    id = db.Column(db.String(32), primary_key=True, default=generate_uuid)
    name = db.Column(db.String(100))
    users = db.relationship('User', backref='company', lazy='dynamic')

    def __unicode__(self):
        return u'<单位 {}>'.format(self.name)

    def __repr__(self):
        return u'<单位 {}>'.format(self.name)
Exemplo n.º 5
0
class User(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(80), unique=True)
    roles = db.relationship('Role', secondary=user_role, backref=db.backref('users', lazy='dynamic'), lazy='dynamic')
    email = db.Column(db.String(120), unique=True)
    password = db.Column(db.String(30), unique=True)
    company_id = db.Column(db.String(32), db.ForeignKey('company.id'))
    create_time = db.Column(db.DateTime, default=datetime.datetime.now())

    def __repr__(self):
        return u'<user {}>'.format(self.name)
Exemplo n.º 6
0
class TranctProc(db.Model):
    '''
    用户流程表详尽
    '''
    id = db.Column(db.Integer, primary_key=True)
    user_flow_info_id = db.Column(db.Integer, db.ForeignKey("user_flow_info.id"))
    user_flow_info = db.relationship('UserFlowInfo', backref=db.backref('tranct_procs', lazy='dynamic'))
    step_action = db.Column(db.Integer)  # 同意1,退回2,终止3
    step_time = db.Column(db.DateTime, default=datetime.datetime.now())
    desc = db.Column(db.String(500))

    def __repr__(self):
        return u'<TranctProc {}>'.format(self.id)
Exemplo n.º 7
0
class Post(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(80))
    body = db.Column(db.Text)
    pub_date = db.Column(db.DateTime)

    category_id = db.Column(db.Integer, db.ForeignKey('category.id'))
    category = db.relationship('Category',
        backref=db.backref('posts', lazy='dynamic'))

    def __init__(self, title, body, category, pub_date=None):
        self.title = title
        self.body = body
        if pub_date is None:
            pub_date = datetime.utcnow()
        self.pub_date = pub_date
        self.category = category

    def __repr__(self):
        return '<Post %r>' % self.title