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 org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
|
@RequestMapping("battDevDischarge")
|
@RestController
|
@Api
|
public class Batt_DevdischargeController{
|
|
@Resource
|
private Batt_DevdischargeService service;
|
@Resource
|
private User_logService uservice;
|
|
@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);
|
{
|
String msg="添加对"+bd.getDev_name()+"设备的记录";
|
User_log ulog= UinfDaoFactory.CreateULog(UinfDaoFactory.Increase, msg);
|
uservice.add(ulog);//将用户的操作记录下来
|
}
|
|
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;
|
}
|
|
}
|