提交 | 用户 | 时间
|
b06c21
|
1 |
package com.iailab.module.model.mcs.pre.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.mcs.pre.entity.MmPredictAlarmConfigEntity; |
|
7 |
import com.iailab.module.model.mcs.pre.service.MmPredictAlarmConfigService; |
|
8 |
import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmConfigPageReqVO; |
|
9 |
import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmConfigRespVO; |
|
10 |
import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmConfigSaveReqVO; |
|
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 PanZhibao |
|
23 |
* @Description |
|
24 |
* @createTime 2024年11月20日 |
|
25 |
*/ |
|
26 |
@RestController |
|
27 |
@RequestMapping("/model/pre/alarm-config") |
|
28 |
public class MmPredictAlarmConfigController { |
|
29 |
|
|
30 |
@Autowired |
|
31 |
private MmPredictAlarmConfigService mmPredictAlarmConfigService; |
|
32 |
|
|
33 |
@PostMapping("/create") |
|
34 |
@Operation(summary = "创建预警配置") |
|
35 |
@PreAuthorize("@ss.hasPermission('pre:alarm-config:create')") |
|
36 |
public CommonResult<Boolean> create(@Valid @RequestBody MmPredictAlarmConfigSaveReqVO createReqVO) { |
|
37 |
mmPredictAlarmConfigService.create(createReqVO); |
|
38 |
return success(true); |
|
39 |
} |
|
40 |
|
|
41 |
@PutMapping("/update") |
|
42 |
@Operation(summary = "更新预警配置") |
|
43 |
@PreAuthorize("@ss.hasPermission('pre:alarm-config:update')") |
|
44 |
public CommonResult<Boolean> update(@Valid @RequestBody MmPredictAlarmConfigSaveReqVO updateReqVO) { |
|
45 |
mmPredictAlarmConfigService.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('pre:alarm-config:delete')") |
|
53 |
public CommonResult<Boolean> deleteTenant(@RequestParam("id") String id) { |
|
54 |
mmPredictAlarmConfigService.delete(id); |
|
55 |
return success(true); |
|
56 |
} |
|
57 |
|
5b952f
|
58 |
@GetMapping("/get/{id}") |
b06c21
|
59 |
@Operation(summary = "获得预警配置") |
潘 |
60 |
@Parameter(name = "id", description = "编号", required = true, example = "1024") |
|
61 |
@PreAuthorize("@ss.hasPermission('pre:alarm-config:query')") |
5b952f
|
62 |
public CommonResult<MmPredictAlarmConfigRespVO> getInfo(@PathVariable("id") String id) { |
b06c21
|
63 |
MmPredictAlarmConfigEntity entity = mmPredictAlarmConfigService.getInfo(id); |
潘 |
64 |
return success(BeanUtils.toBean(entity, MmPredictAlarmConfigRespVO.class)); |
|
65 |
} |
|
66 |
|
|
67 |
@GetMapping("/page") |
|
68 |
@Operation(summary = "获得预警配置分页") |
|
69 |
@PreAuthorize("@ss.hasPermission('pre:alarm-config:query')") |
|
70 |
public CommonResult<PageResult<MmPredictAlarmConfigRespVO>> getTenantPage(@Valid MmPredictAlarmConfigPageReqVO pageVO) { |
5b952f
|
71 |
PageResult<MmPredictAlarmConfigRespVO> pageResult = mmPredictAlarmConfigService.page(pageVO); |
b06c21
|
72 |
return success(BeanUtils.toBean(pageResult, MmPredictAlarmConfigRespVO.class)); |
潘 |
73 |
} |
|
74 |
} |