|
@@ -1409,8 +1409,14 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
$where['component.type_id'] = $data['type_id'];
|
|
$where['component.type_id'] = $data['type_id'];
|
|
}
|
|
}
|
|
$result = Component::where($where)
|
|
$result = Component::where($where)
|
|
- ->leftJoin('component_type','component_type.id','=','component.type_id')
|
|
|
|
- ->select( 'component.*', 'component_type.com_typename')
|
|
|
|
|
|
+ ->leftJoin('component_type', 'component_type.id', '=', 'component.type_id')
|
|
|
|
+ ->leftJoin('component_img', 'component.component_type', '=', 'component_img.component_id')
|
|
|
|
+ ->select(
|
|
|
|
+ 'component.*',
|
|
|
|
+ 'component_type.com_typename',
|
|
|
|
+ DB::raw('COUNT(component_img.id) as img_count')
|
|
|
|
+ )
|
|
|
|
+ ->groupBy('component.id') // 按组件ID分组,确保统计每个组件的图片数量
|
|
->orderBy('component.updated_at', 'desc')
|
|
->orderBy('component.updated_at', 'desc')
|
|
->paginate($data['page_size'], ['*'], 'mypage_name', $data['page']);
|
|
->paginate($data['page_size'], ['*'], 'mypage_name', $data['page']);
|
|
if(empty($result)){
|
|
if(empty($result)){
|