<select id="selectEnrollPlanInfoByPage" resultType="sdibt.group.entity.EnrollPlanInfo">
select * from EnrollPlanInfoList
<where>
<if test="year!=null && year!=''">enrollYear=#{year}</if>
<if test="province!=null && province!=''">and enrollProvince=#{province}</if>
<if test="type!=null && type!=''">and enrollType=#{type}</if>
<if test="major!=null && major!=''">and enrollMajor=#{major}</if>
<!-- <if test="year!=null">enrollYear=2016</if> -->
</where>
limit #{startNum},#{enrollPageNum}
</select>
MyBatis if标签报错
最新推荐文章于 2024-04-24 10:47:03 发布
在使用MyBatis动态SQL时遇到了一个错误,提示'The entity name must immediately follow the '&' in the entity reference.'。经过排查发现,MyBatis的if标签内不支持使用'&'操作符,正确的方式是使用'and'。修正后的代码可以正常运行,避免了该错误。
摘要由CSDN通过智能技术生成