调整设备状态数量统计
parent
bae49d34d8
commit
460240a72a
|
|
@ -79,9 +79,13 @@ class DeviceController extends Controller
|
|||
*/
|
||||
public function typeStatusNum(Request $request)
|
||||
{
|
||||
$baseId = $request->input('base_id');
|
||||
$baseId = $request->input('base_id', 0);
|
||||
$query = Device::query();
|
||||
if($baseId){
|
||||
$query->where('agricultural_base_id', $baseId);
|
||||
}
|
||||
|
||||
$query = Device::where('agricultural_base_id', $baseId)->groupBy('type')->groupBy('status');
|
||||
$query->groupBy('type')->groupBy('status');
|
||||
|
||||
$list = $query->select(DB::raw('type, status, count(1) as num '))->get();
|
||||
$resData = [];
|
||||
|
|
|
|||
Loading…
Reference in New Issue