Commit 9fa83d93 authored by 冯超鹏's avatar 冯超鹏

no message

parent 5b001948
Pipeline #98 canceled with stages
......@@ -495,20 +495,39 @@ class DevicesController extends Controller
$wherein = [1, 5, 10];
}
$databadevice = DB::table('device');
$devicelist = $databadevice
->whereIn('dtype', $wherein)
->leftjoin('device_type as dy', "device.dtype", '=', 'dy.tid')
->leftjoin('gas as g', "device.status", '=', 'g.id')
->leftjoin('status as p', "device.devicepolice", '=', 'p.id')
->leftjoin('danwei as dw', 'device.devicemonad', '=', 'dw.id')
->select('dy.tname', 'g.gas', 'device.*', 'p.status_name', 'dw.danwei')
->orderBy('device.id', 'desc')
->offset($pagenNum)
->limit($limit)
->get()->toArray();
$count = $databadevice
->whereIn('dtype', $wherein)
->count();
if (!is_null($this->isadmin())) {
$devicelist = $databadevice
->whereIn('dtype', $wherein)
->leftjoin('device_type as dy', "device.dtype", '=', 'dy.tid')
->leftjoin('gas as g', "device.status", '=', 'g.id')
->leftjoin('status as p', "device.devicepolice", '=', 'p.id')
->leftjoin('danwei as dw', 'device.devicemonad', '=', 'dw.id')
->select('dy.tname', 'g.gas', 'device.*', 'p.status_name', 'dw.danwei')
->orderBy('device.id', 'desc')
->offset($pagenNum)
->limit($limit)
->get()->toArray();
$count = $databadevice
->whereIn('dtype', $wherein)
->count();
}else{
$devicelist = $databadevice
->whereIn('dtype', $wherein)
->leftjoin('device_type as dy', "device.dtype", '=', 'dy.tid')
->leftjoin('gas as g', "device.status", '=', 'g.id')
->leftjoin('status as p', "device.devicepolice", '=', 'p.id')
->leftjoin('danwei as dw', 'device.devicemonad', '=', 'dw.id')
->where('device.uid','=',Auth::id())
->select('dy.tname', 'g.gas', 'device.*', 'p.status_name', 'dw.danwei')
->orderBy('device.id', 'desc')
->offset($pagenNum)
->limit($limit)
->get()->toArray();
$count = $databadevice
->whereIn('dtype', $wherein)
->where('uid','=',Auth::id())
->count();
}
return $this->jsonSuccessData(['devicelist' => $devicelist, 'count' => $count]);
}
public function devicepolice(Request $request)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment