nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘email‘ not found. Availab

在写筛选查询时,参数为对象,显示此参数找不到,报这个错误,几经研究查询

ERROR o.jeecg.common.exception.JeecgBootExceptionHandler:79 - nested exception is org.apache.ibatis.binding.BindingException: Parameter 'email' not found. Available parameters are [pageNo, pageSize, param3, user, userId, param4, param1, param2]
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'email' not found. Available parameters are [pageNo, pageSize, param3, user, userId, param4, param1, param2]
	at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:96)
	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
	at com.sun.proxy.$Proxy134.selectList(Unknown Source)

xml文件是这样子写的,是因为没有取到值,传的是对象应为对象.字段

<if test="email!=null and      email!=''">
                    AND u.email like concat("%",#{email},"%")
                </if>
                <if test="phone!=null and      phone!=''">
                    AND u.phone =like  concat("%",#{phone},"%")
                </if>

改成这样子就可以了:

<if test="user.email!=null and   user.email!=''">
                    AND u.email like concat("%",#{user.email},"%")
                </if>
                <if test="user.phone!=null and user.phone!=''">
                    AND u.phone =like  concat("%",#{user.phone},"%")
                </if>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值