Commit 013d8d66 by zhuyajie

多条好友引导语

parent 1f703c1f
......@@ -20,6 +20,7 @@ import com.pcloud.book.consumer.analysisengine.BrowseRecordConsr;
import com.pcloud.book.consumer.app.AppConsr;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.common.ExportConsr;
import com.pcloud.book.consumer.content.ResourceConsr;
import com.pcloud.book.consumer.message.MessageConsr;
import com.pcloud.book.consumer.raystask.MainLineConsr;
import com.pcloud.book.consumer.resource.ProductConsr;
......@@ -33,23 +34,7 @@ import com.pcloud.book.group.biz.BookGroupAppBiz;
import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.biz.GroupQrcodeBiz;
import com.pcloud.book.group.dao.AppClickRecordDao;
import com.pcloud.book.group.dao.AppTouchRecordDao;
import com.pcloud.book.group.dao.BookGroupAgentRecordDao;
import com.pcloud.book.group.dao.BookGroupAppDao;
import com.pcloud.book.group.dao.BookGroupCipherUserDao;
import com.pcloud.book.group.dao.BookGroupClassifyDao;
import com.pcloud.book.group.dao.BookGroupDao;
import com.pcloud.book.group.dao.BookGroupServeDao;
import com.pcloud.book.group.dao.CopyCipherRecordDao;
import com.pcloud.book.group.dao.GroupQrcodeDao;
import com.pcloud.book.group.dao.JoinGroupCipherDao;
import com.pcloud.book.group.dao.PushBookGroupUpdateDao;
import com.pcloud.book.group.dao.TempletRelevanceDao;
import com.pcloud.book.group.dao.WeixinQrcodeDao;
import com.pcloud.book.group.dao.WeixinQrcodeGenerationDao;
import com.pcloud.book.group.dao.WxUserWechatRelevanceDao;
import com.pcloud.book.group.dao.WxWechatUserCorrelationDao;
import com.pcloud.book.group.dao.*;
import com.pcloud.book.group.dto.AgentStatisticsInfoDTO;
import com.pcloud.book.group.dto.AltAndCountDTO;
import com.pcloud.book.group.dto.AltIdAndNameDTO;
......@@ -86,20 +71,9 @@ import com.pcloud.book.group.dto.StatisticsIncomeDto;
import com.pcloud.book.group.dto.TopAgentBookGroupDTO;
import com.pcloud.book.group.dto.UserBookBaseInfoDTO;
import com.pcloud.book.group.dto.UserSelectParamDTO;
import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.entity.BookGroupAgentRecord;
import com.pcloud.book.group.entity.BookGroupCipherUser;
import com.pcloud.book.group.entity.BookGroupServe;
import com.pcloud.book.group.entity.GroupQrcode;
import com.pcloud.book.group.entity.JoinGroupCipher;
import com.pcloud.book.group.entity.PushBookGroupUpdate;
import com.pcloud.book.group.entity.QrChangeRecord;
import com.pcloud.book.group.entity.TempletRelevance;
import com.pcloud.book.group.entity.WeixinQrcodeGeneration;
import com.pcloud.book.group.entity.WxUserWechatRelevance;
import com.pcloud.book.group.entity.*;
import com.pcloud.book.group.enums.AppAndProductTypeEnum;
import com.pcloud.book.group.enums.ChangeOriginTypeEnum;
import com.pcloud.book.group.entity.WxWechatUserCorrelation;
import com.pcloud.book.group.enums.CipherTypeEnum;
import com.pcloud.book.group.enums.JoinGroupTypeEnum;
import com.pcloud.book.group.enums.LargeTempletEnum;
......@@ -156,6 +130,7 @@ import com.pcloud.common.utils.export.excel.ExcelExportor;
import com.pcloud.common.utils.httpclient.UrlUtils;
import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.common.utils.zip.CompressUtils;
import com.pcloud.contentcenter.resource.dto.ResourceDTO;
import com.pcloud.facade.tradecenter.dto.ClassifyPayDetailDto;
import com.pcloud.facade.tradecenter.dto.GroupIncomeSearchDto;
import com.pcloud.facade.tradecenter.dto.GroupMoneyDto;
......@@ -330,6 +305,10 @@ public class BookGroupBizImpl implements BookGroupBiz {
private WxWechatUserCorrelationDao wxWechatUserCorrelationDao;
@Autowired
private BookLabelDao bookLabelDao;
@Autowired
private BookGroupFriendGuideDao bookGroupFriendGuideDao;
@Autowired
private ResourceConsr resourceConsr;
private static final ThreadPoolExecutor PLATFORM_STATISTICS_EXPORT_THREAD = new ThreadPoolExecutor(2, 2,
0, TimeUnit.SECONDS, new LinkedBlockingQueue<>(),
......@@ -526,6 +505,11 @@ public class BookGroupBizImpl implements BookGroupBiz {
}
}
}
//好友引导语
List<BookGroupFriendGuide> friendGuides = this.getFriendGuideList(bookGroupId);
if (!ListUtils.isEmpty(friendGuides)){
bookGroupDTO.setFriendGuideList(friendGuides);
}
return bookGroupDTO;
}
......@@ -609,9 +593,43 @@ public class BookGroupBizImpl implements BookGroupBiz {
bookDto.setBookName(null != bookDto.getBookName() ? StringUtil.addBracket(bookDto.getBookName()) : null);
bookGroupDTO.setBookInfo(bookDto);
}
//好友引导语
List<BookGroupFriendGuide> friendGuides = this.getFriendGuideList(bookGroupDTO.getId());
if (!ListUtils.isEmpty(friendGuides)){
bookGroupDTO.setFriendGuideList(friendGuides);
}
return bookGroupDTO;
}
@ParamLog("获取好友引导语信息")
public List<BookGroupFriendGuide> getFriendGuideList(Long bookGroupId){
List<BookGroupFriendGuide> friendGuides = bookGroupFriendGuideDao.getListByBookGroupId(bookGroupId);
if (ListUtils.isEmpty(friendGuides)){
return new ArrayList<>();
}
List<Long> resourceIds = friendGuides.stream().filter(s->s.getType().equals(ReplyTypeEnum.RESOURCE.value)).map(BookGroupFriendGuide::getResourceId).distinct().collect(Collectors.toList());
Map<Long, ResourceDTO> resourceDTOMap = new HashMap<>();
if (!ListUtils.isEmpty(resourceIds)){
resourceDTOMap = resourceConsr.mapByIds(resourceIds);
}
for (BookGroupFriendGuide friendGuide : friendGuides){
if (ReplyTypeEnum.RESOURCE.value.equals(friendGuide.getType()) && !MapUtils.isEmpty(resourceDTOMap)) {
ResourceDTO resourceDTO = resourceDTOMap.get(friendGuide.getResourceId());
if (resourceDTO != null) {
friendGuide.setResourceName(resourceDTO.getResourceName());
friendGuide.setResourceUrl(resourceDTO.getFileUrl());
friendGuide.setResourceTypeCode(resourceDTO.getTypeCode());
friendGuide.setResourceTypeName(resourceDTO.getTypeName());
friendGuide.setFileType(resourceDTO.getFileType());
friendGuide.setResourcePdfItems(resourceDTO.getResourcePdfItems());
friendGuide.setResourceOfficeItemDTOs(resourceDTO.getResourceOfficeItemDTOs());
friendGuide.setFileSize(resourceDTO.getFileSize());
}
}
}
return friendGuides;
}
/**
* 更新群二维码信息
*/
......@@ -642,7 +660,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!");
}
if (JoinGroupTypeEnum.AI_ROBOT.getCode().equals(bookGroup.getJoinGroupType())
&& (StringUtil.isEmpty(bookGroup.getAddFriendGuide())
&& (ListUtils.isEmpty(bookGroup.getFriendGuideList())
|| StringUtil.isEmpty(bookGroup.getShortBookName()))) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!");
}
......@@ -680,6 +698,26 @@ public class BookGroupBizImpl implements BookGroupBiz {
ResponseHandleUtil.parseResponse(productService.postUpdateBookGroupProduct(updateAppProductParamDTO), Product.class);
}
bookGroupDao.update(bookGroup);
if (JoinGroupTypeEnum.AI_ROBOT.getCode().equals(bookGroup.getJoinGroupType())){
this.updateFriendGuide(bookGroup.getId(),bookGroup.getFriendGuideList(), group.getCreateUser());
}
}
/**
* 更新群引导语
* @param bookGroupId
* @param friendGuideList
*/
private void updateFriendGuide(Long bookGroupId, List<BookGroupFriendGuide> friendGuideList,Long createUser){
if (null == bookGroupId || ListUtils.isEmpty(friendGuideList)){
return;
}
bookGroupFriendGuideDao.deleteByBookGroupId(bookGroupId);
friendGuideList.forEach(e->{
e.setBookGroupId(bookGroupId);
e.setCreateUser(createUser);
});
bookGroupFriendGuideDao.insert(friendGuideList);
}
@ParamLog("判断书籍简称是否重复")
......
package com.pcloud.book.group.dao;
import com.pcloud.book.group.entity.BookGroupFriendGuide;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* 好友引导语
*/
public interface BookGroupFriendGuideDao extends BaseDao<BookGroupFriendGuide> {
/**
* 删除
* @param bookGroupId
*/
public void deleteByBookGroupId(Long bookGroupId);
/**
* 查询
* @param bookGroupId
* @return
*/
public List<BookGroupFriendGuide>getListByBookGroupId(Long bookGroupId);
}
package com.pcloud.book.group.dao.impl;
import com.pcloud.book.group.dao.BookGroupFriendGuideDao;
import com.pcloud.book.group.entity.BookGroupFriendGuide;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* 好友引导语
*/
@Component("bookGroupFriendGuideDao")
public class BookGroupFriendGuideDaoImpl extends BaseDaoImpl<BookGroupFriendGuide> implements BookGroupFriendGuideDao {
@Override
public void deleteByBookGroupId(Long bookGroupId) {
getSessionTemplate().delete(getStatement("deleteByBookGroupId"), bookGroupId);
}
@Override
public List<BookGroupFriendGuide> getListByBookGroupId(Long bookGroupId) {
return getSessionTemplate().selectList(getStatement("getListByBookGroupId"), bookGroupId);
}
}
......@@ -5,6 +5,7 @@ import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.group.entity.BookGroupFriendGuide;
import com.pcloud.book.group.entity.BookGroupServe;
import com.pcloud.common.dto.BaseDto;
......@@ -260,6 +261,10 @@ public class BookGroupDTO extends BaseDto {
* 地域标签名称
*/
private String areaLabelName;
/**
* 好友引导语
*/
private List<BookGroupFriendGuide> friendGuideList;
public String getUrl() {
return url;
......@@ -663,6 +668,14 @@ public class BookGroupDTO extends BaseDto {
this.areaLabelName = areaLabelName;
}
public List<BookGroupFriendGuide> getFriendGuideList() {
return friendGuideList;
}
public void setFriendGuideList(List<BookGroupFriendGuide> friendGuideList) {
this.friendGuideList = friendGuideList;
}
@Override
public String toString() {
return "BookGroupDTO{" +
......@@ -712,10 +725,11 @@ public class BookGroupDTO extends BaseDto {
", subLabelId=" + subLabelId +
", verLabelId=" + verLabelId +
", areaLabelId=" + areaLabelId +
", graLabelName=" + graLabelName +
", subLabelName=" + subLabelName +
", verLabelName=" + verLabelName +
", areaLabelName=" + areaLabelName +
"} " + super.toString();
", graLabelName='" + graLabelName + '\'' +
", subLabelName='" + subLabelName + '\'' +
", verLabelName='" + verLabelName + '\'' +
", areaLabelName='" + areaLabelName + '\'' +
", friendGuideList=" + friendGuideList +
'}';
}
}
\ No newline at end of file
package com.pcloud.book.group.entity;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.common.entity.BaseEntity;
......@@ -155,6 +156,11 @@ public class BookGroup extends BaseEntity {
*/
private String shortBookName;
/**
* 好友引导语
*/
private List<BookGroupFriendGuide> friendGuideList;
public Long getId() {
return id;
}
......@@ -379,6 +385,14 @@ public class BookGroup extends BaseEntity {
this.shortBookName = shortBookName;
}
public List<BookGroupFriendGuide> getFriendGuideList() {
return friendGuideList;
}
public void setFriendGuideList(List<BookGroupFriendGuide> friendGuideList) {
this.friendGuideList = friendGuideList;
}
@Override
public String toString() {
return "BookGroup{" +
......@@ -410,6 +424,7 @@ public class BookGroup extends BaseEntity {
", agentId=" + agentId +
", belongSpecialAgent=" + belongSpecialAgent +
", shortBookName='" + shortBookName + '\'' +
"} " + super.toString();
", friendGuideList=" + friendGuideList +
'}';
}
}
\ No newline at end of file
package com.pcloud.book.group.entity;
import com.pcloud.common.entity.BaseEntity;
import com.pcloud.contentcenter.resource.dto.ResourceOfficeItemDTO;
import com.pcloud.contentcenter.resource.dto.ResourcePdfItemDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @Description
* @Author zhuyajie
* @Date 2020/02/02 11:16
**/
@Data
@ApiModel("好友引导语")
public class BookGroupFriendGuide extends BaseEntity {
@ApiModelProperty("社群码id")
private Long bookGroupId;
@ApiModelProperty("类型 1 文字 2 图片 3 链接 4应用 5素材")
private Integer type;
@ApiModelProperty("内容")
private String content;
@ApiModelProperty("描述")
private String description;
@ApiModelProperty("链接地址")
private String linkUrl;
@ApiModelProperty("图片地址")
private String picUrl;
@ApiModelProperty("应用或作品id")
private Long serveId;
@ApiModelProperty("应用或作品类型")
private String serveType;
@ApiModelProperty("资源id")
private Long resourceId;
@ApiModelProperty("排序值")
private Integer seqNum;
@ApiModelProperty("创建人")
private Long createUser;
@ApiModelProperty("应用或作品图片")
private String servePic;
@ApiModelProperty("应用或作品名称")
private String serveName;
@ApiModelProperty("应用或作品类型名称")
private String serveTypeName;
@ApiModelProperty("应用或作品类型编码")
private String serveTypeCode;
@ApiModelProperty("资源链接")
private String resourceUrl;
@ApiModelProperty("资源名称")
private String resourceName;
@ApiModelProperty("资源类型编码")
private String resourceTypeCode;
@ApiModelProperty("资源类型名称")
private String resourceTypeName;
@ApiModelProperty("文件类型")
private String fileType;
@ApiModelProperty("文件大小")
private Long fileSize;
@ApiModelProperty("pdf转码后的单张图片集合")
private List<ResourcePdfItemDTO> resourcePdfItems;
@ApiModelProperty("文件转码后的单张图片集合")
private List<ResourceOfficeItemDTO> resourceOfficeItemDTOs;
}
......@@ -9,12 +9,7 @@ import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.group.biz.BookGroupAppBiz;
import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.biz.GroupQrcodeBiz;
import com.pcloud.book.group.dao.AppTouchRecordDao;
import com.pcloud.book.group.dao.BookGroupCipherUserDao;
import com.pcloud.book.group.dao.BookGroupClassifyDao;
import com.pcloud.book.group.dao.BookGroupDao;
import com.pcloud.book.group.dao.GroupQrcodeDao;
import com.pcloud.book.group.dao.JoinGroupCipherDao;
import com.pcloud.book.group.dao.*;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.GroupClassifyQrcodeDTO;
import com.pcloud.book.group.dto.GroupQrcodeDTO;
......@@ -22,10 +17,7 @@ import com.pcloud.book.group.dto.JoinGroupCipherDTO;
import com.pcloud.book.group.dto.PushAddUserMessageDTO;
import com.pcloud.book.group.dto.SendDefaultGuideMessageDTO;
import com.pcloud.book.group.dto.SendGuideMessageDTO;
import com.pcloud.book.group.entity.AppTouchRecord;
import com.pcloud.book.group.entity.BookGroupCipherUser;
import com.pcloud.book.group.entity.GroupQrcode;
import com.pcloud.book.group.entity.JoinGroupCipher;
import com.pcloud.book.group.entity.*;
import com.pcloud.book.group.enums.CipherTypeEnum;
import com.pcloud.book.group.enums.TouchTypeEnum;
import com.pcloud.book.group.tools.SendSelfMsgTools;
......@@ -66,6 +58,7 @@ import com.sdk.wxgroup.SendMessageTypeEnum;
import com.sdk.wxgroup.SendPicMessageVO;
import com.sdk.wxgroup.SendTextMessageVO;
import com.sdk.wxgroup.WxGroupSDK;
import com.sdk.wxgroup.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -126,6 +119,8 @@ public class BookGuideBizImpl implements BookGuideBiz {
@Autowired
private SelfRobotKeywordDao selfRobotKeywordDao;
@Autowired
private BookGroupFriendGuideDao bookGroupFriendGuideDao;
@Autowired
private ResourceConsr resourceConsr;
@Value("${system.env}")
......@@ -162,7 +157,7 @@ public class BookGuideBizImpl implements BookGuideBiz {
bookGroupCipherUser.setAltId(agreeAddUserDTO.getRobotWxId());
//新增暗号对应记录
bookGroupCipherUserDao.insert(bookGroupCipherUser);
SendTextMessageVO addFriendVo = new SendTextMessageVO();
/* SendTextMessageVO addFriendVo = new SendTextMessageVO();
addFriendVo.setContent(dto.getAddFriendGuide());
addFriendVo.setCode(SendMessageTypeEnum.SELF.getCode());
addFriendVo.setWxId(agreeAddUserDTO.getRobotWxId());
......@@ -170,7 +165,9 @@ public class BookGuideBizImpl implements BookGuideBiz {
addFriendVo.setWxGroupId(agreeAddUserDTO.getUserWxId());
addFriendVo.setIp(agreeAddUserDTO.getIp());
WxGroupSDK.sendTextMessage(addFriendVo);
log.info("临时demo发送个人号加好友欢迎语信息"+addFriendVo.toString());
log.info("临时demo发送个人号加好友欢迎语信息"+addFriendVo.toString());*/
//好友引导语
sendFriendGuide(bookGroupId, agreeAddUserDTO);
//回复关键词引导语
List<SelfRobotKeyword> selfRobotKeywords = selfRobotKeywordDao.getListByBookGroupId(bookGroupId);
if (!ListUtils.isEmpty(selfRobotKeywords)){
......@@ -327,6 +324,79 @@ public class BookGuideBizImpl implements BookGuideBiz {
}
}
/**
* 推好友引导语
* @param bookGroupId
* @param agreeAddUserDTO
*/
private void sendFriendGuide(Long bookGroupId, AgreeAddUserDTO agreeAddUserDTO) {
List<BookGroupFriendGuide> friendGuideList = bookGroupFriendGuideDao.getListByBookGroupId(bookGroupId);
if (ListUtils.isEmpty(friendGuideList)){
return;
}
String userWxId = agreeAddUserDTO.getUserWxId();
String ip = agreeAddUserDTO.getIp();
Integer code = SendMessageTypeEnum.SELF.getCode();
String robotId = agreeAddUserDTO.getRobotWxId();
for (BookGroupFriendGuide bookGroupFriendGuide: friendGuideList){
Integer type = bookGroupFriendGuide.getType();
if (ReplyTypeEnum.TEXT.value.equals(type)) {
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
sendTextMessageVO.setContent(bookGroupFriendGuide.getContent());
sendTextMessageVO.setAltId(robotId);
sendTextMessageVO.setWxGroupId(userWxId);
sendTextMessageVO.setIp(ip);
sendTextMessageVO.setCode(code);
WxGroupSDK.sendTextMessage(sendTextMessageVO);
}
if (ReplyTypeEnum.IMAGE.value.equals(type)) {
SendPicMessageVO sendPicMessageVO = new SendPicMessageVO();
sendPicMessageVO.setWxGroupId(userWxId);
sendPicMessageVO.setAltId(robotId);
sendPicMessageVO.setPicUrl(bookGroupFriendGuide.getPicUrl());
sendPicMessageVO.setIp(ip);
sendPicMessageVO.setCode(code);
WxGroupSDK.sendPicMessage(sendPicMessageVO);
}
if (ReplyTypeEnum.LINK.value.equals(type)) {
SendArticleMessageVO sendArticleMessageVO = new SendArticleMessageVO();
sendArticleMessageVO.setCode(code);
sendArticleMessageVO.setAltId(robotId);
sendArticleMessageVO.setDescription(bookGroupFriendGuide.getDescription());
sendArticleMessageVO.setWxGroupId(userWxId);
sendArticleMessageVO.setLinkUrl(bookGroupFriendGuide.getLinkUrl());
sendArticleMessageVO.setPicUrl(bookGroupFriendGuide.getPicUrl());
sendArticleMessageVO.setTitle(bookGroupFriendGuide.getContent());
sendArticleMessageVO.setIp(ip);
WxGroupSDK.sendArticleMessage(sendArticleMessageVO);
}
if (ReplyTypeEnum.APP.value.equals(type)) {
return;
}
if (ReplyTypeEnum.RESOURCE.value.equals(type)) {
SendFileVO sendFileVO = new SendFileVO();
Map<Long, ResourceDTO> map = resourceConsr.mapByIds(Arrays.asList(bookGroupFriendGuide.getResourceId()));
ResourceDTO resourceDTO = map.get(bookGroupFriendGuide.getResourceId());
if (resourceDTO != null) {
sendFileVO.setFileUrl(resourceDTO.getFileUrl());
String fileName = resourceDTO.getResourceName();
String fileType = resourceDTO.getFileType();
log.info("fileName="+fileName+"+fileType+"+fileType);
if (fileName.contains(fileType)){//去掉后缀
fileName = fileName.substring(0, fileName.indexOf(fileType)-1);
}
log.info("fileName="+fileName);
sendFileVO.setFileName(fileName);
}
sendFileVO.setIp(ip);
sendFileVO.setAltId(robotId);
sendFileVO.setWxId(userWxId);
WxGroupSDK.sendFile(sendFileVO);
}
}
log.info("临时demo发送个人号加好友欢迎语列表信息"+friendGuideList.toString());
}
@ParamLog("进群之后更新群qrCodeId")
private void updateQrcodeForCipher(String wxGroupId, String cipher, String userWxId){
log.info("根据群id查询群信息wxGroupId", wxGroupId);
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.group.dao.impl.BookGroupFriendGuideDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.group.entity.BookGroupFriendGuide">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="book_group_id" property="bookGroupId" jdbcType="BIGINT"/>
<result column="type" property="type" jdbcType="INTEGER"/>
<result column="content" property="content" jdbcType="VARCHAR"/>
<result column="description" property="description" jdbcType="VARCHAR"/>
<result column="link_url" property="linkUrl" jdbcType="VARCHAR"/>
<result column="pic_url" property="picUrl" jdbcType="VARCHAR"/>
<result column="serve_id" property="serveId" jdbcType="BIGINT"/>
<result column="serve_type" property="serveType" jdbcType="VARCHAR"/>
<result column="resource_id" property="resourceId" jdbcType="BIGINT"/>
<result column="seq_num" property="seqNum" jdbcType="INTEGER"/>
<result column="create_user" property="createUser" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, book_group_id, type, content, description, link_url, pic_url, serve_id,
serve_type, resource_id,seq_num,create_user, create_time
</sql>
<insert id="insert" parameterType="com.pcloud.book.group.entity.BookGroupFriendGuide" useGeneratedKeys="true"
keyProperty="id">
insert into book_group_friend_guide
<trim prefix="(" suffix=")" suffixOverrides=",">
book_group_id,
type,
content,
description,
link_url,
pic_url,
serve_id,
serve_type,
resource_id,
seq_num,
create_user,
create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{bookGroupId,jdbcType=BIGINT},
#{type,jdbcType=INTEGER},
#{content,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR},
#{linkUrl,jdbcType=VARCHAR},
#{picUrl,jdbcType=VARCHAR},
#{serveId,jdbcType=BIGINT},
#{serveType,jdbcType=VARCHAR},
#{resourceId,jdbcType=BIGINT},
#{seqNum,jdbcType=INTEGER},
#{createUser,jdbcType=BIGINT},
NOW()
</trim>
</insert>
<!--批量插入-->
<insert id="batchInsert" parameterType="com.pcloud.book.group.entity.BookGroupFriendGuide" useGeneratedKeys="true" keyProperty="id">
insert into book_group_friend_guide (
book_group_id,
type,
content,
description,
link_url,
pic_url,
serve_id,
serve_type,
resource_id,
seq_num,
create_user,
create_time
) values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.bookGroupId,jdbcType=BIGINT},
#{item.type,jdbcType=INTEGER},
#{item.content,jdbcType=VARCHAR},
#{item.description,jdbcType=VARCHAR},
#{item.linkUrl,jdbcType=VARCHAR},
#{item.picUrl,jdbcType=VARCHAR},
#{item.serveId,jdbcType=BIGINT},
#{item.serveType,jdbcType=VARCHAR},
#{item.resourceId,jdbcType=BIGINT},
#{item.seqNum,jdbcType=INTEGER},
#{item.createUser,jdbcType=BIGINT},
NOW()
)
</foreach>
</insert>
<!--删除-->
<delete id="deleteById" parameterType="long">
delete from book_group_friend_guide
where id=#{id}
</delete>
<!--根据社群码id集合删除-->
<delete id="deleteByBookGroupId" parameterType="long">
delete from book_group_friend_guide
where book_group_id = #{bookGroupId}
</delete>
<!--根据社群书id获取-->
<select id="getListByBookGroupId" parameterType="long" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from book_group_friend_guide
where book_group_id = #{bookGroupId}
order by seq_num
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment