|
@@ -19,7 +19,7 @@ class MySqlDao:
|
|
|
self.db_helper = MySqlDatabaseHelper()
|
|
self.db_helper = MySqlDatabaseHelper()
|
|
|
self._product_tablename = "tads_brandcul_product_info_f"
|
|
self._product_tablename = "tads_brandcul_product_info_f"
|
|
|
self._cust_tablename = "tads_brandcul_cust_info_f"
|
|
self._cust_tablename = "tads_brandcul_cust_info_f"
|
|
|
- self._order_tablename = "tads_brandcul_consumer_order_check"
|
|
|
|
|
|
|
+ self._order_tablename = "tads_brandcul_consumer_order"
|
|
|
# self._order_tablename = "tads_brandcul_consumer_order"
|
|
# self._order_tablename = "tads_brandcul_consumer_order"
|
|
|
# self._eval_order_name = "tads_brandcul_consumer_order_check"
|
|
# self._eval_order_name = "tads_brandcul_consumer_order_check"
|
|
|
self._mock_order_tablename = "yunfu_mock_data"
|
|
self._mock_order_tablename = "yunfu_mock_data"
|
|
@@ -128,6 +128,40 @@ class MySqlDao:
|
|
|
|
|
|
|
|
return data
|
|
return data
|
|
|
|
|
|
|
|
|
|
+ def get_product_by_ids(self, city_uuid, product_id_list):
|
|
|
|
|
+ """根据product_code列表查询其信息"""
|
|
|
|
|
+ if not product_id_list:
|
|
|
|
|
+ return None
|
|
|
|
|
+
|
|
|
|
|
+ product_id_str = ",".join([f"'{product_id}'" for product_id in product_id_list])
|
|
|
|
|
+ query = f"""
|
|
|
|
|
+ SELECT *
|
|
|
|
|
+ FROM {self._product_tablename}
|
|
|
|
|
+ WHERE city_uuid = :city_uuid
|
|
|
|
|
+ AND product_code IN ({product_id_str})
|
|
|
|
|
+ """
|
|
|
|
|
+ params = {"city_uuid": city_uuid}
|
|
|
|
|
+ data = self.db_helper.load_data_with_page(query, params)
|
|
|
|
|
+
|
|
|
|
|
+ return data
|
|
|
|
|
+
|
|
|
|
|
+ def get_order_by_product_ids(self, city_uuid, product_ids):
|
|
|
|
|
+ """获取指定香烟列表的所有售卖记录"""
|
|
|
|
|
+ if not product_ids:
|
|
|
|
|
+ return None
|
|
|
|
|
+
|
|
|
|
|
+ product_ids_str = ",".join([f"'{product_code}'" for product_code in product_ids])
|
|
|
|
|
+ query = f"""
|
|
|
|
|
+ SELECT *
|
|
|
|
|
+ FROM {self._order_tablename}
|
|
|
|
|
+ WHERE city_uuid = :city_uuid
|
|
|
|
|
+ AND product_code IN ({product_ids_str})
|
|
|
|
|
+ """
|
|
|
|
|
+ params = {"city_uuid": city_uuid}
|
|
|
|
|
+ data = self.db_helper.load_data_with_page(query, params)
|
|
|
|
|
+
|
|
|
|
|
+ return data
|
|
|
|
|
+
|
|
|
def get_order_by_product(self, city_uuid, product_id):
|
|
def get_order_by_product(self, city_uuid, product_id):
|
|
|
query = f"""
|
|
query = f"""
|
|
|
SELECT *
|
|
SELECT *
|
|
@@ -152,6 +186,19 @@ class MySqlDao:
|
|
|
|
|
|
|
|
return data
|
|
return data
|
|
|
|
|
|
|
|
|
|
+ def get_order_by_cust_and_product(self, city_uuid, cust_id, product_id):
|
|
|
|
|
+ query = f"""
|
|
|
|
|
+ SELECT *
|
|
|
|
|
+ FROM {self._order_tablename}
|
|
|
|
|
+ WHERE city_uuid = :city_uuid
|
|
|
|
|
+ AND cust_code = :cust_id
|
|
|
|
|
+ AND product_code =:product_id
|
|
|
|
|
+ """
|
|
|
|
|
+ params = {"city_uuid": city_uuid, "cust_id": cust_id, "product_id": product_id}
|
|
|
|
|
+ data = self.db_helper.load_data_with_page(query, params)
|
|
|
|
|
+
|
|
|
|
|
+ return data
|
|
|
|
|
+
|
|
|
def data_preprocess(self, data: pd.DataFrame):
|
|
def data_preprocess(self, data: pd.DataFrame):
|
|
|
|
|
|
|
|
data.drop(["cust_uuid", "longitude", "latitude", "range_radius"], axis=1, inplace=True)
|
|
data.drop(["cust_uuid", "longitude", "latitude", "range_radius"], axis=1, inplace=True)
|