Esempio n. 1
0
    def query_to_get_book_goods_info_by_isbn(self, isbn):
        sql = 'select isbn, link, platform, instant_price, max(crawling_time) ' \
              'from book_goods_info ' \
              'where isbn="%s" ' \
              'group by platform' %(isbn)
        self.cursor.execute(sql)
        result_list = self.cursor.fetchall()
        goods_list = []
        for result in result_list:
            goodspo = GoodsPO()
            goodspo.set_all(result)
            goods_list.append(goodspo)

        return goods_list
Esempio n. 2
0
    def __parse_book_to_po(self, book):
        #把Book转化为两个PO实体
        #steop1 : book->goods
        goods = GoodsPO()
        goods.isbn = book.isbn
        goods.instant_price = book.instant_price
        goods.link = book.link
        goods.platform = book.platform
        goods.crawling_time = book.crawling_time

        #step2 : book->bookpo
        bookpo = BookPO()
        bookpo.description = book.description
        bookpo.author = book.author
        bookpo.isbn = book.isbn
        bookpo.press = book.press
        bookpo.title = book.title
        bookpo.price = book.price
        bookpo.cover = book.cover
        return (goods, bookpo)