Skip to content

Commit

Permalink
2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
doyouhaobaby committed Dec 1, 2024
1 parent 91cb37c commit e8360e4
Show file tree
Hide file tree
Showing 3 changed files with 383 additions and 0 deletions.
173 changes: 173 additions & 0 deletions app/Infra/Entity/Platform.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
<?php

declare(strict_types=1);

namespace App\Infra\Entity;

use Leevel\Database\Ddd\Entity;
use Leevel\Database\Ddd\Struct;

/**
* 平台.
*/
final class Platform extends Entity
{
public const string CONNECT = 'common';

/**
* Database table.
*/
public const string TABLE = 'platform';

/**
* Database table name.
*/
public const string TABLE_NAME = '平台';

/**
* Primary key.
*/
public const string ID = 'id';

/**
* Unique Index.
*/
public const array UNIQUE_INDEX = [
'PRIMARY' => [
'field' => ['id'],
'comment' => 'ID',
],
'uniq_platform_id' => [
'field' => ['platform_id'],
'comment' => '平台ID',
],
];

/**
* Auto increment.
*/
public const string AUTO = 'id';

/**
* Soft delete column.
*/
public const string DELETE_AT = 'delete_at';

#[Struct([
self::COLUMN_NAME => 'ID',
self::READONLY => true,
self::COLUMN_STRUCT => [
'type' => 'bigint',
'default' => null,
],
])]
protected ?int $id = null;

#[Struct([
self::COLUMN_NAME => '平台ID',
self::COLUMN_COMMENT => 'ID+3位数据库+2位表名',
self::COLUMN_STRUCT => [
'type' => 'bigint',
'default' => 0,
],
])]
protected ?int $platformId = null;

#[Struct([
self::COLUMN_NAME => '编号',
self::COLUMN_STRUCT => [
'type' => 'varchar',
'default' => '',
'length' => 30,
],
])]
protected ?string $num = null;

#[Struct([
self::COLUMN_NAME => '名称',
self::COLUMN_STRUCT => [
'type' => 'varchar',
'default' => '',
'length' => 50,
],
])]
protected ?string $name = null;

#[Struct([
self::COLUMN_NAME => '平台全称',
self::COLUMN_STRUCT => [
'type' => 'char',
'default' => '',
'length' => 100,
],
])]
protected ?string $fullName = null;

#[Struct([
self::COLUMN_NAME => '状态',
self::COLUMN_COMMENT => '0=禁用;1=启用;',
self::COLUMN_STRUCT => [
'type' => 'tinyint',
'default' => 1,
],
])]
protected ?int $status = null;

#[Struct([
self::COLUMN_NAME => '创建时间',
self::COLUMN_STRUCT => [
'type' => 'datetime',
'default' => 'CURRENT_TIMESTAMP',
],
])]
protected ?string $createAt = null;

#[Struct([
self::COLUMN_NAME => '更新时间',
self::COLUMN_STRUCT => [
'type' => 'datetime',
'default' => 'CURRENT_TIMESTAMP',
],
])]
protected ?string $updateAt = null;

#[Struct([
self::COLUMN_NAME => '删除时间',
self::COLUMN_COMMENT => '0=未删除;大于0=删除时间;',
self::SHOW_PROP_BLACK => true,
self::COLUMN_STRUCT => [
'type' => 'bigint',
'default' => 0,
],
])]
protected ?int $deleteAt = null;

#[Struct([
self::COLUMN_NAME => '创建账号',
self::SHOW_PROP_BLACK => true,
self::COLUMN_STRUCT => [
'type' => 'bigint',
'default' => 0,
],
])]
protected ?int $createAccount = null;

#[Struct([
self::COLUMN_NAME => '更新账号',
self::SHOW_PROP_BLACK => true,
self::COLUMN_STRUCT => [
'type' => 'bigint',
'default' => 0,
],
])]
protected ?int $updateAccount = null;

#[Struct([
self::COLUMN_NAME => '操作版本号',
self::COLUMN_STRUCT => [
'type' => 'bigint',
'default' => 0,
],
])]
protected ?int $version = null;
}
188 changes: 188 additions & 0 deletions app/Infra/Entity/SearchPlan.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
<?php

declare(strict_types=1);

namespace App\Infra\Entity;

use Leevel\Database\Ddd\Entity;
use Leevel\Database\Ddd\Struct;

