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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package com.fgkj.controller;
 
import com.fgkj.util.*;
 
import com.fgkj.dto.Devstate_usr;
import com.fgkj.dto.ServiceModel;
import com.fgkj.dto.User_inf;
import com.fgkj.services.Devstate_usrService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
@RequestMapping("devStateUsr")
@RestController
@Api
public class Devstate_usrController{
 
    @Autowired
    private Devstate_usrService service;
 
    //添加
    @PostMapping("/")
    public ServiceModel add(@RequestBody Devstate_usr dev_usr) {
        // Devstate_usr dev_usr=getGson().fromJson(json, Devstate_usr.class);
        User_inf uinf = (User_inf)ActionUtil.getUser();
        dev_usr.setUid(uinf.getUId());
        ServiceModel model=service.add(dev_usr);
 
        return model;
        
    }
    
    //修改
    public ServiceModel update(@RequestBody Devstate_usr dev_usr) {
        // Devstate_usr dev_usr=getGson().fromJson(json, Devstate_usr.class);
        User_inf uinf = (User_inf)ActionUtil.getUser();
        dev_usr.setUid(uinf.getUId());
        ServiceModel model=service.update(dev_usr);
 
        return model;
        
    }
    //删除
    public ServiceModel del(@RequestBody Devstate_usr dev_usr) {
        User_inf uinf = (User_inf)ActionUtil.getUser();
        // Devstate_usr dev_usr=getGson().fromJson(json, Devstate_usr.class);
        dev_usr.setUid(uinf.getUId());
        ServiceModel model=service.del(dev_usr);
 
        return model;
        
    }
    //根据用户id查询
    public ServiceModel serchByCondition() {
        User_inf uinf = (User_inf)ActionUtil.getUser();
        Devstate_usr dev_usr = new Devstate_usr();
        dev_usr.setUid(uinf.getUId());
        ServiceModel model=service.serchByCondition(dev_usr);
 
        return model;
        
    }    
    
 
 
}