def mget_last_record(cls, bankcard_ids): session = Session() subquery = session.query(cls)\ .order_by(cls.created_at.desc()).subquery() query = session.query(cls, subquery).group_by(subquery.c.rst_id)\ .filter(subquery.c.id.in_(bankcard_ids)) return query.all()
def put(): recruit_ids = [int(_id) for _id in json.loads(request.data).get("id_list")] status_to = int(json.loads(request.data).get("status")) session = DBSession() recruits = session.query(RestaurantRecruitment).filter( RestaurantRecruitment.id.in_(recruit_ids)).all() for recruit in recruits: recruit.status = status_to return ''
def get_voice_order(order_id): voice_order = DBSession.query(VoiceOrder).filter( VoiceOrder.order_id == order_id).first() return voice_order.serialize()
def mget_voice_order(order_ids): voice_orders = DBSession.query(VoiceOrder).filter( VoiceOrder.order_id.in_(order_ids)).all() return {v_order.order_id: v_order.serialize() for v_order in voice_orders}
def get(cls, reply_id): return DBSession.query(cls).get(reply_id)
def delete_restaurant_recruitment(_id): s = DBSession() obj = s.query(RestaurantRecruitment).get(_id) s.delete(obj) s.commit() return True
def get_restaurant_recruitment(_id): obj = DBSession.query(RestaurantRecruitment).get(_id) return obj.serialize()