select * from tabname where 1=1 ${if(参数名=1," and 字段1='内容1'"," and 字段2='内容2'")}
SQL结构大概这样,视情况自行扩展~
你的SQL语句中 where 都没有~不管sql如何千变万化~至少得保证语法正确呀~
SELECT
*
FROM
[ BMMES_JM ].[ dbo ].[ M_JOB_REPORTWORK ] where 1 = 1
${if(gdxh == "B"," and RpABMaterial = 'B' ",
if(gdxh=="A"," and CHARINDEX('_',RpERPWorkOrder)=0 and RpABMaterial = 'A' ",
if(gdxh=="返花", " and CHARINDEX('_',RpERPWorkOrder)>0 and RpABMaterial = 'A' " ,
" and RpAuditStatus ='1'")))}