68 lines
1.8 KiB
C++
68 lines
1.8 KiB
C++
#pragma once
|
|
|
|
|
|
#include"CommonDataPublic.h"
|
|
|
|
|
|
#define ODI __declspec(dllexport)
|
|
|
|
using namespace std;
|
|
using namespace DBPlatformSpace;
|
|
|
|
|
|
typedef struct FuncInfo
|
|
{
|
|
int paraCount; //参数个数
|
|
int paraType[20];//参数类型
|
|
string paraName[20]; //参数名称
|
|
string name; //函数名称
|
|
string nameAndParastr;//函数参数字符串
|
|
string callParaStr; //调用参数字符串
|
|
FuncInfo()
|
|
{
|
|
paraCount = -1;
|
|
name = "";
|
|
}
|
|
}FuncInfo;
|
|
|
|
class CodeGenerator
|
|
{
|
|
public:
|
|
ODI CodeGenerator();
|
|
ODI ~CodeGenerator();
|
|
|
|
//生成接口代码
|
|
ODI ResultMsg generateCSharpCode(M_EntityTableDAO* table, M_EntityModelDAO* model, string codeFileFolderPath, list<string>& resultCodeFilesPathList);
|
|
|
|
private:
|
|
//生成白盒测试代码文件
|
|
ResultMsg generateWhiteBoxFile(string& filename, string path);
|
|
ResultMsg generateHeadFile(string& filename, string path);
|
|
ResultMsg generateSrcFile (string& filename, string path);
|
|
ResultMsg generateConstructFunc(string& content);
|
|
ResultMsg generateDefaultFunc(string& content);
|
|
ResultMsg generateFindByFunc(string& content);
|
|
ResultMsg generateDelByFunc(string& content);
|
|
ResultMsg generateLoadFunc(string& content);
|
|
ResultMsg generateSavetoDaoFunc(string& content);
|
|
void BuildBlobFuncList(string attName, int type);
|
|
ResultMsg generateBlobFunc(string& content);
|
|
ResultMsg generateBlobFuncSrc(string& content);
|
|
void generateBlobTestFunc(string& content, int objId);
|
|
|
|
|
|
void init();
|
|
void clearLastData();
|
|
|
|
M_EntityTableDAO* m_pTable = nullptr;
|
|
string m_daoname;
|
|
M_EntityModelDAO* m_pModel = nullptr;
|
|
std::list<M_NormalColumnDAO*> m_columnlist;
|
|
list<M_FindByInterfaceDAO*> m_findbyInterfacelist;
|
|
list<M_DelByInterfaceDAO*> m_delbyInterfacelist;
|
|
list<FuncInfo*> m_findbyFuncs;
|
|
list<FuncInfo*> m_delbyFuncs;
|
|
list<FuncInfo*> m_blobFuncs; //与char* 和double*相关的函数
|
|
};
|
|
|