mybatis There is no getter for property named 'xx' in 'class java.lang.String
用mybatis查询时,传入一个字符串传参数,且进行判断时,会报
There is no getter for property named 'projectId' in 'class java.lang.String
错误写法:
<select id="queryAll" parameterType="String" resultType="ComDTO">
select
userId,openid,wxName,wxImg,name,sex,age,telNum,checkCode,playNum,otherNum,
user.projectId projectId,projectName,projectSimName,projectNum,user.createTime createTime
from com_user user, com_project project
<where>
user.projectId = project.projectId
<if test="projectId != null and projectId !=''">
and user.projectId=#{projectId}
</if>
</where>
order by userId desc
</select>
需要修改成:
<select id="queryAll" parameterType="String" resultType="ComDTO">
select
userId,openid,wxName,wxImg,name,sex,age,telNum,checkCode,playNum,otherNum,
user.projectId projectId,projectName,projectSimName,projectNum,user.createTime createTime
from com_user user, com_project project
<where>
user.projectId = project.projectId
<if test="_parameter != null and _parameter !=''">
and user.projectId=#{_parameter}
</if>
</where>
order by userId desc
</select>
不管你的参数是什么,都要改成"_parameter"
What a meaningless sense if losing myself,though owning all of the world.