/**
* 常用搜索.
*/
final class SearchPlan extends Entity
{
/**
* Database table.
*/
public const string TABLE = 'search_plan';

/**
* Database table name.
*/
public const string TABLE_NAME = '常用搜索';

/**
* Primary key.
*/
public const string ID = 'id';

/**
* Unique Index.
*/
public const array UNIQUE_INDEX = [
'PRIMARY' => [
'field' => ['id'],
'comment' => 'ID',
],
'uniq_data' => [
'field' => ['platform_id', 'company_id', 'account_id', 'type', 'source_type', 'delete_at'],
'comment' => '数据',
],
];

/**
* Auto increment.
*/
public const string AUTO = 'id';

/**
* Soft delete column.
*/
public const string DELETE_AT = 'delete_at';

#[Struct([
self::COLUMN_NAME => 'ID',
self::READONLY => true,
self::COLUMN_STRUCT => [
'type' => 'bigint',
'default' => null,
],
])]
protected ?int $id = null;

#[Struct([
self::COLUMN_NAME => '平台ID',
self::COLUMN_STRUCT => [
'type' => 'bigint',
'default' => 0,
],
])]
protected ?int $platformId = null;

#[Struct([
self::COLUMN_NAME => '公司ID',
self::COLUMN_STRUCT => [
'type' => 'bigint',
'default' => 0,
],
])]
protected ?int $companyId = null;

#[Struct([
self::COLUMN_NAME => '账号ID',
self::COLUMN_STRUCT => [
'type' => 'bigint',
'default' => 0,
],
])]
protected ?int $accountId = null;

#[Struct([
self::COLUMN_NAME => '搜索名称',
self::COLUMN_STRUCT => [
'type' => 'varchar',
'default' => '',
'length' => 50,
],
])]
protected ?string $name = null;

#[Struct([
self::COLUMN_NAME => '是否为默认搜索',
self::COLUMN_COMMENT => '0=否;1=是;',
self::COLUMN_STRUCT => [
'type' => 'tinyint',
'default' => 0,
],
])]
protected ?int $isDefault = null;

#[Struct([
self::COLUMN_NAME => '计划',
self::COLUMN_STRUCT => [
'type' => 'text',
'default' => null,
],
])]
protected ?string $plan = null;

#[Struct([
self::COLUMN_NAME => '来源类型',
self::COLUMN_STRUCT => [
'type' => 'bigint',
'default' => 0,
],
])]
protected ?int $sourceType = null;

#[Struct([
self::COLUMN_NAME => '备注',
self::COLUMN_STRUCT => [
'type' => 'varchar',
'default' => '',
'length' => 50,
],
])]
protected ?string $remark = null;

#[Struct([
self::COLUMN_NAME => '创建时间',
self::COLUMN_STRUCT => [
'type' => 'datetime',
'default' => 'CURRENT_TIMESTAMP',
],
])]
protected ?string $createAt = null;

#[Struct([
self::COLUMN_NAME => '删除时间',
self::COLUMN_COMMENT => '0=未删除;大于0=删除时间;',
self::SHOW_PROP_BLACK => true,
self::COLUMN_STRUCT => [
'type' => 'bigint',
'default' => 0,
],
])]
protected ?int $deleteAt = null;

#[Struct([
self::COLUMN_NAME => '创建账号',
self::SHOW_PROP_BLACK => true,
self::COLUMN_STRUCT => [
'type' => 'bigint',
'default' => 0,
],
])]
protected ?int $createAccount = null;

#[Struct([
self::COLUMN_NAME => '操作版本号',
self::COLUMN_STRUCT => [
'type' => 'bigint',
'default' => 0,
],
])]
protected ?int $version = null;

#[Struct([
self::COLUMN_NAME => '类型',
self::COLUMN_COMMENT => '1=搜索条件;2=列配置;',
self::ENUM_CLASS => SearchPlanTypeEnum::class,
self::COLUMN_STRUCT => [
'type' => 'tinyint',
'default' => 1,
],
])]
protected ?int $type = null;
}
22 changes: 22 additions & 0 deletions app/Infra/Entity/SearchPlanTypeEnum.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace App\Infra\Entity;

use Leevel\Support\Enum;
use Leevel\Support\Msg;

/**
* 常用搜索类型枚举.
*/
enum SearchPlanTypeEnum: int
{
use Enum;

#[Msg('搜索条件')]
case SEARCH_CRITERIA = 1;

#[Msg('列配置')]
case COLUMN_CONFIGURATION = 2;
}

0 comments on commit e8360e4

Please sign in to comment.