You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.1 KiB
74 lines
2.1 KiB
4 years ago
|
#ifndef DBMTINTMAP_H
|
||
|
#define DBMTINTMAP_H
|
||
|
|
||
|
#include <QMetaType>
|
||
|
#include <QString>
|
||
|
#include <QObject>
|
||
|
#include <QtSql>
|
||
|
#include <QDebug>
|
||
|
|
||
|
#include "model/databaseManager/utils/initializationUtils.h"
|
||
|
#include "model/databaseManager/type/ETintMapName.h"
|
||
|
|
||
|
/*************************************************************************************************/
|
||
|
/**
|
||
|
* @brief Database dto structure for Tintmap
|
||
|
* @author Mohammad Mohsen Talaie
|
||
|
* @details
|
||
|
* @date 20 sep 2020
|
||
|
*/
|
||
|
/*************************************************************************************************/
|
||
|
typedef struct DbmDtoTintMap
|
||
|
{
|
||
|
QString name;
|
||
|
QList<QList<int> > value;
|
||
|
bool isActive;
|
||
|
int inOrder;
|
||
|
}DbmDtoTintMap;
|
||
|
|
||
|
Q_DECLARE_METATYPE(DbmDtoTintMap)
|
||
|
|
||
|
/*************************************************************************************************/
|
||
|
/**
|
||
|
* @brief Database class for Tintmap.
|
||
|
* @author Mohammad Mohsen Talaie
|
||
|
* @details
|
||
|
* @date 20 sep 2020
|
||
|
*/
|
||
|
/*************************************************************************************************/
|
||
|
class DbmTintMap
|
||
|
{
|
||
|
public:
|
||
|
static bool getAllTintMap(QSqlTableModel* tableModel, QList<DbmDtoTintMap>& tintMaps)
|
||
|
{
|
||
|
tableModel->setTable("TintMap");
|
||
|
tableModel->setFilter(QString("isActive is true"));
|
||
|
bool ret = tableModel->select();
|
||
|
int a = tableModel->rowCount();
|
||
|
for(int i = 0; i < tableModel->rowCount(); ++i)
|
||
|
{
|
||
|
DbmDtoTintMap tintMapIns;
|
||
|
INIT_SINGLE(tintMapIns, tableModel, name, String, i);
|
||
|
INTI_LIST_LIST(tintMapIns, tableModel, value, int, Int, i);
|
||
|
INIT_SINGLE(tintMapIns, tableModel, inOrder, Int, i);
|
||
|
tintMaps.append(tintMapIns);
|
||
|
}
|
||
|
|
||
|
return ret;
|
||
|
}
|
||
|
|
||
|
static bool getTintMapByName(QString name, QSqlTableModel* tableModel, DbmDtoTintMap& tintMap)
|
||
|
{
|
||
|
tableModel->setTable("TintMap");
|
||
|
tableModel->setFilter(QString("isActive = 1 and name is '%1'").arg(name));
|
||
|
bool ret = tableModel->select();
|
||
|
INIT_SINGLE(tintMap, tableModel, name, String, 0);
|
||
|
INTI_LIST_LIST(tintMap, tableModel, value, int, Int, 0);
|
||
|
INIT_SINGLE(tintMap, tableModel, inOrder, Int, 0);
|
||
|
|
||
|
return ret;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
#endif //DBMTINTMAP_H
|