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

no message

parent 5b001948
Pipeline #98 canceled with stages
...@@ -495,12 +495,29 @@ class DevicesController extends Controller ...@@ -495,12 +495,29 @@ class DevicesController extends Controller
$wherein = [1, 5, 10]; $wherein = [1, 5, 10];
} }
$databadevice = DB::table('device'); $databadevice = DB::table('device');
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 $devicelist = $databadevice
->whereIn('dtype', $wherein) ->whereIn('dtype', $wherein)
->leftjoin('device_type as dy', "device.dtype", '=', 'dy.tid') ->leftjoin('device_type as dy', "device.dtype", '=', 'dy.tid')
->leftjoin('gas as g', "device.status", '=', 'g.id') ->leftjoin('gas as g', "device.status", '=', 'g.id')
->leftjoin('status as p', "device.devicepolice", '=', 'p.id') ->leftjoin('status as p', "device.devicepolice", '=', 'p.id')
->leftjoin('danwei as dw', 'device.devicemonad', '=', 'dw.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') ->select('dy.tname', 'g.gas', 'device.*', 'p.status_name', 'dw.danwei')
->orderBy('device.id', 'desc') ->orderBy('device.id', 'desc')
->offset($pagenNum) ->offset($pagenNum)
...@@ -508,7 +525,9 @@ class DevicesController extends Controller ...@@ -508,7 +525,9 @@ class DevicesController extends Controller
->get()->toArray(); ->get()->toArray();
$count = $databadevice $count = $databadevice
->whereIn('dtype', $wherein) ->whereIn('dtype', $wherein)
->where('uid','=',Auth::id())
->count(); ->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