查询object
Optional<Brand> brand = new LambdaQueryChainWrapper<>(baseMapper)
.eq(Brand::getName, brandName)
.oneOpt();
查询list
List<ProductAttributeValue> entities = new LambdaQueryChainWrapper<>(baseMapper)
.eq(ProductAttributeValue::getProductId, 1)
.list();
获取最大排序
private int getMaxSort(){
List<Store> stores = new LambdaQueryChainWrapper<>(baseMapper)
.orderByDesc(Store::getSort)
.list();
if (stores.size() <= 0) {
return 1;
}
return stores.get(0).getSort() + 1;
}