Commit ee9362a2f256c0e0f4d9001ccd210e80904abcd6
1 parent
6bfaa848
✨ feat(im): 继续优化频道的各种代码(v3)
Showing
4 changed files
with
29 additions
and
0 deletions
yudao-module-im/src/main/java/cn/iocoder/yudao/module/im/controller/admin/manager/channel/ImChannelMaterialManagerController.java
| ... | ... | @@ -88,4 +88,12 @@ public class ImChannelMaterialManagerController { |
| 88 | 88 | return success(BeanUtils.toBean(material, ImChannelMaterialRespVO.class)); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | + @GetMapping("/simple-list") | |
| 92 | + @Operation(summary = "获得指定频道下的素材精简列表;用于推送弹窗的素材下拉") | |
| 93 | + @Parameter(name = "channelId", description = "频道编号", required = true, example = "1") | |
| 94 | + public CommonResult<List<ImChannelMaterialRespVO>> getSimpleMaterialList(@RequestParam("channelId") Long channelId) { | |
| 95 | + List<ImChannelMaterialDO> list = channelMaterialService.getMaterialListByChannelId(channelId); | |
| 96 | + return success(BeanUtils.toBean(list, ImChannelMaterialRespVO.class)); | |
| 97 | + } | |
| 98 | + | |
| 91 | 99 | } | ... | ... |
yudao-module-im/src/main/java/cn/iocoder/yudao/module/im/dal/mysql/channel/ImChannelMaterialMapper.java
| ... | ... | @@ -7,6 +7,8 @@ import cn.iocoder.yudao.module.im.controller.admin.manager.channel.vo.material.I |
| 7 | 7 | import cn.iocoder.yudao.module.im.dal.dataobject.channel.ImChannelMaterialDO; |
| 8 | 8 | import org.apache.ibatis.annotations.Mapper; |
| 9 | 9 | |
| 10 | +import java.util.List; | |
| 11 | + | |
| 10 | 12 | /** |
| 11 | 13 | * IM 频道素材 Mapper |
| 12 | 14 | * |
| ... | ... | @@ -19,6 +21,12 @@ public interface ImChannelMaterialMapper extends BaseMapperX<ImChannelMaterialDO |
| 19 | 21 | return selectCount(ImChannelMaterialDO::getChannelId, channelId); |
| 20 | 22 | } |
| 21 | 23 | |
| 24 | + default List<ImChannelMaterialDO> selectListByChannelId(Long channelId) { | |
| 25 | + return selectList(new LambdaQueryWrapperX<ImChannelMaterialDO>() | |
| 26 | + .eq(ImChannelMaterialDO::getChannelId, channelId) | |
| 27 | + .orderByDesc(ImChannelMaterialDO::getId)); | |
| 28 | + } | |
| 29 | + | |
| 22 | 30 | default PageResult<ImChannelMaterialDO> selectPage(ImChannelMaterialPageReqVO reqVO) { |
| 23 | 31 | return selectPage(reqVO, new LambdaQueryWrapperX<ImChannelMaterialDO>() |
| 24 | 32 | .eqIfPresent(ImChannelMaterialDO::getChannelId, reqVO.getChannelId()) | ... | ... |
yudao-module-im/src/main/java/cn/iocoder/yudao/module/im/service/channel/ImChannelMaterialService.java
| ... | ... | @@ -58,6 +58,14 @@ public interface ImChannelMaterialService { |
| 58 | 58 | // ==================== 管理后台 ==================== |
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | + * 按频道查询素材精简列表 | |
| 62 | + * | |
| 63 | + * @param channelId 频道编号 | |
| 64 | + * @return 素材列表 | |
| 65 | + */ | |
| 66 | + List<ImChannelMaterialDO> getMaterialListByChannelId(Long channelId); | |
| 67 | + | |
| 68 | + /** | |
| 61 | 69 | * 分页查询素材 |
| 62 | 70 | * |
| 63 | 71 | * @param reqVO 分页查询条件 | ... | ... |
yudao-module-im/src/main/java/cn/iocoder/yudao/module/im/service/channel/ImChannelMaterialServiceImpl.java
| ... | ... | @@ -63,6 +63,11 @@ public class ImChannelMaterialServiceImpl implements ImChannelMaterialService { |
| 63 | 63 | // ==================== 管理后台 ==================== |
| 64 | 64 | |
| 65 | 65 | @Override |
| 66 | + public List<ImChannelMaterialDO> getMaterialListByChannelId(Long channelId) { | |
| 67 | + return channelMaterialMapper.selectListByChannelId(channelId); | |
| 68 | + } | |
| 69 | + | |
| 70 | + @Override | |
| 66 | 71 | public PageResult<ImChannelMaterialDO> getMaterialPage(ImChannelMaterialPageReqVO reqVO) { |
| 67 | 72 | return channelMaterialMapper.selectPage(reqVO); |
| 68 | 73 | } | ... | ... |