tp5视图模型,怎么一张表查询2次呢?

浏览:911 发布日期:2017/08/09 分类:ThinkPHP5专区 关键字: 视图模型 TP5
            $data=Db::view('logistics_order',true)
                //用户表
                ->view('logistics_companyuser',['id','name','tel'],'logistics_companyuser.id=logistics_order.companyuser_id','LEFT')
                //员工表
                ->view('logistics_user',['name'=>'username'],'logistics_user.id=logistics_order.user_id','LEFT')
                //网点表(发货)
                ->view('logistics_branch',['name'=>'staer_branch_name'],'logistics_branch.id=logistics_order.staer_branch_id','LEFT')
                //门店表(发货)
                ->view('logistics_store',['name'=>'staer_store_name'],'logistics_store.id=logistics_order.staer_store_id','LEFT')
                //网点表(收货)
                ->view('logistics_branch',['name'=>'receive_branch_name'],'logistics_branch.id=logistics_order.receive_branch_id','LEFT')
                //门店表(收货)
                ->view('logistics_store',['name'=>'receive_store_name'],'logistics_store.id=logistics_order.receive_store_id','LEFT')

                ->where($map)
                ->select();
最佳答案
评论( 相关
后面还有条评论,点击查看>>