Commit 529bb3ff by Jadon-jiang Committed by Gitee

!9 master PULL 到 back_end_dev

Merge pull request !9 from Jadon-jiang/master
2 parents cceb5112 b987f3d4
......@@ -3,12 +3,16 @@ 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.wecom.domain.vo.WeChatSideVo;
import com.linkwechat.wecom.service.IWeChatCollectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 聊天工具 侧边栏栏 素材收藏
*
......@@ -28,8 +32,8 @@ public class WeChatCollectionController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('chat:collection:add')")
@Log(title = "添加收藏", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult addCollection(@RequestParam(value = "materialId") Long materialId, @RequestParam(value = "userId") Long userId) {
@PutMapping("addCollection")
public AjaxResult addCollection(@RequestParam(value = "materialId") Long materialId,@RequestParam(value = "userId") Long userId) {
return toAjax(weChatCollectionService.addCollection(materialId, userId));
}
......@@ -39,9 +43,20 @@ public class WeChatCollectionController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('chat:collection:delete')")
@Log(title = "取消收藏", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult cancleCollection(@RequestParam(value = "materialId") Long materialId, @RequestParam(value = "userId") Long userId) {
@PostMapping(value = "cancleCollection")
public AjaxResult cancleCollection(@RequestParam(value = "materialId") Long materialId,@RequestParam(value = "userId") Long userId) {
return toAjax(weChatCollectionService.cancleCollection(materialId, userId));
}
/**
* 收藏列表
*/
@PreAuthorize("@ss.hasPermi('chat:collection:list')")
@GetMapping("/list")
public TableDataInfo list(@RequestParam(value = "userId") Long userId) {
startPage();
List<WeChatSideVo> collections = weChatCollectionService.collections(userId);
return getDataTable(collections);
}
}
......@@ -3,15 +3,16 @@ 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.wecom.domain.dto.WeChatItemDto;
import com.linkwechat.wecom.domain.vo.WeChatSideVo;
import com.linkwechat.wecom.service.IWeChatItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 聊天工具侧边栏
......@@ -35,6 +36,15 @@ public class WeChatItemController extends BaseController {
return toAjax(weChatItemService.checkItems(chatItemDto));
}
/**
* h5素材列表
*/
@PreAuthorize("@ss.hasPermi('chat:item:list')")
@GetMapping("/list")
public TableDataInfo list(@RequestParam(value = "sideId") Long sideId) {
startPage();
List<WeChatSideVo> weChatSideVos = weChatItemService.chatItems(sideId);
return getDataTable(weChatSideVos);
}
}
......@@ -178,6 +178,8 @@ wecome:
- /externalcontact/get_unassigned_list
- /externalcontact/send_welcome_msg
- /externalcontact/unionid_to_external_userid
- /externalcontact/add_msg_template
- /externalcontact/get_group_msg_result
- /get_jsapi_ticket
- /ticket/get
fileUplodUrl: /media/upload,/media/uploadimg
......
......@@ -18,7 +18,7 @@ public class WeChatSide extends BaseEntity {
/**
* 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本 5 海报
*/
private Long mediaType;
private String mediaType;
/**
* 聊天工具栏名称
......
package com.linkwechat.wecom.domain.vo;
import lombok.Data;
/**
* 聊天侧边栏
* @author kewen
*/
@Data
public class WeChatSideVo {
/**
* 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本 5 海报
*/
private String mediaType;
/**
* 素材id
*/
private Long materialId;
/**
* 本地资源文件地址
*/
private String materialUrl;
/**
* 文本内容、图片文案
*/
private String content;
/**
* 图片名称
*/
private String materialName;
}
......@@ -2,8 +2,11 @@ package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeChatCollection;
import com.linkwechat.wecom.domain.vo.WeChatSideVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 聊天工具 侧边栏栏 素材收藏
*
......@@ -37,4 +40,12 @@ public interface WeChatCollectionMapper extends BaseMapper<WeChatCollection> {
*/
public int countCollectionByMaterialIdAndUserId(@Param("materialId") Long materialId,@Param("userId") Long userId);
/**
* 收藏列表
*
* @param userId 用户id
* @return {@link WeChatSideVo}s
*/
public List<WeChatSideVo> findCollections(Long userId);
}
......@@ -3,6 +3,7 @@ package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeChatItem;
import com.linkwechat.wecom.domain.dto.WeChatItemDto;
import com.linkwechat.wecom.domain.vo.WeChatSideVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -27,4 +28,12 @@ public interface WeChatItemMapper extends BaseMapper<WeChatItem> {
*/
public int dropItem(@Param("sideId") Long sideId);
/**
* h5素材列表
*
* @param sideId 侧边栏id
* @return
*/
public List<WeChatSideVo> findChatItems(@Param("sideId") Long sideId);
}
......@@ -2,6 +2,8 @@ package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeChatSide;
import com.linkwechat.wecom.domain.vo.WeChatSideVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -27,4 +29,6 @@ public interface WeChatSideMapper extends BaseMapper<WeChatSide> {
*/
public int updateWeChatSideById(WeChatSide weChatSide);
}
......@@ -2,6 +2,9 @@ package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeChatCollection;
import com.linkwechat.wecom.domain.vo.WeChatSideVo;
import java.util.List;
/**
* 聊天工具 侧边栏栏 素材收藏
......@@ -28,4 +31,12 @@ public interface IWeChatCollectionService extends IService<WeChatCollection> {
*/
public int cancleCollection( Long materialId, Long userId);
/**
* 收藏列表
*
* @param userId 用户id
* @return {@link WeChatSideVo}s
*/
public List<WeChatSideVo> collections(Long userId);
}
......@@ -3,6 +3,9 @@ package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeChatItem;
import com.linkwechat.wecom.domain.dto.WeChatItemDto;
import com.linkwechat.wecom.domain.vo.WeChatSideVo;
import java.util.List;
/**
* 聊天工具侧边栏
......@@ -18,4 +21,12 @@ public interface IWeChatItemService extends IService<WeChatItem> {
*/
public int checkItems(WeChatItemDto chatItemDto);
/**
* h5素材列表
*
* @param sideId 侧边栏id
* @return
*/
public List<WeChatSideVo> chatItems(Long sideId);
}
......@@ -3,11 +3,14 @@ package com.linkwechat.wecom.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.utils.SnowFlakeUtil;
import com.linkwechat.wecom.domain.WeChatCollection;
import com.linkwechat.wecom.domain.vo.WeChatSideVo;
import com.linkwechat.wecom.mapper.WeChatCollectionMapper;
import com.linkwechat.wecom.service.IWeChatCollectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 聊天工具 侧边栏栏 素材收藏
*
......@@ -34,4 +37,9 @@ public class WeChatCollectionServiceImpl extends ServiceImpl<WeChatCollectionMap
return weChatCollectionMapper.dropCollection(materialId,userId);
}
@Override
public List<WeChatSideVo> collections(Long userId) {
return weChatCollectionMapper.findCollections(userId);
}
}
......@@ -6,6 +6,7 @@ import com.linkwechat.wecom.domain.WeChatItem;
import com.linkwechat.wecom.domain.WeChatSide;
import com.linkwechat.wecom.domain.WeMaterial;
import com.linkwechat.wecom.domain.dto.WeChatItemDto;
import com.linkwechat.wecom.domain.vo.WeChatSideVo;
import com.linkwechat.wecom.mapper.WeChatItemMapper;
import com.linkwechat.wecom.mapper.WeChatSideMapper;
import com.linkwechat.wecom.service.IWeChatItemService;
......@@ -94,6 +95,11 @@ public class WeChatItemServiceImpl extends ServiceImpl<WeChatItemMapper, WeChatI
return 1;
}
@Override
public List<WeChatSideVo> chatItems(Long sideId) {
return weChatItemMapper.findChatItems(sideId);
}
/**
* 更新该次选择的素材数
*
......
......@@ -23,5 +23,20 @@
material_id=#{materialId} AND user_id=#{userId}
</where>
</select>
<select id="findCollections" resultType="com.linkwechat.wecom.domain.vo.WeChatSideVo">
SELECT
wcc.material_id,
wm.material_name,
wm.material_url,
wm.content,
wc.media_type
FROM
we_chat_collection wcc
LEFT JOIN we_material wm ON wcc.material_id = wm.id
LEFT JOIN we_category wc ON wm.category_id = wc.id
<where>
wcc.user_id=#{userId}
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -20,4 +20,20 @@
side_id=#{sideId}
</where>
</delete>
<select id="findChatItems" resultType="com.linkwechat.wecom.domain.vo.WeChatSideVo">
SELECT
wci.material_id,
wm.material_name,
wm.material_url,
wm.content,
wc.media_type
FROM
we_chat_item wci
LEFT JOIN we_material wm ON wci.material_id = wm.id
LEFT JOIN we_category wc ON wm.category_id = wc.id
<where>
wci.side_id=#{sideId}
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -34,4 +34,5 @@
`using`=0
</where>
</select>
</mapper>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!