mybatis模糊查询

时间:2023-12-22 08:51:20

  今天遇到一个模糊查询的问题,需求是:根据传入的时间查询当天的所有数据,解决办法是使用$或者contact,具体sql模拟如下:

select * from table_name where create_time like concat(#{createTime},'%');
select * from table_name where create_time like concat('%',#{createTime},'%');
select * from table_name where create_time like "%${createTime}%";
select * from table_name where create_time like "${createTime}%";