| | |
| | | @PostMapping("/add") |
| | | public Result<?> addStandardsInformation(@RequestHeader("X-Token") String token, @RequestBody Standards standards) throws Exception { |
| | | Object object = RedisUtil.get(token); |
| | | if (ObjectUtils.isEmpty(object)){ |
| | | return Result.fail("对不起添加失败,请添加Token!"); |
| | | } |
| | | Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); |
| | | standards.setUserId((Integer) unmarshal.get("id")); |
| | | Integer isStandardsSuccess = standardsService.addStandardsInformation(standards); |
| | |
| | | map.put("total", listPage.getTotal()); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @ApiOperation("标准库-->根据Id修改参数") |
| | | @PutMapping("/update") |
| | | public Result<?> updateStandardsInformation(@RequestHeader("X-Token") String token, @RequestBody Standards standards) throws Exception { |
| | | Object object = RedisUtil.get(token); |
| | | Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); |
| | | standards.setUserId((Integer) unmarshal.get("id")); |
| | | Integer isUpdateSuccess = standardsService.updateStandardsInformation(standards); |
| | | if (isUpdateSuccess == 1){ |
| | | return Result.success("更新成功!"); |
| | | } |
| | | return Result.fail("更新失败!"); |
| | | } |
| | | |
| | | @ApiOperation("标准库-->根据ID删除数据") |
| | | @DeleteMapping("/delete") |
| | | public Result<?> deleteStandardsInformation(String standardsId) { |
| | | Integer isDeleteSuccess = standardsService.deleteStandardsInformation(standardsId); |
| | | if (isDeleteSuccess == 1){ |
| | | return Result.success("删除成功!"); |
| | | } |
| | | return Result.fail("删除失败!"); |
| | | } |
| | | } |