think-orm icon indicating copy to clipboard operation
think-orm copied to clipboard

withJoin生成SQL不带前缀

Open anydson opened this issue 4 years ago • 0 comments

THINKPHP 6.0.3

Order::withJoin([ 'userInfo' => ['id', 'nick_name'], 'currency' => ['iname', 'an', 'pn', 'vn'] ], 'LEFT') ->withCount(['subOrderCount' => function ($query, &$alias) { $query->where('status', 'IN', '0,1,6'); $alias = 'sub_total'; }]) ->withCount(['subOrderCount' => function ($query, &$alias) { $query->where('status', 'IN', '3,4,7'); $alias = 'sub_cancel_total'; }]) ->where($where) ->limit($pagetion['offsize'], $pagetion['limit']) ->order($pagetion['order']) ->select() ->toArray();

DB配置数据表前缀后, 执行以上语句生成SQL,字段部分不带前缀,数据库报错,withJoin方法生成语句没有自动增加表前缀

anydson avatar Jul 21 '20 02:07 anydson