package com.sinata.web.controller.backend;
|
|
import com.sinata.common.core.domain.R;
|
import com.sinata.system.domain.dto.MwWarningConfigDTO;
|
import com.sinata.system.domain.vo.MwWarningConfigVO;
|
import com.sinata.system.service.MwWarningConfigService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiParam;
|
import lombok.RequiredArgsConstructor;
|
import org.springframework.validation.annotation.Validated;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import javax.validation.Valid;
|
|
/**
|
* <p>
|
* 预警配置 前端控制器
|
* </p>
|
*
|
* @author mitao
|
* @since 2024-12-02
|
*/
|
@Validated
|
@RestController
|
@Api(tags = {"预警配置相关接口"})
|
@RequiredArgsConstructor
|
@RequestMapping("/backend/mwWarningConfig")
|
public class MwWarningConfigController {
|
private final MwWarningConfigService mwWarningConfigService;
|
|
/**
|
* 保存设置
|
*
|
* @param dto
|
* @return
|
*/
|
@ApiOperation("保存设置")
|
@PostMapping("/save")
|
public R<?> save(@Valid @RequestBody MwWarningConfigDTO dto) {
|
mwWarningConfigService.saveConfig(dto);
|
return R.ok();
|
}
|
|
/**
|
* 根据类型获取配置信息
|
*
|
* @param type
|
* @return
|
*/
|
@ApiOperation("根据类型获取配置信息")
|
@GetMapping("/{type}")
|
public R<MwWarningConfigVO> getByType(@ApiParam(name = "type", value = "配置类型", required = true) @PathVariable("type") Integer type) {
|
return R.ok(mwWarningConfigService.getByType(type));
|
}
|
}
|