| | |
| | | } |
| | | |
| | | @PostMapping("/batch") |
| | | @ApiOperation(value = "批量添加类型") |
| | | public ResponseResult<Void> batchAdd(@RequestBody List<Type> types) { |
| | | types.forEach(type -> type.setDel_flag(0)); |
| | | |
| | |
| | | } |
| | | |
| | | @DeleteMapping("/{typeId}") |
| | | @ApiOperation(value = "删除类型") |
| | | public ResponseResult<Void> delete(@PathVariable Integer typeId) { |
| | | Type type = new Type(); |
| | | type.setType_id(typeId); |
| | |
| | | } |
| | | |
| | | @PutMapping |
| | | @ApiOperation(value = "更新类型") |
| | | public ResponseResult<Void> update(@RequestBody Type type) { |
| | | boolean success = typeService.updateById(type); |
| | | if (success) { |
| | |
| | | } |
| | | |
| | | @PutMapping("/batch") |
| | | @ApiOperation(value = "批量更新类型") |
| | | public ResponseResult<Void> batchUpdate(@RequestBody List<Type> types) { |
| | | boolean success = typeService.updateBatchById(types); |
| | | if (success) { |
| | |
| | | } |
| | | |
| | | @GetMapping("/{typeId}") |
| | | @ApiOperation(value = "根据ID查询类型") |
| | | public ResponseResult<Type> getById(@PathVariable Integer typeId) { |
| | | Type type = typeService.getById(typeId); |
| | | if (type != null && type.getDel_flag() != 1) { |
| | |
| | | } |
| | | |
| | | @DeleteMapping("/batch") |
| | | @ApiOperation(value = "批量删除类型") |
| | | public ResponseResult<Void> batchDelete(@RequestBody List<Integer> typeIds) { |
| | | List<Type> types = typeIds.stream().map(id -> { |
| | | Type type = new Type(); |
| | |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "查询类型列表,不传页数和大小就查全部") |
| | | public ResponseResult<List<Type>> list( |
| | | @RequestParam(required = false) Integer page, |
| | | @RequestParam(required = false) Integer pageSize) { |