1、项目spring +mybatis +oracle

2、报错信息:

[DEBUG] -- :: org.apache.ibatis.logging.jdbc.BaseJdbcLogger.debug(BaseJdbcLogger.java:): ==>  Preparing: SELECT COUNT(  ) FROM OA_TERMINKALENDERTYPE oat WHERE = OR oat.FCODE = ? OR oat.FVALUE = ?
[ERROR] -- :: com.yunagile.action.AsInterceptor.intercept(AsInterceptor.java:): /bsys/hospoa/selectCodeIsVAction
org.apache.ibatis.binding.BindingException: Parameter 'code' not found. Available parameters are [FVALUE, FCODE, param1, param2]
at org.apache.ibatis.binding.MapperMethod$ParamMap.get(MapperMethod.java:)
at org.apache.ibatis.reflection.wrapper.MapWrapper.get(MapWrapper.java:)
at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:)
at org.apache.ibatis.scripting.defaults.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.parameterize(PreparedStatementHandler.java:)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.parameterize(RoutingStatementHandler.java:)
at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:)
at sun.reflect.GeneratedMethodAccessor75.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:)
at java.lang.reflect.Method.invoke(Method.java:)
at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:)
at com.yunagile.dal.mybatis.plugin.OffsetLimitInterceptor.intercept(OffsetLimitInterceptor.java:)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:)
at com.sun.proxy.$Proxy194.query(Unknown Source)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:)
at sun.reflect.GeneratedMethodAccessor81.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:)
at java.lang.reflect.Method.invoke(Method.java:)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:)
at com.sun.proxy.$Proxy26.selectOne(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:)
at com.sun.proxy.$Proxy140.selectCodeIsV(Unknown Source)
at com.yunagile.oa.terminkalender.bussiness.TerminkalenderTypeService.selectCodeIsV(TerminkalenderTypeService.java:)
at com.yunagile.oa.terminkalender.bussiness.TerminkalenderTypeService$$FastClassByCGLIB$$89d233f1.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:)
at com.yunagile.oa.terminkalender.bussiness.TerminkalenderTypeService$$EnhancerByCGLIB$$6060fd9b.selectCodeIsV(<generated>)
at com.yunagile.oa.terminkalender.actions.TerminkalenderTypeQueryAction.selectCodeIsV(TerminkalenderTypeQueryAction.java:)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:)
at java.lang.reflect.Method.invoke(Method.java:)
at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:)
at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:)
at ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:)
at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodWithDebugInfo(XWorkMethodAccessor.java:)
at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethod(XWorkMethodAccessor.java:)
at ognl.OgnlRuntime.callMethod(OgnlRuntime.java:)
at ognl.ASTMethod.getValueBody(ASTMethod.java:)
at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:)
at ognl.SimpleNode.getValue(SimpleNode.java:)
at ognl.Ognl.getValue(Ognl.java:)
at ognl.Ognl.getValue(Ognl.java:)
at com.opensymphony.xwork2.ognl.OgnlUtil$.execute(OgnlUtil.java:)
at com.opensymphony.xwork2.ognl.OgnlUtil.compileAndExecuteMethod(OgnlUtil.java:)
at com.opensymphony.xwork2.ognl.OgnlUtil.callMethod(OgnlUtil.java:)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:)
at com.yunagile.system.data.InterceptorController.doingTargetOhterQuery(InterceptorController.java:)
at com.yunagile.action.AsInterceptor.intercept(AsInterceptor.java:)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:)
at org.apache.struts2.interceptor.DeprecationInterceptor.intercept(DeprecationInterceptor.java:)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:)
at org.apache.struts2.interceptor.DeprecationInterceptor.intercept(DeprecationInterceptor.java:)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:)
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:)
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:)
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:)
at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:)
at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:)
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:)
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:)
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:)
at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:)
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:)
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:)
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:)
at com.yunagile.system.ext.SessionNeededFilter.executeChain(SessionNeededFilter.java:)
at com.yunagile.system.ext.struts.CoreFilter.doFilterInternal(CoreFilter.java:)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:)
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:)
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:)
at org.apache.shiro.web.servlet.AbstractShiroFilter$.call(AbstractShiroFilter.java:)
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:)
at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:)
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:)
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:)
at org.apache.logging.log4j.core.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:)
at java.lang.Thread.run(Thread.java:)

3、我的代码:

/**
我的map文件*
*/
public interface TerminkalenderTypeMapper extends BaseMapper<TerminkalenderType, String>{ /**
* 查询编码是否存在
* @param code
* @return Integer 返回对应code 所对应的条目
* 加@param("参数名称")
*/
public Integer selectCodeIsV(@Param("FCODE")String code,@Param("FVALUE")String name); }

<!-- sql文件  查询code是否存在 -->
<select id="selectCodeIsV" parameterType="java.lang.String" resultType="java.lang.Integer">
SELECT
COUNT( 1 )
FROM
OA_TERMINKALENDERTYPE oat
WHERE 1=2
<if test="FCODE !=null and FCODE !='' and FCODE !='undefined'">
OR oat.FCODE = #{code}
</if>
<if test="FVALUE !=null and FVALUE !='' and FVALUE !='undefined'">
OR oat.FVALUE = #{name}
</if>
</select>

4、修改sql:

    <!-- 查询code是否存在 -->
<select id="selectCodeIsV" parameterType="java.lang.String" resultType="java.lang.Integer">
SELECT
COUNT( 1 )
FROM
OA_TERMINKALENDERTYPE oat
WHERE 1=2
<if test="FCODE !=null and FCODE !='' and FCODE !='undefined'">
OR oat.FCODE = #{FCODE}
</if>
<if test="FVALUE !=null and FVALUE !='' and FVALUE !='undefined'">
OR oat.FVALUE = #{FVALUE}
</if>
</select>
04-27 01:50