#ifndef SERVICELOADDB_H #define SERVICELOADDB_H #include #include #include #include #include #include #include #include #include #include #include #include #include "models/types.h" // IWYU pragma: keep class ServiceLoadDB : public QObject { Q_OBJECT public: explicit ServiceLoadDB(QObject *parent = nullptr); void start(); QMap loadLocations(); QMap loadDepartments(); QMap loadManufacturers(); QMap loadDeviceTypes(); QMap loadDeviceModels(); QMap loadDevices(); bool updateDevice(const Device &device); private: QList readStructureElements(int modelId); template T getValueOrDefault(const QSqlQuery &query, const QSqlRecord &record, const QString &fieldName, const T &defaultValue); private: QSqlDatabase _db; QString _dbInput; QSqlQuery _query; QMap _mapDeviceModels; }; #endif // SERVICELOADDB_H