Fan.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace catchAdmin\wind\model;
  3. use catcher\base\CatchModel as Model;
  4. use think\facade\Db;
  5. use catchAdmin\wind\model\get\FanGet;
  6. use catchAdmin\wind\model\search\FanSearch;
  7. use catchAdmin\permissions\model\DataRangScopeTrait;
  8. class Fan extends Model
  9. {
  10. use DataRangScopeTrait;
  11. use FanGet;
  12. use FanSearch;
  13. // 表名
  14. public $name = 'fan';
  15. // 数据库字段映射
  16. public $field = array(
  17. 'id',
  18. // 风厂的id
  19. 'wind_id',
  20. // 编号
  21. 'number',
  22. 'fan_model',
  23. 'longitude',
  24. 'latitude',
  25. 'info',
  26. // 创建人ID
  27. 'creator_id',
  28. // 创建时间
  29. 'created_at',
  30. // 更新时间
  31. 'updated_at',
  32. // 软删除
  33. 'deleted_at',
  34. );
  35. public function getList()
  36. {
  37. return $this->dataRange()
  38. ->catchSearch()
  39. ->append(['wind_name','model_name'])
  40. ->field('*')
  41. ->catchOrder()
  42. ->creator()
  43. ->paginate();
  44. }
  45. public function getFanList()
  46. {
  47. return $this->dataRange()
  48. ->catchSearch()
  49. ->field('id as value,number as name')
  50. ->catchOrder()
  51. ->select();
  52. }
  53. }