MyBatis查询传一个参数时报错:There is no getter for property named 'sleevetype' in 'class java.lang.Integer
用MyBatis进行查询,传入参数只有一个时(非Map)如int,报错
There is no getter for property named 'sleevetype' in 'class java.lang.Integer
解决方法一:
原因在于测试条件写法有误,
<if test="sleevetype==0"><!-- 专属 -->
exclusive=1
</if>
<if test="sleevetype!=0"><!-- 非专属 -->
sleeve_type=#{sleevetype} and exclusive=0
</if>
正确写法:
<if test="_parameter==0"><!-- 专属 -->
exclusive=1
</if>
<if test="_parameter!=0"><!-- 非专属 -->
sleeve_type=#{sleevetype} and exclusive=0
</if>
不管传的参数是什么,都要改成"_parameter" 。
解决方法二:
是在DAO接口声明部分在形参前加上 @Param("sleevetype")
实际上,当DAO接口有多个参数时,需要使用@Param,或者用Map,或者对象。
MyBatis查询传一个参数时报错:There is no getter for property named 'sleevetype' in 'class java.lang.Integer的更多相关文章
- Mybatis找不到参数错误:There is no getter for property named 'categoryId' in 'class java.lang.Integer'。
Mybatis找不到参数错误:There is no getter for property named 'categoryId' in 'class java.lang.Integer'. 错误Li ...
- MyBatis if test 传入一个数字进行比较报错 There is no getter for property named 'userState' in 'class java.lang.Integer'
在写MyBatis映射文件中,我要传入一个 int 类型的参数,在映射文件中用 'test' 中进行比较,我花了很长时间百度,发现都是不靠谱的方法,有把数字在比较时转成字符串用 equals 比较的. ...
- mybatis之org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'time' in 'class java.lang.String'
mybatis接口 List<String> getUsedCate(String time); 配置文件 <select id="getUsedCate" pa ...
- Bug--Mybatis报错:There is no getter for property named 'id' in 'class java.lang.Integer'
Mybatis 添加@Param("")注释就可以了
- Mybatis中传参包There is no getter for property named 'XXX' in 'class java.lang.String'
Mybatis中传参包There is no getter for property named 'XXX' in 'class java.lang.String' 一.发现问题 <select ...
- SSM框架报错分析(一)——There is no getter for property named 'XXX' in 'class java.lang.String'
一.发现问题 <select id="queryStudentByNum" resultType="student" parameterType=&quo ...
- 【Mybatis】mybatis查询报错org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'areaName' in 'class java.lang.String'
mybatis查询报错: Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for pro ...
- 已解决: mybatis报错 org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'xxx' in 'class java.lang.String'
最近在练习MyBatis时 进行姓名的模糊查询时候出现 org.apache.ibatis.exceptions.PersistenceException: ### Error querying da ...
- 当传入数据只有一个时mybatis中<if>判断会出现There is no getter for property named 'subjectId' in 'class java.lang.Intege
用"_parameter"代替当前参数 正确: <select id="selectSubjectByPId" parameterType="j ...
随机推荐
- sql语句or与union all的执行效率比较
看到一篇文章是讲sql语句or与union all的执行效率比较的,以前没怎么注意这个问题,感觉文章写的不错,转来一看. 文章原链接:http://www.cunyoulu.com/zhuanti/q ...
- ubuntu上怎么设置默认python命令是执行python3而不是python2
来源:https://segmentfault.com/q/1010000003713912 alternatives这么好的机制用起来呀. shell里执行: sudo update-alterna ...
- iOS从App跳转至系统设置菜单各功能项的编写方法讲解
跳到系统设置里的WiFi界面 info里面设置: 在项目中的info.plist中添加 URL types 并设置一项URL Schemes为prefs,如下图 代码: 复制代码 代码如下: NSUR ...
- IOS开发之——Masonry 只支持OC,暂不支持swift
前言 1 MagicNumber -> autoresizingMask -> autolayout 以上是纯手写代码所经历的关于页面布局的三个时期 在iphone1-iphone3gs时 ...
- 倒戈了,转投简书 -------->
深情自白 还记得数月前那个月黑风高的晚上,笔主偶遇简书,被那婀娜多姿的Markdown输出深深吸引不能自拔,从此立下毒誓要两边同时发布.然而天有不测风云(这边的太丑),前思后想寝食难安之后作出决定,正 ...
- Asp.Net的两种开发方式
来源:http://www.zhidao91.com/asp-net/ 在经过对.Net平台深入的学习以后,我发现很多语言开发动态网站时,它的后台逻辑都差不多是相同的,今天在这里我给大家来聊聊在.Ne ...
- 对于RegExp反向引用的一点理解
置顶文章:<纯CSS打造银色MacBook Air(完整版)> 上一篇:<关于js的Array.prototype.slice.call> 作者主页:myvin 博主QQ:85 ...
- PM2实用入门指南
简介 PM2是node进程管理工具,可以利用它来简化很多node应用管理的繁琐任务,如性能监控.自动重启.负载均衡等,而且使用非常简单. 下面就对PM2进行入门性的介绍,基本涵盖了PM2的常用的功能和 ...
- node判断文件目录是否存在
'use strict'; //这是一个简单的应用 var path = require('path'); var fs = require("fs") ; global.l = ...
- css中的伪类和伪元素
伪类用单冒号 我们平时熟悉的a:link.a:visited.a:hover和a : active 伪元素用双冒号(为了更好的兼容我们也用单冒号) 常用的:before :after和 :fir ...