def by_name(cls, name): """ 根据name查询数据 :param name: :return: """ return dbSession.query(cls).filter_by(name=name).first()
def by_uuid(cls, uuid): """ 根据UUID查询单条数据 :param uuid: :return: """ return dbSession.query(cls).filter_by(uuid=uuid).first()
def by_id(cls, id): """ 根据ID 查询单条数据 :param id: :return: """ return dbSession.query(cls).filter_by(id=id).first()
def all(cls): """ 查询所有的数据,返回表数据 :return: 列表 """ query = dbSession.query(cls) data = query.all() count = query.count() return data, count
def all(cls): """ 查询所有的数据,返回表数据 :return: 列表 """ query = dbSession.query(cls) data = query.order_by(cls.group_id).all() count = query.count() return data, count
def all(cls): """ 查询所有的数据,返回表数据 :return: 列表 """ return dbSession.query(cls).all()
def query(cls): return dbSession.query(cls)
def all(cls): query = dbSession.query(cls) data = query.all() count = query.count() return data, count
def by_id(cls, group_id): return dbSession.query(cls).filter_by(id=group_id).first()
def by_name(cls, name): return dbSession.query(cls).filter_by(name=name).first()