71 lines
1.5 KiB
Smarty
71 lines
1.5 KiB
Smarty
<?php
|
|
|
|
namespace app\common\model\{$moduleName};
|
|
|
|
use app\common\arw\adjfut\src\Validate;
|
|
use app\BaseModel;
|
|
use think\model\concern\SoftDelete;
|
|
use app\common\arw\adjfut\src\Excel;
|
|
use app\Request;
|
|
use app\common\exception\Tool;
|
|
use think\facade\Db;
|
|
|
|
class {$className} extends BaseModel
|
|
{
|
|
use SoftDelete;
|
|
// 删除字段
|
|
protected $deleteTime = '{$businessName}_delete_time';
|
|
// 设置主键名
|
|
protected $pk = '{$businessName}_guid';
|
|
// 设置废弃字段
|
|
protected $disuse = [];
|
|
// 设置字段信息
|
|
protected $schema = [
|
|
{$fields}
|
|
];
|
|
// 设置json类型字段
|
|
protected $json = [''];
|
|
// 开启自动写入时间戳字段
|
|
protected $autoWriteTimestamp = 'datetime';
|
|
// 创建时间
|
|
protected $createTime = '{$businessName}_create_time';
|
|
// 修改时间
|
|
protected $updateTime = '{$businessName}_update_time';
|
|
|
|
{$importExcelField}
|
|
|
|
/**
|
|
* 新增前
|
|
*/
|
|
public static function onBeforeInsert(self $model): void
|
|
{
|
|
// self::checkRepeatData($model);
|
|
$model->completeCreateField();
|
|
}
|
|
|
|
/**
|
|
* 更新前
|
|
*/
|
|
public static function onBeforeUpdate(self $model): void
|
|
{
|
|
// self::checkRepeatData($model);
|
|
$model->completeUpdateField();
|
|
}
|
|
|
|
/**
|
|
* 删除前
|
|
*/
|
|
public static function onBeforeDelete(self $model): void
|
|
{
|
|
$model->completeDeleteField();
|
|
}
|
|
|
|
{$exportExcelContent}
|
|
|
|
{$importExcelContent}
|
|
|
|
{$importExcelInitContent}
|
|
|
|
|
|
}
|