潘志宝
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.MmItemAccuracyRateEntity;
7 import com.iailab.module.model.mcs.pre.service.MmItemAccuracyRateService;
8 import com.iailab.module.model.mcs.pre.vo.MmItemAccuracyRatePageReqVO;
9 import com.iailab.module.model.mcs.pre.vo.MmItemAccuracyRateRespVO;
10 import com.iailab.module.model.mcs.pre.vo.MmItemAccuracyRateSaveReqVO;
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-rate")
28 public class MmItemAccuracyRateController {
29
30     @Autowired
31     private MmItemAccuracyRateService mmItemAccuracyRateService;
32
33     @PostMapping("/create")
34     @Operation(summary = "创建预测精准度配置")
35     @PreAuthorize("@ss.hasPermission('item:accuracy-rate:create')")
36     public CommonResult<Boolean> create(@Valid @RequestBody MmItemAccuracyRateSaveReqVO createReqVO) {
37         mmItemAccuracyRateService.create(createReqVO);
38         return success(true);
39     }
40
41     @PutMapping("/update")
42     @Operation(summary = "更新预测精准度配置")
43     @PreAuthorize("@ss.hasPermission('item:accuracy-rate:update')")
44     public CommonResult<Boolean> update(@Valid @RequestBody MmItemAccuracyRateSaveReqVO updateReqVO) {
45         mmItemAccuracyRateService.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-rate:delete')")
53     public CommonResult<Boolean> deleteTenant(@RequestParam("id") String id) {
54         mmItemAccuracyRateService.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-rate:query')")
62     public CommonResult<MmItemAccuracyRateRespVO> getInfo(@PathVariable("id") String id) {
63         MmItemAccuracyRateEntity entity = mmItemAccuracyRateService.getInfo(id);
64         return success(BeanUtils.toBean(entity, MmItemAccuracyRateRespVO.class));
65     }
66
67     @GetMapping("/page")
68     @Operation(summary = "获得预测精准度配置分页")
69     @PreAuthorize("@ss.hasPermission('item:accuracy-rate:query')")
70     public CommonResult<PageResult<MmItemAccuracyRateRespVO>> getTenantPage(@Valid MmItemAccuracyRatePageReqVO pageVO) {
71         PageResult<MmItemAccuracyRateEntity> pageResult = mmItemAccuracyRateService.page(pageVO);
72         return success(BeanUtils.toBean(pageResult, MmItemAccuracyRateRespVO.class));
73     }
74 }