完成挂账管理相关需求

This commit is contained in:
谭凯凯
2024-11-26 09:26:44 +08:00
committed by Tankaikai
parent ee88ccc07d
commit 41e21bcd3b

View File

@@ -45,6 +45,7 @@ public class TbCreditBuyerServiceImpl extends ServiceImpl<TbCreditBuyerMapper, T
private LambdaQueryWrapper<TbCreditBuyer> getWrapper(Map<String, Object> params) {
MapProxy mapProxy = MapProxy.create(params);
String keywords = mapProxy.getStr("keywords");
String repaymentStatus = mapProxy.getStr("repaymentStatus");
TbCreditBuyer param = BeanUtil.toBean(params, TbCreditBuyer.class);
LambdaQueryWrapper<TbCreditBuyer> wrapper = Wrappers.lambdaQuery();
@@ -55,6 +56,16 @@ public class TbCreditBuyerServiceImpl extends ServiceImpl<TbCreditBuyerMapper, T
if (StrUtil.isNotEmpty(keywords)) {
wrapper.nested(i -> i.like(TbCreditBuyer::getDebtor, keywords).or().like(TbCreditBuyer::getMobile, keywords));
}
if (StrUtil.isNotEmpty(repaymentStatus)) {
if ("unpaid".equals(repaymentStatus)) {
wrapper.apply("0 < ifnull((select x.count from view_credit_buyer_order_count x where x.credit_buyer_id = tb_credit_buyer.id and x.status = 'unpaid'),0)");
wrapper.apply("0 = ifnull((select x.count from view_credit_buyer_order_count x where x.credit_buyer_id = tb_credit_buyer.id and x.status = 'partial'),0)");
}else if ("partial".equals(repaymentStatus)) {
wrapper.apply("0 < ifnull((select x.count from view_credit_buyer_order_count x where x.credit_buyer_id = tb_credit_buyer.id and x.status = 'partial'),0)");
}else if ("paid".equals(repaymentStatus)) {
wrapper.apply("0 = ifnull((select sum(x.count) from view_credit_buyer_order_count x where x.credit_buyer_id = tb_credit_buyer.id and x.status in ('unpaid','partial')),0)");
}
}
wrapper.eq(TbCreditBuyer::getDelFlag, 0);
wrapper.select(TbCreditBuyer::getId, TbCreditBuyer::getShopId, TbCreditBuyer::getStatus, TbCreditBuyer::getDebtor, TbCreditBuyer::getMobile, TbCreditBuyer::getPosition, TbCreditBuyer::getCreditAmount, TbCreditBuyer::getRepaymentMethod, TbCreditBuyer::getPaymentMethod, TbCreditBuyer::getRemark, TbCreditBuyer::getDelFlag, TbCreditBuyer::getOwedAmount, TbCreditBuyer::getAccumulateAmount, TbCreditBuyer::getShopName, TbCreditBuyer::getResponsiblePerson, TbCreditBuyer::getAccountBalance);
wrapper.orderByDesc(TbCreditBuyer::getStatus);