WorldBase.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. declare(strict_types=1);
  3. namespace ImiApp\Model\Base;
  4. use Imi\Model\Model as Model;
  5. use Imi\Model\Annotation\DDL;
  6. use Imi\Model\Annotation\Table;
  7. use Imi\Model\Annotation\Column;
  8. use Imi\Model\Annotation\Entity;
  9. /**
  10. * world 基类
  11. * @Entity(bean=false)
  12. * @Table(name="world", id={"id"})
  13. * @DDL(sql="CREATE TABLE `world` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `randomNumber` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci", decode="")
  14. * @property int|null $id
  15. * @property int|null $randomNumber
  16. */
  17. abstract class WorldBase extends Model
  18. {
  19. /**
  20. * id
  21. * @Column(name="id", type="int", length=10, accuracy=0, nullable=false, default="", isPrimaryKey=true, primaryKeyIndex=0, isAutoIncrement=true)
  22. * @var int|null
  23. */
  24. protected ?int $id = null;
  25. /**
  26. * 获取 id
  27. *
  28. * @return int|null
  29. */
  30. public function getId(): ?int
  31. {
  32. return $this->id;
  33. }
  34. /**
  35. * 赋值 id
  36. * @param int|null $id id
  37. * @return static
  38. */
  39. public function setId($id)
  40. {
  41. $this->id = null === $id ? null : (int)$id;
  42. return $this;
  43. }
  44. /**
  45. * randomNumber
  46. * @Column(name="randomNumber", type="int", length=11, accuracy=0, nullable=false, default="0", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false)
  47. * @var int|null
  48. */
  49. protected ?int $randomNumber = null;
  50. /**
  51. * 获取 randomNumber
  52. *
  53. * @return int|null
  54. */
  55. public function getRandomNumber(): ?int
  56. {
  57. return $this->randomNumber;
  58. }
  59. /**
  60. * 赋值 randomNumber
  61. * @param int|null $randomNumber randomNumber
  62. * @return static
  63. */
  64. public function setRandomNumber($randomNumber)
  65. {
  66. $this->randomNumber = null === $randomNumber ? null : (int)$randomNumber;
  67. return $this;
  68. }
  69. }