|
@@ -1,33 +1,47 @@
|
|
|
<?php
|
|
|
+
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
namespace ImiApp\Model\Base;
|
|
|
|
|
|
-use Imi\Model\Model as Model;
|
|
|
-use Imi\Model\Annotation\DDL;
|
|
|
-use Imi\Model\Annotation\Table;
|
|
|
+use Imi\Config\Annotation\ConfigValue;
|
|
|
use Imi\Model\Annotation\Column;
|
|
|
+use Imi\Model\Annotation\DDL;
|
|
|
use Imi\Model\Annotation\Entity;
|
|
|
+use Imi\Model\Annotation\Table;
|
|
|
+use Imi\Model\Model as Model;
|
|
|
|
|
|
/**
|
|
|
- * fortune 基类
|
|
|
- * @Entity(bean=false)
|
|
|
- * @Table(name="fortune", id={"id"})
|
|
|
+ * fortune 基类.
|
|
|
+ *
|
|
|
+ * @Entity(camel=true, bean=false, incrUpdate=false)
|
|
|
+ * @Table(name=@ConfigValue(name="@app.models.ImiApp\Model\Fortune.name", default="fortune"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.ImiApp\Model\Fortune.poolName"))
|
|
|
* @DDL(sql="CREATE TABLE `fortune` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `message` varchar(2048) CHARACTER SET utf8 NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci", decode="")
|
|
|
+ *
|
|
|
* @property int|null $id
|
|
|
* @property string|null $message
|
|
|
*/
|
|
|
abstract class FortuneBase extends Model
|
|
|
{
|
|
|
/**
|
|
|
- * id
|
|
|
- * @Column(name="id", type="int", length=10, accuracy=0, nullable=false, default="", isPrimaryKey=true, primaryKeyIndex=0, isAutoIncrement=true)
|
|
|
+ * {@inheritdoc}
|
|
|
+ */
|
|
|
+ public const PRIMARY_KEY = 'id';
|
|
|
+
|
|
|
+ /**
|
|
|
+ * {@inheritdoc}
|
|
|
+ */
|
|
|
+ public const PRIMARY_KEYS = ["id"];
|
|
|
+
|
|
|
+ /**
|
|
|
+ * id.
|
|
|
+ * @Column(name="id", type="int", length=10, accuracy=0, nullable=false, default="", isPrimaryKey=true, primaryKeyIndex=0, isAutoIncrement=true, unsigned=true, virtual=false)
|
|
|
* @var int|null
|
|
|
*/
|
|
|
- protected ?int $id = null;
|
|
|
+ protected ?int $id = NULL;
|
|
|
|
|
|
/**
|
|
|
- * 获取 id
|
|
|
+ * 获取 id.
|
|
|
*
|
|
|
* @return int|null
|
|
|
*/
|
|
@@ -37,7 +51,7 @@ abstract class FortuneBase extends Model
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 赋值 id
|
|
|
+ * 赋值 id.
|
|
|
* @param int|null $id id
|
|
|
* @return static
|
|
|
*/
|
|
@@ -48,14 +62,14 @@ abstract class FortuneBase extends Model
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * message
|
|
|
- * @Column(name="message", type="varchar", length=2048, accuracy=0, nullable=false, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false)
|
|
|
+ * message.
|
|
|
+ * @Column(name="message", type="varchar", length=2048, accuracy=0, nullable=false, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
|
|
|
* @var string|null
|
|
|
*/
|
|
|
- protected ?string $message = null;
|
|
|
+ protected ?string $message = NULL;
|
|
|
|
|
|
/**
|
|
|
- * 获取 message
|
|
|
+ * 获取 message.
|
|
|
*
|
|
|
* @return string|null
|
|
|
*/
|
|
@@ -65,7 +79,7 @@ abstract class FortuneBase extends Model
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 赋值 message
|
|
|
+ * 赋值 message.
|
|
|
* @param string|null $message message
|
|
|
* @return static
|
|
|
*/
|