Every Java codebase I have worked on that uses MyBatis-Plus has the same small loop in it. You change one condition, and then you need to know what the change actually produced.
LambdaQueryWrapper < User > qw = Wrappers . lambdaQuery ( ) ; qw . eq ( StringUtils . isNotBlank ( req . getUsername ( ) ) , User :: getUsername , req . getUsername ( ) ) . ge ( req . getCreatedFrom ( ) != null , User :: getCreatedAt , req . getCreatedFrom ( ) ) . orderByDesc ( User :: getId ) ; userMapper . selectPage ( page , qw ) ;
Enter fullscreen mode
Exit fullscreen mode
Three things are uncertain here, and none of them are visible in the code:
whether the username condition is in the statement at all, since it depends on a runtime value;
whether the logical-delete column was appended, and where in the WHERE clause;
what the paging count query looks like next to the LIMIT query.
So you restart the app, send one request, scroll to the console, find Preparing: SELECT ... WHERE username = ?…