houzhongjian
2024-11-07 a874b928e16320839315b9abcdf2cece1229a424
提交 | 用户 | 时间
cf2287 1 package com.iailab.module.model.mpk.controller.admin;
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.model.mpk.entity.PackEntity;
7 import com.iailab.module.model.mpk.service.PackService;
8 import com.iailab.module.model.mpk.vo.PackPageReqVO;
9 import io.swagger.v3.oas.annotations.Operation;
10 import io.swagger.v3.oas.annotations.tags.Tag;
11 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.web.bind.annotation.*;
13
14 import javax.validation.Valid;
15 import java.util.List;
16
17 import static com.iailab.framework.common.pojo.CommonResult.success;
18
19 /**
20  * @author PanZhibao
21  * @Description
22  * @createTime 2024年11月05日
23  */
24 @Tag(name = "模型服务 - MDK包名管理")
25 @RestController
26 @RequestMapping("/model/mpk/pack")
27 public class PackController {
28
29     @Autowired
30     private PackService packService;
31
32     @GetMapping("/page")
33     @Operation(summary = "获得分页")
34     public CommonResult<PageResult<PackEntity>> page(@Valid PackPageReqVO reqVO) {
35         PageResult<PackEntity> page = packService.page(reqVO);
36         return success(BeanUtils.toBean(page, PackEntity.class));
37     }
38
39     @GetMapping("/list")
40     @Operation(summary = "获得列表")
41     public CommonResult<List<PackEntity>> list() {
42         List<PackEntity> list = packService.list();
43         return success(list);
44     }
45
46     @GetMapping("/get")
47     @Operation(summary = "获得详情")
48     public CommonResult<PackEntity> get(@RequestParam("id") String id) {
49         PackEntity data = packService.get(id);
50         return success(data);
51     }
52
53     @PostMapping("/create")
54     @Operation(summary = "创建")
55     public CommonResult<Boolean> save(@Valid @RequestBody PackEntity entity) {
56         packService.create(entity);
57         return success(true);
58     }
59
60     @PutMapping("/update")
61     @Operation(summary = "更新")
62     public CommonResult<Boolean> update(@Valid @RequestBody PackEntity entity) {
63         packService.update(entity);
64         return success(true);
65     }
66
67     @DeleteMapping("/delete")
68     public CommonResult<Boolean> delete(@RequestParam("id") String id) {
69         packService.delete(id);
70         return success(true);
71     }
72 }