puzhibing
2023-06-13 11b4c2cf16ff93e4e4955f88db3ae9c28d6f7782
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
package com.dsh.guns.modular.system.controller.general;
 
import com.dsh.course.feignClient.activity.TUserClinet;
import com.dsh.guns.config.UserExt;
import com.dsh.guns.core.base.controller.BaseController;
import com.dsh.guns.core.log.LogObjectHolder;
import com.dsh.guns.modular.system.model.TbUserExit;
import com.dsh.guns.modular.system.service.ITbUserExitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
 
/**
 * 控制器
 *
 * @author fengshuonan
 * @Date 2022-06-17 14:43:39
 */
@Controller
@RequestMapping("/userExit")
public class TUserExitController extends BaseController {
 
    private String PREFIX = "/system/tUserExit/";
 
    @Autowired
    private ITbUserExitService tbUserExitService;
 
    @Autowired
    private TUserClinet tUserClinet;
 
    /**
     * 跳转到首页
     */
    @RequestMapping("")
    public String index(Model model)
    {
        Integer language = UserExt.getLanguage();
        model.addAttribute("language",language);
        return PREFIX + "tbUserExit.html";
    }
 
    /**
     * 跳转到添加
     */
    @RequestMapping("/tbUserExit_add")
    public String tbUserExitAdd() {
        return PREFIX + "tbUserExit_add.html";
    }
 
    /**
     * 跳转到修改
     */
    @RequestMapping("/tbUserExit_update/{tbUserExitId}")
    public String tbUserExitUpdate(@PathVariable Integer tbUserExitId, Model model) {
        TbUserExit tbUserExit = tbUserExitService.getById(tbUserExitId);
        model.addAttribute("item", tbUserExit);
        LogObjectHolder.me().set(tbUserExit);
        return PREFIX + "tbUserExit_edit.html";
    }
 
    /**
     * 获取列表
     */
    @RequestMapping(value = "/list")
    @ResponseBody
    public List<TbUserExit> list(String time, String name, Integer state) {
        return tbUserExitService.getList(time, name, state);
    }
 
 
    @RequestMapping(value = "/userExit")
    @ResponseBody
    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public Object userExit(Integer id, String text) {
        TbUserExit byId = tbUserExitService.getById(id);
        byId.setState(2);
        byId.setRemark(text);
        tbUserExitService.updateById(byId);
        tUserClinet.userExit(byId.getUserId());
        return SUCCESS_TIP;
    }
 
    /**
     * 新增
     */
 
    /**
     * 删除
     */
    @RequestMapping(value = "/delete")
    @ResponseBody
    public Object delete(@RequestParam Integer TUserExitId) {
        TbUserExit byId = tbUserExitService.getById(TUserExitId);
        byId.setState(3);
        tbUserExitService.updateById(byId);
        return SUCCESS_TIP;
    }
 
    @RequestMapping(value = "/start")
    @ResponseBody
    public Object start(@RequestParam Integer TUserExitId) {
        TbUserExit byId = tbUserExitService.getById(TUserExitId);
        byId.setState(1);
        tbUserExitService.updateById(byId);
        return SUCCESS_TIP;
    }
 
    @RequestMapping(value = "/stop")
    @ResponseBody
    public Object stop(@RequestParam Integer TUserExitId) {
        TbUserExit byId = tbUserExitService.getById(TUserExitId);
        byId.setState(2);
        tbUserExitService.updateById(byId);
        return SUCCESS_TIP;
    }
 
    /**
     * 修改
     */
    @RequestMapping(value = "/update")
    @ResponseBody
    public Object update(TbUserExit tbUserExit) {
        tbUserExitService.updateById(tbUserExit);
        return SUCCESS_TIP;
    }
 
    /**
     * 详情
     */
    @RequestMapping(value = "/detail/{tbUserExitId}")
    @ResponseBody
    public Object detail(@PathVariable("tbUserExitId") Integer tbUserExitId) {
        return tbUserExitService.getById(tbUserExitId);
    }
 
 
    @ResponseBody
    @RequestMapping(value = "/saveUserExit")
    public void saveUserExit(@RequestBody TbUserExit tbUserExit) {
        tbUserExitService.save(tbUserExit);
    }
 
 
}