def get_all_user_page(self,_page,_limit):
     _users = Sysuser.objects.all().order_by('id')[(int(_page)-1)*int(_limit):int(_page)*int(_limit)]
     _count = Sysuser.objects.all().count()
     # 将查询集里的model遍历 将model属性和属性值转成字典
     _dict_users = tools.queryset_to_json(_users)
     _data_page_json = {}
     _data_page_json['Rows']=_dict_users
     _data_page_json['Total']=_count
     return json.dumps(_data_page_json,ensure_ascii=False)
 def get_roles_page(self,_page,_limit):
     _roles = SysRole.objects.all()[(int(_page)-1)*int(_limit):int(_page)*int(_limit)]
     _count = SysRole.objects.all().count()
     # 将查询集里的model遍历 将model属性和属性值转成字典
     _dict_roles = tools.queryset_to_json(_roles)
     _data_page_json = {}
     _data_page_json['Rows']=_dict_roles
     _data_page_json['Total']=_count
     return json.dumps(_data_page_json,ensure_ascii=False)
 def get__user_by_role_page(self,_page,_limit,_role_id):
     # 取字段values_list flat=True为单个显示 去掉为元祖显示
     _user_ids = SysUserRole.objects.all().filter(roleid=_role_id).values_list("userid", flat=True)
     _count = SysUserRole.objects.all().filter(roleid=_role_id).count()
     #  __in 条件的值
     _users = Sysuser.objects.filter(id__in=_user_ids)[(int(_page)-1)*int(_limit):int(_page)*int(_limit)]
     _dict_users = tools.queryset_to_json(_users)
     _data_page_json = {}
     _data_page_json['Rows']=_dict_users
     _data_page_json['Total']=_count
     return json.dumps(_data_page_json,ensure_ascii=False)