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);
|
}
|
|
|
}
|