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.
 
 
 
 
 
 

76 lines
1.5 KiB

  1. <?php
  2. namespace backend\modules\api\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "base_bus_cost".
  6. *
  7. * @property integer $id
  8. * @property integer $supplier_id
  9. * @property integer $bus_res_id
  10. * @property string $base_cost
  11. * @property string $comment
  12. */
  13. class BaseBusCost extends \yii\db\ActiveRecord
  14. {
  15. /**
  16. * @inheritdoc
  17. */
  18. public static function tableName()
  19. {
  20. return 'base_bus_cost';
  21. }
  22. /**
  23. * @inheritdoc
  24. */
  25. public function rules()
  26. {
  27. return [
  28. [['supplier_id', 'bus_res_id'], 'integer'],
  29. [['base_cost'], 'number'],
  30. [['comment'], 'string', 'max' => 100],
  31. ];
  32. }
  33. /**
  34. * @inheritdoc
  35. */
  36. public function attributeLabels()
  37. {
  38. return [
  39. 'id' => 'ID',
  40. 'supplier_id' => 'Supplier ID',
  41. 'bus_res_id' => 'Bus Res ID',
  42. 'base_cost' => 'Base Cost',
  43. 'comment' => 'Comment',
  44. ];
  45. }
  46. /**
  47. * Function Description:获取供应商基本价格信息
  48. * Function Name: getBaseCost
  49. *
  50. * @return array|\yii\db\ActiveRecord[]
  51. *
  52. * @author 李健
  53. */
  54. public function getBaseCost()
  55. {
  56. $select = [
  57. 'supplier_id',
  58. 'bus_res_id',
  59. 'base_cost'
  60. ];
  61. $res = self::find()
  62. ->select($select)
  63. ->from(self::tableName())
  64. ->where('id>0')
  65. ->asArray()
  66. ->all();
  67. return $res;
  68. }
  69. }