perryhsu
2020-09-30 3ab47f8fdd1da2c97917c38b2510855d7c3963c4
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
62
63
64
65
package com.fgkj.controller;
 
 
import com.fgkj.dto.BattInf;
import com.fgkj.dto.Batt_Devdischarge;
import com.fgkj.dto.ServiceModel;
import com.fgkj.services.Batt_DevdischargeService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
@RequestMapping("battDevDischarge")
@RestController
@Api
public class Batt_DevdischargeController{
 
    @Autowired
    private Batt_DevdischargeService service;
 
    @PostMapping("/")
    public ServiceModel add(@RequestBody Batt_Devdischarge bd){
        // Batt_Devdischarge bd = getGson("yyyy-MM-dd").fromJson(json, Batt_Devdischarge.class);
        ServiceModel model = service.add(bd);
 
        return model;
    }
 
    @PutMapping("/")
    public ServiceModel update(@RequestBody Batt_Devdischarge bd){
        // Batt_Devdischarge bd = getGson("yyyy-MM-dd").fromJson(json, Batt_Devdischarge.class);
        ServiceModel model = service.update(bd);
 
        return model;
    }
 
    @DeleteMapping("/")
    public ServiceModel del(@RequestBody Batt_Devdischarge bd){
        // Batt_Devdischarge bd = getGson("yyyy-MM-dd").fromJson(json, Batt_Devdischarge.class);
        ServiceModel model = service.del(bd);
 
        return model;
    }
 
    @GetMapping("all")
    public ServiceModel searchAll(){
        ServiceModel model = service.searchAll();
 
        return model;
    }
    
    
    //10.1根据设备id连battinf和batt_devdischarge表
    /*
     * 记录时间放在battinf的battproducer
     * 统计类型放在moncount中:  1:电压,2电流,3功率*/
    @GetMapping("byCondition")
    public ServiceModel serchByCondition(@RequestBody BattInf binf){
        // BattInf binf = getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattInf.class);
        //System.out.println(binf);
        ServiceModel model = service.serchByCondition(binf);
 
        return model;
    }
 
}