添加测试的代码生成以及采购编码的页面的代码生成

This commit is contained in:
panx
2024-08-23 16:04:38 +08:00
parent 3566f03653
commit abccb6c47c
19 changed files with 1397 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
<?php
namespace app\admin\model;
use think\Model;
use think\model\concern\SoftDelete;
/**
* pdm_partitem
* <!---->
* 部件
* Class PdmPartitem
* @package app\admin\model
*/
class PdmPartitem extends Model
{
use SoftDelete;
// 定义时间戳字段名
protected $createTime = 'create_time';
protected $updateTime = 'update_time';
protected $deleteTime = 'delete_time';
/**
* 定义 sa_user 关联模型
* @localKey createrid
* @bind nickname,name
*/
public function user()
{
return $this->hasOne(\app\common\model\system\User::Class,'id','createrid')->bind(['nickname','name']);
}
public function setPartattributeAttr($value)
{
if (!empty($value) && is_array($value)) {
$arr = [];
foreach ($value['key'] as $key => $elem) {
$arr[$elem] = $value['value'][$key];
}
$value = json_encode($arr,JSON_UNESCAPED_UNICODE);
}
return $value ?: json_encode([]);
}
public function getPartattributeAttr($value)
{
if (!empty($value) && is_string($value)) {
$value = json_decode($value, true);
}
return $value;
}
}