2026-06-30 24681c81c09022f584a57006f2534b5f74723414
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
package cn.iocoder.yudao.module.im.service.channel;
 
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.im.controller.admin.manager.channel.vo.channel.ImChannelPageReqVO;
import cn.iocoder.yudao.module.im.controller.admin.manager.channel.vo.channel.ImChannelSaveReqVO;
import cn.iocoder.yudao.module.im.dal.dataobject.channel.ImChannelDO;
import jakarta.validation.Valid;
 
import java.util.Collection;
import java.util.List;
import java.util.Map;
 
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
 
/**
 * IM 频道 Service 接口
 *
 * @author 芋道源码
 */
public interface ImChannelService {
 
    // ==================== 用户端 ====================
 
    /**
     * 按状态查询频道列表,按 sort 升序
     *
     * @param status 状态;对应 CommonStatusEnum
     * @return 频道列表
     */
    List<ImChannelDO> getChannelListByStatus(Integer status);
 
    /**
     * 按编号批量查询频道
     *
     * @param ids 频道编号列表
     * @return 频道列表
     */
    List<ImChannelDO> getChannelList(Collection<Long> ids);
 
    /**
     * 按编号批量查询频道 Map
     *
     * @param ids 频道编号列表
     * @return id -> 频道 Map
     */
    default Map<Long, ImChannelDO> getChannelMap(Collection<Long> ids) {
        return convertMap(getChannelList(ids), ImChannelDO::getId);
    }
 
    /**
     * 校验频道存在
     *
     * @param id 频道编号
     * @return 频道 DO
     */
    @SuppressWarnings("UnusedReturnValue")
    ImChannelDO validateChannelExists(Long id);
 
    // ==================== 管理后台 ====================
 
    /**
     * 分页查询频道
     *
     * @param reqVO 分页查询条件
     * @return 频道分页
     */
    PageResult<ImChannelDO> getChannelPage(ImChannelPageReqVO reqVO);
 
    /**
     * 获取频道详情
     *
     * @param id 频道编号
     * @return 频道 DO
     */
    ImChannelDO getChannel(Long id);
 
    /**
     * 新增频道
     *
     * @param reqVO 新增请求
     * @return 新增频道编号
     */
    Long createChannel(@Valid ImChannelSaveReqVO reqVO);
 
    /**
     * 修改频道
     *
     * @param reqVO 修改请求
     */
    void updateChannel(@Valid ImChannelSaveReqVO reqVO);
 
    /**
     * 删除频道;频道下有素材或消息时拒绝
     *
     * @param id 频道编号
     */
    void deleteChannel(Long id);
 
}