ResultMap 配置,报错;
SQL: select * from orders where WHERE name like '%粉%'
更改过后,再次运行;
对应的数据库中的table为;(把含有‘粉 ’ 的name列的数据全都取出来了’)
附上resultMap 配置;
<select id="findOrdersByNameAndPrice" parameterType="orders" resultMap="ordersMap">
select * from orders
<where>
<if test="name!=null and name!=''">
and name like '%${name}%'
</if>
<if test="price!=null and price!=''">
and price=#{price}
</if>
</where>
</select>
<!-- /*column+属性名*/-->
<resultMap id="ordersMap" type="orders">
<id property="id" column="id"/><!--主键-->
<result property="name" column="name"/>
<result property="price" column="price"/>
</resultMap>