refactor(wms): 优化运单状态更新逻辑

- 使用LambdaUpdateWrapper替代实体对象进行条件更新
- 避免创建不必要的实体实例提升性能
- 统一使用MyBatis-Plus的链式调用方式
- 减少数据库操作的内存开销
- 提高代码可读性和维护性
This commit is contained in:
2026-01-28 10:25:58 +08:00
parent c79b4257b7
commit d05f2f6629

View File

@@ -1,6 +1,7 @@
package com.klp.service.impl; package com.klp.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.klp.common.core.page.TableDataInfo; import com.klp.common.core.page.TableDataInfo;
import com.klp.common.core.domain.PageQuery; import com.klp.common.core.domain.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -107,10 +108,10 @@ public class WmsDeliveryWaybillServiceImpl implements IWmsDeliveryWaybillService
} }
@Override @Override
public Boolean changeStatus(WmsDeliveryWaybillBo bo) { public Boolean changeStatus(WmsDeliveryWaybillBo bo) {
WmsDeliveryWaybill update = new WmsDeliveryWaybill(); LambdaUpdateWrapper<WmsDeliveryWaybill> updateWrapper = new LambdaUpdateWrapper<>();
update.setWaybillId(bo.getWaybillId()); updateWrapper.eq(WmsDeliveryWaybill::getWaybillId, bo.getWaybillId())
update.setStatus(bo.getStatus()); .set(WmsDeliveryWaybill::getStatus, bo.getStatus());
return baseMapper.updateById(update) > 0; return baseMapper.update(null, updateWrapper) > 0;
} }
/** /**
* 保存前的数据校验 * 保存前的数据校验