EquipmentType.php 963 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /*
  3. * @Descripttion:
  4. * @version: 1.0.0
  5. * @Author: likang
  6. * @Date: 2022-06-17 15:45:06
  7. * @LastEditors: likang
  8. * @LastEditTime: 2022-06-21 13:57:42
  9. */
  10. namespace catchAdmin\equipment\model;
  11. use catcher\base\CatchModel as Model;
  12. use think\Model as ThinkModel;
  13. class EquipmentType extends Model
  14. {
  15. // 表名
  16. public $name = 'equipment_type';
  17. // 数据库字段映射
  18. public $field = array(
  19. 'id',
  20. // 父类的id
  21. 'pid',
  22. // 1 有效 -1 无效
  23. 'status',
  24. // 名称
  25. 'name',
  26. // 创建人ID
  27. 'creator_id',
  28. // 创建时间
  29. 'created_at',
  30. // 更新时间
  31. 'updated_at',
  32. // 软删除
  33. 'deleted_at',
  34. //顺序
  35. 'order'
  36. );
  37. public function getParentNamebyChildId($id)
  38. {
  39. $pid =$this->where('id',$id)->value('pid');
  40. $name = $this->where('id',$pid)->value('name');
  41. return $name;
  42. }
  43. }