whyczh
2021-03-29 9d175aec573808196f738db730edd67db393ecc7
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
package com.whyc.controller;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.whyc.dto.Response;
import com.whyc.pojo.DeviceInf;
import com.whyc.pojo.DeviceType;
import com.whyc.service.DeviceInfService;
import com.whyc.service.DeviceTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
@RestController
@RequestMapping("testConfig")
@Slf4j
@Api(tags = "试验配置")
public class TestConfigController {
    @Autowired
    private DeviceInfService deviceInfService;
    @Autowired
    private DeviceTypeService deviceTypeService;
 
    @PutMapping
    @ApiOperation("加载默认配置参数")
    public Response setDefautlTestConfig(@RequestParam Integer deviceId){
        DeviceInf deviceInf = deviceInfService.getOneByDeviceId(deviceId);
        DeviceType deviceType = deviceTypeService.getOneByDeviceTypeId(deviceInf.getSystemId());
        deviceInf.setLoadStartType(deviceType.getLoadStartType());
        deviceInf.setLoadRuntimeHour(deviceType.getLoadRuntimeHour());
        deviceInf.setLoadRuntimeMin(deviceType.getLoadRuntimeMin());
        deviceInf.setLoadCurrStd(deviceType.getLoadCurrStd());
        deviceInf.setLoadVolStd(deviceType.getLoadVolStd());
        deviceInf.setLoadRpm(deviceType.getLoadRpm());
        deviceInf.setLoadTorque(deviceType.getLoadTorque());
        deviceInf.setLoadPropulsionShaft(deviceType.getLoadPropulsionShaft());
        return deviceInfService.update(deviceInf);
    }
 
 
}