perryhsu
2020-10-17 a543f4de1c91ef6f43aace92975c6cf28de23618
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
package com.fgkj.controller;
 
import com.fgkj.util.*;
 
import com.fgkj.dto.Batt_param_low;
import com.fgkj.dto.ServiceModel;
import com.fgkj.dto.UserRole;
import com.fgkj.services.Batt_param_lowService;
import com.google.gson.Gson;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
@RequestMapping("battParamLow")
@RestController
@Api
public class Batt_param_lowController{
 
    @Autowired
    private Batt_param_lowService service;
 
    private ServiceModel model;
 
    // private Batt_param_low blow;
    // private String blowstr;
 
    @GetMapping("all")
    public ServiceModel searchAll(){
        model=service.searchAll();
        //System.out.println(result);
        return model;
    }
 
    @PutMapping("all")
    public ServiceModel updateAll(@RequestBody List<Batt_param_low> list){
        Gson gson=new Gson();
        UserRole u=new UserRole();
        // List<Batt_param_low> list = gson.fromJson(blowstr, new TypeToken<List<Batt_param_low>>(){}.getType());
        for(int i=0;i<list.size();i++){
            model=service.update(list.get(i));
        }
        return model;
    }
}