baomidou / mybatis-plus

An powerful enhanced toolkit of MyBatis for simplify development
https://baomidou.com
Apache License 2.0
16.25k stars 4.29k forks source link

query().one()报错baseMapper can not be null #6265

Closed shanheinfo closed 2 months ago

shanheinfo commented 2 months ago

当前使用版本 3.5.7 当前环境信息 java11 + springboot2.7.6 + 达梦8 描述bug现象 baseMapper can not be null 提供问题复现步骤 在一个实现类中,创建另外一个实现类,使用他的任何查询方法,都会报出 baseMapper can not be null 如: XXPlatformCodeService xxPlatformCodeServices = new XXPlatformCodeServiceImpl(); XXPlatformCode platform_code = xxPlatformCodeServices.selectPlatformCode(platformCode);

(同): XXPlatformCodeService xxPlatformCodeServices = new XXPlatformCodeServiceImpl(); XXbsterPlatformCode platform_code = xxPlatformCodeServices.query().eq("platform_code", platformCode).one(); 提供完整堆栈日志(可选) com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: baseMapper can not be null at com.baomidou.mybatisplus.core.toolkit.ExceptionUtils.mpe(ExceptionUtils.java:49) at com.baomidou.mybatisplus.core.toolkit.Assert.isTrue(Assert.java:38) at com.baomidou.mybatisplus.core.toolkit.Assert.notNull(Assert.java:72) at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.getBaseMapper(ServiceImpl.java:62) at com.baomidou.mybatisplus.extension.service.IService.query(IService.java:596) 提供问题复现工程(可选) 请尽量提供复现工程,减少大家排错的时间.

totoro52 commented 2 months ago

这不废话吗,你手动创建的对象又没被代理过,怎么可能会有这些东西