shuos_yan 2019-12-20 15:40 采纳率: 0%
浏览 1225

mybatis-plus not found selectByid

各位大佬,我今天在搞mybatis plus的时候使用本身的selectById方法,报错如下:

Servlet.service() for servlet [dispatcherServlet] in context with path [/server] threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.yss.cn.modules.mapper.TBaseAuthMapper.selectById] with root cause

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.yss.cn.modules.mapper.TBaseAuthMapper.selectById

在网上百度了一下:有的说的需要加@TableId 注解,加了但是不行,各个代码如下:

serviceImpl:

@Autowired
    private TBaseAuthMapper tBaseAuthMapper;

 @Override
    public TBaseAuthResult findTBaseAuthResultById(Integer id){
        return BeanUtil.cast(tBaseAuthMapper.selectById(id), TBaseAuthResult.class);
    }

mapper:


public interface TBaseAuthMapper extends BaseMapper<TBaseAuth> {

}

TBaseAuth:

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_base_auth")
public class TBaseAuth implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 序号
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    ...
}

哪位大佬帮忙解决一下,万分感谢!!!

  • 写回答

1条回答

  • 张洪財 2019-12-20 16:32
    关注

    连接的数据库对吗? 是不是没 有找到t_base_auth 这个表。 你的表是否有前缀?

    评论

报告相同问题?

悬赏问题

  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试