提交 | 用户 | 时间
|
449017
|
1 |
package com.iailab.module.model.mpk.controller.admin; |
D |
2 |
|
|
3 |
import com.iailab.framework.common.page.PageData; |
|
4 |
import com.iailab.framework.common.pojo.CommonResult; |
|
5 |
import com.iailab.module.model.mpk.dto.MpkFileDTO; |
|
6 |
import com.iailab.module.model.mpk.dto.ProjectDTO; |
|
7 |
import com.iailab.module.model.mpk.dto.ProjectPackageHistoryModelDTO; |
|
8 |
import com.iailab.module.model.mpk.service.ProjectService; |
|
9 |
import org.springframework.beans.factory.annotation.Autowired; |
b425df
|
10 |
import org.springframework.security.access.prepost.PreAuthorize; |
449017
|
11 |
import org.springframework.web.bind.annotation.*; |
D |
12 |
|
|
13 |
import java.util.Date; |
|
14 |
import java.util.HashMap; |
|
15 |
import java.util.List; |
|
16 |
import java.util.Map; |
|
17 |
|
|
18 |
import static com.iailab.framework.common.pojo.CommonResult.success; |
|
19 |
|
|
20 |
|
|
21 |
/** |
|
22 |
* @description: |
|
23 |
* @author: dzd |
|
24 |
* @date: 2024/8/22 14:40 |
|
25 |
**/ |
|
26 |
@RestController |
|
27 |
@RequestMapping("/model/mpk/project") |
|
28 |
public class ProjectController { |
|
29 |
@Autowired |
|
30 |
private ProjectService projectService; |
|
31 |
|
b425df
|
32 |
@PreAuthorize("@ss.hasPermission('mpk:project:query')") |
449017
|
33 |
@GetMapping("page") |
D |
34 |
public CommonResult<PageData<ProjectDTO>> page(@RequestParam Map<String, Object> params){ |
|
35 |
PageData<ProjectDTO> page = projectService.page(params); |
|
36 |
|
|
37 |
return success(page); |
|
38 |
} |
|
39 |
|
b425df
|
40 |
@PreAuthorize("@ss.hasPermission('mpk:project:query')") |
449017
|
41 |
@GetMapping("list") |
D |
42 |
public CommonResult<List<ProjectDTO>> list() { |
|
43 |
List<ProjectDTO> list = projectService.list(new HashMap<>()); |
|
44 |
|
|
45 |
return success(list); |
|
46 |
} |
|
47 |
|
b425df
|
48 |
@PreAuthorize("@ss.hasPermission('mpk:project:query')") |
449017
|
49 |
@GetMapping("{id}") |
D |
50 |
public CommonResult<ProjectDTO> get(@PathVariable("id") String id){ |
|
51 |
ProjectDTO data = projectService.get(id); |
|
52 |
|
|
53 |
return success(data); |
|
54 |
} |
|
55 |
|
b425df
|
56 |
@PreAuthorize("@ss.hasPermission('mpk:project:create')") |
449017
|
57 |
@PostMapping |
b425df
|
58 |
public CommonResult<Boolean> save(@RequestBody ProjectDTO dto){ |
449017
|
59 |
projectService.save(dto); |
D |
60 |
|
b425df
|
61 |
return CommonResult.success(true); |
449017
|
62 |
} |
D |
63 |
|
b425df
|
64 |
@PreAuthorize("@ss.hasPermission('mpk:project:update')") |
449017
|
65 |
@PutMapping |
b425df
|
66 |
public CommonResult<Boolean> update(@RequestBody ProjectDTO dto){ |
449017
|
67 |
dto.setUpdateTime(new Date()); |
D |
68 |
projectService.update(dto); |
|
69 |
|
b425df
|
70 |
return CommonResult.success(true); |
449017
|
71 |
} |
D |
72 |
|
b425df
|
73 |
@PreAuthorize("@ss.hasPermission('mpk:project:delete')") |
449017
|
74 |
@DeleteMapping |
b425df
|
75 |
public CommonResult<Boolean> delete(String id){ |
449017
|
76 |
|
D |
77 |
projectService.delete(id); |
|
78 |
|
b425df
|
79 |
return CommonResult.success(true); |
449017
|
80 |
} |
D |
81 |
|
|
82 |
@GetMapping("getProjectModel") |
|
83 |
public CommonResult<PageData<MpkFileDTO>> getProjectModel(@RequestParam Map<String, Object> params){ |
|
84 |
PageData<MpkFileDTO> page = projectService.getProjectModel(params); |
|
85 |
|
|
86 |
return CommonResult.success(page); |
|
87 |
} |
|
88 |
|
|
89 |
} |