Mybatis根据时间段查询结果一直为空(在确定有数据时还是为空)

Mybatis使用时间段查询一直为空;

原因:

Map<String,Object> map=new  HashMap<String,Object>();
map.put("beginTime",beginTime);
map.put("endTime",endTime);
map.put("staruserId",staruserId);
map.put("pageSize",pageSize);
map.put("pageNum",pageNum);
List<BusinessLog> businessLogList=businessLogMapper.getUserBuyRecordByTime(map);

<select id="getUserBuyRecordByTime" resultType="com.xingyou.common.po.BusinessLog" parameterType="java.util.Map">
  select Top ${pageSize}
  create_date createDate,produce_name produceName,order_number orderNumber,pay_credit payCredit
  from business_log
  where create_date BETWEEN #{beginTime} and #{endTime}


</select>

实现类中map的key值和maper.xml调用的参数名称不一致,由于#{}只是占位符,所以没有对应也不报错,前面一直尝试是不是mybatis不能传字符串类型,将时间参数改成date类型不行,改成时间戳类型(long)还是不行,把#号改成$号就会报错

记在:map中的key一定要和mapper.xml中使用的参数名称一致

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值