huang
5 天以前 9571229a2013472dc701ecf5767f2873b36d8f90
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
package com.mes.device.controller;
 
import com.mes.device.service.DeviceControlProfileService;
import com.mes.device.vo.DeviceControlProfile;
import com.mes.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
@RestController
@RequestMapping("device/control")
@Api(tags = "设备控制参数")
@RequiredArgsConstructor
@Validated
public class DeviceControlProfileController {
 
    private final DeviceControlProfileService controlProfileService;
 
    @GetMapping("/{deviceId}")
    @ApiOperation("获取设备控制参数")
    public Result<DeviceControlProfile> getProfile(@PathVariable Long deviceId) {
        return Result.success(controlProfileService.getProfile(deviceId));
    }
 
    @PostMapping("/{deviceId}")
    @ApiOperation("更新设备控制参数")
    public Result<Void> saveProfile(@PathVariable Long deviceId,
                                    @RequestBody DeviceControlProfile profile) {
        controlProfileService.updateProfile(deviceId, profile);
        return Result.success(null);
    }
}