mybatis xxmapper.xml 报错 Mapped Statements collection does not contain value for

1 篇文章 0 订阅
PhoneLocationMapper.xml 文件内容:
其中namespace 必须为PhoneLocationMapper接口的完整类名,否则会报后面错误!
<?xml version="1.0" encoding="UTF-8" ?>  
  
<!DOCTYPE mapper PUBLIC   
    "-//mybatis.org//DTD Mapper 3.0//EN"  
    "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.boying.mapper.PhoneLocationMapper">
	<resultMap id="phoneLocation" type="com.boying.entity.PhoneLocation">
        <id     column="ID"        property="id"        javaType="java.lang.String" jdbcType="VARCHAR" />
        <result column="PHONE_ID"  property="phoneId"   javaType="java.lang.String" jdbcType="VARCHAR" />
        <result column="LONGITUDE" property="longitude" javaType="java.lang.String" jdbcType="VARCHAR" />
        <result column="LATITUDE"  property="latitude"  javaType="java.lang.String" jdbcType="VARCHAR" />
        <result column="USER_ID"   property="userId"    javaType="java.lang.String" jdbcType="VARCHAR" />
        <result column="KEEP_TIME" property="keepTime"  javaType="java.util.Date" jdbcType="VARCHAR" />
    </resultMap>
    <select id="findByUserId" parameterType="com.boying.entity.PhoneLocation" resultMap="phoneLocation" >
    	 <![CDATA[
	     	SELECT * FROM ${tableName} WHERE USER_ID = #{userId} ORDER BY KEEP_TIME DESC
	     ]]>
    </select>
</mapper>

错误内容如下:
java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.boying.mapper.PhoneLocationMapper.findByUserId
	at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:672)
	at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:507)
	at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:500)
	at org.apache.ibatis.binding.MapperMethod.setupCommandType(MapperMethod.java:240)
	at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:71)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:39)
	at $Proxy21.findByUserId(Unknown Source)
	at com.boying.service.impl.PhoneLocationServiceImpl.findByUserId(PhoneLocationServiceImpl.java:34)
	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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
	at $Proxy22.findByUserId(Unknown Source)
	at com.boying.controller.position.PositionController.findByUserId(PositionController.java:39)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值