From e7680c43ac2116442a6dab06455c0995562d878b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?piexlMax=28=E5=A5=87=E6=B7=BC?= Date: Wed, 21 May 2025 17:41:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A4=84=E7=90=86SQL=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E4=B8=ADIN=E5=92=8CNOT=20IN=E6=93=8D=E4=BD=9C=E7=AC=A6?= =?UTF-8?q?=E7=9A=84=E6=A0=BC=E5=BC=8F=E5=8C=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在生成SQL查询条件时,当操作符为IN或NOT IN时,未正确格式化SQL语句。现已修复此问题,确保生成的SQL语句符合预期格式。 --- server/service/system/sys_export_template.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/service/system/sys_export_template.go b/server/service/system/sys_export_template.go index 869ed11e..eabb7a5a 100644 --- a/server/service/system/sys_export_template.go +++ b/server/service/system/sys_export_template.go @@ -208,6 +208,11 @@ func (sysExportTemplateService *SysExportTemplateService) ExportExcel(templateID for _, condition := range template.Conditions { sql := fmt.Sprintf("%s %s ?", condition.Column, condition.Operator) value := paramsValues.Get(condition.From) + + if condition.Operator == "IN" || condition.Operator == "NOT IN" { + sql = fmt.Sprintf("%s %s (?)", condition.Column, condition.Operator) + } + if value != "" { if condition.Operator == "LIKE" { value = "%" + value + "%"