You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

72 line
1.9 KiB

  1. <?php
  2. namespace common\models;
  3. use yii\db\ActiveRecord;
  4. /**
  5. * This is the model class for table "base_supplier_purchase".
  6. *
  7. * @property integer $ID
  8. * @property integer $CREATE_USER_ID
  9. * @property string $CREATE_TIME
  10. * @property integer $UPDATE_USER_ID
  11. * @property string $UPDATE_TIME
  12. * @property integer $CANCEL_FLAG
  13. * @property integer $SUPPLIER_ID
  14. * @property integer $PRODUCT_TYPE
  15. * @property string $PURCHASER_NAME
  16. */
  17. class BaseSupplierPurchase extends ActiveRecord
  18. {
  19. const HOTEL = 25; //酒店
  20. const MOTORCADE = 259; //车队
  21. /**
  22. * @inheritdoc
  23. */
  24. public static function tableName()
  25. {
  26. return 'base_supplier_purchase';
  27. }
  28. /**
  29. * @inheritdoc
  30. */
  31. public function rules()
  32. {
  33. return [
  34. [['CREATE_USER_ID', 'UPDATE_USER_ID', 'CANCEL_FLAG', 'SUPPLIER_ID', 'PRODUCT_TYPE'], 'integer'],
  35. [['CREATE_TIME'], 'required'],
  36. [['UPDATE_TIME'], 'safe'],
  37. [['CREATE_TIME', 'PURCHASER_NAME'], 'string', 'max' => 20],
  38. ];
  39. }
  40. /**
  41. * @inheritdoc
  42. */
  43. public function attributeLabels()
  44. {
  45. return [
  46. 'ID' => 'ID',
  47. 'CREATE_USER_ID' => '记录创建用户ID',
  48. 'CREATE_TIME' => '记录创建时间',
  49. 'UPDATE_USER_ID' => '记录最后更新用户ID',
  50. 'UPDATE_TIME' => '记录最后更新时间',
  51. 'CANCEL_FLAG' => '记录有效性标记,CANCEL_FLAG=0记录有效;CANCEL_FLAG=1,记录已删除',
  52. 'SUPPLIER_ID' => '供应商或渠道商ID,对应BASE_SUPPLIER.ID',
  53. 'PRODUCT_TYPE' => '采购产品类别',
  54. 'PURCHASER_NAME' => '采购人',
  55. ];
  56. }
  57. /**
  58. * @return \yii\db\ActiveQuery 酒店
  59. */
  60. public function getUserName()
  61. {
  62. return $this->hasOne(User::className(), ['ID' => 'PURCHASER_NAME'])->from('base_user as User');
  63. }
  64. }