使用多个foreach进行遍历查询时,如果采用如下图的写法,不加上<if test=""></if>
进行判断的话,可能会出现后面的foreach的参数值传不进去的问题
报错信息如下:
SELECT DISTINCT d.xh 'xh', a.cardID 'cardID', c.name 'patientName', b.sectionid 'sectionid', b.name 'sectionName', d.news_title 'newsTitle', d.accessory 'accessory' FROM tb_gy_clinic a LEFT JOIN tb_gy_subscribe_card c ON a.cardID = c.cardID LEFT JOIN tb_gy_section b ON a.sectionId = b.sectionid LEFT JOIN tb_health_education d ON b.sectionid = d.sectionid WHERE d.type = ? AND a.cardID IN ( ? , ? , ? ) AND d.sectionid IN
### Cause: com.microsoft.sqlserver.jdbc.SQLServerException: 'IN' 附近有语法错误。
; uncategorized