With the behavior of MyBatis from the drawer, as far as I know, you cannot.
You can try to write an interceptor for the ParameterHandler parameter and enter a value there, but this is not always possible, since you can play with only two methods in the parameter handler:
getParameterObject , which returns the parameter that was sent to the request (it can be a constant, a string, a map, a custom object, or even zero, as is the case in your example where you do not send the parameter)setParameters , where, I think, you could try setting the parameter if you know where it is in the prepared statement (in most cases you cannot).
My suggestion is to pass it as a parameter to your request. The functions of the MyBatis interceptor are not well documented, so you may not get the right combination from the start, and you may have more problems than it costs.
source share