def get_product_by_pid_list(self, pid_list): """ :param pid_list: list type :return: """ result = Product.select().where(Product.pid << pid_list) product_list = [] for p in result: dp = self._format_product_to_show(p) product_list.append(dp) return product_list
def query_product_list(self, query_condition): """ :param query_condition: dict type :return: """ where_condition = 1 if query_condition: for k, v in query_condition.items(): where_condition = where_condition & self._query_statement(k, v) result = Product.select().where(where_condition) product_list = [] for p in result: dp = self._format_product_to_show(p, only_show_first_photo=True) product_list.append(dp) return product_list
def get_one_by_pid(self, pid): p = Product.select().where(Product.pid == pid) if not p: return {} dp = self._format_product_to_show(p[0]) return dp
def get_product_obj_by_pid_list(self, pid_list): return Product.select().where(Product.pid << pid_list)