whycrzg
2021-02-23 351b9a53cb9ecebdf8f79db0117f540d9c42c2a4
src/main/java/com/fgkj/controller/BattDischarge_paramController.java
@@ -9,27 +9,31 @@
import com.fgkj.services.BattDischarge_paramService;
import com.fgkj.services.User_logService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@RequestMapping("battDischargeParam")
@RestController
@Api
@Api(tags = "battDischargeParam接口")
public class BattDischarge_paramController{
   @Autowired
   @Resource
   private BattDischarge_paramService service;
   @Autowired
   @Resource
   private User_logService uservice;
   //8.1添加新的参数
   @PostMapping("/")
   @ApiOperation(notes = "{ \"param_name\": \"\", \"preset_time\": 0, \"preset_cap\": 0.0, \"preset_monvol\": 0.0, \"preset_groupvol\": 0.0, \"preset_curr\": 0.0, \"preset_mon\": 0, \"dcvolhighlimit\": 0.0, \"chargecurrset\": 0.0, \"note\": \"tt\", \"plan_circle\": 0, \"plan_rate\": 0 }",value="添加新的参数")
   public ServiceModel add(@RequestBody BattDischarge_param param){
      // BattDischarge_param param = getGson("yyyy-MM-dd").fromJson(json, BattDischarge_param.class);
      ServiceModel model = service.add(param);
      {
      if (model.getCode().equals(1)){
         String msg="添加"+param.getParam_name()+"放电计划参数";
         User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Increase, msg);
         uservice.add(ulog);//将用户的操作记录下来
@@ -37,13 +41,14 @@
      return model;
   }
   //8.1修改参数信息
   @PutMapping("/")
   @ApiOperation(notes = "{ \"num\": 15, \"param_name\": \"\", \"preset_time\": 0, \"preset_cap\": 0.0, \"preset_monvol\": 0.0, \"preset_groupvol\": 0.0, \"preset_curr\": 0.0, \"preset_mon\": 0, \"dcvolhighlimit\": 0.0, \"chargecurrset\": 0.0, \"note\": \"CC\", \"plan_circle\": 0, \"plan_rate\": 0 }",value="修改参数信息")
   public ServiceModel update(@RequestBody BattDischarge_param param){
      // BattDischarge_param param = getGson("yyyy-MM-dd").fromJson(json, BattDischarge_param.class);
      ServiceModel model = service.update(param);
      {
      if (model.getCode().equals(1)){
         String msg="修改"+param.getParam_name()+"放电计划参数";
         User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Alter, msg);
         uservice.add(ulog);//将用户的操作记录下来
@@ -53,8 +58,10 @@
   }
   @DeleteMapping("/")
   public ServiceModel del(@RequestBody BattDischarge_param param){
      // BattDischarge_param param = getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattDischarge_param.class);
   @ApiOperation(notes = "",value="删除")
   public ServiceModel del(@RequestParam Integer num) {
      BattDischarge_param param = new BattDischarge_param();
      param.setNum(num);
      ServiceModel model = service.del(param);
      return model;
@@ -62,15 +69,18 @@
   
   //8.1查询所有的参数
   @GetMapping("all")
   @ApiOperation(notes = "",value="查询所有的参数")
   public ServiceModel searchAll(){
      ServiceModel model = service.searchAll();
      return model;
   }
   @GetMapping("byCondition")
   public ServiceModel serchByCondition(@RequestBody BattDischarge_param param){
      // BattDischarge_param param = getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattDischarge_param.class);
   @PostMapping("byCondition")
   @ApiOperation(notes = "",value="byCondition")
   public ServiceModel serchByCondition(@RequestParam Integer num){
      BattDischarge_param param = new BattDischarge_param();
      param.setNum(num);
      ServiceModel model = service.serchByCondition(param);
      return model;
   }