kaiyu
2021-06-11 2c9b203b574069ada650fd9e53115ed665adbc24
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
package com.moral.api.controller;
 
import com.alibaba.fastjson.JSON;
import com.moral.api.entity.DeviceAdjustValue;
import com.moral.api.service.DeviceAdjustValueService;
import com.moral.constant.ResultMessage;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.Map;
 
@Slf4j
@Api(tags = {"校准值"})
@RestController
@RequestMapping("/deviceAdjustValue")
public class DeviceAdjustValueController {
 
    @Resource
    private DeviceAdjustValueService deviceAdjustValueService;
 
    @RequestMapping(value = "insertOneDeviceAdjustValue", method = RequestMethod.POST)
    @ResponseBody
    public ResultMessage insertOneDeviceAdjustValue(@RequestBody DeviceAdjustValue deviceAdjustValue) {
        //DeviceAdjustValue deviceAdjustValue = JSON.parseObject(JSON.toJSONString(parameters), DeviceAdjustValue.class);
        Map<String,Object> resultMap = deviceAdjustValueService.insertOne(deviceAdjustValue);
        String msg = resultMap.get("msg").toString();
        int code = Integer.parseInt(resultMap.get("code").toString());
        if (code == 0){
            return ResultMessage.ok(msg);
        }
        return ResultMessage.fail(Integer.parseInt(resultMap.get("code").toString()),resultMap.get("msg").toString());
    }
 
}