whycrzh
2021-01-28 9f05d9863af714b206bdfffe2096d60a942c9d23
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package com.fgkj.controller;
 
import com.fgkj.dto.BattInf;
import com.fgkj.dto.Batt_Devdischarge;
import com.fgkj.dto.ServiceModel;
import com.fgkj.dto.User_log;
import com.fgkj.mapper.UinfDaoFactory;
import com.fgkj.services.Batt_DevdischargeService;
import com.fgkj.services.User_logService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
 
@RequestMapping("battDevDischarge")
@RestController
@Api(tags = "battDevDischarge接口")
public class Batt_DevdischargeController{
 
    @Resource
    private Batt_DevdischargeService service;
    @Resource
    private User_logService uservice;
 
    @PostMapping("/")
    @ApiOperation(notes = "",value="新增")
    public ServiceModel add(@RequestBody Batt_Devdischarge bd){
        // Batt_Devdischarge bd = getGson("yyyy-MM-dd").fromJson(json, Batt_Devdischarge.class);
        ServiceModel model = service.add(bd);
        {
            String msg="添加对"+bd.getDev_name()+"设备的记录";
            User_log ulog= UinfDaoFactory.CreateULog(UinfDaoFactory.Increase, msg);
            uservice.add(ulog);//将用户的操作记录下来
        }
 
        return model;
    }
 
    @PutMapping("/")
    @ApiOperation(notes = "",value="修改")
    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("/")
    @ApiOperation(notes = "",value="删除")
    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")
    @ApiOperation(notes = "",value="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;
    }
 
}