lambdaQuery中EQ、NE、GT、LT、GE、LE的用法

lt:less than 小于
le:less than or equal to 小于等于
eq:equal to 等于
ne:not equal to 不等于
ge:greater than or equal to 大于等于
gt:greater than 大于
lq: 是小于等于

Maybatis-Plus lambdaQuery和mapper中EQ、NE、GT、LT、GE、LE的用法及详解

1.等于当前时间

//EQ 就是 EQUAL等于

taskFlowService.lambdaQuery().eq(TaskFlow::getCreateTime,DateUtil.now())

2.不等于当前时间

//NE就是 NOT EQUAL不等于

taskFlowService.lambdaQuery().ne(TaskFlow::getCreateTime,DateUtil.now());

3.大于当前时间

//GT 就是 GREATER THAN大于

taskFlowService.lambdaQuery().gt(TaskFlow::getCreateTime,DateUtil.now());

4.小于当前时间

//LT 就是 LESS THAN小于

taskFlowService.lambdaQuery().lt(TaskFlow::getCreateTime,DateUtil.now());

5.大于等于当前时间

//GE 就是 GREATER THAN OR EQUAL 大于等于

taskFlowService.lambdaQuery().ge(TaskFlow::getCreateTime,DateUtil.now());

6.小于等于当前时间

//LE 就是 LESS THAN OR EQUAL 小于等于

taskFlowService.lambdaQuery().le(TaskFlow::getCreateTime,DateUtil.now());

7.2个时间段是否相交

if ((!start1.after(end2)) && (!end1.before(start2))) {
System.out.println("时间重叠");
}

posted @ 2022-09-21 16:49  勿忘言默小江  阅读(4733)  评论(0)    收藏  举报