79 lines
1.8 KiB
C++
79 lines
1.8 KiB
C++
#ifndef CASSETDATAMNG_H
|
|
#define CASSETDATAMNG_H
|
|
|
|
#include "db_api_ex/CDbApi.h"
|
|
#include "CAssetCommon.h"
|
|
#include <QMap>
|
|
#include <QObject>
|
|
|
|
class CAssetDataMng :public QObject
|
|
{
|
|
public:
|
|
static CAssetDataMng *instance();
|
|
|
|
void destory();
|
|
|
|
QMap<int, QString> readLocation();
|
|
|
|
QList<int> readLocationOrder();
|
|
|
|
QMap<QString, QString> readDevg();
|
|
|
|
QMap<QString, QString> readDevgByLoc(int loc);
|
|
|
|
QMap<QString, QString> readDev();
|
|
|
|
void readLocDevgMap(QMap<QString, QString> &devgMap,QMap<int ,QList<QString> > & locDevgMap);
|
|
|
|
int readLocIdByDevg(const QString &devg, int &loc);
|
|
|
|
QList<AssetInfo> getAssetInfoByDevg(const QStringList &devgList);
|
|
QList<AssetRecord> getRecordInfoByDevId(const QString &devId);
|
|
QList<AssetRecord> getRecordInfoByDevId(const QList<QString> &idList);
|
|
|
|
QList<QString> getStatus();
|
|
QString buildDevgCon(const QStringList &devgList);
|
|
QString buildDevCon(const QList<QString> &idList);
|
|
|
|
int addAsset(const AssetInfo & info);
|
|
|
|
void importAsset(const QMap<QString, AssetInfo> &infoMap, QString &mess);
|
|
|
|
int updateAsset(const AssetInfo & info);
|
|
|
|
int delAsset(const QList<QString> &idList);
|
|
|
|
int addRecord(const AssetRecord & info);
|
|
|
|
void importRecord(const QMap<QString, AssetRecord> &infoMap, QString &mess);
|
|
|
|
int updateRecord(const AssetRecord & info);
|
|
int delRecord(const QList<QString> &intList);
|
|
|
|
int getCount();
|
|
|
|
void addCount();
|
|
|
|
void subCount();
|
|
|
|
QString getError();
|
|
QString getRandomId();
|
|
private:
|
|
CAssetDataMng();
|
|
|
|
QStringList getAllAssetIdList();
|
|
|
|
QStringList getAllRecordIdList();
|
|
|
|
private:
|
|
static CAssetDataMng * m_pInstance;
|
|
|
|
iot_dbms::CDbApi *m_pWriteDb;
|
|
|
|
int m_referenceCount;
|
|
|
|
QString m_error;
|
|
};
|
|
|
|
#endif // CASSETDATAMNG_H
|