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

no message

parent 5b001948
Pipeline #98 canceled with stages
...@@ -495,20 +495,39 @@ class DevicesController extends Controller ...@@ -495,20 +495,39 @@ class DevicesController extends Controller
$wherein = [1, 5, 10]; $wherein = [1, 5, 10];
} }
$databadevice = DB::table('device'); $databadevice = DB::table('device');
$devicelist = $databadevice if (!is_null($this->isadmin())) {
->whereIn('dtype', $wherein) $devicelist = $databadevice
->leftjoin('device_type as dy', "device.dtype", '=', 'dy.tid') ->whereIn('dtype', $wherein)
->leftjoin('gas as g', "device.status", '=', 'g.id') ->leftjoin('device_type as dy', "device.dtype", '=', 'dy.tid')
->leftjoin('status as p', "device.devicepolice", '=', 'p.id') ->leftjoin('gas as g', "device.status", '=', 'g.id')
->leftjoin('danwei as dw', 'device.devicemonad', '=', 'dw.id') ->leftjoin('status as p', "device.devicepolice", '=', 'p.id')
->select('dy.tname', 'g.gas', 'device.*', 'p.status_name', 'dw.danwei') ->leftjoin('danwei as dw', 'device.devicemonad', '=', 'dw.id')
->orderBy('device.id', 'desc') ->select('dy.tname', 'g.gas', 'device.*', 'p.status_name', 'dw.danwei')
->offset($pagenNum) ->orderBy('device.id', 'desc')
->limit($limit) ->offset($pagenNum)
->get()->toArray(); ->limit($limit)
$count = $databadevice ->get()->toArray();
->whereIn('dtype', $wherein) $count = $databadevice
->count(); ->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]); return $this->jsonSuccessData(['devicelist' => $devicelist, 'count' => $count]);
} }
public function devicepolice(Request $request) 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