|
@@ -617,13 +617,20 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
}
|
|
}
|
|
public function getComponentList(array $data): array
|
|
public function getComponentList(array $data): array
|
|
{
|
|
{
|
|
|
|
+ var_dump($data, '---------');
|
|
$where = [];
|
|
$where = [];
|
|
// $where[] = ['sector.id', '=', $data['id']];
|
|
// $where[] = ['sector.id', '=', $data['id']];
|
|
|
|
+ if (!empty($data['template_class_id'])) {
|
|
|
|
+ $where['template_class.id'] = $data['template_class_id'];
|
|
|
|
+ }
|
|
|
|
+ if (!empty($data['component_name'])) {
|
|
|
|
+ $where['component.component_name'] = $data['component_name'];
|
|
|
|
+ }
|
|
$result = Component::where($where)
|
|
$result = Component::where($where)
|
|
->leftJoin('template', 'template.id', '=', 'component.template_id')
|
|
->leftJoin('template', 'template.id', '=', 'component.template_id')
|
|
->leftJoin('template_class', 'template_class.id', '=', 'template.template_class_id') // 添加这一行
|
|
->leftJoin('template_class', 'template_class.id', '=', 'template.template_class_id') // 添加这一行
|
|
->leftJoin('sector', 'sector.id', '=', 'component.sector_id')
|
|
->leftJoin('sector', 'sector.id', '=', 'component.sector_id')
|
|
- ->select('template_class.name as template_class_name', 'template.template_name as template_name', 'sector.sector_name as sector_name', 'component.*')
|
|
|
|
|
|
+ ->select('template_class.name as template_class_name', 'template.template_name as template_name', 'template_class.id as template_class_id', 'sector.sector_name as sector_name', 'component.*')
|
|
->orderBy('sector.updated_at', 'desc')
|
|
->orderBy('sector.updated_at', 'desc')
|
|
->orderBy('sector.created_at', 'desc')
|
|
->orderBy('sector.created_at', 'desc')
|
|
->paginate($data['page_size'], ['*'], 'mypage_name', $data['page']);
|
|
->paginate($data['page_size'], ['*'], 'mypage_name', $data['page']);
|