配置sql如下:
select id="queryFathernodeResource" parameterType="java.lang.String"
resultType="SysFathernodeResourceModel">
SELECT t.soleid soleId,
t.fathernodename fathernodeName,
t.column_3 column_3,
TO_CHAR(t.createtime,'yyyy-mm-dd hh24:mi:ss')createTime
FROM
t_sys_fathernode_resource t
WHERE 1=1
<if test="roleId!=null and roleId!=''">
AND EXISTS(SELECT t1.resourceid FROM t_sys_role_resource
t1 WHERE
t.soleid=t1.resourceid AND
t1.roleid=#{roleId})
</if>
</select>
dao方法:
public List<SysFathernodeResourceModel> queryFathernodeResource(
String roleId) throws DaoException {
List<SysFathernodeResourceModel> result = null;
try {
result = this.getSqlSession().selectList(
"sysRole.queryFathernodeResource",roleId);
} catch (Exception e) {
throw new DaoException(e);
}
return result;
}
结论:
把if判断标签去掉就可以了,标签是针对JAVABEAN或者MAP的,String不能用标签
详细错误日志:
[PF_ManagerWeb] 2012-08-14 15:02:31 com.ideal.spdb.utils.LogAspect@(LogAspect.java:86)
INFO :调用异常通知!
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'status' in 'class java.lang.String'
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:346)
at $Proxy14.selectList(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:189)
at com.ideal.spdb.application.dao.impl.IApplicationMgrDaoImpl.getNeedTransferApplictionList(IApplicationMgrDaoImpl.java:40)
at com.ideal.spdb.application.dao.impl.IApplicationMgrDaoImpl$$FastClassByCGLIB$$24e42888.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:692)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:50)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:55)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:625)
at com.ideal.spdb.application.dao.impl.IApplicationMgrDaoImpl$$EnhancerByCGLIB$$4b88eab8.getNeedTransferApplictionList(<generated>)
at com.ideal.spdb.test.ApplicationTest.testApplication(ApplicationTest.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'status' in 'class java.lang.String'
at org.apache.ibatis.reflection.Reflector.getGetInvoker(Reflector.java:308)
at org.apache.ibatis.reflection.MetaClass.getGetInvoker(MetaClass.java:93)
at org.apache.ibatis.reflection.wrapper.BeanWrapper.getBeanProperty(BeanWrapper.java:131)
at org.apache.ibatis.reflection.wrapper.BeanWrapper.get(BeanWrapper.java:27)
at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:103)
at org.apache.ibatis.builder.xml.dynamic.DynamicContext$ContextMap.get(DynamicContext.java:70)
at org.apache.ibatis.builder.xml.dynamic.DynamicContext$ContextAccessor.getProperty(DynamicContext.java:88)
at org.apache.ibatis.ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1529)
at org.apache.ibatis.ognl.ASTProperty.getValueBody(ASTProperty.java:84)
at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:175)
at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:213)
at org.apache.ibatis.ognl.ASTNotEq.getValueBody(ASTNotEq.java:47)
at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:175)
at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:213)
at org.apache.ibatis.ognl.ASTAnd.getValueBody(ASTAnd.java:54)
at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:175)
at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:213)
at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:314)
at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:394)
at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:435)
at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:414)
at org.apache.ibatis.builder.xml.dynamic.ExpressionEvaluator.evaluateBoolean(ExpressionEvaluator.java:17)
at org.apache.ibatis.builder.xml.dynamic.IfSqlNode.apply(IfSqlNode.java:15)
at org.apache.ibatis.builder.xml.dynamic.MixedSqlNode.apply(MixedSqlNode.java:14)
at org.apache.ibatis.builder.xml.dynamic.DynamicSqlSource.getBoundSql(DynamicSqlSource.java:22)
at org.apache.ibatis.mapping.MappedStatement.getBoundSql(MappedStatement.java:198)
at org.apache.ibatis.executor.BaseExecutor.createCacheKey(BaseExecutor.java:115)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:90)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:72)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:75)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:338)
... 34 more
分享到:
相关推荐
今天小编就为大家分享一篇关于Mybatis单个参数的if判断报异常There is no getter for property named 'xxx' in 'class java.lang.Integer'的解决方案,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,...
主要介绍了使用Mybatis遇到的there is no getter异常,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
解决Mybatis 分页插件pagehelper不支持逆向工程Example条件查询.含源码和jar包
主要给大家介绍了mybatis中foreach报错:_frch_item_0 not found的解决方法,文章通过示例代码介绍了详细的解决方法,对大家具有一定的参考学习价值,需要的朋友们下面来一起看看吧。
常问问题1,出现了如下BUG org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'statement' in 'class ...
mybatis数据类型错误及解决方法
mybatis 报空值异常及其解决办法
mybatis乱码的解决方法 gbk iso-8859-1 ibatis3乱码
free-idea-mybatis is an enchange plugin for idea to supoort mybatis,here is the main functions: generate mapper xml files navigate from the code to mapper and from the mapper back to code auto code...
MyBatis整合中项目出现406错误解决方法
已修改 注释添加 生成路径不存在报异常
主要介绍了mybatis连接MySQL8出现的问题解决方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
解决mybatis头文件报错 下载好压缩包 解压将文件放到本地文件夹 例如 D盘的哪个文件夹 D:\mybatis\ ;然后打开eclipse ->Window->prefenrence->XML->XML Catalog->User Specifiled Entreis->Add->Location(此处是你...
1、这是Eclipse MyBatis generator 1.3.7插件的核心包 2、首先到Eclipse中下载 MyBatis Generator 1.3.7插件,下载完按步骤进行安装 打开Help > Eclipse Marketplace > Search > 输入框输入 MyBatis Generator ...
myeclipse10的mybatis generator的在线安装总是失败, 最终发现了安装方法,附件里有说明
主要介绍了引入mybatis-plus报 Invalid bound statement错误问题的解决方法,需要的朋友可以参考下
MyBatis generator is available as an Eclipse plugin and includes the extra capability of merging generated Java files as... Documentation for MyBatis generator is integrated into the Eclipse help system.
MybatisX-idea.0.1.0.jar 原版
generator, A code generator for MyBatis and iBATIS.
mybatis一对多的查询方法详解! mybatis一对多的查询方法详解! mybatis一对多的查询方法详解! mybatis一对多的查询方法详解!