Employee.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <?php
  2. class Employee implements JsonSerializable {
  3. private $id;
  4. private $name;
  5. private $createTime;
  6. private $number;
  7. private $mobile;
  8. private $email;
  9. private $idCardNo;
  10. private $realName;
  11. private $companies;
  12. public function jsonSerialize() {
  13. $data = [];
  14. foreach ($this as $key=>$val){
  15. if ($val !== null) $data[$key] = $val;
  16. }
  17. if(sizeof($data) < 1){
  18. return null;
  19. }
  20. return $data;
  21. }
  22. /**
  23. * @return mixed
  24. */
  25. public function getNumber()
  26. {
  27. return $this->number;
  28. }
  29. /**
  30. * @param mixed $number
  31. */
  32. public function setNumber($number)
  33. {
  34. $this->number = $number;
  35. }
  36. /**
  37. * @return mixed
  38. */
  39. public function getIdCardNo()
  40. {
  41. return $this->idCardNo;
  42. }
  43. /**
  44. * @param mixed $idCardNo
  45. */
  46. public function setIdCardNo($idCardNo)
  47. {
  48. $this->idCardNo = $idCardNo;
  49. }
  50. /**
  51. * @return mixed
  52. */
  53. public function getId()
  54. {
  55. return $this->id;
  56. }
  57. /**
  58. * @param mixed $id
  59. */
  60. public function setId($id)
  61. {
  62. $this->id = $id;
  63. }
  64. /**
  65. * @return mixed
  66. */
  67. public function getName()
  68. {
  69. return $this->name;
  70. }
  71. /**
  72. * @param mixed $name
  73. */
  74. public function setName($name)
  75. {
  76. $this->name = $name;
  77. }
  78. /**
  79. * @return mixed
  80. */
  81. public function getCreateTime()
  82. {
  83. return $this->createTime;
  84. }
  85. /**
  86. * @param mixed $createTime
  87. */
  88. public function setCreateTime($createTime)
  89. {
  90. $this->createTime = $createTime;
  91. }
  92. /**
  93. * @return mixed
  94. */
  95. public function getMobile()
  96. {
  97. return $this->mobile;
  98. }
  99. /**
  100. * @param mixed $mobile
  101. */
  102. public function setMobile($mobile)
  103. {
  104. $this->mobile = $mobile;
  105. }
  106. /**
  107. * @return mixed
  108. */
  109. public function getEmail()
  110. {
  111. return $this->email;
  112. }
  113. /**
  114. * @param mixed $email
  115. */
  116. public function setEmail($email)
  117. {
  118. $this->email = $email;
  119. }
  120. /**
  121. * @return mixed
  122. */
  123. public function getRealName()
  124. {
  125. return $this->realName;
  126. }
  127. /**
  128. * @param mixed $realName
  129. */
  130. public function setRealName($realName)
  131. {
  132. $this->realName = $realName;
  133. }
  134. /**
  135. * @return mixed
  136. */
  137. public function getCompanies()
  138. {
  139. return $this->companies;
  140. }
  141. /**
  142. * @param mixed $companies
  143. */
  144. public function setCompanies($companies)
  145. {
  146. $this->companies = $companies;
  147. }
  148. }