MARVEI 2021-11-16 11:31 采纳率: 83.3%
浏览 116
已结题

mapper.xml里面定义了与对应mapper中的方法,但是映射找不到此类

报错信息如下

2021-11-16 10:38:22.982 ERROR 4880 --- [nio-8081-exec-5] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.wang.server.mapper.MenuMapper.getMenusByAdminid] with root cause

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.wang.server.mapper.MenuMapper.getMenusByAdminid
    at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:235) ~[mybatis-3.5.3.jar:3.5.3]
    at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.<init>(MybatisMapperMethod.java:50) ~[mybatis-plus-core-3.3.1.tmp.jar:3.3.1.tmp]
    at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.lambda$cachedMapperMethod$0(MybatisMapperProxy.java:101) ~[mybatis-plus-core-3.3.1.tmp.jar:3.3.1.tmp]
    at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660) ~[na:1.8.0_181]
    at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.cachedMapperMethod(MybatisMapperProxy.java:100) ~[mybatis-plus-core-3.3.1.tmp.jar:3.3.1.tmp]
    at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:95) ~[mybatis-plus-core-3.3.1.tmp.jar:3.3.1.tmp]
    at com.sun.proxy.$Proxy84.getMenusByAdminid(Unknown Source) ~[na:na]
    at com.wang.server.service.impl.MenuServiceImpl.getMenusByAdminid(MenuServiceImpl.java:34) ~[classes/:na]
    at com.wang.server.service.impl.MenuServiceImpl$$FastClassBySpringCGLIB$$baae436e.invoke(<generated>) ~[classes/:na]
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.3.12.jar:5.3.12]
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689) ~[spring-aop-5.3.12.jar:5.3.12]
    at com.wang.server.service.impl.MenuServiceImpl$$EnhancerBySpringCGLIB$$40f11160.getMenusByAdminid(<generated>) ~[classes/:na]
    at com.wang.server.controller.MenuController.getMenusByAdminID(MenuController.java:31) ~[classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_181]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_181]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_181]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_181]
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-5.3.12.jar:5.3.12]
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150) ~[spring-web-5.3.12.jar:5.3.12]
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) ~[spring-webmvc-5.3.12.jar:5.3.12]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) ~[spring-webmvc-5.3.12.jar:5.3.12]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.12.jar:5.3.12]
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.12.jar:5.3.12]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067) ~[spring-webmvc-5.3.12.jar:5.3.12]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963) ~[spring-webmvc-5.3.12.jar:5.3.12]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.12.jar:5.3.12]
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.12.jar:5.3.12]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:655) ~[tomcat-embed-core-9.0.54.jar:4.0.FR]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.12.jar:5.3.12]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) ~[tomcat-embed-core-9.0.54.jar:4.0.FR]

mapper中的定义


public interface MenuMapper extends BaseMapper<Menu> {

    /**
     * 根据用户Id 查询用户列表
     * @param id
     * @return
     */
    List<Menu> getMenusByAdminid(Integer id);
}

mapper.xml

<!--根据用户id查询菜单列表-->
    <select id="getMenusByAdminid" resultMap="Menus" >
    SELECT DISTINCT
    m1.*,
    m2.id AS id2,
    m2.url AS url2,
    m2.component AS component2,
    m2.`name` AS name2,
    m2.iconCls As iconCls2,
    m2.keepAlive AS keepAlive2,
    m2.requireAuth AS requireAuth2,
    m2.parentId AS parentId2,
    m2.enabled AS enabled2
    FROM
    t_menu m1, t_menu m2,t_admin_role ar,t_menu_role mr WHERE m1.id = m2.parentId
    AND
    m2.id = mr.mid
    AND
    mr.rid = ar.rid
    AND
    ar.adminId = #{id}
    AND m2.enabled = TRUE
    </select>

请问这要做怎么解决呀

  • 写回答

3条回答 默认 最新

  • 三千烦恼丝xzh 2021-11-16 12:22
    关注

    盲猜XML指定的Mapper类写错了

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

问题事件

  • 系统已结题 12月13日
  • 已采纳回答 12月5日
  • 创建了问题 11月16日

悬赏问题

  • ¥15 用twincat控制!
  • ¥15 请问一下这个运行结果是怎么来的
  • ¥15 单通道放大电路的工作原理
  • ¥30 YOLO检测微调结果p为1
  • ¥20 求快手直播间榜单匿名采集ID用户名简单能学会的
  • ¥15 DS18B20内部ADC模数转换器
  • ¥15 做个有关计算的小程序
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决