提交 | 用户 | 时间
|
5f25e3
|
1 |
package com.iailab.module.system.controller.admin.app; |
潘 |
2 |
|
|
3 |
import com.iailab.framework.apilog.core.annotation.ApiAccessLog; |
|
4 |
import com.iailab.framework.common.pojo.CommonResult; |
|
5 |
import com.iailab.framework.common.pojo.PageParam; |
|
6 |
import com.iailab.framework.common.pojo.PageResult; |
|
7 |
import com.iailab.framework.common.util.object.BeanUtils; |
|
8 |
import com.iailab.framework.excel.core.util.ExcelUtils; |
818a01
|
9 |
import com.iailab.module.system.api.app.dto.AppMenuRespDTO; |
5f25e3
|
10 |
import com.iailab.module.system.controller.admin.app.vo.AppPageReqVO; |
潘 |
11 |
import com.iailab.module.system.controller.admin.app.vo.AppRespVO; |
|
12 |
import com.iailab.module.system.controller.admin.app.vo.AppSaveReqVO; |
7da8f1
|
13 |
import com.iailab.module.system.controller.admin.auth.vo.AuthPermissionInfoRespVO; |
5f25e3
|
14 |
import com.iailab.module.system.dal.dataobject.app.AppDO; |
潘 |
15 |
import com.iailab.module.system.service.app.AppService; |
|
16 |
import io.swagger.v3.oas.annotations.Operation; |
|
17 |
import io.swagger.v3.oas.annotations.Parameter; |
|
18 |
import io.swagger.v3.oas.annotations.tags.Tag; |
|
19 |
import org.springframework.beans.factory.annotation.Autowired; |
|
20 |
import org.springframework.security.access.prepost.PreAuthorize; |
|
21 |
import org.springframework.web.bind.annotation.*; |
|
22 |
|
|
23 |
import javax.servlet.http.HttpServletResponse; |
|
24 |
import javax.validation.Valid; |
|
25 |
|
|
26 |
import java.io.IOException; |
|
27 |
import java.util.List; |
|
28 |
|
|
29 |
import static com.iailab.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
|
30 |
import static com.iailab.framework.common.pojo.CommonResult.success; |
|
31 |
|
|
32 |
@Tag(name = "管理后台 - 应用管理") |
|
33 |
@RestController |
|
34 |
@RequestMapping("/system/app") |
|
35 |
public class AppController { |
|
36 |
|
|
37 |
@Autowired |
|
38 |
private AppService appService; |
|
39 |
|
|
40 |
@PostMapping("/create") |
|
41 |
@Operation(summary = "创建应用") |
|
42 |
@PreAuthorize("@ss.hasPermission('system:app:create')") |
|
43 |
public CommonResult<Long> createApp(@Valid @RequestBody AppSaveReqVO createReqVO) { |
|
44 |
return success(appService.create(createReqVO)); |
|
45 |
} |
|
46 |
|
|
47 |
@PutMapping("/update") |
|
48 |
@Operation(summary = "更新应用") |
|
49 |
@PreAuthorize("@ss.hasPermission('system:app:update')") |
|
50 |
public CommonResult<Boolean> updateApp(@Valid @RequestBody AppSaveReqVO updateReqVO) { |
|
51 |
appService.update(updateReqVO); |
|
52 |
return success(true); |
|
53 |
} |
|
54 |
|
|
55 |
@DeleteMapping("/delete") |
|
56 |
@Operation(summary = "删除应用") |
|
57 |
@Parameter(name = "id", description = "ID", required = true, example = "1024") |
|
58 |
@PreAuthorize("@ss.hasPermission('system:app:delete')") |
|
59 |
public CommonResult<Boolean> deleteApp(@RequestParam("id") Long id) { |
|
60 |
appService.delete(id); |
|
61 |
return success(true); |
|
62 |
} |
|
63 |
|
|
64 |
@GetMapping("/get") |
|
65 |
@Operation(summary = "获得应用") |
|
66 |
@Parameter(name = "id", description = "ID", required = true, example = "1024") |
|
67 |
@PreAuthorize("@ss.hasPermission('system:app:query')") |
|
68 |
public CommonResult<AppRespVO> getTenant(@RequestParam("id") Long id) { |
|
69 |
AppDO data = appService.getInfo(id); |
|
70 |
return success(BeanUtils.toBean(data, AppRespVO.class)); |
|
71 |
} |
|
72 |
|
|
73 |
@GetMapping("/page") |
256352
|
74 |
@Operation(summary = "获得分页") |
5f25e3
|
75 |
@PreAuthorize("@ss.hasPermission('system:app:query')") |
818a01
|
76 |
public CommonResult<PageResult<AppRespVO>> getAppPage(@Valid AppPageReqVO pageVO) { |
5f25e3
|
77 |
PageResult<AppDO> pageResult = appService.getPage(pageVO); |
潘 |
78 |
return success(BeanUtils.toBean(pageResult, AppRespVO.class)); |
|
79 |
} |
|
80 |
|
818a01
|
81 |
@GetMapping("/getAppList") |
H |
82 |
@Operation(summary = "获得应用列表") |
|
83 |
@PreAuthorize("@ss.hasPermission('system:app-menu:query')") |
|
84 |
public CommonResult<List<AppRespVO>> getAppList() { |
|
85 |
List<AppDO> appDOS = appService.getList(); |
|
86 |
return success(BeanUtils.toBean(appDOS, AppRespVO.class)); |
|
87 |
} |
|
88 |
|
7da8f1
|
89 |
@GetMapping("/getAppMenu") |
H |
90 |
@Operation(summary = "获得应用菜单列表") |
|
91 |
@PreAuthorize("@ss.hasPermission('system:app-menu:query')") |
|
92 |
@Parameter(name = "id", description = "ID", required = true, example = "1024") |
|
93 |
public CommonResult<List<AppRespVO>> getAppMenu(@RequestParam("id") Long id) { |
|
94 |
List<AuthPermissionInfoRespVO.MenuVO> appDOS = appService.getAppMenu(id); |
|
95 |
return success(BeanUtils.toBean(appDOS, AppRespVO.class)); |
|
96 |
} |
818a01
|
97 |
|
5f25e3
|
98 |
@GetMapping("/export-excel") |
潘 |
99 |
@Operation(summary = "导出租户 Excel") |
|
100 |
@PreAuthorize("@ss.hasPermission('system:tenant:export')") |
|
101 |
@ApiAccessLog(operateType = EXPORT) |
|
102 |
public void exportTenantExcel(@Valid AppPageReqVO exportReqVO, |
|
103 |
HttpServletResponse response) throws IOException { |
|
104 |
exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
|
105 |
List<AppDO> list = appService.getPage(exportReqVO).getList(); |
|
106 |
// 导出 Excel |
|
107 |
ExcelUtils.write(response, "租户.xls", "数据", AppRespVO.class, |
|
108 |
BeanUtils.toBean(list, AppRespVO.class)); |
|
109 |
} |
|
110 |
} |