FromSQLite.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef FROMSQLITE_H
  2. #define FROMSQLITE_H
  3. #include "spdlog/spdlog.h"
  4. #include <QString>
  5. #include <QSqlDatabase>
  6. struct OneTemplateInfo;
  7. struct OnePlanItemInfo;
  8. /**
  9. * @brief 单机版目前不考虑多个频率区分模版的问题,模版所有的频率都可以操作
  10. *
  11. */
  12. class FromSQLite
  13. {
  14. public:
  15. FromSQLite();
  16. ~FromSQLite();
  17. /* 初始化数据库 */
  18. void initDB(const QString dbPath);
  19. /* 获取模版名称列表 */
  20. bool getTemplateList(int chnID, QList<OneTemplateInfo>& listTemplate);
  21. /* 保存模板 */
  22. bool saveTemplate(const QString templateName, const QList<OnePlanItemInfo>& listPlan);
  23. /* 删除模版 */
  24. bool deleteTemplate(const OneTemplateInfo& info);
  25. /* 删除模版列表 */
  26. bool deleteTemplateList(const QList<OneTemplateInfo>& listTemplate);
  27. /* 获取模版数据 */
  28. bool getTemplateData(const OneTemplateInfo& info, QList<OnePlanItemInfo>& listPlan);
  29. /* 修改模版列表 */
  30. bool modifyTemplateList(const QMap<OneTemplateInfo, QList<OnePlanItemInfo>>& mapTemplate);
  31. /* 更新模板名称 */
  32. bool updateTemplateName(const QMap<OneTemplateInfo, QString>& mapTemplateName);
  33. private:
  34. std::shared_ptr<spdlog::logger> m_logger = nullptr; /* 日志对象 */
  35. QSqlDatabase m_DB; /* 数据库对象 */
  36. };
  37. #endif // FROMSQLITE_H