# sql 语句执行函数
def get_access(request): uid=request cursor=connection.cursor() cursor.execute("select a.username ,b.role_name,c.node_id,d.node_name from user a LEFT JOIN role b on a.role_id=b.id LEFT JOIN access c on b.id =c.node_id LEFT JOIN node d on c.node_id=d.id where a.id=%s"%uid) result=cursor.fetchall() # 列表形式返回 return result