whycrzg
2021-02-23 351b9a53cb9ecebdf8f79db0117f540d9c42c2a4
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
package com.fgkj.services;
 
import com.fgkj.dto.App_Param;
import com.fgkj.dto.ServiceModel;
import com.fgkj.mapper.impl.App_ParamMapper;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
 
import javax.annotation.Resource;
import java.util.List;
@Service
public class App_ParamService {
 
    @Resource
    private App_ParamMapper mapper;;
 
    ServiceModel model = new ServiceModel();
    
    //根据discharge/charge/poweroff查询
    @GetMapping("byInfo")
    public ServiceModel serchByInfo(App_Param param) {
        ServiceModel model = new ServiceModel();
        List list=mapper.serchByInfo(param);
        if(list!=null&&list.size()>0){
            model.setCode(1);
            model.setMsg("查询成功!");
            model.setData(list);
        }else{
            model.setCode(0);
            model.setMsg("查询失败!");
        }
        //System.out.println(model);
        return model;
    }
    
    
    //修改参数
    @PutMapping("/")
    public ServiceModel update(List<App_Param> params) {
        ServiceModel model = new ServiceModel();
        boolean bl=mapper.updatePro(params)>0;
 
        if(bl){
            model.setCode(1);
            model.setMsg("修改成功!");
        }else{
            model.setCode(0);
            model.setMsg("修改失败!");
        }
        return model;
    }
 
}