mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-01 15:32:48 +08:00
feat(scheme): 新增数据库表结构同步方案
This commit is contained in:
121
app/admin/scheme/TestGoods.php
Normal file
121
app/admin/scheme/TestGoods.php
Normal file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\scheme;
|
||||
|
||||
use app\common\scheme\BaseScheme;
|
||||
use app\common\scheme\attribute\Table;
|
||||
use app\common\scheme\attribute\Field;
|
||||
use app\common\scheme\attribute\Component;
|
||||
use app\common\scheme\attribute\Index;
|
||||
|
||||
#[Table(name: 'ul_test_goods', comment: '')]
|
||||
#[Index(columns: ['uid'], name: 'uid', type: 'UNIQUE')]
|
||||
#[Index(columns: ['cate_id'], name: 'cate_id', type: 'NORMAL')]
|
||||
#[Index(columns: ['detail'], name: 'detail', type: 'FULLTEXT')]
|
||||
class TestGoods extends BaseScheme
|
||||
{
|
||||
#[Field(type: 'int', length: 11, precision: 0, scale: 0, nullable: false, default: null, comment: '', unsigned: true, autoIncrement: true, primary: true)]
|
||||
public $id;
|
||||
|
||||
#[Field(type: 'bigint', length: 11, precision: 0, scale: 0, nullable: false, default: '0', comment: '分类ID', unsigned: true, autoIncrement: false, primary: false)]
|
||||
#[Component(type: 'relation', options: ['table' => 'mall_cate', 'relationBindSelect' => 'title'])]
|
||||
public $cate_id;
|
||||
|
||||
#[Field(type: 'char', length: 20, precision: 20, scale: 0, nullable: false, default: '', comment: '商品名称', unsigned: false, autoIncrement: false, primary: false)]
|
||||
public $title;
|
||||
|
||||
#[Field(type: 'char', length: 255, precision: 255, scale: 0, nullable: false, default: null, comment: '商品logo', unsigned: false, autoIncrement: false, primary: false)]
|
||||
#[Component(type: 'image', options: [])]
|
||||
public $logo;
|
||||
|
||||
#[Field(type: 'text', length: null, precision: 0, scale: 0, nullable: false, default: null, comment: '商品图片', unsigned: false, autoIncrement: false, primary: false)]
|
||||
#[Component(type: 'images', options: [])]
|
||||
public $images;
|
||||
|
||||
#[Field(type: 'text', length: null, precision: 0, scale: 0, nullable: false, default: null, comment: '商品描述', unsigned: false, autoIncrement: false, primary: false)]
|
||||
#[Component(type: 'editor', options: [])]
|
||||
public $describe;
|
||||
|
||||
#[Field(type: 'int', length: 11, precision: 0, scale: 0, nullable: false, default: '0', comment: '总库存', unsigned: true, autoIncrement: false, primary: false)]
|
||||
public $total_stock;
|
||||
|
||||
#[Field(type: 'int', length: 11, precision: 0, scale: 0, nullable: false, default: '0', comment: '排序', unsigned: true, autoIncrement: false, primary: false)]
|
||||
public $sort;
|
||||
|
||||
#[Field(type: 'int', length: 11, precision: 0, scale: 0, nullable: false, default: '0', comment: '状态', unsigned: true, autoIncrement: false, primary: false)]
|
||||
#[Component(type: 'radio', options: ['正常', '禁用'])]
|
||||
public $status;
|
||||
|
||||
#[Field(type: 'varchar', length: 100, precision: 100, scale: 0, nullable: false, default: null, comment: '合格证', unsigned: false, autoIncrement: false, primary: false)]
|
||||
#[Component(type: 'file', options: [])]
|
||||
public $cert_file;
|
||||
|
||||
#[Field(type: 'text', length: null, precision: 0, scale: 0, nullable: false, default: null, comment: '检测报告', unsigned: false, autoIncrement: false, primary: false)]
|
||||
#[Component(type: 'files', options: [])]
|
||||
public $verfiy_file;
|
||||
|
||||
#[Field(type: 'char', length: 255, precision: 255, scale: 0, nullable: false, default: '', comment: '备注说明', unsigned: false, autoIncrement: false, primary: false)]
|
||||
public $remark;
|
||||
|
||||
#[Field(type: 'int', length: 11, precision: 0, scale: 0, nullable: false, default: '0', comment: '', unsigned: true, autoIncrement: false, primary: false)]
|
||||
public $create_time;
|
||||
|
||||
#[Field(type: 'int', length: 11, precision: 0, scale: 0, nullable: false, default: '0', comment: '', unsigned: true, autoIncrement: false, primary: false)]
|
||||
public $update_time;
|
||||
|
||||
#[Field(type: 'int', length: 11, precision: 0, scale: 0, nullable: false, default: '0', comment: '', unsigned: true, autoIncrement: false, primary: false)]
|
||||
public $delete_time;
|
||||
|
||||
#[Field(type: 'datetime', length: null, precision: 0, scale: 0, nullable: false, default: null, comment: '发布日期', unsigned: false, autoIncrement: false, primary: false)]
|
||||
#[Component(type: 'date', options: ['date'])]
|
||||
public $publish_time;
|
||||
|
||||
#[Field(type: 'date', length: null, precision: 0, scale: 0, nullable: false, default: null, comment: '售卖日期', unsigned: false, autoIncrement: false, primary: false)]
|
||||
#[Component(type: 'date', options: ['datetime'])]
|
||||
public $sale_time;
|
||||
|
||||
#[Field(type: 'varchar', length: 100, precision: 100, scale: 0, nullable: false, default: null, comment: '简介', unsigned: false, autoIncrement: false, primary: false)]
|
||||
#[Component(type: 'textarea', options: [])]
|
||||
public $intro;
|
||||
|
||||
#[Field(type: 'int', length: 11, precision: 0, scale: 0, nullable: false, default: null, comment: '秒杀状态', unsigned: true, autoIncrement: false, primary: false)]
|
||||
#[Component(type: 'select', options: [0 => '未参加', 1 => '已开始', 3 => '已结束'])]
|
||||
public $time_status;
|
||||
|
||||
#[Field(type: 'int', length: 11, precision: 0, scale: 0, nullable: false, default: '0', comment: '是否推荐', unsigned: false, autoIncrement: false, primary: false)]
|
||||
#[Component(type: 'switch', options: ['不推荐', '推荐'])]
|
||||
public $is_recommend;
|
||||
|
||||
#[Field(type: 'varchar', length: 100, precision: 100, scale: 0, nullable: false, default: '0', comment: '商品类型', unsigned: false, autoIncrement: false, primary: false)]
|
||||
#[Component(type: 'checkbox', options: ['taobao' => '淘宝', 'jd' => '京东'])]
|
||||
public $shop_type;
|
||||
|
||||
#[Field(type: 'varchar', length: 100, precision: 100, scale: 0, nullable: false, default: null, comment: '商品标签', unsigned: false, autoIncrement: false, primary: false)]
|
||||
#[Component(type: 'table', options: ['table' => 'mall_tag', 'type' => 'checkbox', 'valueField' => 'id', 'fieldName' => 'title'])]
|
||||
public $tag;
|
||||
|
||||
#[Field(type: 'varchar', length: 100, precision: 100, scale: 0, nullable: true, default: null, comment: '商品标签(单选)', unsigned: false, autoIncrement: false, primary: false)]
|
||||
#[Component(type: 'table', options: ['table' => 'mall_tag', 'type' => 'radio', 'valueField' => 'id', 'fieldName' => 'title'])]
|
||||
public $tag_backup;
|
||||
|
||||
#[Field(type: 'varchar', length: 100, precision: 100, scale: 0, nullable: false, default: null, comment: '产地', unsigned: false, autoIncrement: false, primary: false)]
|
||||
#[Component(type: 'city', options: ['name-province' => '0', 'code' => '0'])]
|
||||
public $from_area;
|
||||
|
||||
#[Field(type: 'varchar', length: 100, precision: 100, scale: 0, nullable: false, default: '山东省/临沂市', comment: '仓库', unsigned: false, autoIncrement: false, primary: false)]
|
||||
#[Component(type: 'city', options: ['level' => 'city'])]
|
||||
public $store_city;
|
||||
|
||||
#[Field(type: 'varchar', length: 100, precision: 100, scale: 0, nullable: false, default: null, comment: '商品标签 (输入)', unsigned: false, autoIncrement: false, primary: false)]
|
||||
#[Component(type: 'tag', options: [])]
|
||||
public $tag_input;
|
||||
|
||||
#[Field(type: 'varchar', length: 100, precision: 100, scale: 0, nullable: false, default: null, comment: '唯一id', unsigned: false, autoIncrement: false, primary: false)]
|
||||
public $uid;
|
||||
|
||||
#[Field(type: 'decimal', length: 10, precision: 10, scale: 0, nullable: true, default: null, comment: '价格', unsigned: false, autoIncrement: false, primary: false)]
|
||||
public $price;
|
||||
|
||||
#[Field(type: 'text', length: null, precision: 0, scale: 0, nullable: true, default: null, comment: '详情', unsigned: false, autoIncrement: false, primary: false)]
|
||||
public $detail;
|
||||
}
|
||||
9
app/common/command/scheme/Backup.php
Normal file
9
app/common/command/scheme/Backup.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\command\scheme;
|
||||
|
||||
use base\common\command\scheme\Backup as BaseCommand;
|
||||
|
||||
class Backup extends BaseCommand
|
||||
{
|
||||
}
|
||||
9
app/common/command/scheme/Make.php
Normal file
9
app/common/command/scheme/Make.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\command\scheme;
|
||||
|
||||
use base\common\command\scheme\Make as BaseCommand;
|
||||
|
||||
class Make extends BaseCommand
|
||||
{
|
||||
}
|
||||
9
app/common/command/scheme/Sync.php
Normal file
9
app/common/command/scheme/Sync.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\command\scheme;
|
||||
|
||||
use base\common\command\scheme\Sync as BaseCommand;
|
||||
|
||||
class Sync extends BaseCommand
|
||||
{
|
||||
}
|
||||
9
app/common/scheme/BaseScheme.php
Normal file
9
app/common/scheme/BaseScheme.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\scheme;
|
||||
|
||||
use base\common\scheme\BaseScheme as Base;
|
||||
|
||||
abstract class BaseScheme extends Base
|
||||
{
|
||||
}
|
||||
11
app/common/scheme/attribute/Component.php
Normal file
11
app/common/scheme/attribute/Component.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\scheme\attribute;
|
||||
|
||||
use Attribute;
|
||||
use base\common\scheme\attribute\Component as BaseComponent;
|
||||
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
class Component extends BaseComponent
|
||||
{
|
||||
}
|
||||
11
app/common/scheme/attribute/Field.php
Normal file
11
app/common/scheme/attribute/Field.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\scheme\attribute;
|
||||
|
||||
use Attribute;
|
||||
use base\common\scheme\attribute\Field as BaseField;
|
||||
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
class Field extends BaseField
|
||||
{
|
||||
}
|
||||
11
app/common/scheme/attribute/Index.php
Normal file
11
app/common/scheme/attribute/Index.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\scheme\attribute;
|
||||
|
||||
use Attribute;
|
||||
use base\common\scheme\attribute\Index as BaseIndex;
|
||||
|
||||
#[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)]
|
||||
class Index extends BaseIndex
|
||||
{
|
||||
}
|
||||
11
app/common/scheme/attribute/Table.php
Normal file
11
app/common/scheme/attribute/Table.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\scheme\attribute;
|
||||
|
||||
use Attribute;
|
||||
use base\common\scheme\attribute\Table as BaseTable;
|
||||
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class Table extends BaseTable
|
||||
{
|
||||
}
|
||||
9
app/common/service/scheme/DbToSchemeService.php
Normal file
9
app/common/service/scheme/DbToSchemeService.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\service\scheme;
|
||||
|
||||
use base\common\service\scheme\DbToSchemeService as BaseService;
|
||||
|
||||
class DbToSchemeService extends BaseService
|
||||
{
|
||||
}
|
||||
9
app/common/service/scheme/SchemeToDbService.php
Normal file
9
app/common/service/scheme/SchemeToDbService.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\service\scheme;
|
||||
|
||||
use base\common\service\scheme\SchemeToDbService as BaseService;
|
||||
|
||||
class SchemeToDbService extends BaseService
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user