LambdaQueryWrapper between 3 days directly give the complete code

LambdaQueryWrapper is a dynamic SQL auxiliary class of Mybatis Plus that can help build complex SQL statements.

The sample code in 3 days is as follows:

LambdaQueryWrapper<YourEntity>wrapper = new LambdaQueryWrapper<>();
wrapper.between(YourEntity::getCreateTime, LocalDateTime.now().minusDays(3), LocalDateTime.now());
List<YourEntity> result = yourMapper.selectList(wrapper);

This code assumes that your entity class is YourEntity, which contains a createTime attribute, and the corresponding Mapper is yourMapper. Use LambdaQueryWrapper to build query conditions, and use the between method to query the data between the current time and the previous 3 days of createTime. Finally, perform the query operation through yourMapper.selectList(wrapper).

Guess you like

Origin blog.csdn.net/weixin_35753431/article/details/129058191