Update model template files

This commit is contained in:
antao 2018-10-31 17:32:46 +08:00 committed by an-tao
parent 0d77fa1490
commit d340e1cc10
2 changed files with 10 additions and 6 deletions

View File

@ -28,13 +28,16 @@ const std::string User::tableName = "{{tableName}}";
<%c++
for(auto col:cols)
{
if(col._colType.empty())
continue;
%>
if(!r["<%c++$$<<col._colName;%>"].isNull())
{
_<%c++$$<<col._colValName;%>=std::make_shared<<%c++$$<<col._colType;%>>(r["<%c++$$<<col._colName;%>"].as<<%c++$$<<col._colType;%>>());
}
<%c++
}%>
<%c++
}
%>
}
<%c++
for(auto col:cols)

View File

@ -22,14 +22,15 @@ namespace {{dbName}}
class {{className}}
{
public:
public:
const static std::string primaryKeyName;
const static bool hasPrimaryKey;
const static std::string tableName;
typedef {{primaryKeyType}} PrimaryKeyType;
{{className}}(const Row &r) noexcept;
<%c++
<%c++
auto cols=@@.get<std::vector<ColumnInfo>>("columns");
for(auto col:cols)
{
@ -46,9 +47,9 @@ class {{className}}
$$<<" //FIXME!!"<<" getValueOf"<<col._colTypeName<<"() const noexcept;\n";
$$<<"\n";
}
%>
%>
private:
<%c++
<%c++
for(auto col:cols)
{
if(!col._colType.empty())