对Mybatis-Plus用法上的一些拓展
<dependency>
<groupId>io.github.taowater</groupId>
<artifactId>mybatis-plus-ex</artifactId>
<version>LATEST</version>
</dependency>import com.taowater.mpx.mapper.BaseMapper;
// 增强的BaseMapper,保留原BaseMapper所有方法,拓展功能
public interface PersonMapper extends BaseMapper<Person> {
}var list = personMapper.selectList(w -> w
.geCol(Person::getFatherId, Person::getMotherId) // 字段间相比
.eq(Person::getFamilyName, "刘") // 原有相等条件
.eqX(Person::getName, "备") // 如果条件值为空(包括null和集合为空),则不执行该行条件装配
.eqR(Person::getDeathDate, null) // 如果条件值为空,则短路结果为空,不执行查询
.limit(10) // limit n操作