package com.iailab.module.model.mcs.pre.controller.admin;
|
|
import com.iailab.framework.common.pojo.CommonResult;
|
import com.iailab.framework.common.pojo.PageResult;
|
import com.iailab.framework.common.util.object.BeanUtils;
|
import com.iailab.module.model.mcs.pre.entity.MmPredictAlarmConfigEntity;
|
import com.iailab.module.model.mcs.pre.service.MmPredictAlarmConfigService;
|
import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmConfigPageReqVO;
|
import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmConfigRespVO;
|
import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmConfigSaveReqVO;
|
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Parameter;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.validation.Valid;
|
|
import static com.iailab.framework.common.pojo.CommonResult.success;
|
|
/**
|
* @author PanZhibao
|
* @Description
|
* @createTime 2024年11月20日
|
*/
|
@RestController
|
@RequestMapping("/model/pre/alarm-config")
|
public class MmPredictAlarmConfigController {
|
|
@Autowired
|
private MmPredictAlarmConfigService mmPredictAlarmConfigService;
|
|
@PostMapping("/create")
|
@Operation(summary = "创建预警配置")
|
@PreAuthorize("@ss.hasPermission('pre:alarm-config:create')")
|
public CommonResult<Boolean> create(@Valid @RequestBody MmPredictAlarmConfigSaveReqVO createReqVO) {
|
mmPredictAlarmConfigService.create(createReqVO);
|
return success(true);
|
}
|
|
@PutMapping("/update")
|
@Operation(summary = "更新预警配置")
|
@PreAuthorize("@ss.hasPermission('pre:alarm-config:update')")
|
public CommonResult<Boolean> update(@Valid @RequestBody MmPredictAlarmConfigSaveReqVO updateReqVO) {
|
mmPredictAlarmConfigService.update(updateReqVO);
|
return success(true);
|
}
|
|
@DeleteMapping("/delete")
|
@Operation(summary = "删除预警配置")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@PreAuthorize("@ss.hasPermission('pre:alarm-config:delete')")
|
public CommonResult<Boolean> deleteTenant(@RequestParam("id") String id) {
|
mmPredictAlarmConfigService.delete(id);
|
return success(true);
|
}
|
|
@GetMapping("/get/{id}")
|
@Operation(summary = "获得预警配置")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@PreAuthorize("@ss.hasPermission('pre:alarm-config:query')")
|
public CommonResult<MmPredictAlarmConfigRespVO> getInfo(@PathVariable("id") String id) {
|
MmPredictAlarmConfigEntity entity = mmPredictAlarmConfigService.getInfo(id);
|
return success(BeanUtils.toBean(entity, MmPredictAlarmConfigRespVO.class));
|
}
|
|
@GetMapping("/page")
|
@Operation(summary = "获得预警配置分页")
|
@PreAuthorize("@ss.hasPermission('pre:alarm-config:query')")
|
public CommonResult<PageResult<MmPredictAlarmConfigRespVO>> getTenantPage(@Valid MmPredictAlarmConfigPageReqVO pageVO) {
|
PageResult<MmPredictAlarmConfigRespVO> pageResult = mmPredictAlarmConfigService.page(pageVO);
|
return success(BeanUtils.toBean(pageResult, MmPredictAlarmConfigRespVO.class));
|
}
|
}
|