提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.module.report.controller.admin.goview; |
H |
2 |
|
|
3 |
import com.iailab.framework.common.pojo.CommonResult; |
|
4 |
import com.iailab.framework.common.pojo.PageParam; |
|
5 |
import com.iailab.framework.common.pojo.PageResult; |
|
6 |
import com.iailab.module.report.controller.admin.goview.vo.project.GoViewProjectCreateReqVO; |
|
7 |
import com.iailab.module.report.controller.admin.goview.vo.project.GoViewProjectRespVO; |
|
8 |
import com.iailab.module.report.controller.admin.goview.vo.project.GoViewProjectUpdateReqVO; |
|
9 |
import com.iailab.module.report.convert.goview.GoViewProjectConvert; |
|
10 |
import com.iailab.module.report.dal.dataobject.goview.GoViewProjectDO; |
|
11 |
import com.iailab.module.report.service.goview.GoViewProjectService; |
|
12 |
import io.swagger.v3.oas.annotations.Operation; |
|
13 |
import io.swagger.v3.oas.annotations.Parameter; |
|
14 |
import io.swagger.v3.oas.annotations.tags.Tag; |
|
15 |
import org.springframework.security.access.prepost.PreAuthorize; |
|
16 |
import org.springframework.validation.annotation.Validated; |
|
17 |
import org.springframework.web.bind.annotation.*; |
|
18 |
|
|
19 |
import javax.annotation.Resource; |
|
20 |
import javax.validation.Valid; |
|
21 |
|
|
22 |
import static com.iailab.framework.common.pojo.CommonResult.success; |
|
23 |
import static com.iailab.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
|
24 |
|
|
25 |
@Tag(name = "管理后台 - GoView 项目") |
|
26 |
@RestController |
|
27 |
@RequestMapping("/report/go-view/project") |
|
28 |
@Validated |
|
29 |
public class GoViewProjectController { |
|
30 |
|
|
31 |
@Resource |
|
32 |
private GoViewProjectService goViewProjectService; |
|
33 |
|
|
34 |
@PostMapping("/create") |
|
35 |
@Operation(summary = "创建项目") |
|
36 |
@PreAuthorize("@ss.hasPermission('report:go-view-project:create')") |
|
37 |
public CommonResult<Long> createProject(@Valid @RequestBody GoViewProjectCreateReqVO createReqVO) { |
|
38 |
return success(goViewProjectService.createProject(createReqVO)); |
|
39 |
} |
|
40 |
|
|
41 |
@PutMapping("/update") |
|
42 |
@Operation(summary = "更新项目") |
|
43 |
@PreAuthorize("@ss.hasPermission('report:go-view-project:update')") |
|
44 |
public CommonResult<Boolean> updateProject(@Valid @RequestBody GoViewProjectUpdateReqVO updateReqVO) { |
|
45 |
goViewProjectService.updateProject(updateReqVO); |
|
46 |
return success(true); |
|
47 |
} |
|
48 |
|
|
49 |
@DeleteMapping("/delete") |
|
50 |
@Operation(summary = "删除 GoView 项目") |
|
51 |
@Parameter(name = "id", description = "编号", required = true, example = "1024") |
|
52 |
@PreAuthorize("@ss.hasPermission('report:go-view-project:delete')") |
|
53 |
public CommonResult<Boolean> deleteProject(@RequestParam("id") Long id) { |
|
54 |
goViewProjectService.deleteProject(id); |
|
55 |
return success(true); |
|
56 |
} |
|
57 |
|
|
58 |
@GetMapping("/get") |
|
59 |
@Operation(summary = "获得项目") |
|
60 |
@Parameter(name = "id", description = "编号", required = true, example = "1024") |
|
61 |
@PreAuthorize("@ss.hasPermission('report:go-view-project:query')") |
|
62 |
public CommonResult<GoViewProjectRespVO> getProject(@RequestParam("id") Long id) { |
|
63 |
GoViewProjectDO project = goViewProjectService.getProject(id); |
|
64 |
return success(GoViewProjectConvert.INSTANCE.convert(project)); |
|
65 |
} |
|
66 |
|
|
67 |
@GetMapping("/my-page") |
|
68 |
@Operation(summary = "获得我的项目分页") |
|
69 |
@PreAuthorize("@ss.hasPermission('report:go-view-project:query')") |
|
70 |
public CommonResult<PageResult<GoViewProjectRespVO>> getMyProjectPage(@Valid PageParam pageVO) { |
|
71 |
PageResult<GoViewProjectDO> pageResult = goViewProjectService.getMyProjectPage( |
|
72 |
pageVO, getLoginUserId()); |
|
73 |
return success(GoViewProjectConvert.INSTANCE.convertPage(pageResult)); |
|
74 |
} |
|
75 |
|
|
76 |
} |