| | |
| | | @DeleteMapping("/{typeId}") |
| | | @ApiOperation(value = "删除类型") |
| | | public ResponseResult<Void> delete(@PathVariable Integer typeId) { |
| | | Type type = new Type(); |
| | | type.setType_id(typeId); |
| | | boolean success = typeService.updateById(type); |
| | | if (success) { |
| | | return ResponseResult.success(); |
| | | } |
| | | return ResponseResult.error("删除类型失败"); |
| | | |
| | | typeService.removeById(typeId); |
| | | |
| | | return ResponseResult.success(); |
| | | } |
| | | |
| | | @PutMapping |
| | | @ApiOperation(value = "更新类型") |
| | | public ResponseResult<Void> update(@RequestBody Type type) { |
| | | boolean success = typeService.updateById(type); |
| | | if (success) { |
| | | return ResponseResult.success(); |
| | | } |
| | | return ResponseResult.error("更新类型失败"); |
| | | typeService.updateById(type); |
| | | return ResponseResult.success(); |
| | | } |
| | | |
| | | @PutMapping("/batch") |