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