From 2aa0dd9c34c6be86e70b1d2d939d3660552cb514 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期三, 17 九月 2025 14:44:23 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AssetTypeController.java | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 58 insertions(+), 1 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AssetTypeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AssetTypeController.java index 34f52b3..6d6c444 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AssetTypeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AssetTypeController.java @@ -1,8 +1,25 @@ package com.ruoyi.web.controller.api; - +import com.ruoyi.common.core.domain.R; +import com.ruoyi.system.dto.asset.AssetTypeDTO; +import com.ruoyi.system.service.AssetTypeService; +import com.ruoyi.system.vo.asset.AssetTypeTreeVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; +import java.util.List; /** * <p> @@ -12,9 +29,49 @@ * @author WuGuanFengYue * @since 2025-09-15 */ +@Api(tags = {"资产-资产类型管理相关接口"}) +@Validated @RestController @RequestMapping("/asset-type") +@RequiredArgsConstructor public class AssetTypeController { + private final AssetTypeService assetTypeService; + + @ApiOperation("获取资产类型树形数据") + @GetMapping("/tree") + public R<List<AssetTypeTreeVO>> getAssetTypeTree() { + List<AssetTypeTreeVO> treeData = assetTypeService.getAssetTypeTree(); + return R.ok(treeData); + } + + @ApiOperation("新增资产类型") + @PostMapping("/add") + public R<Void> addAssetType(@Valid @RequestBody AssetTypeDTO dto) { + assetTypeService.addAssetType(dto); + return R.ok(); + } + + @ApiOperation("编辑资产类型") + @PutMapping("/edit") + public R<Void> editAssetType(@Valid @RequestBody AssetTypeDTO dto) { + assetTypeService.editAssetType(dto); + return R.ok(); + } + + @ApiOperation("删除资产类型") + @DeleteMapping("/{id}") + public R<Void> deleteAssetType(@ApiParam(name = "id", value = "资产类型ID", required = true) @PathVariable Integer id) { + assetTypeService.deleteAssetType(id); + return R.ok(); + } + + @ApiOperation("批量删除资产类型") + @PostMapping("/batch-delete") + public R<Void> batchDeleteAssetType(@RequestBody List<Integer> ids) { + assetTypeService.batchDeleteAssetType(ids); + return R.ok(); + } + } -- Gitblit v1.7.1