| | |
| | | * @author 江苏鵷雏网络科技有限公司 |
| | | * @since 2023-07-17 |
| | | */ |
| | | @Api(tags = "标准库-->规格-->查看-->父-->子") |
| | | @Api(tags = "标准库-->4、项目") |
| | | @RestController |
| | | @RequestMapping("/product") |
| | | public class ProductController { |
| | |
| | | @Autowired |
| | | private ProductService productService; |
| | | |
| | | @ApiOperation("测试标准模块-->添加测试标准") |
| | | @PostMapping("/add") |
| | | public Result<?> addProductInformation(@RequestHeader("X-Token") String token, @RequestBody Product product) throws Exception { |
| | | Object userMessage = RedisUtil.get(token); |
| | | if (!ObjectUtils.isEmpty(userMessage)){ |
| | | Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(userMessage), Map.class); |
| | | product.setUserId(Integer.parseInt(unmarshal.get("id").toString())); |
| | | } else { |
| | | return Result.fail("对不起,Token错误!"); |
| | | } |
| | | Integer isProductSuccess = productService.addProductInformation(product); |
| | | if (isProductSuccess == 1) { |
| | | return Result.success("添加物料【"+ product.getName() +"】成功!"); |
| | | } |
| | | return Result.fail("添加物料【"+ product.getName() +"】失败!"); |
| | | } |
| | | |
| | | @ApiOperation("物料库-->根据物料ID查询所有测试标准") |
| | | @GetMapping("/list") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(value = "物料ID", name = "materialId", dataTypeClass = String.class) |
| | | }) |
| | | public Result<?> getListProductInformation(Integer materialId) { |
| | | List<Map<String, Object>> listMaterialInformation = productService.getListProductInformation(materialId); |
| | | return Result.success(listMaterialInformation); |
| | | } |
| | | |
| | | @ApiOperation("物料库-->根据测试标准ID查询基本信息") |
| | | @GetMapping("/delete") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(value = "测试标准ID", name = "productId", dataTypeClass = String.class) |
| | | }) |
| | | public Result<?> getProductInformation(Integer productId) { |
| | | Map<String, Object> productInformation = productService.getProductInformation(productId); |
| | | return Result.success(productInformation); |
| | | } |
| | | |
| | | @ApiOperation("物料库-->删除测试标准模块数据") |
| | | @ApiOperation("删除测试标准模块数据") |
| | | @DeleteMapping("/delete") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(value = "测试标准ID", name = "productId", dataTypeClass = String.class) |
| | |
| | | } |
| | | return Result.fail("删除失败!"); |
| | | } |
| | | |
| | | // @ApiOperation("物料库-->修改物料") |
| | | // @PutMapping("/update") |
| | | // public Result<?> updateMaterialInformation(@RequestBody Material material) { |
| | | // Integer isUpdateMaterialSuccess = materialService.updateMaterialInformation(material); |
| | | // if (isUpdateMaterialSuccess == 1) { |
| | | // return Result.success("修改物料【"+ material.getName() +"】成功!"); |
| | | // } |
| | | // return Result.fail("修改物料【"+ material.getName() +"】失败!"); |
| | | // } |
| | | } |