From a02ea2641e82986fc66f377ec7f67a028cd59ccb Mon Sep 17 00:00:00 2001 From: simonyan <315082291@qq.com> Date: Fri, 11 Oct 2024 10:29:42 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E8=AE=BE=E7=BD=AE=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=A1=A8=E5=90=8D=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Include/nmNum/nmData/nmDataDemo.h | 2 ++ Include/nmNum/nmData/nmDataExample.h | 3 ++- Include/nmNum/nmData/nmDefines.h | 8 ++++++++ Src/nmNum/nmData/nmDataDemo.cpp | 7 +++++++ Src/nmNum/nmData/nmDataExample.cpp | 10 ++++++++-- Src/nmNum/nmData/nmDataOilReservoirOutline.cpp | 6 +++++- 6 files changed, 32 insertions(+), 4 deletions(-) diff --git a/Include/nmNum/nmData/nmDataDemo.h b/Include/nmNum/nmData/nmDataDemo.h index 4b5cabe..fe74472 100644 --- a/Include/nmNum/nmData/nmDataDemo.h +++ b/Include/nmNum/nmData/nmDataDemo.h @@ -36,6 +36,8 @@ public: // 接口 virtual ZxDataObject* clone(); virtual QString type() const; + // 表名 + virtual QString getTableName(); // 加载保存(数据库部分) virtual bool _parseData(VecVariant vec, int& n); diff --git a/Include/nmNum/nmData/nmDataExample.h b/Include/nmNum/nmData/nmDataExample.h index 4d889f1..5bde4ee 100644 --- a/Include/nmNum/nmData/nmDataExample.h +++ b/Include/nmNum/nmData/nmDataExample.h @@ -19,7 +19,8 @@ public: // 接口 virtual ZxDataObject* clone(); virtual QString type() const; - + // 表名 + virtual QString getTableName(); // 加载保存(数据库部分) virtual bool _parseData(VecVariant vec, int& n); virtual bool _sumUpData(VecVariant& vec); diff --git a/Include/nmNum/nmData/nmDefines.h b/Include/nmNum/nmData/nmDefines.h index 7e1ef35..9b93ee8 100644 --- a/Include/nmNum/nmData/nmDefines.h +++ b/Include/nmNum/nmData/nmDefines.h @@ -42,3 +42,11 @@ namespace nmDataModelType const QString sTypeNumDataOilReservoirOutline = "zx_NumDataOilReservoirOutline"; const QString sTypeNumDataExample = "zx_NumDataExample"; } + +namespace nmDataTableName +{ + // 数据模型类型定义 + const QString sTableNumDataDemo = "N_DATA_OIL_DEMO"; + const QString sTableNumDataOilReservoirOutline = "N_DATA_OIL_RESERVOIR_OUTLINE"; + const QString sTableNumDataExample = "N_DATA_OIL_EXAMPLE"; +} diff --git a/Src/nmNum/nmData/nmDataDemo.cpp b/Src/nmNum/nmData/nmDataDemo.cpp index 3a930b1..64a6214 100644 --- a/Src/nmNum/nmData/nmDataDemo.cpp +++ b/Src/nmNum/nmData/nmDataDemo.cpp @@ -51,9 +51,16 @@ ZxDataObject* nmDataDemo::clone() QString nmDataDemo::type() const { + // 模块自行处理及定义,框架部分不再涉及 return nmDataModelType::sTypeNumDataDemo; } +QString nmDataDemo::getTableName() +{ + // 返回表名,模型自行处理 + return nmDataTableName::sTableNumDataDemo; +} + void nmDataDemo::setWellCode(const QString& s) { m_sWellCode = s; diff --git a/Src/nmNum/nmData/nmDataExample.cpp b/Src/nmNum/nmData/nmDataExample.cpp index 20eaba3..37913a8 100644 --- a/Src/nmNum/nmData/nmDataExample.cpp +++ b/Src/nmNum/nmData/nmDataExample.cpp @@ -1,7 +1,7 @@ #include "nmDataExample.h" #include "nmDefines.h" -ZX_DEFINE_DYNAMIC(DataOilReservoirOutline, nmDataExample) +ZX_DEFINE_DYNAMIC(DataExample, nmDataExample) nmDataExample::nmDataExample(): ZxDataObjectDbl(0) { @@ -51,7 +51,13 @@ ZxDataObject* nmDataExample::clone() QString nmDataExample::type() const { - return nmDataModelType::sTypeNumDataOilExample; + return nmDataModelType::sTypeNumDataExample; +} + +QString nmDataExample::getTableName() +{ + // 返回表名,模型自行处理 + return nmDataTableName::sTableNumDataExample; } bool nmDataExample::_parseData(VecVariant vec, int& n) diff --git a/Src/nmNum/nmData/nmDataOilReservoirOutline.cpp b/Src/nmNum/nmData/nmDataOilReservoirOutline.cpp index d24c148..7cb4e34 100644 --- a/Src/nmNum/nmData/nmDataOilReservoirOutline.cpp +++ b/Src/nmNum/nmData/nmDataOilReservoirOutline.cpp @@ -53,7 +53,11 @@ QString nmDataOilReservoirOutline::type() const { return nmDataModelType::sTypeNumDataOilReservoirOutline; } - +QString nmDataOilReservoirOutline::getTableName() +{ + // 返回表名,模型自行处理 + return nmDataTableName::sTableNumDataOilReservoirOutline; +} bool nmDataOilReservoirOutline::_parseData(VecVariant vec, int& n) { m_sCode = vec.at(n++).toString();