From d8f4f75f7b0615592d55a3435258fcacf546441b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=80=C3=AE=C3=97=C3=9A=C3=95=C3=B1?= Date: Mon, 19 Sep 2022 17:32:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=962?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/interview_zsgc.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/models/interview_zsgc.py b/models/interview_zsgc.py index 700460e..1dcae50 100644 --- a/models/interview_zsgc.py +++ b/models/interview_zsgc.py @@ -375,14 +375,24 @@ class InterviewDo: # 多个条件 if ',' in value: values = value.split(',') + bast_index = len(values) - 1 for index, i in enumerate(values): if index > 0: - whereStr += 'or ' + str(key) + ' like ' + "'%" + i + "%'" + ' ' + if index == bast_index: + whereStr += 'or ' + str(key) + ' like ' + "'%" + i + "%'" + ') ' + else: + whereStr += 'or ' + str(key) + ' like ' + "'%" + i + "%'" + ' ' else: if whereStr: - whereStr += 'and ' + str(key) + ' like ' + "'%" + i + "%'" + ' ' + if bast_index > 0: + whereStr += 'and (' + str(key) + ' like ' + "'%" + i + "%'" + ' ' + else: + whereStr += 'and ' + str(key) + ' like ' + "'%" + i + "%'" + ' ' else: - whereStr += str(key) + ' like ' + "'%" + i + "%'" + ' ' + if bast_index > 0: + whereStr += '(' + str(key) + ' like ' + "'%" + i + "%'" + ' ' + else: + whereStr += str(key) + ' like ' + "'%" + i + "%'" + ' ' continue if value == '': continue @@ -395,10 +405,10 @@ class InterviewDo: if key == 'hr_manner': if value == '': if whereStr: - whereStr += 'and ' + str(key) + ' = ' + str(0) + ' ' + whereStr += 'and (' + str(key) + ' = ' + str(0) + ' ' else: - whereStr += str(key) + ' = ' + str(0) + ' ' - whereStr += 'or ' + str(key) + ' = ' + str(1) + ' ' + whereStr += '(' + str(key) + ' = ' + str(0) + ' ' + whereStr += 'or ' + str(key) + ' = ' + str(1) + ') ' if isinstance(value, str): if not value.strip(): continue