|
@@ -198,19 +198,24 @@ class EquipmentInfo(View):
|
|
|
username = request_dict.get('username', None)
|
|
|
if not page or not line:
|
|
|
return response.json(444, 'page,line')
|
|
|
- user = Device_User.objects.filter(username=username)
|
|
|
- if not user.exists():
|
|
|
- return response.json(104)
|
|
|
- users = CommonService.qs_to_dict(user)
|
|
|
- # 从字典类型中找到对应的pk值,即是userID
|
|
|
- user_id = users.get('datas')[0].get('pk')
|
|
|
check_perm = ModelService.check_perm(userID=userID, permID=30)
|
|
|
if not check_perm:
|
|
|
return response.json(404)
|
|
|
- uid_list = Device_Info.objects.filter(userID_id=user_id).values_list('UID', flat=True)
|
|
|
- if not len(uid_list):
|
|
|
- return response.json(0, {'datas': [], 'count': 0})
|
|
|
- qs = Equipment_Info.objects.filter(userID_id=user_id).order_by('-id')
|
|
|
+
|
|
|
+ if not username:
|
|
|
+ qs = Equipment_Info.objects.all().order_by('-id')
|
|
|
+ else:
|
|
|
+ user = Device_User.objects.filter(username=username)
|
|
|
+ users = CommonService.qs_to_dict(user)
|
|
|
+ # 从字典类型中找到对应的pk值,即是userID
|
|
|
+ user_id = users.get('datas')[0].get('pk')
|
|
|
+ if not user.exists():
|
|
|
+ return response.json(104)
|
|
|
+
|
|
|
+ uid_list = Device_Info.objects.filter(userID_id=user_id).values_list('UID', flat=True)
|
|
|
+ if not len(uid_list):
|
|
|
+ return response.json(0, {'datas': [], 'count': 0})
|
|
|
+ qs = Equipment_Info.objects.filter(userID_id=user_id).order_by('-id')
|
|
|
if not qs.exists():
|
|
|
return response.json(0, {'datas': [], 'count': 0})
|
|
|
count = qs.count()
|