#pragma once #include "DPData.h" #include "ExcelOP.h" #define RELATION_MN 4 //m:n关系类型 #define RELATION_11 1 #define RELATION_1N 2 #define RELATION_N1 3 #define FK_11 1 //1:1 #define FK_1N 2 //1:N #include //typedef struct FuncInfo //{ // int paraCount; //参数个数 // int paraType[20]; //参数类型 // QStringList paraName; //参数名称 // QString name; //函数名称 // QString nameAndParastr;//函数参数字符串 // QString callParaStr; //调用参数字符串 // FuncInfo() // { // paraCount = 0; // name = ""; // paraType[20] = { 0 }; // } //}ByFunction; class Filter; class DataRow; class FindByInterface; class DelByInterface; class SceneInfo; class DataClass:public DPData { Q_OBJECT Q_PROPERTY(QString displayName READ getdisplayName WRITE setdisplayName) Q_PROPERTY(QString description READ getDescription WRITE setDescription) Q_PROPERTY(QString name READ getName WRITE setName) //名称标识 Q_PROPERTY(unsigned int createVersion READ getCreateVersion WRITE setCreateVersion) Q_PROPERTY(unsigned int deleteVersion READ getdeleteVersion WRITE setDeleteVersion) Q_PROPERTY(unsigned int countType READ getCountType WRITE setCountType) Q_PROPERTY(unsigned int type READ getType WRITE setType) Q_PROPERTY(QString interalName READ getInternalName WRITE setInternalName) public: DataClass(); ~DataClass(); QString getdisplayName() const { return _strDisplayName; } void setdisplayName(QString name) { _strDisplayName = name; } QString getDescription() const { return _strDescription; } void setDescription(QString des) { _strDescription = des; } unsigned int getCreateVersion() const { return _wCreateVersion; } void setCreateVersion(unsigned int cVersion) { _wCreateVersion = cVersion; } unsigned int getdeleteVersion() const { return _wDeleteVersion; } void setDeleteVersion(unsigned int dVersion) { _wDeleteVersion = dVersion; } unsigned int getCountType() const { return _wCountType; } void setCountType(unsigned int cType) { _wCountType = cType; } void setType(unsigned int type) { _type = type; } unsigned int getType() const { return _type; } QString getInternalName() const { return _strInternalName; } void setInternalName(QString strName) { _strInternalName = strName; } //判断名称标识合法性 bool checkNameillegal( QString& errMsg); bool checkNameSize(int min, int max, QString& errMsg); bool checkLetter(QString& errmsg, int index); //判断第几个字符 /*保存本身数据*/ bool saveSelf(); void saveToDao(); /*增加child数据*/ bool addChild(DPData* newData); /*删除一条child数据*/ bool deleteChild(unsigned int id); /*删除本对象*/ // bool deleteSelf(); bool deleteFromModel(QString& result ); /*从数据库加载一条数据到当前对象*/ void loadData(DBPlatformSpace::DAO* pDao); /*获取所有下层数据*/ void getAllChildren(DPData* pManager = nullptr); /*从总map中移除所有child*/ void removeChildinDPMap(); /*移除场景信息*/ void removeSceneinDPMap(); // DPData* hasSameNameChild(QString propertyName, QString name, bool add); /*获取新的属性*/ void getNewProperty(json& parameter, QVariantMap& valueMap); void setNewData(json& parameter); /*将名称标识 加上T_前缀*/ void reName(); /*转json*/ void toJson(json& jsonObj, bool recursive = false); /*生成需求文件数据*/ void setFileData(FileGenerate* generator, QStringList flag); /*移动到新的数据模块*/ bool moveData(json& parameter, DPData* pManager); //数据字典类相关 bool importDict(QString& result); bool exportDict(); int exportTemplate(); void dictToJson(json& jsonObj); //生成代码相关 bool generateCode( QStringList& qfileList); bool getFindByInterface(); bool addFindByInterface(FindByInterface* pNew); bool delFindByInterfaceById(int id); bool updateFindByInterfaceById(json& parameter); bool getDelByInterface(); bool addDelByInterface(DelByInterface* pNew); bool delDelByInterfaceById(int id); bool updateDelByInterfaceById(json& parameter); QString getWhiteBoxType(); bool setWhiteBoxType(json& parameter); //生成.NET接口 bool generateCSharpCode(QStringList& qfileList); //场景相关 bool addScene(DPData* pNew); bool deleteScene(int id); // bool moveScene(json& parameter); bool getScene(DPData* pMng); //数据检索与编辑 bool getAllDataToJson(json& jsonObj); bool saveTableData(json& jsonObj, DPData* pModel); bool delTableData(json& jsonObj); //建立数据类关联 static bool buildRelationship(DPData* pClass1, DPData*pClass2, QString name1, QString name2, int type, DataClass*& pNewClass); //删除数据关系 static bool deleteRelationship(DPData* pClass1, DPData* pClass2, QString& result); static bool deleteMNrealationship(DPData* pClass1, DPData* pClass2, QString& result); /*处理删除返回值*/ static bool resolveDeleteResult(QString deletedResult); //筛选数据 int filterData(QString filterStr, json& jsonObj); void doFilter( json& jsonRet); int getFieldType(QString field); //生成c#接口代码(2023.10) //bool generateCSharpCode(QStringList& qfileList); //bool generateHeadfile(QString& file, QString path); //bool generateSrcfile(QString& file, QString path); //void generateFindbyFunction(QString& con); //void generateDelbyFunction(QString& con); //void generateSaveDelselfFunc(QString& con); //void generateLoadFunc(QString& con); //void generateSavetoDaoFunc(QString& con); //DPData* getAttributeById(int id); //QStringList _delbyParas; //QList _findbyFuncs; //QList _delbyFuncs; QString _tableName; //[20230915数据检索与编辑模块数据类显示名称] QString _strDisplayName; //显示名称 QString _strDescription; //描述 unsigned int _wCreateVersion = 0; //创建版本 unsigned int _wDeleteVersion = 0; //删除版本 QString _strInternalName; //内部名称 unsigned int _wCountType = 0; //数量类型 int _type = 0; //1普通数据类 2关系数据类 QList _relTableName; //关系数据类名(文档输出用) QList _fkTableName; //关联数据类名(文档输出用) QList _fkTypeName; //关联类型(文档输出用) int _version = 0; // QList _dictionaryData; //数据字典表数据 QMap _findByMap; //查询接口list QMap _delByMap;//删除接口list QMap _sceneMap; //场景map bool _initAttriute = false; bool _initScene = false; //数据类数据 QList tableData; QStack filterItems; //存储前端检索条件 QStack opStack; QStack midResultStack; //中间条件判断结果 int colnum = 0; QMap colType; //字段名--类型 protected: private: ExcelOP excel; };