提交 | 用户 | 时间
|
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.MmPredictAlarmMessageEntity; |
|
7 |
import com.iailab.module.model.mcs.pre.service.MmPredictAlarmMessageService; |
|
8 |
import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmMessagePageReqVO; |
|
9 |
import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmMessageRespVO; |
|
10 |
import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmMessageSaveReqVO; |
|
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-message") |
|
28 |
public class MmPredictAlarmMessageController { |
|
29 |
|
|
30 |
@Autowired |
|
31 |
private MmPredictAlarmMessageService mmPredictAlarmMessageService; |
|
32 |
|
|
33 |
@PostMapping("/create") |
|
34 |
@Operation(summary = "创建预警消息") |
|
35 |
@PreAuthorize("@ss.hasPermission('pre:alarm-message:create')") |
|
36 |
public CommonResult<Boolean> create(@Valid @RequestBody MmPredictAlarmMessageSaveReqVO createReqVO) { |
|
37 |
mmPredictAlarmMessageService.create(createReqVO); |
|
38 |
return success(true); |
|
39 |
} |
|
40 |
|
|
41 |
@PutMapping("/update") |
|
42 |
@Operation(summary = "更新预警消息") |
|
43 |
@PreAuthorize("@ss.hasPermission('pre:alarm-message:update')") |
|
44 |
public CommonResult<Boolean> update(@Valid @RequestBody MmPredictAlarmMessageSaveReqVO updateReqVO) { |
|
45 |
mmPredictAlarmMessageService.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-message:delete')") |
|
53 |
public CommonResult<Boolean> deleteTenant(@RequestParam("id") String id) { |
|
54 |
mmPredictAlarmMessageService.delete(id); |
|
55 |
return success(true); |
|
56 |
} |
|
57 |
|
|
58 |
@GetMapping("/get") |
|
59 |
@Operation(summary = "获得预警消息") |
|
60 |
@Parameter(name = "id", description = "编号", required = true, example = "1024") |
|
61 |
@PreAuthorize("@ss.hasPermission('pre:alarm-message:query')") |
|
62 |
public CommonResult<MmPredictAlarmMessageRespVO> getInfo(@RequestParam("id") String id) { |
|
63 |
MmPredictAlarmMessageEntity entity = mmPredictAlarmMessageService.getInfo(id); |
|
64 |
return success(BeanUtils.toBean(entity, MmPredictAlarmMessageRespVO.class)); |
|
65 |
} |
|
66 |
|
|
67 |
@GetMapping("/page") |
|
68 |
@Operation(summary = "获得预警消息分页") |
|
69 |
@PreAuthorize("@ss.hasPermission('pre:alarm-message:query')") |
|
70 |
public CommonResult<PageResult<MmPredictAlarmMessageRespVO>> getTenantPage(@Valid MmPredictAlarmMessagePageReqVO pageVO) { |
|
71 |
PageResult<MmPredictAlarmMessageEntity> pageResult = mmPredictAlarmMessageService.page(pageVO); |
|
72 |
return success(BeanUtils.toBean(pageResult, MmPredictAlarmMessageRespVO.class)); |
|
73 |
} |
|
74 |
} |