#pragma once
#include<string>
#include<map>
#include<vector>

#include "CivBaseStruct.h"
#include "pandaDbManager.h"

using namespace std;
class CivConnection;

/**
 水泵查询接口
*/
class PANDADBMANAGER_API CivPumpHelper
{
public:
	enum CacheType
	{
		SnToCode, 
		CodeToSn
	};
	explicit CivPumpHelper(const string& uri);
	~CivPumpHelper();

	// 获取指定属性字段键值对映射
	void getMap(const string& key, const string& val, map<string, string>& res);

	// 获取水泵的个数
	int getPumpNumbers();

	// 获取水泵的编号
	void getPumpSn(vector<string>& pumpNames, map<string, string>& pumpMap);

	// 获取泵站
	void getPumpStations(vector<PumpStation>& stations);

	void getMonitors(vector<string>& monitors, map<string, string>& monitorMap);

	bool updateDatas(const std::string& tablename, const std::map<std::string, std::map<std::string, float>>& resultMap);
	void codeToSn(const std::string& tablename, std::map<std::string, std::string>& resmap);
	void snToCode(const std::string& tablename, std::map<std::string, std::string>& resmap);
private:
	void baseCommonCache(const std::string& tablename, std::map<std::string, std::string>& resmap, CacheType cacheType);
private:
	CivConnection* mConn = nullptr;

	const string mTable = "水泵";
};
