|
|
@ -3,6 +3,8 @@ |
|
|
namespace App\Http\Controllers\Admin; |
|
|
namespace App\Http\Controllers\Admin; |
|
|
|
|
|
|
|
|
use App\Exceptions\CustomException; |
|
|
use App\Exceptions\CustomException; |
|
|
|
|
|
use App\Models\AdminFloor; |
|
|
|
|
|
use App\Models\Parking; |
|
|
use App\Models\ParkingPattern; |
|
|
use App\Models\ParkingPattern; |
|
|
use App\Models\ParkingPatternSpace; |
|
|
use App\Models\ParkingPatternSpace; |
|
|
use App\Models\ParkingSpace; |
|
|
use App\Models\ParkingSpace; |
|
|
@ -67,6 +69,60 @@ class ParkingPatternSpaceController extends BaseController |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($request->has('parking_space_attr')) { |
|
|
|
|
|
$parking_space_attr = $request->input('parking_space_attr'); |
|
|
|
|
|
if ($parking_space_attr) { |
|
|
|
|
|
$space_ids = ParkingPatternSpace::query()->where( |
|
|
|
|
|
'pattern_id', |
|
|
|
|
|
$pattern_id |
|
|
|
|
|
)->pluck('space_id'); |
|
|
|
|
|
$ParkingSpaceModel = ParkingSpace::query()->where( |
|
|
|
|
|
'space_type_id', |
|
|
|
|
|
$parking_space_attr |
|
|
|
|
|
); |
|
|
|
|
|
if ($space_ids) { |
|
|
|
|
|
$ParkingSpaceModel->whereIn('id', $space_ids); |
|
|
|
|
|
} |
|
|
|
|
|
$new_space_ids = $ParkingSpaceModel->pluck('id'); |
|
|
|
|
|
if ($new_space_ids) { |
|
|
|
|
|
$query->whereIn('space_id', $new_space_ids); |
|
|
|
|
|
} else { |
|
|
|
|
|
$query->where('id', 0); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($request->has('parking_id')) { |
|
|
|
|
|
$parking_id = $request->input('parking_id'); |
|
|
|
|
|
if ($parking_id) { |
|
|
|
|
|
$floor_ids = AdminFloor::query()->where( |
|
|
|
|
|
'building_floor', |
|
|
|
|
|
$parking_id |
|
|
|
|
|
)->pluck('id'); |
|
|
|
|
|
if ($floor_ids) { |
|
|
|
|
|
$space_ids = ParkingPatternSpace::query()->where( |
|
|
|
|
|
'pattern_id', |
|
|
|
|
|
$pattern_id |
|
|
|
|
|
)->pluck('space_id'); |
|
|
|
|
|
$ParkingSpaceModel = ParkingSpace::query()->whereIn( |
|
|
|
|
|
'floor_id', |
|
|
|
|
|
$floor_ids |
|
|
|
|
|
); |
|
|
|
|
|
if ($space_ids) { |
|
|
|
|
|
$ParkingSpaceModel->whereIn('id', $space_ids); |
|
|
|
|
|
} |
|
|
|
|
|
$new_space_ids = $ParkingSpaceModel->pluck('id'); |
|
|
|
|
|
if ($new_space_ids) { |
|
|
|
|
|
$query->whereIn('space_id', $new_space_ids); |
|
|
|
|
|
} else { |
|
|
|
|
|
$query->where('id', 0); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
$query->where('id', 0); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 分页 |
|
|
// 分页 |
|
|
$page = $request->input('page', 1); |
|
|
$page = $request->input('page', 1); |
|
|
$perPage = $request->input('per_page', 10); |
|
|
$perPage = $request->input('per_page', 10); |
|
|
@ -83,9 +139,14 @@ class ParkingPatternSpaceController extends BaseController |
|
|
$ParkingSpace = ParkingSpace::query()->find($item['space_id']); |
|
|
$ParkingSpace = ParkingSpace::query()->find($item['space_id']); |
|
|
$item['parking_space_number'] = ''; |
|
|
$item['parking_space_number'] = ''; |
|
|
$item['parking_space_attr'] = ''; |
|
|
$item['parking_space_attr'] = ''; |
|
|
|
|
|
$item['parking'] = ''; |
|
|
if ($ParkingSpace) { |
|
|
if ($ParkingSpace) { |
|
|
$item['parking_space_number'] = $ParkingSpace['number']; |
|
|
$item['parking_space_number'] = $ParkingSpace['number']; |
|
|
$item['parking_space_attr'] = ParkingSpaceAttributes::getAttr($ParkingSpace['space_attr_id']); |
|
|
$item['parking_space_attr'] = ParkingSpaceAttributes::getAttr($ParkingSpace['space_attr_id']); |
|
|
|
|
|
$parking_id = AdminFloor::query()->where('id', $ParkingSpace['floor_id'])->value('building_floor'); |
|
|
|
|
|
if ($parking_id) { |
|
|
|
|
|
$item['parking'] = Parking::getName($parking_id); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
$item['parking_space_type'] = ParkingSpaceType::getName( |
|
|
$item['parking_space_type'] = ParkingSpaceType::getName( |
|
|
$item['space_type_id'] |
|
|
$item['space_type_id'] |
|
|
@ -124,7 +185,9 @@ class ParkingPatternSpaceController extends BaseController |
|
|
{ |
|
|
{ |
|
|
try { |
|
|
try { |
|
|
$data = [ |
|
|
$data = [ |
|
|
'parking_space_type_list' => ParkingSpaceType::getData() |
|
|
'parking_space_type_list' => ParkingSpaceType::getData(), |
|
|
|
|
|
'parking_space_attr_list' => ParkingSpaceAttributes::getData(), |
|
|
|
|
|
'parking_list' => Parking::getData() |
|
|
]; |
|
|
]; |
|
|
return $this->responseService->success($data); |
|
|
return $this->responseService->success($data); |
|
|
} catch (Exception $e) { |
|
|
} catch (Exception $e) { |
|
|
|