Mybatis的xml中,模糊查询like在MySQL和SQLServer中的语法不同,注意!!!’
1.MySQL的语法
<select id="listSkuPrice" resultMap="walmartSkuMap">
select sku,
price,
create_date,
create_by,
last_update_date,
last_update_by
from twalmart_sku_price
where 1=1 and sku like concat('%',#{name},'%')
</select>
2.SQLServer的语法
select id="listSkuPrice" resultMap="walmartSkuMap">
select w.sku, w.price, u.user_name createBy,w.create_date,last_update_date ,us.user_name lastUpdateBy
from twalmart_sku_price w
left join M_user u on w.create_by=u.userId
left join M_user us on w.last_update_by=us.userId
where 1=1 and sku like '%'+#{name}+'%'
</select>