MCPcopy Create free account
hub / github.com/bsxj97/flower-mall / ChatController

Class ChatController

src/main/java/com/controller/ChatController.java:46–233  ·  view source on GitHub ↗

在线客服 后端接口 @author @email @date 2021-03-20 11:33:21

Source from the content-addressed store, hash-verified

44 * @date 2021-03-20 11:33:21
45 */
46@RestController
47@RequestMapping("/chat")
48public class ChatController {
49 @Autowired
50 private ChatService chatService;
51
52
53
54 /**
55 * 后端列表
56 */
57 @RequestMapping("/page")
58 public R page(@RequestParam Map<String, Object> params,ChatEntity chat,
59 HttpServletRequest request){
60 if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
61 chat.setUserid((Long)request.getSession().getAttribute("userId"));
62 }
63
64 EntityWrapper<ChatEntity> ew = new EntityWrapper<ChatEntity>();
65 PageUtils page = chatService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, chat), params), params));
66 return R.ok().put("data", page);
67 }
68
69 /**
70 * 前端列表
71 */
72 @RequestMapping("/list")
73 public R list(@RequestParam Map<String, Object> params,ChatEntity chat, HttpServletRequest request){
74 if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
75 chat.setUserid((Long)request.getSession().getAttribute("userId"));
76 }
77
78 EntityWrapper<ChatEntity> ew = new EntityWrapper<ChatEntity>();
79 PageUtils page = chatService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, chat), params), params));
80 return R.ok().put("data", page);
81 }
82
83 /**
84 * 列表
85 */
86 @RequestMapping("/lists")
87 public R list( ChatEntity chat){
88 EntityWrapper<ChatEntity> ew = new EntityWrapper<ChatEntity>();
89 ew.allEq(MPUtil.allEQMapPre( chat, "chat"));
90 return R.ok().put("data", chatService.selectListView(ew));
91 }
92
93 /**
94 * 查询
95 */
96 @RequestMapping("/query")
97 public R query(ChatEntity chat){
98 EntityWrapper< ChatEntity> ew = new EntityWrapper< ChatEntity>();
99 ew.allEq(MPUtil.allEQMapPre( chat, "chat"));
100 ChatView chatView = chatService.selectView(ew);
101 return R.ok("查询在线客服成功").put("data", chatView);
102 }
103

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected