change(crm): 处理无明细时金额清零及优化物料查询方法

- 无明细时将报价总金额全部置零,避免保留历史金额
- 修改物料分页查询方法,使用selectJoinPage提高查询效率
- 修改物料列表查询方法,使用selectJoinList增强数据关联能力
dev
zangch@mesnac.com 3 weeks ago
parent ce3870c1bb
commit a1abe313bb

@ -346,7 +346,14 @@ public class CrmQuoteInfoServiceImpl implements ICrmQuoteInfoService {
.eq(CrmQuoteMaterial::getQuoteId, quoteId);
List<CrmQuoteMaterialVo> items = quoteMaterialMapper.selectVoList(lqw);
if (items == null || items.isEmpty()) {
return true; // 无明细则不处理
// 无明细时将金额全部置零,避免保留历史金额
CrmQuoteInfo update = new CrmQuoteInfo();
update.setQuoteId(quoteId);
update.setTotalIncludingTax(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP));
update.setTotalBeforeTax(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP));
update.setTotalTax(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP));
update.setTotalPrice(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP));
return baseMapper.updateById(update) > 0;
}
// 汇总金额(统一两位小数,四舍五入)
BigDecimal totalIncluding = BigDecimal.ZERO;

@ -54,7 +54,7 @@ public class CrmQuoteMaterialServiceImpl implements ICrmQuoteMaterialService {
@Override
public TableDataInfo<CrmQuoteMaterialVo> queryPageList(CrmQuoteMaterialBo bo, PageQuery pageQuery) {
MPJLambdaWrapper<CrmQuoteMaterial> lqw = buildQueryWrapper(bo);
Page<CrmQuoteMaterialVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
Page<CrmQuoteMaterialVo> result = baseMapper.selectJoinPage(pageQuery.build(), CrmQuoteMaterialVo.class, lqw);
return TableDataInfo.build(result);
}
@ -67,7 +67,7 @@ public class CrmQuoteMaterialServiceImpl implements ICrmQuoteMaterialService {
@Override
public List<CrmQuoteMaterialVo> queryList(CrmQuoteMaterialBo bo) {
MPJLambdaWrapper<CrmQuoteMaterial> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
return baseMapper.selectJoinList(CrmQuoteMaterialVo.class, lqw);
}
private MPJLambdaWrapper<CrmQuoteMaterial> buildQueryWrapper(CrmQuoteMaterialBo bo) {

Loading…
Cancel
Save