SELECT * FROM BX_REPORT_FORM t
where 1=1
${
if(len(WORK)=0,"","and substr(t.ACCOUNT_YEAR_MONTH,1,4) = '"+left(WORK,4)+"'")
}
AND ITEM_CODE = 'BX001'
你的 控件名是不是WORK?
${if(len(WORK)=0,"","and substr(t.ACCOUNT_YEAR_MONTH,1,4) = left('"+WORK+"',4)")}