mybatis语句汇总

1、concat,like %的使用
select *
from repayment_order rp
where rp.trans_date like CONCAT(#{transDate},'%' )

#{transDate} 不可加引号
2、foreach,in 的使用

select * from repayment_order rp 
where rp.trans_date in 
    <foreach collection="transDate" item="transDateItem" open="(" close=")" 
     separator="," >
#{transDateItem}
     </foreach> 


map.put("transDate",transDate);

猜你喜欢

转载自caraly.iteye.com/blog/2378574