In MyBatis, the dynamic SQL constructed by annotations is and by default when splicing multiple Where, and how to modify it to or

such as the title, for example, I implement the following splicing

for (Object key : key_values){
                        WHERE("(article.title LIKE "%"+key.toString()+"%" OR article.content LIKE "%"+key.toString()+"%")");
                    }

SQL output the following intermediate link as AND

SELECT user.nickname,user.userIcon,article.*
FROM article,user
WHERE (user.openID = article.openID) 
AND ((article.title LIKE "%sql%" OR article.content LIKE "%sql%") AND (article.title LIKE "%%" OR article.content LIKE "%%"))

and what I want is the following result, the middle link is OR

SELECT user.nickname,user.userIcon,article.*
FROM article,user
WHERE (user.openID = article.openID) 
AND ((article.title LIKE "%sql%" OR article.content LIKE "%sql%") OR (article.title LIKE "%%" OR article.content LIKE "%%"))
Jul.07,2022
Menu