//子查询 $subQuery = $this->model ->order('createtime asc') ->buildSql(); $list = $this->model ->table($subQuery.'a') ->with(['assetsdevice']) ->group('ip') ->select();