perryhsu
2020-10-14 f803c2a9296bcf3d2dba97b32f40276aa8b83d56
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package com.fgkj.controller;
 
import com.fgkj.mapper.UinfDaoFactory;
import com.fgkj.dto.ServiceModel;
import com.fgkj.dto.User_battgroup_baojigroup;
import com.fgkj.dto.User_log;
import com.fgkj.services.User_battgroup_baojigroupService;
import com.fgkj.services.User_logService;
import com.opensymphony.xwork2.ActionSupport;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
@RequestMapping("baojiGroupBattGroup")
@RestController
@Api
public class User_battgroup_baojigroupController{
 
    @Autowired
    private User_battgroup_baojigroupService service;
    @Autowired
    private User_logService uservice;
 
    // 5.3删除包机组
    @DeleteMapping("/")
    public ServiceModel delete(@RequestBody User_battgroup_baojigroup us) {
        ServiceModel model=service.delete(us);
        {
            String msg="删除"+us.getBaoji_group_name()+"包机组";
            User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Delete, msg);
            uservice.add(ulog);//将用户的操作记录下来
        }
        
        return model;
    }
    
    //5.3根据包机组id查对应的机房和电池组
    @GetMapping("byInfo")
    public ServiceModel serchByInfo(@RequestBody User_battgroup_baojigroup us){
        ServiceModel model=service.serchByInfo(us);
        
        return model;
    }
    
    //5.3根据包机组id查包机组对应的用户
    @GetMapping("byCondition")
    public ServiceModel serchByCondition(@RequestBody User_battgroup_baojigroup us){
        ServiceModel model=service.serchByCondition(us);
        
        return model;
    }
    
     //5.3查所有包机组
    @GetMapping("all")
    public ServiceModel searchAll(){
        ServiceModel model=service.searchAll();
        
        return model;
    }
    
    // 5.3添加新包机组
    @PostMapping("/")
    public ServiceModel add(@RequestBody User_battgroup_baojigroup us) {
        ServiceModel model=service.add(us);
        {
            String msg="添加新的包机组为"+us.getBaoji_group_name();
            User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Increase, msg);
            uservice.add(ulog);//将用户的操作记录下来
        }
        
        return model;
    }
 
    // 5.3修改包机组名
    @PutMapping("/")
    public ServiceModel update(@RequestBody User_battgroup_baojigroup us) {
        ServiceModel model=service.update(us);
        {
            String msg="修改"+us.getBaoji_group_name()+"包机组信息";
            User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Alter, msg);
            uservice.add(ulog);//将用户的操作记录下来
        }
        
        return model;
    }
        
}