使用compareTo方法:
eg1:
int result = bigdemical1.compareTo(bigdemical2)
result = -1,表示bigdemical1小于bigdemical2;
result = 0,表示bigdemical1等于bigdemical2;
result = 1,表示bigdemical1大于bigdemical2;
也可以直接和1进行比较:
eg2:
if(skuReductionTo.getFullCount() > 0 || skuReductionTo.getFullPrice().compareTo(new BigDecimal("0")) == 1) {
R r1 = couponFeignService.saveSkuReduction(skuReductionTo);
if(r1.getCode() != 0) {
log.error("远程保存sku优惠信息失败");
}
}