dengzedong
2024-12-24 76743b009ca5ea67557fcab597b332f8d1947813
提交 | 用户 | 时间
818a01 1 package com.iailab.module.system.controller.admin.app;
H 2
3 import com.iailab.framework.common.pojo.CommonResult;
4 import com.iailab.framework.common.pojo.PageResult;
5 import com.iailab.framework.common.util.object.BeanUtils;
6 import com.iailab.module.system.controller.admin.app.vo.*;
7 import com.iailab.module.system.dal.dataobject.app.AppGroupDO;
8 import com.iailab.module.system.service.app.AppGroupService;
9 import io.swagger.v3.oas.annotations.Operation;
10 import io.swagger.v3.oas.annotations.Parameter;
11 import io.swagger.v3.oas.annotations.tags.Tag;
12 import org.springframework.security.access.prepost.PreAuthorize;
13 import org.springframework.web.bind.annotation.*;
14
15 import javax.annotation.Resource;
16 import javax.validation.Valid;
17
18 import java.util.List;
19
20 import static com.iailab.framework.common.pojo.CommonResult.success;
21
22 /**
23  * @author Houzhongjian
24  * @Description
25  * @createTime 2024年09月20日
26  */
27 @Tag(name = "管理后台 - 应用分组")
28 @RestController
29 @RequestMapping("/system/app-group")
30 public class AppGroupController {
31
32     @Resource
33     private AppGroupService appGroupService;
34
35     @PostMapping("/create")
36     @Operation(summary = "创建应用分组")
37     @PreAuthorize("@ss.hasPermission('system:app-group:create')")
38     public CommonResult<Long> createApp(@Valid @RequestBody AppGroupSaveReqVO createReqVO) {
39         return success(appGroupService.create(createReqVO));
40     }
41
42     @PutMapping("/update")
43     @Operation(summary = "更新应用分组")
44     @PreAuthorize("@ss.hasPermission('system:app-group:update')")
45     public CommonResult<Boolean> updateApp(@Valid @RequestBody AppGroupSaveReqVO updateReqVO) {
46         appGroupService.update(updateReqVO);
47         return success(true);
48     }
49
50     @DeleteMapping("/delete")
51     @Operation(summary = "删除应用分组")
52     @Parameter(name = "id", description = "ID", required = true, example = "1024")
53     @PreAuthorize("@ss.hasPermission('system:app-group:delete')")
54     public CommonResult<Boolean> deleteAppGroup(@RequestParam("id") Long id) {
55         appGroupService.delete(id);
56         return success(true);
57     }
58
59     @GetMapping("/get")
60     @Operation(summary = "获得应用分组")
61     @Parameter(name = "id", description = "ID", required = true, example = "1024")
62     @PreAuthorize("@ss.hasPermission('system:app-group:query')")
63     public CommonResult<AppGroupRespVO> getInfo(@RequestParam("id") Long id) {
64         AppGroupDO data = appGroupService.getInfo(id);
65         return success(BeanUtils.toBean(data, AppGroupRespVO.class));
66     }
67
68     @GetMapping("/page")
69     @Operation(summary = "获得分页")
70     @PreAuthorize("@ss.hasPermission('system:app-group:query')")
71     public CommonResult<PageResult<AppGroupRespVO>> getAppGroupPage(@Valid AppGroupPageReqVO pageVO) {
72         PageResult<AppGroupDO> pageResult = appGroupService.getPage(pageVO);
73         return success(BeanUtils.toBean(pageResult, AppGroupRespVO.class));
74     }
75
76     @GetMapping("/getAppGroupList")
77     @Operation(summary = "获得应用分组列表")
78     @PreAuthorize("@ss.hasPermission('system:app-group:query')")
79     public CommonResult<List<AppGroupRespVO>> getAppList() {
80         List<AppGroupDO> appGroupDOS = appGroupService.getList();
81         return success(BeanUtils.toBean(appGroupDOS, AppGroupRespVO.class));
82     }
83 }