🐛 根据赋码条件查询物料
All checks were successful
Release / Release (push) Successful in 43s

This commit is contained in:
my_ong
2025-03-09 15:54:33 +08:00
parent fa39990202
commit 0a5cef4f6f

View File

@@ -80,10 +80,16 @@ public class MaterialController {
@PostMapping("material/list") @PostMapping("material/list")
@Operation(summary = "查询所有物料列表") @Operation(summary = "查询所有物料列表")
public List<Material> all(@Parameter(description = "类型") @RequestParam(required = false, defaultValue = "") String type) { public List<Material> all(@Parameter(description = "类型") @RequestParam(required = false, defaultValue = "") String type,
@Parameter(description = "是否赋码") @RequestParam(required = false) Boolean assignRule) {
String[] types = StringUtils.isNotBlank(type) ? type.split(",") : new String[0]; String[] types = StringUtils.isNotBlank(type) ? type.split(",") : new String[0];
List<Material> materials = materialService.queryLikeRight(List.of(types)); List<Material> materials = materialService.queryLikeRight(List.of(types));
if (Boolean.FALSE.equals(assignRule)) {
materials.stream().filter(item -> Boolean.TRUE.equals(item.getAssignRule()))
.forEach(item -> item.setTypeName(typeService.getTypeName(item.getType())));
} else {
materials.forEach(item -> item.setTypeName(typeService.getTypeName(item.getType()))); materials.forEach(item -> item.setTypeName(typeService.getTypeName(item.getType())));
}
return materials; return materials;
} }