潘志宝
2024-09-12 27e7299964b861c079dbb2826edab00dfd6dc27d
提交 | 用户 | 时间
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;
10 import org.springframework.web.bind.annotation.*;
11
12 import java.util.Date;
13 import java.util.HashMap;
14 import java.util.List;
15 import java.util.Map;
16
17 import static com.iailab.framework.common.pojo.CommonResult.success;
18
19
20 /**
21  * @description:
22  * @author: dzd
23  * @date: 2024/8/22 14:40
24  **/
25 @RestController
26 @RequestMapping("/model/mpk/project")
27 public class ProjectController {
28     @Autowired
29     private ProjectService projectService;
30
31     @GetMapping("page")
32     public CommonResult<PageData<ProjectDTO>> page(@RequestParam Map<String, Object> params){
33         PageData<ProjectDTO> page = projectService.page(params);
34
35         return success(page);
36     }
37
38     @GetMapping("list")
39     public CommonResult<List<ProjectDTO>> list() {
40         List<ProjectDTO> list = projectService.list(new HashMap<>());
41
42         return success(list);
43     }
44
45     @GetMapping("{id}")
46     public CommonResult<ProjectDTO> get(@PathVariable("id") String id){
47         ProjectDTO data = projectService.get(id);
48
49         return success(data);
50     }
51
52     @PostMapping
53     public CommonResult save(@RequestBody ProjectDTO dto){
54         projectService.save(dto);
55
56         return CommonResult.success();
57     }
58
59     @PutMapping
60     public CommonResult update(@RequestBody ProjectDTO dto){
61         dto.setUpdateTime(new Date());
62         projectService.update(dto);
63
64         return CommonResult.success();
65     }
66
67     @DeleteMapping
68     public CommonResult delete(String id){
69
70         projectService.delete(id);
71
72         return CommonResult.success();
73     }
74
75     @GetMapping("getProjectModel")
76     public CommonResult<PageData<MpkFileDTO>> getProjectModel(@RequestParam Map<String, Object> params){
77         PageData<MpkFileDTO> page = projectService.getProjectModel(params);
78
79         return CommonResult.success(page);
80     }
81
82 }