<select id="texselecttimulist" parameterClass="strsql" resultClass="strsql">
select * form bs_timu_tab
<dynamic prepend="where">
<isNotEmpty prepend="and" property="jiaoshi">
jiaoshihao=#jiaoshi#
</isNotEmpty>
<isNotEqual prepend="and" property="nian" compareValue="0">
nian=#nian#
</isNotEqual>
<isNotEqual prepend="and" property="bei4" compareValue="0">
bei4 like "%"+#bei4#+"%"
</isNotEqual>
<isNotEmpty prepend="and" property="timu">
timu like "%"+#timu#+"%"
</isNotEmpty>
</dynamic>
</select>
这是sql 配置 但是执行后报错
org.springframework.jdbc.BadSqlGrammarException: SqlMapClient operation; bad SQL grammar []; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred while applying a parameter map.
--- Check the texselecttimulist-InlineParameterMap.
--- Check the statement (query failed).
--- Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'form bs_timu_tab where jiaoshi='091201077' and nian='' at line 1
大神门这是为什么谢谢
------解决思路----------------------
<isNotEqual prepend="and" property="nian" compareValue="0">
nian=#nian#
</isNotEqual>
你这个不先判断为空吗?