pageHelper 不生效问题

空值问题
This commit is contained in:
wangw 2025-02-28 10:50:51 +08:00
parent dce2c309e5
commit 26b6a5a5da
10 changed files with 33 additions and 44 deletions

View File

@ -34,7 +34,6 @@ alipay:
pagehelper:
helper-dialect: mysql
reasonable: true
support-methods-arguments: true
dubbo:

View File

@ -21,7 +21,6 @@ mybatis-flex:
pagehelper:
helper-dialect: mysql
reasonable: true
support-methods-arguments: true
dubbo:

View File

@ -21,5 +21,4 @@ mybatis-flex:
jdbc-type-for-null: 'null'
pagehelper:
helper-dialect: mysql
reasonable: true
support-methods-arguments: true

View File

@ -12,5 +12,4 @@ logging:
pagehelper:
helper-dialect: mysql
reasonable: true
support-methods-arguments: true

View File

@ -87,4 +87,30 @@ public class CheckOrderPay implements Serializable {
public Integer getPointsNum() {
return pointsNum == null ? 0 : pointsNum;
}
public BigDecimal getDiscountRatio() {
return discountRatio == null ? BigDecimal.ONE : discountRatio;
}
public BigDecimal getFullCouponDiscountAmount() {
return fullCouponDiscountAmount == null ? BigDecimal.ZERO : fullCouponDiscountAmount;
}
public BigDecimal getProductCouponDiscountAmount() {
return productCouponDiscountAmount == null ? BigDecimal.ZERO : productCouponDiscountAmount;
}
public BigDecimal getDiscountAmount() {
return discountAmount == null ? BigDecimal.ZERO : discountAmount;
}
public BigDecimal getPointsDiscountAmount() {
return pointsDiscountAmount == null ? BigDecimal.ZERO : pointsDiscountAmount;
}
public BigDecimal getRoundAmount() {
return roundAmount == null ? BigDecimal.ZERO : roundAmount;
}
}

View File

@ -49,17 +49,7 @@
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<exclusions>
<exclusion>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>sqlparser4.5</artifactId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>

View File

@ -33,7 +33,7 @@
<dubbo-registry-nacos.version>3.3.3</dubbo-registry-nacos.version>
<dubbo.version>3.3.3</dubbo.version>
<seata.version>2.0.0</seata.version>
<pagehelper.version>6.1.0</pagehelper.version>
<pagehelper.version>2.1.0</pagehelper.version>
<alipay-sdk-java.version>4.40.54.ALL</alipay-sdk-java.version>
<aliyun-sms.version>2.0.24</aliyun-sms.version>
<aliyun.oss.version>2.8.3</aliyun.oss.version>
@ -168,21 +168,9 @@
<artifactId>seata-spring-boot-starter</artifactId>
<version>${seata.version}</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>${pagehelper.version}</version>
<exclusions>
<exclusion>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>sqlparser4.5</artifactId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>${pagehelper.version}</version>
</dependency>
<!--

View File

@ -91,12 +91,12 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
@Override
public Page<ShopActivateCouponRecord> find(Long userId, Long shopId, Integer status) {
Page<Object> page = PageUtil.buildPage();
PageHelper.startPage(Math.toIntExact(page.getPageNumber()),Math.toIntExact(page.getPageSize()));
List<Long> shopUserIds = shopUserService.queryChain()
.eq(ShopUser::getUserId, userId)
.eq(ShopUser::getShopId, shopId)
.select(ShopUser::getId).listAs(Long.class);
if (CollectionUtil.isNotEmpty(shopUserIds)) {
PageHelper.startPage(Math.toIntExact(page.getPageNumber()),Math.toIntExact(page.getPageSize()));
return PageUtil.convert(new PageInfo<>(couponRecordService.findByUser(shopUserIds, status)));
}
return new Page<>();

View File

@ -282,7 +282,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
if (prodCouponAmount.getPrice().compareTo(param.getProductCouponDiscountAmount()) != 0) {
throw new ValidateException("生成支付订单失败,商品优惠券优惠金额不正确");
}
BigDecimal newTotalAmount = BigDecimal.ZERO;
BigDecimal newTotalAmount;
//折扣金额 9折 计算 订单金额*0.9 向上取整
if (param.getDiscountRatio().compareTo(BigDecimal.ONE) != 0) {
newTotalAmount = totalAmount.getPrice().multiply(param.getDiscountRatio()).setScale(2, RoundingMode.UP);
@ -648,7 +648,6 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
*/
private void upOrderPayInfo(OrderInfo orderInfo, CheckOrderPay param) {
orderInfo.setPointsNum(param.getPointsNum());
orderInfo.setOriginAmount(param.getOriginAmount());
orderInfo.setRoundAmount(param.getRoundAmount());
orderInfo.setOrderAmount(param.getOrderAmount());
orderInfo.setPointsDiscountAmount(param.getPointsDiscountAmount());
@ -660,7 +659,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
//折扣信息
orderInfo.setDiscountInfo(buildDiscountInfo(orderInfo));
//最终折扣
orderInfo.setDiscountRatio(param.getOriginAmount().divide(param.getOrderAmount(), 2, RoundingMode.UP));
orderInfo.setDiscountRatio(orderInfo.getOriginAmount().divide(param.getOrderAmount(), 2, RoundingMode.UP));
saveOrUpdate(orderInfo);
}

View File

@ -42,17 +42,7 @@
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<exclusions>
<exclusion>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>sqlparser4.5</artifactId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.czg</groupId>