FCarInfo.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. namespace app\modules\car\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "{{%f_car_info}}".
  6. *
  7. * @property int $car_id
  8. * @property string $card_num 车牌号
  9. * @property string|null $city 地市
  10. * @property string|null $dpt_sec 二级单位
  11. * @property string|null $grid 网格
  12. * @property string|null $factory 厂家
  13. * @property int|null $passengers 载客人数
  14. * @property string|null $model 型号
  15. * @property float|null $emissions 排量
  16. * @property string|null $car_type 车辆类型
  17. * @property string|null $enabled_date 启用日期
  18. * @property string|null $using_tag 用途分类
  19. * @property string|null $asset_id 资产编号
  20. * @property string|null $self_rent 产权
  21. * @property string|null $rps_dpt 责任部门
  22. * @property string|null $rps_man 责任人
  23. * @property int|null $cell_num 电话号码
  24. */
  25. class FCarInfo extends \app\common\models\EActiveRecord
  26. {
  27. /**
  28. * {@inheritdoc}
  29. */
  30. public static function tableName()
  31. {
  32. return '{{%f_car_info}}';
  33. }
  34. /**
  35. * {@inheritdoc}
  36. */
  37. public function rules()
  38. {
  39. return [
  40. [['card_num'], 'required'],
  41. [['passengers', 'cell_num'], 'integer'],
  42. [['emissions'], 'number'],
  43. [['enabled_date'], 'safe'],
  44. [['card_num', 'city', 'dpt_sec', 'grid', 'factory', 'model', 'car_type', 'using_tag', 'asset_id', 'self_rent', 'rps_dpt', 'rps_man'], 'string', 'max' => 63],
  45. ];
  46. }
  47. /**
  48. * {@inheritdoc}
  49. */
  50. public function attributeLabels()
  51. {
  52. return [
  53. 'car_id' => 'Car ID',
  54. 'card_num' => '车牌号',
  55. 'city' => '地市',
  56. 'dpt_sec' => '二级单位',
  57. 'grid' => '网格',
  58. 'factory' => '厂家',
  59. 'passengers' => '载客人数',
  60. 'model' => '型号',
  61. 'emissions' => '排量',
  62. 'car_type' => '车辆类型',
  63. 'enabled_date' => '启用日期',
  64. 'using_tag' => '用途分类',
  65. 'asset_id' => '资产编号',
  66. 'self_rent' => '产权',
  67. 'rps_dpt' => '责任部门',
  68. 'rps_man' => '责任人',
  69. 'cell_num' => '电话号码',
  70. ];
  71. }
  72. public function getCartable()
  73. {
  74. return FOneCarOneTable::find()->where("car_id=$this->car_id")->orderBy(['id'=>SORT_DESC])->limit(1)->one();
  75. }
  76. }