Exemple #1
0
class User_Company(Base):
    log.info('----->>用户与公司关联表')
    __tablename__ = 'user_company'
    id = Column(Integer, primary_key=True, autoincrement=True)
    User_ID = Column(String(20), comment='用户ID')
    Company_ID = Column(String(20), comment='公司ID')
    Company_Power_ID = Column(Integer, comment='公司权限ID')
Exemple #2
0
class User_Item(Base):
    log.info('---->> 用户关联的项目表')
    __tablename__ = 'user_item'
    id = Column(Integer, primary_key=True, autoincrement=True)
    User_ID = Column(String(20), comment='用户ID')
    Item_ID = Column(String(20), comment='项目ID')
    Item_Power_ID = Column(Integer, comment='权限ID')
Exemple #3
0
class User(Base):
    __tablename__ = 'users'

    id = Column('id', Integer, primary_key=True)
    name = Column('name', String)
    token = Column('token', String)
    expire = Column('expire', Integer)
    password = Column('password', String)

    def verifyToken(self, token):
        if token == self.token and self.expire > getTime():
            return True
        return False

    def getToken(self, password):
        if pwd.verify(password, self.password):

            # generate token
            alphabet = string.ascii_letters + string.digits
            self.token = ''.join( \
                    choice(alphabet) for i in range(TOKEN_SIZE))

            self.expire = getTime() + TOKEN_EXPIRE
            session.commit()
            return self.token

        return None

    def __init__(self, name, password):
        self.name = name
        self.password = pwd.encrypt(password)
        session.add(self)
        session.commit()
Exemple #4
0
class Power(Base):
    log.info('----->权限表')
    __tablename__ = 'power'
    id = Column(Integer, primary_key=True, autoincrement=True)
    Power_ID = Column(String(20), comment='权限ID')
    Power_Name = Column(String(20), comment='权限名称')
    Power_Status = Column(Enum('0', '1', '2'),
                          comment='权限位置:0、公司权限,1、项目组权限,2、待定。。')
Exemple #5
0
class Person(Base):
    __tablename__ = 'person'
    nid = Column(Integer, primary_key=True)
    name = Column(String(32), index=True, nullable=True)
    hobby_id = Column(Integer, ForeignKey("hobby.id"))  # 建FK关系

    # 与生成表结构无关,仅用于查询方便
    hobby = relationship("Hobby", backref='pers')  # 反向关联的名字
Exemple #6
0
class Item_Power(Base):
    log.info('---->> 账户在项目内的权限表')
    __tablename__ = 'item_power'
    id = Column(Integer, primary_key=True, autoincrement=True)
    Item_Power_ID = Column(Integer, comment='权限ID')
    Power_ID = Column(String(20), comment='权限名称')
    Power_Status = Column(Enum('0', '1', '2'),
                          comment='权限状态:0、有权限,1、没有权限,2、半权限')
Exemple #7
0
class Join(Base):
    __tablename__ = 'join'

    user = Column('user', Integer, primary_key=True)
    message = Column('message', Integer, primary_key=True)

    def __init__(self, user, message):
        self.user = user.id
        self.message = message.id
        session.add(self)
        session.commit()
Exemple #8
0
class Teacher_cash(db.Model):
    id = Column(Integer, primary_key=True)
    teacher_id = Column(Integer)
    teacher_name = Column(String)
    teacher_surname = Column(String)
    username = Column(String)
    salary = Column(Integer)
    payment = Column(Integer)
    result = Column(Integer)
    payment_data = Column(DateTime)
Exemple #9
0
class Message(Base):
    __tablename__ = 'messages'

    id = Column('id', Integer, primary_key=True)
    content = Column('content', String)
    time = Column('time', Integer)
    votes = Column('votes', Integer)

    def __init__(self, content):
        self.content = content
        self.time = int(round(time.time() * 1000))
        self.votes = 0
        session.add(self)
        session.commit()
Exemple #10
0
class Item_list(Base):
    log.info('---->> 项目表')
    __tablename__ = 'item_list'
    id = Column(Integer, primary_key=True, autoincrement=True)
    Item_ID = Column(String(20))
    Company_ID = Column(String(40), comment='公司ID')
    Item_Name = Column(String(20), comment='项目名称')
    Item_Introduce = Column(LONGTEXT, comment='项目介绍')
    Item_Status = Column(INT, comment='项目状态:0、正常进行,1、未开始,2、已结束,3、暂停项目,4、')
    Creation_Time = Column(DateTime, comment='项目创建日期')
    Last_Modified = Column(DateTime, comment='最后更新时间')
    User_ID = Column(String(20), comment='创建人ID')
