yangys
2024-03-27 e48aa2ac8dea1be5db11c63edf0b912c4ad5ce65
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package com.qianwen.smartman.modules.tool.controller;
 
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.util.List;
import javax.validation.Valid;
import com.qianwen.core.boot.ctrl.BladeController;
import com.qianwen.core.scanner.modular.annotation.DeleteResource;
import com.qianwen.core.scanner.modular.annotation.GetResource;
import com.qianwen.core.scanner.modular.annotation.PostResource;
import com.qianwen.core.scanner.modular.stereotype.ApiResource;
import com.qianwen.core.secure.annotation.PreAuth;
import com.qianwen.core.tool.api.R;
import com.qianwen.smartman.modules.tool.convert.ToolCategoryConvert;
import com.qianwen.smartman.modules.tool.service.IToolCategoryService;
import com.qianwen.smartman.modules.tool.vo.ToolCategoryTreeVO;
import com.qianwen.smartman.modules.tool.vo.ToolCategoryVO;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
 
@Api(value = "刀具类型管理", tags = {"刀具类型管理"})
@ApiResource({"blade-tool/tool-category"})
@RestController
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/tool/controller/ToolCategoryController.class */
public class ToolCategoryController extends BladeController {
    private final IToolCategoryService toolCategoryService;
 
    public ToolCategoryController(final IToolCategoryService toolCategoryService) {
        this.toolCategoryService = toolCategoryService;
    }
 
    @PreAuth
    @GetResource({"/tree"})
    @ApiOperation("刀具类型树")
    public R<List<ToolCategoryTreeVO>> tree() {
        return R.data(this.toolCategoryService.tree());
    }
 
    @PreAuth
    @GetResource({"/list"})
    @ApiOperation("刀具类型列表")
    public R<List<ToolCategoryVO>> list() {
        return R.data(ToolCategoryConvert.INSTANCE.convert(this.toolCategoryService.list()));
    }
 
    @PreAuth
    @PostResource({"/insert"})
    @ApiOperation(value = "刀具类型新增", notes = "传入toolCategoryVO")
    public R<ToolCategoryVO> insert(@Valid @RequestBody ToolCategoryVO toolCategoryVO) {
        return R.data(this.toolCategoryService.save(toolCategoryVO));
    }
 
    @PreAuth
    @DeleteResource({"/remove"})
    @ApiOperation(value = "刀具类型删除", notes = "传入ids")
    public R remove(@ApiParam(value = "主键", required = true) @RequestBody List<Long> ids) {
        if (ids.isEmpty()) {
            return R.status(false);
        }
        return R.status(this.toolCategoryService.remove(ids).booleanValue());
    }
 
    @PreAuth
    @PostResource({"/updateName"})
    @ApiOperation("刀具类型重命名")
    public R<Boolean> updateName(Long id, String newName) {
        return R.data(this.toolCategoryService.updateName(id, newName));
    }
}