baomidou / mybatis-plus

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

kotlin lambdaQuery问题异常 #6193

Closed hoscent closed 3 months ago

hoscent commented 5 months ago

当前使用版本 3.5.5 当前环境信息 例如: Java8 + Mysql5.7 Java 17 + Mysql8.0,使用kotlin进行编写 描述bug现象 使用lambda进行查询,会将所在方法的方法名当作实体类的一部分,抛出can not find lambda cache for this property [xx$lambda$0] of entity [xx],我尝试修改方法名,确定了这个bug来源 异常截图 提供问题复现步骤 1.配置MybatisPlusConfig,开启MapperScan 2.编写Dao层 3.编写Serviece层接口,继承IServiece 4..编写ServieceImpl,继承ServiceImpl和Service层接口 提供完整堆栈日志(可选) com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: can not find lambda cache for this property [postList$lambda$0] of entity [...xxx.Post] at com.baomidou.mybatisplus.core.toolkit.ExceptionUtils.mpe(ExceptionUtils.java:49) ~[mybatis-plus-core-3.5.5.jar:3.5.5] at com.baomidou.mybatisplus.core.toolkit.Assert.isTrue(Assert.java:38) ~[mybatis-plus-core-3.5.5.jar:3.5.5] at com.baomidou.mybatisplus.core.toolkit.Assert.notNull(Assert.java:72) ~[mybatis-plus-core-3.5.5.jar:3.5.5] at com.baomidou.mybatisplus.core.conditions.AbstractLambdaWrapper.getColumnCache(AbstractLambdaWrapper.java:149) ~[mybatis-plus-core-3.5.5.jar:3.5.5] at com.baomidou.mybatisplus.core.conditions.AbstractLambdaWrapper.getColumnCache(AbstractLambdaWrapper.java:132) ~[mybatis-plus-core-3.5.5.jar:3.5.5] at com.baomidou.mybatisplus.core.conditions.AbstractLambdaWrapper.columnToString(AbstractLambdaWrapper.java:66) ~[mybatis-plus-core-3.5.5.jar:3.5.5] at com.baomidou.mybatisplus.core.conditions.AbstractLambdaWrapper.columnToString(AbstractLambdaWrapper.java:62) ~[mybatis-plus-core-3.5.5.jar:3.5.5] at com.baomidou.mybatisplus.core.conditions.AbstractLambdaWrapper.columnToString(AbstractLambdaWrapper.java:39) ~[mybatis-plus-core-3.5.5.jar:3.5.5] at com.baomidou.mybatisplus.core.conditions.AbstractWrapper.lambda$columnToSqlSegment$638936d7$1(AbstractWrapper.java:666) ~[mybatis-plus-core-3.5.5.jar:3.5.5] at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[na:na] at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) ~[na:na] at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[na:na] at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[na:na] at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) ~[na:na] at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na] at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[na:na] at com.baomidou.mybatisplus.core.conditions.segments.NormalSegmentList.childrenSqlSegment(NormalSegmentList.java:88) ~[mybatis-plus-core-3.5.5.jar:3.5.5] at com.baomidou.mybatisplus.core.conditions.segments.AbstractISegmentList.getSqlSegment(AbstractISegmentList.java:102) ~[mybatis-plus-core-3.5.5.jar:3.5.5] at com.baomidou.mybatisplus.core.conditions.segments.MergeSegments.getSqlSegment(MergeSegments.java:71) ~[mybatis-plus-core-3.5.5.jar:3.5.5] at com.baomidou.mybatisplus.core.conditions.AbstractWrapper.getSqlSegment(AbstractWrapper.java:619) ~[mybatis-plus-core-3.5.5.jar:3.5.5] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na] at org.apache.ibatis.ognl.OgnlRuntime.invokeMethodInsideSandbox(OgnlRuntime.java:882) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:867) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.ognl.OgnlRuntime.getMethodValue(OgnlRuntime.java:1712) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.ognl.ObjectPropertyAccessor.getPossibleProperty(ObjectPropertyAccessor.java:47) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.ognl.ObjectPropertyAccessor.getProperty(ObjectPropertyAccessor.java:110) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.ognl.OgnlRuntime.getProperty(OgnlRuntime.java:2341) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.ognl.ASTProperty.getValueBody(ASTProperty.java:95) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:171) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:206) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.ognl.ASTChain.getValueBody(ASTChain.java:128) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:171) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:206) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.ognl.ASTNotEq.getValueBody(ASTNotEq.java:34) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:171) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:206) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.ognl.ASTAnd.getValueBody(ASTAnd.java:45) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:171) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:206) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:408) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:383) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.scripting.xmltags.OgnlCache.getValue(OgnlCache.java:47) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.scripting.xmltags.VarDeclSqlNode.apply(VarDeclSqlNode.java:33) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.scripting.xmltags.MixedSqlNode.lambda$apply$0(MixedSqlNode.java:32) ~[mybatis-3.5.15.jar:3.5.15] at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) ~[na:na] at org.apache.ibatis.scripting.xmltags.MixedSqlNode.apply(MixedSqlNode.java:32) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.scripting.xmltags.IfSqlNode.apply(IfSqlNode.java:35) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.scripting.xmltags.MixedSqlNode.lambda$apply$0(MixedSqlNode.java:32) ~[mybatis-3.5.15.jar:3.5.15] at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) ~[na:na] at org.apache.ibatis.scripting.xmltags.MixedSqlNode.apply(MixedSqlNode.java:32) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.scripting.xmltags.DynamicSqlSource.getBoundSql(DynamicSqlSource.java:39) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.mapping.MappedStatement.getBoundSql(MappedStatement.java:320) ~[mybatis-3.5.15.jar:3.5.15] at com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor.intercept(MybatisPlusInterceptor.java:69) ~[mybatis-plus-extension-3.5.5.jar:3.5.5] at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:59) ~[mybatis-3.5.15.jar:3.5.15] at jdk.proxy2/jdk.proxy2.$Proxy111.query(Unknown Source) ~[na:na] at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:154) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147) ~[mybatis-3.5.15.jar:3.5.15] at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:142) ~[mybatis-3.5.15.jar:3.5.15] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na] at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:425) ~[mybatis-spring-2.1.2.jar:2.1.2] at jdk.proxy2/jdk.proxy2.$Proxy82.selectList(Unknown Source) ~[na:na] at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:224) ~[mybatis-spring-2.1.2.jar:2.1.2] at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.executeForMany(MybatisMapperMethod.java:164) ~[mybatis-plus-core-3.5.5.jar:3.5.5] at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:77) ~[mybatis-plus-core-3.5.5.jar:3.5.5] at com.baomidou.mybatisplus.core.override.MybatisMapperProxy$PlainMethodInvoker.invoke(MybatisMapperProxy.java:152) ~[mybatis-plus-core-3.5.5.jar:3.5.5] at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:89) ~[mybatis-plus-core-3.5.5.jar:3.5.5] at jdk.proxy2/jdk.proxy2.$Proxy98.selectList(Unknown Source) ~[na:na] at com.baomidou.mybatisplus.core.mapper.BaseMapper.selectPage(BaseMapper.java:348) ~[mybatis-plus-core-3.5.5.jar:3.5.5] at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732) ~[na:na] at com.baomidou.mybatisplus.core.override.MybatisMapperProxy$DefaultMethodInvoker.invoke(MybatisMapperProxy.java:166) ~[mybatis-plus-core-3.5.5.jar:3.5.5] at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:89) ~[mybatis-plus-core-3.5.5.jar:3.5.5] at jdk.proxy2/jdk.proxy2.$Proxy98.selectPage(Unknown Source) ~[na:na] at com.hoscent.smile.service.impl.IPostServiceImpl.getPostList(IPostServiceImpl.kt:34) ~[main/:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na] at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343) ~[spring-aop-6.0.17.jar:6.0.17] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:699) ~[spring-aop-6.0.17.jar:6.0.17] at com.hoscent.smile.service.impl.IPostServiceImpl$$SpringCGLIB$$0.getPostList() ~[main/:na] at com.hoscent.smile.controller.PostController.getPostList(PostController.kt:46) ~[main/:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na] at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-6.0.17.jar:6.0.17] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150) ~[spring-web-6.0.17.jar:6.0.17] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:118) ~[spring-webmvc-6.0.17.jar:6.0.17] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:887) ~[spring-webmvc-6.0.17.jar:6.0.17] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:798) ~[spring-webmvc-6.0.17.jar:6.0.17] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-6.0.17.jar:6.0.17] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1081) ~[spring-webmvc-6.0.17.jar:6.0.17] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:974) ~[spring-webmvc-6.0.17.jar:6.0.17] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014) ~[spring-webmvc-6.0.17.jar:6.0.17] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:903) ~[spring-webmvc-6.0.17.jar:6.0.17] at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:564) ~[tomcat-embed-core-10.1.19.jar:6.0] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885) ~[spring-webmvc-6.0.17.jar:6.0.17] at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658) ~[tomcat-embed-core-10.1.19.jar:6.0] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:205) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) ~[tomcat-embed-websocket-10.1.19.jar:10.1.19] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-6.0.17.jar:6.0.17] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.0.17.jar:6.0.17] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-6.0.17.jar:6.0.17] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.0.17.jar:6.0.17] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-6.0.17.jar:6.0.17] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.0.17.jar:6.0.17] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:391) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:896) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1744) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63) ~[tomcat-embed-core-10.1.19.jar:10.1.19] at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na] 提供问题复现工程(可选) 请尽量提供复现工程,减少大家排错的时间.

