Cyd.php 796 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. *
  4. *User:Administrator
  5. *Date:2021/10/14
  6. */
  7. namespace app\api\model;
  8. use think\Model;
  9. class Cyd extends Model
  10. {
  11. function production()
  12. {
  13. return $this->belongsTo('production', 'product_unit','id');
  14. }
  15. function unitsTest()
  16. {
  17. return $this->belongsTo('unitsTest', 'units_id', 'id');
  18. }
  19. public function selectSampleListByTaskIdAndUid($where,$pageNum=1,$pageSize=null)
  20. {
  21. $cyd = (new Cyd());
  22. $data = $cyd->with(['Production', 'UnitsTest'])->where($where)->page($pageNum,$pageSize)->select();
  23. return $data;
  24. }
  25. public function countSampleListByTaskIdAndUid($where)
  26. {
  27. $cyd = (new Cyd());
  28. $count = $cyd->with(['Production', 'UnitsTest'])->where($where)->count();
  29. return $count;
  30. }
  31. }