feat(wms): 实现产品和原材料列表空值处理及导出功能
- 在 WmsProductServiceImpl 中添加空值检查逻辑,将 null 值替换为"空置" - 在 WmsRawMaterialServiceImpl 中添加空值检查逻辑,将 null 值替换为"空置" - 为 WmsProductVo 的 productId 字段添加 Excel 导出注解 - 为 WmsRawMaterialVo 的 rawMaterialId 字段添加 Excel 导出注解 - 统一处理两个服务中的空值显示问题,提升数据展示一致性 - 增强列表查询方法的健壮性,避免返回 null 情况下的异常
This commit is contained in:
@@ -25,6 +25,7 @@ public class WmsProductVo {
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@ExcelProperty(value = "ID")
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,6 +25,7 @@ public class WmsRawMaterialVo {
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@ExcelProperty(value = "ID")
|
||||
private Long rawMaterialId;
|
||||
|
||||
/**
|
||||
|
||||
@@ -85,7 +85,30 @@ public class WmsProductServiceImpl implements IWmsProductService {
|
||||
@Override
|
||||
public List<WmsProductVo> queryList(WmsProductBo bo) {
|
||||
LambdaQueryWrapper<WmsProduct> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
List<WmsProductVo> wmsProductVos = baseMapper.selectVoList(lqw);
|
||||
// 处理空值替换为"空置"
|
||||
if (wmsProductVos != null) {
|
||||
for (WmsProductVo vo : wmsProductVos) {
|
||||
if (vo.getSpecification() == null) {
|
||||
vo.setSpecification("空置");
|
||||
}
|
||||
if (vo.getMaterial() == null) {
|
||||
vo.setMaterial("空置");
|
||||
}
|
||||
if (vo.getManufacturer() == null) {
|
||||
vo.setManufacturer("空置");
|
||||
}
|
||||
if (vo.getSurfaceTreatmentDesc() == null) {
|
||||
vo.setSurfaceTreatmentDesc("空置");
|
||||
}
|
||||
if (vo.getZincLayer() == null) {
|
||||
vo.setZincLayer("空置");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
wmsProductVos = new java.util.ArrayList<>();
|
||||
}
|
||||
return wmsProductVos;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<WmsProduct> buildQueryWrapper(WmsProductBo bo) {
|
||||
|
||||
@@ -91,7 +91,30 @@ public class WmsRawMaterialServiceImpl implements IWmsRawMaterialService {
|
||||
@Override
|
||||
public List<WmsRawMaterialVo> queryList(WmsRawMaterialBo bo) {
|
||||
LambdaQueryWrapper<WmsRawMaterial> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
List<WmsRawMaterialVo> wmsRawMaterialVos = baseMapper.selectVoList(lqw);
|
||||
// 处理空值替换为"空置"
|
||||
if (wmsRawMaterialVos != null) {
|
||||
for (WmsRawMaterialVo vo : wmsRawMaterialVos) {
|
||||
if (vo.getSpecification() == null) {
|
||||
vo.setSpecification("空置");
|
||||
}
|
||||
if (vo.getMaterial() == null) {
|
||||
vo.setMaterial("空置");
|
||||
}
|
||||
if (vo.getManufacturer() == null) {
|
||||
vo.setManufacturer("空置");
|
||||
}
|
||||
if (vo.getSurfaceTreatmentDesc() == null) {
|
||||
vo.setSurfaceTreatmentDesc("空置");
|
||||
}
|
||||
if (vo.getZincLayer() == null) {
|
||||
vo.setZincLayer("空置");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
wmsRawMaterialVos = new java.util.ArrayList<>();
|
||||
}
|
||||
return wmsRawMaterialVos;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user