Compare commits
10 Commits
3545b82015
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 751828be48 | |||
| e2d6718e9c | |||
| 71f4b82e4b | |||
| b4b4b914c2 | |||
| d71251fecf | |||
| 77e60ef482 | |||
| 116d788ecc | |||
| 0c20bd0519 | |||
| d8a584e9b7 | |||
| 36261488b4 |
@@ -16,8 +16,9 @@ class ProductCompatParts
|
||||
{
|
||||
$params = request()->param([
|
||||
'name',
|
||||
'page/d' => 1,
|
||||
'size/d' => 10
|
||||
'is_show' => null,
|
||||
'page/d' => 1,
|
||||
'size/d' => 10
|
||||
]);
|
||||
|
||||
$list = ProductCompatPartsModel::withoutField([
|
||||
@@ -25,6 +26,7 @@ class ProductCompatParts
|
||||
'deleted_at'
|
||||
])
|
||||
->language(request()->lang_id)
|
||||
->disabled(is_null($params['is_show']) ? null : ($params['is_show'] == 1 ? 0 : 1))
|
||||
->withSearch('name', [
|
||||
'name' => $params['name']??null
|
||||
])
|
||||
|
||||
@@ -16,13 +16,6 @@ class ProductCompatPartsModel extends ProductCompatPartsBaseModel
|
||||
// 软件删除时间字段
|
||||
protected $deleteTime = 'deleted_at';
|
||||
|
||||
// 状态获取器
|
||||
public function getStatusTextAttr($value, array $data)
|
||||
{
|
||||
$status = ['启用', '禁用'];
|
||||
return $status[$data['status']];
|
||||
}
|
||||
|
||||
// 按所属语言查询
|
||||
public function scopeLanguage(\think\db\Query $query, int $value)
|
||||
{
|
||||
@@ -39,6 +32,13 @@ class ProductCompatPartsModel extends ProductCompatPartsBaseModel
|
||||
$query->where('name', '=', $value);
|
||||
}
|
||||
|
||||
// 按状态查询
|
||||
public function scopeDisabled(\think\db\Query $query, int|null $disabled)
|
||||
{
|
||||
if (is_null($disabled)) return;
|
||||
$query->where('disabled', '=', $disabled);
|
||||
}
|
||||
|
||||
// 查询配件类型名称搜索
|
||||
public function searchNameAttr(\think\db\Query $query, string|null $value, array $data)
|
||||
{
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\admin\model\v1;
|
||||
|
||||
use app\common\model\ProductCompatRelBaseModel;
|
||||
|
||||
/**
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class ProductCompatRelModel extends ProductCompatRelBaseModel
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
/**
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class ProductCompatRelBaseModel extends BaseModel
|
||||
{
|
||||
// 表名
|
||||
protected $name = "product_compat_rel";
|
||||
|
||||
// 主键
|
||||
protected $pk = "id";
|
||||
|
||||
// 字段信息
|
||||
protected $schema = [
|
||||
"id" => "int",
|
||||
"language_id" => "int",
|
||||
"product_id" => "int",
|
||||
"compat_id" => "int",
|
||||
"series_name" => "string",
|
||||
"show_series_name" => "int",
|
||||
"remark" => "int",
|
||||
"created_at" => "datetime",
|
||||
"updated_at" => "datetime",
|
||||
];
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class CreateProductCompatRel extends Migrator
|
||||
class CreateProductCompatTypes extends Migrator
|
||||
{
|
||||
/**
|
||||
* Change Method.
|
||||
@@ -28,20 +28,19 @@ class CreateProductCompatRel extends Migrator
|
||||
*/
|
||||
public function change()
|
||||
{
|
||||
$table = $this->table('product_compat_rel', [
|
||||
'engine' => 'InnoDB',
|
||||
$table = $this->table('product_compat_types', [
|
||||
'engine' => 'MyISAM',
|
||||
'collation' => 'utf8mb4_general_ci',
|
||||
'comment' => '产品兼容性关联表'
|
||||
'comment' => '产品兼容性-产品类型'
|
||||
]);
|
||||
|
||||
$table->addColumn('language_id', 'integer', ['signed' => false, 'null' => false, 'comment' => '语言ID'])
|
||||
->addColumn('product_id', 'integer', ['null' => false, 'comment' => '产品id'])
|
||||
->addColumn('compat_id', 'json', ['null' => false, 'comment' => '关联的兼容性数据id'])
|
||||
->addColumn('series_name', 'string', ['limit' => 128, 'null' => true, 'comment' => '产品系列名'])
|
||||
->addColumn('show_series_name', 'boolean', ['null' => false, 'default' => 0, 'comment' => '是否显示系列名:0=否,1=是'])
|
||||
->addColumn('remark', 'string', ['limit' => 512, 'null' => true, 'comment' => '兼容性说明'])
|
||||
->addColumn('name', 'string', ['limit' => 128, 'null' => true, 'comment' => '类型名称'])
|
||||
->addColumn('sort', 'integer', ['default' => 0, 'comment' => '排序'])
|
||||
->addColumn('disabled', 'boolean', ['default' => 0, 'comment' => '是否禁用 0:启用 1:禁用'])
|
||||
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
|
||||
->addColumn('updated_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', 'comment' => '更新时间'])
|
||||
->addColumn('deleted_at', 'timestamp', ['null' => true, 'comment' => '删除时间'])
|
||||
->addIndex(['language_id'], ['name' => 'idx_language_id'])
|
||||
->create();
|
||||
}
|
||||
Reference in New Issue
Block a user