from django import http from django.db import connection # 用于判断银行账号是否存在 def et_CACC_NO(CACC_NO): """ :return: """ if len(CACC_NO)<=0: return 'NO' sql = "SELECT COUNT(*) FROM BACC WHERE BACC_NO=%s" % (CACC_NO) with connection.cursor() as cursor: # 判断单号是否重复 SUM_CACC_NO = cursor.execute(sql).fetchall()[0][0] if SUM_CACC_NO <=0: return 'NO'