Exemple #11
0
class Deleted_students(db.Model):
    id = Column(Integer, primary_key=True)
    reason = Column(String)
    student_id = Column(Integer)
    student_name = Column(String)
    student_surname = Column(String)
    student_phone = Column(String)
    student_parent_phone = Column(Integer)

    def init(self, reason, student_id, student_name, student_surname,
             student_phone, student_parent_phone):
        self.reason = reason
        self.student_id = student_id
        self.student_name = student_name
        self.student_parent_phone = student_parent_phone
        self.student_phone = student_phone
        self.student_surname = student_surname

    def format(self, reason, student_surname, student_phone,
               student_parent_phone, student_name, student_id):
        return {
            'reason': reason,
            'student_surname': student_surname,
            'student_phone': student_phone,
            'student_parent_phone': student_parent_phone,
            'student_name': student_name,
            'student_id': student_id,
        }
Exemple #12
0
class Student_cash(db.Model):
    id = Column(Integer, primary_key=True)
    student_id = Column(Integer)
    student_name = Column(String)
    student_surname = Column(String)
    username = Column(String)
    debt = Column(Integer)
    payment = Column(Integer)
    result = Column(Integer)
    payment_data = Column(DateTime)

    def add(self):
        db.session.add(self)
        db.session.commit()
Exemple #13
0
class Case(Base):
    log.info('----->用例表')
    __tablename__ = 'case'
    Case_ID = Column(Integer,
                     primary_key=True,
                     autoincrement=True,
                     comment='用例编号')
    Case_Title = Column(String(40), comment='用例标题')
    Case_Describe = Column(Text, comment='描述')
    File_ID = Column(String(20), comment='文件表ID')
    Case_Status = Column(Enum('1', '2', '3', '4', '5'),
                         comment='用例等级:1,2,3,4,5')
    User_ID = Column(String(20), comment='创建人ID')
    Responsibility_ID = Column(String(20), comment='责任人ID')
    Partake_ID = Column(String(20), comment='参与人')
    Item_ID = Column(String(20), comment='项目ID')
Exemple #14
0
class due_days(db.Model):
    id = Column(Integer, primary_key=True)
    img_due_days = Column(String, nullable=False)
    group_id_student = Column(Integer, nullable=False)
    id_of_student = Column(Integer, nullable=False)
    date_of_absent = Column(DateTime, nullable=False)
    reason_due = Column(String(), nullable=False)
Exemple #15
0
class reason_apset_days(db.Model):
    tablename = 'Reason'
    id = Column(Integer, primary_key=True)
    img_due_days = Column(String, nullable=False)
    reason_due = Column(String(), nullable=False)
    student_id = Column(Integer, nullable=False)
    date_abset = Column(DateTime, nullable=False)
    group_id = Column(Integer, nullable=False)
Exemple #16
0
class Company_list(Base):
    log.info('----->>公司表')
    __tablename__ = 'company_list'
    id = Column(Integer, primary_key=True, autoincrement=True)
    Company_ID = Column(String(20))
    Company_Name = Column(String(20), comment='公司名称')
    Company_Introd = Column(LONGTEXT, comment='公司介绍')
    Creation_Time = Column(DateTime, comment='公司创建时间')
    User_ID = Column(String(20), comment='创建人ID')
Exemple #17
0
class All_Capital_Expenditure(db.Model):
    id = Column(Integer, primary_key=True)
    total_sum = Column(Integer)
Exemple #18
0
class Bank(db.Model):
    id = Column(Integer, primary_key=True)
    cash = Column(Integer)
Exemple #19
0
class Groups(db.Model):
    __tablename__ = 'Groups'
    id = Column(Integer, primary_key=True)
    name = Column(String(), nullable=False)
    old_name = Column(String)
    teacher_1 = Column(Integer, nullable=False)
    number_students = Column(Integer)
    subject = Column(String)
    cost = Column(Integer)
    location = Column(Integer)
    teacher_name = Column(String)
    teacher_surname = Column(String)
    type_of_course = Column(String)

    def add_group(self):
        db.session.add(self)
        db.session.commit()

    def add_teacher(self):
        db.session.add(self)
        db.session.commit()

    def delete(self):
        db.session.delete(self)
        db.session.commit()

    def init(self, name, teacher_1, student1):
        self.name = name
        self.student1 = student1
        self.teacher_1 = teacher_1

    def format_teacher(self, name, location, teacher_1):
        return {'name': name, 'location': location, 'teacher_1': teacher_1}
Exemple #20
0
class Hobby(Base):
    __tablename__ = 'hobby'
    id = Column(Integer, primary_key=True)
    caption = Column(String(50), default='篮球')
Exemple #21
0
class File(Base):
    log.info('----->文件管理表')
    __tablename__ = 'file'
    id = Column(Integer, primary_key=True, autoincrement=True, comment='用例编号')
    File_ID = Column(String(20), comment='文件ID')
    File_Position = Column(Text, comment='文件位置')
