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>

mybatis传入两个String类型的参数的更多相关文章

  1. 关于ASP.NET中WEBAPI中POST请求中FromBody修饰的string类型的参数服务器端获取不到值FromBody空值的简单解决方法

    其实解决办法很简单,就是POST请求的时候,来自实体的参数,content-type:application/x-www-form-urlencoded情况下,是默认按照键值对来解析的,比如param ...

  2. Switch能否用String类型做参数?

    switch(expr): 其中,expr参数可以是一个枚举常量(由整型或字符类型实现)或一个整数表达式,其中整数表达式可以是基本类型int或其包装类Integer.由于byte.short和char ...

  3. MyBatis String类型传递参数注意事项

    Mybatis查询sql传入一个字符串传参数,报There is no getter for property named 'ids' in 'class java.lang.String'. 后来改 ...

  4. c++实现一个比较两个string类型的版本号的小demo

    在软件实现更新模块的时候,有可能会判断一下服务器上的版本的版本号和本地版本的版本号. 下面有类似这样形式的版本号:string str = "0.0.0.1"; 分析一下可以看出, ...

  5. JNI_Z_07_方法的操作(没有String类型的参数)_参数的传递方式

    1. 2.VC6(CPP)的DLL代码: #include<stdio.h> #include "jniZ_TjniMethod02.h" JNIEXPORT void ...

  6. JNI_Z_06_方法的操作(没有String类型的参数)_父类的同名方法

    1.关键在于: 使用的 method id 是 子类的 还是 父类的,而 父类methodID的获取 必须使用 父类的class对象. 2.VC6(CPP)的DLL代码: #include<st ...

  7. JNI_Z_05_方法的操作(没有String类型的参数)

    1.步骤: (1).获取 jclass (2).获取 method的id (3).调用 method ZC: 貌似 JNI里面 操作 类的方法,完全是 无视 访问权限的... 然而 static的方法 ...

  8. 计算两个String 类型的时间相关几个月

    /** * 返回两个时间段相隔几个月 * @param date1 * @param date2 * @return * @throws ParseException * @throws ParseE ...

  9. 比较两个NSDate类型的参数相差的时间差

    +(NSInteger)getDaysFrom:(NSDate *)serverDate To:(NSDate *)endDate { NSCalendar *gregorian = [[NSCale ...

随机推荐

  1. poj--3187--Backward Digit Sums(dfs)

    Backward Digit Sums Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5667   Accepted: 32 ...

  2. C Looooops(扩展欧几里得+模线性方程)

    http://poj.org/problem?id=2115 题意:给出A,B,C和k(k表示变量是在k位机下的无符号整数),判断循环次数,不能终止输出"FOREVER". 即转化 ...

  3. Drainage Ditches(网络流(EK算法))

    计算最大流,EK算法模板题. #include <stdio.h> #include <string.h> #include <queue> using names ...

  4. 0502 php简单了解

    准备工作: 安装好wamp,配置站点:apache2.4.9\conf\httpd.conf 注意事项: 1.必须有分号 2.不要有无意义空行,会以空格形式输出. 3.变量,关键字(if,for..) ...

  5. DIV+CSS设计时浏览器兼容性

          近期用Div+css做了个企业网站,在浏览器中测试的时候确发现在IE7中显示正常的页面,在ie6中非常混乱,当时第一感觉就想到了兼容问题,可是百思不得其解应该从哪下手,经过一两天的查资料, ...

  6. Asp.net跨域配置

    <system.webServer> <httpProtocol> <customHeaders> <add name="Access-Contro ...

  7. POJ 3264 线段树 ST

    题意:给你一个数列,从中挑一段,问你这段数的最大值减最小值是多少. 思路:线段树. // by Sirius_Ren #include <cstdio> #include <algo ...

  8. MySQL命令学习之技巧(博主推荐)

    关于,这篇博客呢,是

  9. 小白写的一个ASP.NET分页控件,仅供娱乐

    无聊,第一次写博客,自己动手写了一个分页控件.由于我是新手,有很多地方写得不够好,希望各位大牛多多指正.哈哈哈 /// <summary> /// 分页控件 /// </summar ...

  10. python--2、数据类型

    字符串 name='jinyudong' 按索引取值.正向取 与 反向取 name['3'] 'y' name['-3'] 'o' 切片(若要使用倒序指定步长为-1),开始或者结束不指定即为到最边上的 ...