WeChatContactMsgController.java
4.42 KB
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
package com.linkwechat.web.controller.wecom;
import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.common.utils.poi.ExcelUtil;
import com.linkwechat.wecom.domain.WeChatContactMsg;
import com.linkwechat.wecom.domain.vo.WeChatContactMsgVo;
import com.linkwechat.wecom.service.IWeChatContactMsgService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
/**
* 会话消息Controller
*
* @author ruoyi
* @date 2021-07-28
*/
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/linkwechat/msg" )
public class WeChatContactMsgController extends BaseController {
private final IWeChatContactMsgService iWeChatContactMsgService;
/**
* 查询会话消息列表
*/
@PreAuthorize("@ss.hasPermi('linkwechat:msg:list')")
@GetMapping("/list")
public TableDataInfo list(WeChatContactMsg weChatContactMsg) {
startPage();
List<WeChatContactMsg> list = iWeChatContactMsgService.queryList(weChatContactMsg);
return getDataTable(list);
}
/**
* 导出会话消息列表
*/
@PreAuthorize("@ss.hasPermi('linkwechat:msg:export')" )
@Log(title = "会话消息" , businessType = BusinessType.EXPORT)
@GetMapping("/export" )
public AjaxResult export(WeChatContactMsg weChatContactMsg) {
List<WeChatContactMsg> list = iWeChatContactMsgService.queryList(weChatContactMsg);
ExcelUtil<WeChatContactMsg> util = new ExcelUtil<WeChatContactMsg>(WeChatContactMsg.class);
return util.exportExcel(list, "msg" );
}
/**
* 获取会话消息详细信息
*/
@PreAuthorize("@ss.hasPermi('linkwechat:msg:query')" )
@GetMapping(value = "/{id}" )
public AjaxResult getInfo(@PathVariable("id" ) Long id) {
return AjaxResult.success(iWeChatContactMsgService.getById(id));
}
/**
* 新增会话消息
*/
@PreAuthorize("@ss.hasPermi('linkwechat:msg:add')" )
@Log(title = "会话消息" , businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WeChatContactMsg weChatContactMsg) {
return toAjax(iWeChatContactMsgService.save(weChatContactMsg) ? 1 : 0);
}
/**
* 修改会话消息
*/
@PreAuthorize("@ss.hasPermi('linkwechat:msg:edit')" )
@Log(title = "会话消息" , businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WeChatContactMsg weChatContactMsg) {
return toAjax(iWeChatContactMsgService.updateById(weChatContactMsg) ? 1 : 0);
}
/**
* 删除会话消息
*/
@PreAuthorize("@ss.hasPermi('linkwechat:msg:remove')" )
@Log(title = "会话消息" , businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}" )
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(iWeChatContactMsgService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
}
/**
* 外部联系人/单聊 会话列表
*/
@Log(title = "外部联系人/单聊 会话列表" , businessType = BusinessType.OTHER)
@GetMapping("selectExternalChatList/{fromId}" )
public AjaxResult<List<WeChatContactMsgVo>> selectExternalChatList(@PathVariable("fromId") String fromId) {
return AjaxResult.success(iWeChatContactMsgService.selectExternalChatList(fromId));
}
/**
* 内部联系人 会话列表
*/
@Log(title = "内部联系人 会话列表" , businessType = BusinessType.OTHER)
@GetMapping("selectInternalChatList/{fromId}" )
public AjaxResult<List<WeChatContactMsgVo>> selectInternalChatList(@PathVariable("fromId") String fromId) {
return AjaxResult.success(iWeChatContactMsgService.selectInternalChatList(fromId));
}
/**
* 群聊 会话列表
*/
@Log(title = "群聊 会话列表" , businessType = BusinessType.OTHER)
@GetMapping("selectGroupChatList/{fromId}" )
public AjaxResult<List<WeChatContactMsgVo>> selectGroupChatList(@PathVariable("fromId") String fromId) {
return AjaxResult.success(iWeChatContactMsgService.selectGroupChatList(fromId));
}
}