Exemple #22
0
class All_groups(db.Model):
    id = Column(Integer, primary_key=True)
    all_groups = Column(Integer)
Exemple #23
0
class Student(db.Model):
    id = Column(Integer, primary_key=True)
    xojakent_admin = Column(Boolean)
    gazalkent_admin = Column(Boolean)
    name = Column(String)
    surname = Column(String)
    born_date = Column(DateTime)
    age = Column(Integer)
    username = Column(String)
    phone = Column(String)
    mother_phone = Column(String)
    father_phone = Column(String)
    password = Column(String)
    director = Column(Boolean)
    subject_1 = Column(String)
    subject_2 = Column(String)
    subject_3 = Column(String)
    for_group = Column(Boolean, default=False)
    group1 = Column(Integer)
    group2 = Column(Integer)
    group3 = Column(Integer)
    locations = Column(Integer, ForeignKey('Locations.id'))
    money = Column(Integer())
    attendance = Column(Boolean, default=False)
    charity = Column(Integer)
    photo = Column(String)
    otasining_ismi = Column(String)
    for_moved = Column(Boolean, default=False)

    def add(self):
        db.session.add(self)
        db.session.commit()

    def init(self, name, surname, age, username, for_group, phone, password,
             subject_1, subject_2, subject_3, locations, xojakent_admin,
             gazalkent_admin, director, charity, image):
        self.name = name
        self.surname = surname
        self.age = age
        self.username = username
        self.phone = phone
        self.for_group = for_group
        self.password = password
        self.subject_1 = subject_1
        self.subject_2 = subject_2
        self.subject_3 = subject_3
        self.locations = locations
        self.xojakent_admin = xojakent_admin
        self.gazalkent_admin = gazalkent_admin
        self.director = director
        self.charity = charity

    def delete(self):
        db.session.delete(self)
        db.session.commit()

    def format(self, name, surname, age, gmail, phone, password, subject_1,
               subject_2, subject_3, locations, xojakent_admin,
               gazalkent_admin, director):
        return {
            'name': name,
            'surname': surname,
            'age': age,
            'gmail': gmail,
            'phone': phone,
            'password': password,
            'subject_1': subject_1,
            'subject_2': subject_2,
            'subject_3': subject_3,
            'locations': locations,
            'xojakent_admin': xojakent_admin,
            'gazalkent_admin': gazalkent_admin,
            'director': director
        }
Exemple #24
0
class User(Base):
    log.info('----->>用户表')
    __tablename__ = "user"
    id = Column(Integer, primary_key=True, autoincrement=True)
    User_ID = Column(String(20), comment='用户ID')
    User_Name = Column(String(20), comment='用户昵称')
    User_Introduce = Column(String(40), comment='用户简介')
    User_Identity = Column(Enum('0', '1', '2'),
                           comment='用户身份:0、普通用户,1、草鸡管理员,2、临时用户')
    User_Phone = Column(Integer, comment='电话号码')
    User_Email = Column(String(20), comment='邮箱')
    User_Password = Column(String(40), comment='密码')
    File_ID = Column(String(20), comment='用户头像保存位置')
    Creation_Time = Column(DateTime, comment='用户创建日期')
    Last_Modified = Column(DateTime, comment='用户最后登录时间')
    Token = Column(String(20), comment='token')
    User_Status = Column(
        Enum('0', '1', '2', '3', '4', '5', '6'),
        comment='用户状态:0、正常状态,1、未分配公司,2、未分配项目,3、账户已过期,4、账户冻结,5、账户异常,6、待定。。')
Exemple #25
0
class Capital_expenditure(db.Model):
    id = Column(Integer, primary_key=True)
    item = Column(String)
    number_items = Column(Integer)
    amount_item = Column(Integer)
    bought_data = Column(DateTime)
Exemple #26
0
class Overhead(db.Model):
    id = Column(Integer, primary_key=True)
    reason = Column(String)
    quantity = Column(String)
    sum = Column(Integer)
    payed_data = Column(DateTime)
Exemple #27
0
class Withdrawal(db.Model):
    id = Column(Integer, primary_key=True)
    who = Column(String)
    why = Column(String)
    amount = Column(Integer)
    date = Column(DateTime)
Exemple #28
0
class All_withdrawal(db.Model):
    id = Column(Integer, primary_key=True)
    total_sum = Column(Integer)
Exemple #29
0
class All_overhead(db.Model):
    id = Column(Integer, primary_key=True)
    total_sum = Column(Integer)
Exemple #30
0
class All_Charity_Sums(db.Model):
    id = Column(Integer, primary_key=True)
    bank_charity = Column(Integer)