feat(inventory): 添加盘库差异记录批量新增功能
- 在服务层接口中添加批量新增方法定义 - 在控制器中实现批量新增API端点 - 在服务实现类中添加批量新增业务逻辑 - 添加请求参数验证和空值检查 - 使用BeanUtil工具进行对象转换 - 集成基础映射器的批量插入功能
This commit is contained in:
@@ -75,6 +75,16 @@ public class InvCountDiscrepancyController extends BaseController {
|
|||||||
return toAjax(iInvCountDiscrepancyService.insertByBo(bo));
|
return toAjax(iInvCountDiscrepancyService.insertByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量新增盘库差异记录
|
||||||
|
*/
|
||||||
|
@Log(title = "盘库差异记录", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping("/batch")
|
||||||
|
public R<Void> addBatch(@Validated(AddGroup.class) @RequestBody List<InvCountDiscrepancyBo> bos) {
|
||||||
|
return toAjax(iInvCountDiscrepancyService.insertBatchByBo(bos));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改盘库差异记录
|
* 修改盘库差异记录
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -37,6 +37,11 @@ public interface IInvCountDiscrepancyService {
|
|||||||
*/
|
*/
|
||||||
Boolean insertByBo(InvCountDiscrepancyBo bo);
|
Boolean insertByBo(InvCountDiscrepancyBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量新增盘库差异记录
|
||||||
|
*/
|
||||||
|
Boolean insertBatchByBo(List<InvCountDiscrepancyBo> bos);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改盘库差异记录
|
* 修改盘库差异记录
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import com.klp.flow.service.IInvCountDiscrepancyService;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 盘库差异记录Service业务层处理
|
* 盘库差异记录Service业务层处理
|
||||||
@@ -91,6 +92,19 @@ public class InvCountDiscrepancyServiceImpl implements IInvCountDiscrepancyServi
|
|||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量新增盘库差异记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertBatchByBo(List<InvCountDiscrepancyBo> bos) {
|
||||||
|
if (bos == null || bos.isEmpty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
List<InvCountDiscrepancy> addList = BeanUtil.copyToList(bos, InvCountDiscrepancy.class);
|
||||||
|
addList.forEach(this::validEntityBeforeSave);
|
||||||
|
return baseMapper.insertBatch(addList);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改盘库差异记录
|
* 修改盘库差异记录
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user