From 645aafcadb307e62666701d12501b06fc3f1c3f4 Mon Sep 17 00:00:00 2001 From: xiaoan <419177984@qq.com> Date: Wed, 24 Apr 2024 22:09:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=84=91=E5=9B=BE=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=9F=A5=E7=9C=8Bbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/views/mind_map.py | 47 ++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 31 deletions(-) diff --git a/server/views/mind_map.py b/server/views/mind_map.py index ce29aec..73190d0 100644 --- a/server/views/mind_map.py +++ b/server/views/mind_map.py @@ -30,9 +30,6 @@ class JsMindView(LoginRequiredJSONMixin, ListAPIView): 查询思维导图 """ pk = request.GET.get('id') - print("-----------------------------") - print(pk) - print("-----------------------------") # 页面源 page_tag = request.GET.get('s_p') user = request.user @@ -40,34 +37,22 @@ class JsMindView(LoginRequiredJSONMixin, ListAPIView): return build_response(code=CODE_FAILED, msg="参数错误") select_id = json.loads(user.select_xiaozu)['xiaozu'] - print(select_id[0]) - print('list current user: %s' % user) - # if pk is not None: - # # 查询导图详细 查看用户是否有权限 - # sql = """ - # select * from cooperation_mind mind where id=%s and mind.class_id =%s - # - # """ % (pk, select_id[0]) - # # sql = """ - # # select * from cooperation_mind mind where id=%s and mind.class_id=%s - # # union all select m1.* from cooperation_mind m1 join cooperation_mind_share sh on sh.coop_mind_id = m1.id where m1.id=%s and sh.operator_user_id =%s - # # union all select m1.* from cooperation_mind m1 join cooperation_mind_star st on st.coop_mind_id = m1.id where m1.id=%s and st.operator_user_id =%s - # # """ % (pk, select_id, pk, select_id, pk, select_id) - # mind = CooperationMind.objects.raw(sql) - # if len(mind) is None: - # return build_response(code=CODE_FAILED, msg="无权限") - # # 序列化 - # serializer = CooperationMindSerializer(mind[0]) - # print("--------------------------") - # print("--------------------------") - # print("--------------------------") - # print("--------------------------") - # print(serializer) - # print("--------------------------") - # print("--------------------------") - # print("--------------------------") - # print("--------------------------") - # return build_response(data=serializer.data) + if pk is not None: + # 查询导图详细 查看用户是否有权限 + sql = """ + select * from cooperation_mind mind where id=%s + """ % (pk) + # sql = """ + # select * from cooperation_mind mind where id=%s and mind.class_id=%s + # union all select m1.* from cooperation_mind m1 join cooperation_mind_share sh on sh.coop_mind_id = m1.id where m1.id=%s and sh.operator_user_id =%s + # union all select m1.* from cooperation_mind m1 join cooperation_mind_star st on st.coop_mind_id = m1.id where m1.id=%s and st.operator_user_id =%s + # """ % (pk, select_id, pk, select_id, pk, select_id) + mind = CooperationMind.objects.raw(sql) + if len(mind) is None: + return build_response(code=CODE_FAILED, msg="无权限") + # 序列化 + serializer = CooperationMindSerializer(mind[0]) + return build_response(data=serializer.data) # 查询列表 if 'b9b101e' == page_tag: