39 lines
1.0 KiB
C++
39 lines
1.0 KiB
C++
// extraPropertyManager.h
|
|
#pragma once
|
|
#include <QObject>
|
|
#include <QVector>
|
|
#include <QMap>
|
|
#include "global.h"
|
|
|
|
/**
|
|
* 属性层级信息管理
|
|
* */
|
|
|
|
class ExtraPropertyManager : public QObject {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit ExtraPropertyManager(QObject* parent = nullptr);
|
|
|
|
// 加载所有属性
|
|
bool loadAll();
|
|
void initial();
|
|
// 查询方法
|
|
QVector<ExtraProperty> getByFilter(const QVariantMap& filter,const QString& filterType) const; //filterType:name,tag
|
|
ExtraProperty getByCode(const QString& code) const;
|
|
QMap<QString, ExtraProperty> geAlltProperty() {return m_props;}
|
|
|
|
// CRUD操作
|
|
int add(const ExtraProperty& prop);
|
|
bool update(const ExtraProperty& prop);
|
|
bool remove(int id);
|
|
|
|
// 层级选项
|
|
QStringList getGrids() const;
|
|
QStringList getZones(const QString& grid = "") const;
|
|
QStringList getStations(const QString& grid = "", const QString& zone = "") const;
|
|
|
|
private:
|
|
QMap<QString, ExtraProperty> m_props; // 内存缓存
|
|
};
|