• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

mybatis-plus异常, org.apache.ibatis.builder.BuilderException: Error evaluating expression AND

武飞扬头像
yanweijie0317
帮助1

原来正常的接口,今天调用的时候又异常了。

异常信息:nested exception is org.apache.ibatis.builder.BuilderException: Error evaluating expression 'null!=name AND name != '''. Cause: org.apache.ibatis.ognl.ExpressionSyntaxException: Malformed OGNL expression: null!=name AND name != '' [org.apache.ibatis.ognl.ParseException: Encountered \" <IDENT> \"AND \"\" at line 1, column 12.\r\nWas expecting one of:\r\n    <EOF> \r\n    \",\" ...\r\n    \"=\" ...\r\n    \"?\" ...\r\n    \"||\" ...\r\n    \"or\" ...\r\n    \"&&\" ...\r\n    \"and\" ...\r\n    \"|\" ...\r\n    \"bor\" ...\r\n    \"^\" ...\r\n    \"xor\" ...\r\n    \"&\" ...\r\n    \"band\" ...\r\n    \"==\" ...\r\n    \"eq\" ...\r\n    \"!=\" ...\r\n    \"neq\" ...\r\n    \"<\" ...\r\n    \"lt\" ...\r\n    \">\" ...\r\n    \"gt\" ...\r\n    \"<=\" ...\r\n    \"lte\" ...\r\n    \">=\" ...\r\n    \"gte\" ...\r\n    \"in\" ...\r\n    \"not\" ...\r\n    \"<<\" ...\r\n    \"shl\" ...\r\n    \">>\" ...\r\n    \"shr\" ...\r\n    \">>>\" ...\r\n    \"ushr\" ...\r\n    \" \" ...\r\n    \"-\" ...\r\n    \"*\" ...\r\n    \"/\" ...\r\n    \"%\" ...\r\n    \"instanceof\" ...\r\n    \".\" ...\r\n    \"(\" ...\r\n    \"[\" ...\r\n    <DYNAMIC_SUBSCRIPT> ...\r\n    \"(\" ...\r\n    ]"

错误原因:

  1.  
    @Select({"<script>","SELECT * FROM lbs_device WHERE deleted = 0 AND app_id = #{appId} "
  2.  
    "<if test=\"null!=name and name != ''\"> AND name=#{name}</if>"
  3.  
    "<if test=\"null!=imei and imei != ''\"> AND imei=#{imei}</if>"
  4.  
    "<if test=\"null!=enterpriseId and enterpriseId != -2\"> AND tenant_id=#{enterpriseId}</if>","</script>"})
  5.  
    List<DeviceEntity> queryPageList(@Param("name")String name , @Param("imei") String imei, @Param("appId") Long appId , @Param("enterpriseId") Long enterpriseId);

这个<if>判断的test条件不能使用AND,只能使用and

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhiefick
系列文章
更多 icon
同类精品
更多 icon
继续加载