| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 | 
							- import pymysql
 
- class MysqlSearchUtils():
 
-     def __init__(self):
 
-         try:
 
-             self.conn = pymysql.connect(host="139.186.27.96",port=4000,user="data",passwd="hcst@2021",db="jeecg-boot",charset="utf8mb4")
 
-             self.cursor = self.conn.cursor()
 
-         except pymysql.err as e:
 
-             print("error"% e)
 
-     def get_one(self):
 
-         sql = "select * from ctop_user_allocation where account_id = %s order by id desc"
 
-         self.cursor.execute(sql, ('9556344',))
 
-         rest = self.cursor.fetchone()
 
-         result = dict(zip([k[0] for k in self.cursor.description], rest))
 
-         self.cursor.close()
 
-         return result
 
-     def get_all(self):
 
-         sql = "select * from ctop_user_allocation where project_id = %s order by id desc"
 
-         self.cursor.execute(sql, ('458',))
 
-         rest = self.cursor.fetchall()
 
-         result = [dict(zip([k[0] for k in self.cursor.description], row)) for row in rest]
 
-         self.cursor.close()
 
-         return result
 
-     def get_all_ai_account_target_template_by_params(self,status,account_id):
 
-         sql = "select * from ctop_ai_kuaishou_auto_creative_account_info where status = %s order by id desc"
 
-         self.cursor.execute(sql, (status,))
 
-         rest = self.cursor.fetchall()
 
-         result = [dict(zip([k[0] for k in self.cursor.description], row)) for row in rest]
 
-         self.cursor.close()
 
-         return result
 
-     def db_close(self):
 
-         self.conn.close()
 
-     def get_kuaishou_video_list_by_params(self, accountId, startDate, endDate):
 
-         sql = "select * from ctop_kuaishou_video_get where account_id = %s and stat_date>= %s and stat_date<=%s order by id desc"
 
-         self.cursor.execute(sql, (accountId,startDate,endDate))
 
-         rest = self.cursor.fetchall()
 
-         result = [dict(zip([k[0] for k in self.cursor.description], row)) for row in rest]
 
-         self.cursor.close()
 
-         return result
 
- if __name__ == '__main__':
 
-     obj = MysqlSearchUtils()
 
-     reslt = obj.get_all()
 
-     for item in reslt:
 
-         print(item)
 
-         print("-" * 10)
 
-     obj.db_close()
 
 
  |