mitao
2025-04-04 d89a42213b4a32535e93185dedf41fe7a7fc1940
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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));
    }
}