easy-swoole / easyswoole

swoole,easyswoole,swoole framework
https://www.easyswoole.com/
Apache License 2.0
4.73k stars 511 forks source link

多表join left easyswoole 少字段 #499

Closed 2021-cm closed 4 months ago

2021-cm commented 2 years ago

5QS2MT1}{JWH2N5WL14({5M ![Uploading YKJ3$UQMQNF$TTCA{OIPH.jpg…]() function getList($where = [],$field = null,$page = 1,$limit = 10) { return DbManager::getInstance()->invoke(function ($client) use ($where,$field,$page,$limit){ $model = self::invoke($client)->limit($limit*($page -1),$limit)->withTotalCount(); $list = $model->join('member_add_info',' member_add_info.member_id = member.id','left')->join('department','department.id = member_add_info.department_id','left')->field($field)->all($where); $total = $model->lastQueryResult()->getTotalCount(); return ['list'=>$list,'total'=>$total]; }); }

XueSiLf commented 4 months ago

你需要对all()方法得到的结果进行toArray(false,false)操作