Browse Source

告警信息管理列表模糊搜索关键字2

master
wanghongjun 1 month ago
parent
commit
8a777027c2
  1. 18
      app/Http/Controllers/Admin/ParkingAlarmInformationController.php

18
app/Http/Controllers/Admin/ParkingAlarmInformationController.php

@ -45,26 +45,34 @@ class ParkingAlarmInformationController extends BaseController
$type_id = []; $type_id = [];
$nameTypeId = AdminTranslationService::getLikeTypeIds(100, $keyword); $nameTypeId = AdminTranslationService::getLikeTypeIds(100, $keyword);
if ($nameTypeId) { if ($nameTypeId) {
$type_id = $nameTypeId; $type_id = $nameTypeId;
} }
$conditionTypeId = AdminTranslationService::getLikeTypeIds(101, $keyword); $conditionTypeId = AdminTranslationService::getLikeTypeIds(101, $keyword);
if ($conditionTypeId) { if ($conditionTypeId) {
$type_id = $conditionTypeId; $type_id = array_merge($type_id,
(array)$conditionTypeId
);
} }
$contentTypeId = AdminTranslationService::getLikeTypeIds(102, $keyword); $contentTypeId = AdminTranslationService::getLikeTypeIds(102, $keyword);
if ($contentTypeId) { if ($contentTypeId) {
$type_id = $contentTypeId; $type_id = array_merge($type_id,
(array)$contentTypeId
);
} }
$remarkTypeId = AdminTranslationService::getLikeTypeIds(103, $keyword); $remarkTypeId = AdminTranslationService::getLikeTypeIds(103, $keyword);
if ($remarkTypeId) { if ($remarkTypeId) {
$type_id = $remarkTypeId; $type_id = array_merge($type_id,
(array)$remarkTypeId
);
} }
$query->where(function ($q) use ($keyword, $type_id) { $query->where(function ($q) use ($keyword, $type_id) {
$q->orWhere('name', $keyword); $q->orWhere('name', $keyword);
$q->orWhere('condition', $keyword); $q->orWhere('condition', $keyword);
$q->orWhere('content', $keyword); $q->orWhere('content', $keyword);
$q->orWhere('remark', $keyword); $q->orWhere('remark', $keyword);
$q->orWhereIn('id', $type_id); if ($type_id) {
$q->orWhereIn('id', $type_id);
}
}); });
} }
} }

Loading…
Cancel
Save