yangys
2024-03-31 53c8d3e3bd3596132b362f20e52aef380d493a84
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
71
72
73
74
75
76
77
package com.qianwen.smartman.modules.system.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.smartman.common.constant.CommonConstant;
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.annotation.PutResource;
import com.qianwen.core.scanner.modular.stereotype.ApiResource;
import com.qianwen.core.tenant.annotation.NonDS;
import com.qianwen.core.tool.api.R;
import com.qianwen.smartman.modules.system.convert.WorkbenchConvert;
import com.qianwen.smartman.modules.system.entity.Workbench;
import com.qianwen.smartman.modules.system.service.IWorkbenchService;
import com.qianwen.smartman.modules.system.vo.WorkbenchVO;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
@Api(value = "工作台", tags = {"工作台"})
@RestController
@ApiResource({"blade-system/workbench"})
@NonDS
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/system/controller/WorkbenchController.class */
public class WorkbenchController {
    private final IWorkbenchService workbenchService;
 
    public WorkbenchController(final IWorkbenchService workbenchService) {
        this.workbenchService = workbenchService;
    }
 
    @ApiOperation(value = "查看所有工作台", notes = "查看所有工作台")
    @GetResource({"/list"})
    public R<List<WorkbenchVO>> list(@RequestParam("status") @ApiParam("status") Integer status) {
        return R.data(this.workbenchService.listWorkbench(status));
    }
 
    @PostResource
    @ApiOperation(value = "增加工作台", notes = "增加工作台")
    public R<Workbench> addWorkbench(@RequestParam("name") @ApiParam("工作台名称") String name) {
        return R.data(this.workbenchService.addWorkbench(name));
    }
 
    @PutResource
    @ApiOperation(value = "编辑工作台", notes = "编辑工作台")
    public R updateWorkbench(@Valid @RequestBody WorkbenchVO workbenchVO) {
        return R.status(this.workbenchService.updateWorkbench(workbenchVO).booleanValue());
    }
 
    @ApiOperation(value = "删除工作台", notes = "删除工作台")
    @DeleteResource
    public R deleteWorkbench(@RequestParam("id") @ApiParam(value = "工作台Id", required = true) Long id) {
        return R.status(this.workbenchService.deleteWorkbench(id).booleanValue());
    }
 
    @ApiOperation(value = "工作台详情", notes = "工作台详情")
    @GetResource({"detailed-workbench"})
    public R<WorkbenchVO> queryWorkbench(@RequestParam("id") @ApiParam(value = "工作台Id", required = true) Long id) {
        return R.data(WorkbenchConvert.INSTANCE.convert((Workbench) this.workbenchService.getById(id)));
    }
 
    @PostResource({"switch-status"})
    @ApiOperation(value = "启动/禁用工作台", notes = "启动/禁用工作台")
    public R openWorkbench(@RequestParam("id") @ApiParam(value = "工作台Id", required = true) Long id, @RequestParam("status") @ApiParam(value = "启用", required = true) Integer status) {
        return R.status(this.workbenchService.switchWorkbench(id, status).booleanValue());
    }
 
    @PutResource({CommonConstant.SORT_FIELD})
    @ApiOperation(value = "排序工作台", notes = "排序工作台")
    public R sortWorkbench(@Valid @RequestBody List<WorkbenchVO> workbenchVOS) {
        return R.status(this.workbenchService.sortWorkbench(workbenchVOS).booleanValue());
    }
}