#pragma once
#include "CivAssembly.h"
#include "CivInpHelperAbs.h"

/**
* 增加
*/
class PANDADBMANAGER_API CivProjInpDbHelper: public CivInpHelperAbs
{
public:
	explicit CivProjInpDbHelper(const std::string& uri);
	~CivProjInpDbHelper();

	void handlePump() override;
	void handleValve() override;

	bool getNode(CivNode& node)override;
	bool getPipe(CivPipe& pipe) override;
	bool getTank(CivTank& tank) override;
	bool getValve(CivValve& valve) override;
	bool getPumps(CivPumps& pump) override;
	bool getReservoirs(CivReservoirs& reservoirs) override;
	bool getCoordinates(CivCoordinates& coord) override;
	bool getQuality(CivQuality& quality) override;
	bool getStatus(CivStatus& status) override;

	void setProjCode(const std::string& projCode);

private:
	// 将方案详情表查出的数据按图层分类
	void sortProjDeatil();

	/**
	*@brief 根据图层动态生成需要查询详情表条件
	*/
	std::string inline splicingConditions(const std::string& layer);

	std::string inline genSql(const std::string& table);

	std::string mPorjCode;
	std::string mCondition;

	// 根据方案编码做详情表的数据缓存
	std::map<std::string,std::vector<std::map<std::string,std::string>>>  mDetailMap;
};
