看了首页的例子.没有看到怎么根据参数动态加条件的?
比如我们用的:
public interface PetDao {
@
SelectProvider(type = PetMapperSql.class)
List<Pet> queryPet(@Param("param") PetQueryParam param);
}
public class PetMapperSql extends BaseMapperSql {
public SelectModel queryPet(@Param("param") PetQueryParam param) {
return select(
Pet.id,
Pet.name, Pet.petType, Pet.birthday, Pet.updateTime)
.from(Pet)
.where().and(
Pet.name, isLikeWhenPresent(param.getName()).then(x -> "%" + x + "%"))
.and(Pet.birthday, isGreaterThan(param.getBirthdayStart()).when(Objects::nonNull))
.and(Pet.birthday, isLessThanWhenPresent(param.getBirthdayEnd()))
.build();
}
}
.and(Pet.birthday, isGreaterThan(param.getBirthdayStart()).when(Objects::nonNull))