Orgs.php 945 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace app\api\model;
  3. use think\facade\Db;
  4. use think\Model;
  5. /**
  6. * Created by PhpStorm
  7. * Author: ihavoc
  8. * Date: 2020/11/22
  9. * Time: 16:24
  10. *
  11. */
  12. class Orgs extends Model {
  13. protected $table = 't_orgs';
  14. protected $pk = 'id';
  15. //添加任务 返回添加数据的主键id
  16. public function createOrgsInfo($data)
  17. {
  18. return $this->insertAll($data);
  19. }
  20. //连表查询对应的ccjc信息
  21. public function selectCcjcData($where,$pageNum=1,$pageSize=10)
  22. {
  23. $result= Db::name("orgs")
  24. ->join('t_ccjc','t_orgs.task_id=t_ccjc.id')
  25. ->where($where)
  26. ->page((int)$pageNum,(int)$pageSize)
  27. ->select();
  28. return $result;
  29. }
  30. public function countCcjcData($where)
  31. {
  32. $result= Db::name("orgs")
  33. ->Join('t_ccjc','t_orgs.task_id=t_ccjc.id')
  34. ->where($where)
  35. ->count();
  36. return $result;
  37. }
  38. }