From e7c5c8c6768e018b17a766d7481f13300b7cd5a8 Mon Sep 17 00:00:00 2001 From: huliguo <2023611923@qq.com> Date: 星期三, 09 七月 2025 18:54:48 +0800 Subject: [PATCH] 新增 --- src/main/java/com/linghu/controller/TypeController.java | 18 ++++++------------ 1 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/linghu/controller/TypeController.java b/src/main/java/com/linghu/controller/TypeController.java index f3c99e9..9296c81 100644 --- a/src/main/java/com/linghu/controller/TypeController.java +++ b/src/main/java/com/linghu/controller/TypeController.java @@ -44,23 +44,17 @@ @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") -- Gitblit v1.7.1