全字段修改/动态修改
根据id修改品牌信息(修改全部字段)
<update id="updateBrand">
update tb_brand
set brand_name =
#{brandName},company_name=#{companyName},ordered=#{ordered},description=#{description},status=#{status}
where id=#{id}
</update>
//3.使用接口代理对象调用方法完成增删改查的操作,获取结果
====int result = brandMapper.updateBrand(brand);
根据id修改品牌信息(动态字段修改: 值修改传递的不为null值的字段)
<update id="updateBrand2">
update tb_brand
<set>
<if test="brandName !=null and brandName != ''">
brand_name = #{brandName},
</if>
<if test="companyName !=null and companyName != ''">
company_name=#{companyName},
</if>
<if test="ordered != null">
ordered=#{ordered},
</if>
<if test="description !=null and description != ''">
description=#{description},
</if>
<if test="status != null">
status=#{status}
</if>
</set>
where id=#{id}
</update>