tfse-app-api-v0.2/company/company_db.py

23 lines
543 B
Python
Raw Normal View History

2021-12-13 16:04:10 +08:00
import pymongo
2022-01-26 17:34:59 +08:00
MG_USER = "root"
MG_PWD = "sromitdTW569kC#M"
MG_HOST = "116.63.130.34"
MG_PORT = "27018"
CLIENT = pymongo.MongoClient('mongodb://{}:{}@{}:{}'.format(MG_USER, MG_PWD, MG_HOST, MG_PORT))
2021-12-13 16:04:10 +08:00
2022-01-26 17:34:59 +08:00
def FIND_DATA_IN_COMPANY(param1, param2):
2021-12-13 16:04:10 +08:00
"""
2021-12-21 11:06:58 +08:00
从企业数据库中查询数据
2021-12-13 16:04:10 +08:00
Parameters:
2021-12-21 11:06:58 +08:00
param1 str 数据表
param2 dict 查询条件
2021-12-13 16:04:10 +08:00
Returns:
res: desc
"""
2022-01-26 17:34:59 +08:00
collection = CLIENT['企业'][param1]
2021-12-21 11:06:58 +08:00
data = collection.find(param2, {'_id': False})
2021-12-17 17:15:20 +08:00
record = list(data)
return record