首先看一下错误在哪里,然后分析错误。
我被这个困了一下午,睡了个觉又重新打了一遍代码,发现了问题所在,不废话,直接上图。
平时写代码,“=”后面可以直接写代码或者写你想写的东西,但是这个不行,需要加个空格才能写你要写的东西。
<select id="selectByCondition" resultMap="brandResultMap">
select *
from tb_brand
where
<if test="status != null">
status = #{status}
</if>
<if test="companyName != null and companyName != ''">
and company_name like #{companyName}
</if>
<if test="brandName != null and brandName != ''">
and brand_name like #{brandName}
</if>
</select>