口腔客户管理系统
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.

Change.php 935B

2 years ago
12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace app\admin\model;
  3. use think\Model;
  4. class Change extends Model
  5. {
  6. public function getAll($param, $page, $pageSize)
  7. {
  8. unset($param['page']);
  9. unset($param['pageSize']);
  10. foreach ($param as $k => $v) {
  11. if ($param[$k] === '' || $param[$k] === null) {
  12. unset($param[$k]);
  13. }
  14. }
  15. $result = $this->where($param)->with(['getUserOneData', 'getCustomerOneData'])->limit($page, $pageSize)->select();
  16. $total = $this->where($param)->count();
  17. return ['rows' => $result, 'total' => $total];
  18. }
  19. public function getUserOneData()
  20. {
  21. return $this->hasOne(\app\admin\model\User::class, 'id', 'user_id')->bind(['username' => 'username']);
  22. }
  23. public function getCustomerOneData()
  24. {
  25. return $this->hasOne(\app\admin\model\Customer::class, 'id', 'customer_id')->bind(['customer_name' => 'name']);
  26. }
  27. }