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
100
101
102
103
104
105
106
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.material.ImChannelMaterialPageReqVO;
import cn.iocoder.yudao.module.im.controller.admin.manager.channel.vo.material.ImChannelMaterialSaveReqVO;
import cn.iocoder.yudao.module.im.dal.dataobject.channel.ImChannelMaterialDO;
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 ImChannelMaterialService {
 
    // ==================== 用户端 ====================
 
    /**
     * 校验素材存在
     *
     * @param id 素材编号
     * @return 素材 DO
     */
    ImChannelMaterialDO validateMaterialExists(Long id);
 
    /**
     * 按编号批量查询素材
     *
     * @param ids 素材编号列表
     * @return 素材列表
     */
    List<ImChannelMaterialDO> getMaterialList(Collection<Long> ids);
 
    /**
     * 按编号批量查询素材 Map
     *
     * @param ids 素材编号列表
     * @return id -> 素材 Map
     */
   default Map<Long, ImChannelMaterialDO> getMaterialMap(Collection<Long> ids) {
       return convertMap(getMaterialList(ids), ImChannelMaterialDO::getId);
   }
 
    /**
     * 统计指定频道下的素材数量
     *
     * @param channelId 频道编号
     * @return 数量
     */
    Long getMaterialCountByChannelId(Long channelId);
 
    // ==================== 管理后台 ====================
 
    /**
     * 按频道查询素材精简列表
     *
     * @param channelId 频道编号
     * @return 素材列表
     */
    List<ImChannelMaterialDO> getMaterialListByChannelId(Long channelId);
 
    /**
     * 分页查询素材
     *
     * @param reqVO 分页查询条件
     * @return 素材分页
     */
    PageResult<ImChannelMaterialDO> getMaterialPage(ImChannelMaterialPageReqVO reqVO);
 
    /**
     * 获取素材详情(含 content 富文本)
     *
     * @param id 素材编号
     * @return 素材 DO
     */
    ImChannelMaterialDO getMaterial(Long id);
 
    /**
     * 新增素材
     *
     * @param reqVO 新增请求
     * @return 新增素材编号
     */
    Long createMaterial(@Valid ImChannelMaterialSaveReqVO reqVO);
 
    /**
     * 修改素材
     *
     * @param reqVO 修改请求
     */
    void updateMaterial(@Valid ImChannelMaterialSaveReqVO reqVO);
 
    /**
     * 删除素材;素材已被推送过时拒绝,避免历史消息无法回查
     *
     * @param id 素材编号
     */
    void deleteMaterial(Long id);
 
}