baomidou / mybatis-plus-samples

MyBatis-Plus Samples
https://baomidou.com
Apache License 2.0
2.25k stars 2.08k forks source link

Where is sample for combination condition like AND/OR? #73

Closed trungdoviet closed 3 weeks ago

trungdoviet commented 1 year ago

Hi team i have requirement to write SQL like:

Select * from table_a where col1 IN (1,2,3) OR col2 IN ("x", "y", "z")

How to write this one with mybatis-plus?

qiuzhihui1990 commented 1 year ago

Hello. I think you can try the following:

in("col1", collect1).or().in("col2",collect2)