{assign var="datetime" value=$file->GetFileCreateTime()}
{assign var="namespace" value=$file->GetNamespace()}
{assign var="classes" value=$file->GetClasses()}
{assign var="uses" value=$file->GetUses()}
<?php
/**
 * Created by FFB.
 * Company: Shenzhen Zhixun Information Tec. Nanchang Com.
 * Copyright: ShenzhenZhixun
 * Email: eastbus@126.com
 * User: FFB
 * Date: {$datetime}
 * 文件不允许修改，自动生成
 */

namespace {$namespace};

{section name=index loop=$uses}
use {{$uses[index]}};
{/section}
{section name=index loop=$classes}
{assign var="className" value=$classes[index]->GetClassName()}
{assign var="tableName" value=$classes[index]->GetTable()->GetName()}
{assign var="attrs" value=$classes[index]->GetAttrs()}
{assign var="extends" value=$classes[index]->GetExtends()}
class {$className}{foreach item=e from=$extends key=i}{if $i == 0} extends {/if}{$e}{/foreach}{
    public static function tableName()
    {
        return '{literal}{{{/literal}{{$tableName}}{literal}}}{/literal}';
    }
    {section name=index loop=$attrs}
    {assign var="fieldName" value=$attrs[index]->GetColumn()->GetName()}
    {assign var="fieldComment" value=$attrs[index]->GetColumn()->GetComment()}
    {assign var="attrName" value=$attrs[index]->GetName()}

    /**
     * ------------ 字段 {{$fieldName}} 
     * ------------ 表字段注释: {{$fieldComment}}
     */
    public function set{{$attrName}}($val): self
    {
        $this->setAttr("{{$fieldName}}", $val);
        return $this;
    }
    // ---------------------------------------------
    {/section}

}
{/section}
