潘志宝
2024-12-10 a440ec3bfaa1363f5841100b8948d852971a2eb1
提交 | 用户 | 时间
5b952f 1 package com.iailab.module.model.mcs.pre.controller.admin;
L 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.mcs.pre.entity.MmItemAccuracyHisEntity;
7 import com.iailab.module.model.mcs.pre.service.MmItemAccuracyHisService;
8 import com.iailab.module.model.mcs.pre.vo.MmItemAccuracyHisPageReqVO;
9 import com.iailab.module.model.mcs.pre.vo.MmItemAccuracyHisRespVO;
10 import com.iailab.module.model.mcs.pre.vo.MmItemAccuracyHisSaveReqVO;
11 import io.swagger.v3.oas.annotations.Operation;
12 import io.swagger.v3.oas.annotations.Parameter;
13 import org.springframework.beans.factory.annotation.Autowired;
14 import org.springframework.security.access.prepost.PreAuthorize;
15 import org.springframework.web.bind.annotation.*;
16
17 import javax.validation.Valid;
18
19 import static com.iailab.framework.common.pojo.CommonResult.success;
20
21 /**
22  * @author lirm
23  * @Description
24  * @createTime 2024年11月25日
25  */
26 @RestController
27 @RequestMapping("/model/item/accuracy-his")
28 public class MmItemAccuracyHisController {
29
30     @Autowired
31     private MmItemAccuracyHisService mmItemAccuracyHisService;
32
33     @PostMapping("/create")
34     @Operation(summary = "创建预测精准度历史配置")
35     @PreAuthorize("@ss.hasPermission('item:accuracy-his:create')")
36     public CommonResult<Boolean> create(@Valid @RequestBody MmItemAccuracyHisSaveReqVO createReqVO) {
37         mmItemAccuracyHisService.create(createReqVO);
38         return success(true);
39     }
40
41     @PutMapping("/update")
42     @Operation(summary = "更新预测精准度历史配置")
43     @PreAuthorize("@ss.hasPermission('item:accuracy-his:update')")
44     public CommonResult<Boolean> update(@Valid @RequestBody MmItemAccuracyHisSaveReqVO updateReqVO) {
45         mmItemAccuracyHisService.update(updateReqVO);
46         return success(true);
47     }
48
49     @DeleteMapping("/delete")
50     @Operation(summary = "删除预测精准度历史配置")
51     @Parameter(name = "id", description = "编号", required = true, example = "1024")
52     @PreAuthorize("@ss.hasPermission('item:accuracy-his:delete')")
53     public CommonResult<Boolean> deleteTenant(@RequestParam("id") String id) {
54         mmItemAccuracyHisService.delete(id);
55         return success(true);
56     }
57
58     @GetMapping("/get/{id}")
59     @Operation(summary = "获得预测精准度历史配置")
60     @Parameter(name = "id", description = "编号", required = true, example = "1024")
61     @PreAuthorize("@ss.hasPermission('item:accuracy-his:query')")
62     public CommonResult<MmItemAccuracyHisRespVO> getInfo(@PathVariable("id") String id) {
63         MmItemAccuracyHisEntity entity = mmItemAccuracyHisService.getInfo(id);
64         return success(BeanUtils.toBean(entity, MmItemAccuracyHisRespVO.class));
65     }
66
67     @GetMapping("/page")
68     @Operation(summary = "获得预测精准度历史配置分页")
69     @PreAuthorize("@ss.hasPermission('item:accuracy-his:query')")
70     public CommonResult<PageResult<MmItemAccuracyHisRespVO>> getTenantPage(@Valid MmItemAccuracyHisPageReqVO pageVO) {
71         PageResult<MmItemAccuracyHisEntity> pageResult = mmItemAccuracyHisService.page(pageVO);
72         return success(BeanUtils.toBean(pageResult, MmItemAccuracyHisRespVO.class));
73     }
74 }