In MyBatis, you mark the places where parameters should be inserted into your SQL like so:
SELECT * FROM Person WHERE id = #{id}
Typically this is done by adding the % to the parameter itself before passing it in, in whatever language you're using outside of SQL. However note that either way you might still need to do an escaping step if your search term may have _ or % in it. See eg this question for background.)
To fix the concatenation problem in general, put MySQL into ANSI sql_mode and you get proper support for the || operator, as well as correct handling of double quotes for schema names rather than string literals.
(If you can't do that you'd have to build a function to build the statement out of either || or CONCAT(), abstracting away the difference.)