nieqiurong commented 5 months ago

提供复现工程.

hoscent commented 3 months ago

build.gradle.kts

dependencies {
    ...
    runtimeOnly("com.mysql:mysql-connector-j")
    implementation("com.alibaba:druid-spring-boot-3-starter:1.2.23")
    implementation("com.baomidou:mybatis-plus-spring-boot3-starter:3.5.6")
    ...
}

application.yml

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/test?serverTimezone=Asia/Shanghai
    username: root
    password: 123456
    type: com.alibaba.druid.pool.DruidDataSource
mybatis-plus:
  global-config:
    db-config:
      table-prefix: de_
      id-type: auto

AppConfig.kt

@Configuration
class AppConfig {
    @Bean
    fun mybatisPlusInterceptor(): MybatisPlusInterceptor {
        val interceptor = MybatisPlusInterceptor()
        val paginationInnerInterceptor = PaginationInnerInterceptor(DbType.MYSQL)
        interceptor.addInnerInterceptor(paginationInnerInterceptor)
        return interceptor
    }
}

User.kt

class User {
    var id: Long? = null
    var username: String? = null
    var password: String? = null
    var gmtCreate: LocalDateTime? = null
    var gmtModified: LocalDateTime? = null
}

UserDao.kt

@Mapper
interface UserDao: BaseMapper<User> {
}

IUserService.kt

interface IUserService : IService<User> {
    fun getUserList(page: Int, size: Int): IPage<User>
}

IUserServiceImpl.kt

@Service
class IUserServiceImpl : ServiceImpl<UserDao, User>(), IUserService {
    @Autowired
    private lateinit var userDao: UserDao

    override fun getUserList(page: Int, size: Int): IPage<User> {
        val lqw = Wrappers.lambdaQuery<User>()
        lqw.orderByDesc(User::gmtCreate, User::gmtModified)
        val iPage: IPage<User> = Page(page.toLong(), size.toLong())
        return userDao.selectPage(iPage, lqw)
    }
}

TestController.kt

@RestController
@RequestMapping("/test")
class TestController {
    @Autowired
    private lateinit var userService: IUserService

    @GetMapping("/userList")
    fun userList(): IPage<Post?> {
        return userService.getUserList(1, 10)
    }
}
nieqiurong commented 3 months ago

这好像不能直接用这个.

val lqw = KtQueryWrapper(User::class.java)

hoscent commented 3 months ago

已解决,感谢