mybatis-plus QueryWrapper条件句多重和または


私はプロジェクトの中で1つの業務に出会って月の前年同期と環比を計算して、1つの時間のフィールドの中で多くの時間の範囲の記録を調べる必要があって、実現するSQLの例は以下の通りです:
select * from fault_happen where train_code = '710' and fault_level = '3' and 
(happen_time >= '2020-07-01 00:00:00' and happen_time < '2020-08-01 00:00:00'
OR happen_time >= '2020-06-01 00:00:00' and happen_time < '2020-07-01 00:00:00' 
OR happen_time >= '2019-07-01 00:00:00' and happen_time < '2019-08-01 00:00:00')
;

しかし、QueryWrapperでこのネストされた複数の和または条件をどのようにつなぎ合わせるのでしょうか.条件を無視する文の中の括弧()の直接的な接合論理が間違っている場合は、使用する必要がある.and(java.util.function.Function func)この方法:実装されるJavaコードは以下の通りです.
wrapper.and(x ->
                x.ge("happen_time", currentMonthHead).lt("happen_time", currentMonthTail)
                        .or().ge("happen_time", lastMonthHead).lt("happen_time", lastMonthTail)
                        .or().ge("happen_time", lastYearHead).lt("happen_time", lastYearTail)
            );