关于Mapper文件中日期比较

对于同一天内不能用>=或者<=查出同一天的数据
可以使用to_number函数和to_char来实现完成
sql写法:

to_number(to_char(sysdate,'yyyyMMdd')) >= 20180102(类似的时间格式数据)

Mapper中写法

to_number(to_char(“时间字段”,'yyyyMMdd')) >= to_number(to_char(#{日期参数},'yyyyMMdd'))

猜你喜欢

转载自blog.csdn.net/weixin_39885753/article/details/86522776