Example #1
0
class Role(Model):
    __table__ = 'tb_role'
    id = IntField(primary_key=True)
    code = StrField(column_type='varchar(10)')
    name = StrField(column_type='varchar(50)')

    @classmethod
    def all(cls):
        return {item.code: item.name for item in Role.find()}

    @classmethod
    def all_name(cls):
        return [item.name for item in Role.find()]
Example #2
0
File: fund.py Project: ehoac/wfund
class FundKind(Model):
    __table__ = 'tb_fund_kind'
    id = IntField(primary_key=True)
    code = StrField(column_type='varchar(10)')
    value = StrField(column_type='varchar(50)')

    @classmethod
    def all(cls):
        return {item.code: item.value for item in FundKind.find()}

    @classmethod
    def all_name(cls):
        return [k.value for k in cls.find()]
Example #3
0
class Config(Model):
    __table__ = 'tb_config'
    id = IntField(primary_key=True)
    code = StrField()
    value = StrField()
    dsc = StrField(column_type='varchar(500)')
    sign = StrField(column_type='varchar(1)')

    @classmethod
    def get_value(cls, code=''):
        configs = cls.find(where="code=? and sign='Y'", args=code)
        if configs and len(configs) > 0:
            config = configs[0]
            if config.value == 'Y' or config.value == 'y':
                return True
            elif config.value == 'N' or config.value == 'n':
                return False
            else:
                return config.value
Example #4
0
File: fund.py Project: ehoac/wfund
class FundApply(Model):
    __table__ = 'tb_fund_apply'
    id = IntField(primary_key=True)
    kind = StrField(column_type='varchar(5)')
    state = StrField(column_type='varchar(5)')
    money = DecimalField()
    date = StrField(column_type='varchar(25)')
    reason = StrField(column_type='varchar(500)')
    persons = StrField(column_type='varchar(500)')
    create_time = StrField(column_type='varchar(25)')
    update_time = StrField(column_type='varchar(25)')
    user_id = IntField()
Example #5
0
class User(Model):
    __table__ = 'tb_user'
    id = IntField(primary_key=True)
    code = StrField(column_type='varchar(50)')
    name = StrField(column_type='varchar(50)')
    password = StrField(column_type='varchar(128)')
    sex = StrField(column_type='varchar(2)')
    birthday = StrField(column_type='varchar(25)')
    mobile = StrField(column_type='varchar(11)')
    email = StrField(column_type='varchar(200)')
    address = StrField(column_type='varchar(200)')
    home = StrField(column_type='varchar(200)')
    avatar = TextField()
    create_time = StrField(column_type='varchar(25)')
    update_time = StrField(column_type='varchar(25)')
    role = StrField(column_type='varchar(10)')

    @classmethod
    def all(cls):
        return {item.id: item.name for item in User.find()}
Example #6
0
File: fund.py Project: ehoac/wfund
class FundProvide(Model):
    __table__ = 'tb_fund_provide'
    id = IntField(primary_key=True)
    money = DecimalField()
    create_time = StrField(column_type='varchar(25)')
    user_id = IntField()