|
|
@@ -207,6 +207,24 @@ class MySqlDao:
|
|
|
|
|
|
return data
|
|
|
|
|
|
+ def get_order_by_cust_ids_and_product_ids(self, city_uuid, cust_id_list, product_ids):
|
|
|
+ """获取指定商户列表在指定品规列表上的售卖记录"""
|
|
|
+ logger.info(f"Getting orders by cust ids and product ids for city_uuid={city_uuid}, custs={len(cust_id_list)}, products={len(product_ids)}")
|
|
|
+ if not cust_id_list or not product_ids:
|
|
|
+ return pd.DataFrame()
|
|
|
+
|
|
|
+ query = text(f"""
|
|
|
+ SELECT cust_code, product_code, sale_qty
|
|
|
+ FROM {self._order_tablename}
|
|
|
+ WHERE city_uuid = :city_uuid
|
|
|
+ AND cust_code IN :cust_ids
|
|
|
+ AND product_code IN :product_ids
|
|
|
+ """).bindparams(bindparam("cust_ids", expanding=True), bindparam("product_ids", expanding=True))
|
|
|
+ params = {"city_uuid": city_uuid, "cust_ids": list(cust_id_list), "product_ids": list(product_ids)}
|
|
|
+ data = pd.DataFrame(self.db_helper.fetch_all(query, params))
|
|
|
+
|
|
|
+ return data
|
|
|
+
|
|
|
def get_order_by_product(self, city_uuid, product_id):
|
|
|
logger.info(f"Getting orders by product for city_uuid={city_uuid}, product_id={product_id}")
|
|
|
query = f"""
|