Commit bb956790 by zhuyajie

多条关键词回复

parent 4a4d9f5f
...@@ -29,10 +29,7 @@ import com.pcloud.book.group.enums.AppAndProductTypeEnum; ...@@ -29,10 +29,7 @@ import com.pcloud.book.group.enums.AppAndProductTypeEnum;
import com.pcloud.book.group.enums.BookGroupAppOriginTypeEnum; import com.pcloud.book.group.enums.BookGroupAppOriginTypeEnum;
import com.pcloud.book.keywords.dao.BookGuideDao; import com.pcloud.book.keywords.dao.BookGuideDao;
import com.pcloud.book.keywords.dao.BookKeywordDao; import com.pcloud.book.keywords.dao.BookKeywordDao;
import com.pcloud.book.keywords.entity.BookGuide; import com.pcloud.book.keywords.entity.*;
import com.pcloud.book.keywords.entity.BookGuideReply;
import com.pcloud.book.keywords.entity.BookKeyword;
import com.pcloud.book.keywords.entity.SelfRobotKeyword;
import com.pcloud.book.keywords.enums.ReplyTypeEnum; import com.pcloud.book.keywords.enums.ReplyTypeEnum;
import com.pcloud.book.push.dao.PushGroupDao; import com.pcloud.book.push.dao.PushGroupDao;
import com.pcloud.book.push.entity.PushGroup; import com.pcloud.book.push.entity.PushGroup;
...@@ -360,20 +357,23 @@ public class BookGroupAppBizImpl implements BookGroupAppBiz { ...@@ -360,20 +357,23 @@ public class BookGroupAppBizImpl implements BookGroupAppBiz {
} }
List<BookGroupApp> bookGroupApps = new ArrayList<>(); List<BookGroupApp> bookGroupApps = new ArrayList<>();
for (SelfRobotKeyword selfRobotKeyword : selfRobotKeywords) { for (SelfRobotKeyword selfRobotKeyword : selfRobotKeywords) {
if (ReplyTypeEnum.APP.value.equals(selfRobotKeyword.getType())) { List<SelfRobotKeywordReply> replyList = selfRobotKeyword.getKeywordReplyList();
BookGroupApp bookGroupApp = new BookGroupApp(); for (SelfRobotKeywordReply keywordReply : replyList){
bookGroupApp.setOriginType(BookGroupAppOriginTypeEnum.SELF_KEYWORD.code); if (ReplyTypeEnum.APP.value.equals(keywordReply.getType())) {
bookGroupApp.setServeId(selfRobotKeyword.getServeId()); BookGroupApp bookGroupApp = new BookGroupApp();
bookGroupApp.setServeType(selfRobotKeyword.getServeType()); bookGroupApp.setOriginType(BookGroupAppOriginTypeEnum.SELF_KEYWORD.code);
bookGroupApp.setClassifyId(0L); bookGroupApp.setServeId(keywordReply.getServeId());
bookGroupApp.setBookGroupId(selfRobotKeyword.getBookGroupId()); bookGroupApp.setServeType(keywordReply.getServeType());
bookGroupApp.setCreateUser(selfRobotKeyword.getCreateUser()); bookGroupApp.setClassifyId(0L);
//判断是否已经添加过 bookGroupApp.setBookGroupId(selfRobotKeyword.getBookGroupId());
BookGroupApp bookGroupAppOld = bookGroupAppDao.getByCondition(bookGroupApp); bookGroupApp.setCreateUser(selfRobotKeyword.getCreateUser());
if (bookGroupAppOld != null) { //判断是否已经添加过
continue; BookGroupApp bookGroupAppOld = bookGroupAppDao.getByCondition(bookGroupApp);
if (bookGroupAppOld != null) {
continue;
}
bookGroupApps.add(bookGroupApp);
} }
bookGroupApps.add(bookGroupApp);
} }
} }
if (ListUtils.isEmpty(bookGroupApps)) { if (ListUtils.isEmpty(bookGroupApps)) {
......
...@@ -25,18 +25,12 @@ import com.pcloud.book.group.tools.SendWeixinRequestTools; ...@@ -25,18 +25,12 @@ import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO; import com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO;
import com.pcloud.book.keywords.biz.BookGuideBiz; import com.pcloud.book.keywords.biz.BookGuideBiz;
import com.pcloud.book.keywords.biz.BookKeywordBiz; import com.pcloud.book.keywords.biz.BookKeywordBiz;
import com.pcloud.book.keywords.dao.BookGuideDao; import com.pcloud.book.keywords.dao.*;
import com.pcloud.book.keywords.dao.BookGuideReplyDao;
import com.pcloud.book.keywords.dao.KeywordDao;
import com.pcloud.book.keywords.dao.SelfRobotKeywordDao;
import com.pcloud.book.keywords.dto.GuideDTO; import com.pcloud.book.keywords.dto.GuideDTO;
import com.pcloud.book.keywords.dto.KeywordDTO; import com.pcloud.book.keywords.dto.KeywordDTO;
import com.pcloud.book.keywords.dto.KeywordStatusDTO; import com.pcloud.book.keywords.dto.KeywordStatusDTO;
import com.pcloud.book.keywords.dto.ReplyKeywordDTO; import com.pcloud.book.keywords.dto.ReplyKeywordDTO;
import com.pcloud.book.keywords.entity.BookGuide; import com.pcloud.book.keywords.entity.*;
import com.pcloud.book.keywords.entity.BookGuideReply;
import com.pcloud.book.keywords.entity.Keyword;
import com.pcloud.book.keywords.entity.SelfRobotKeyword;
import com.pcloud.book.keywords.enums.ReplyTypeEnum; import com.pcloud.book.keywords.enums.ReplyTypeEnum;
import com.pcloud.book.keywords.vo.GuideVO; import com.pcloud.book.keywords.vo.GuideVO;
import com.pcloud.book.keywords.vo.ReplyMessageVO; import com.pcloud.book.keywords.vo.ReplyMessageVO;
...@@ -125,6 +119,8 @@ public class BookGuideBizImpl implements BookGuideBiz { ...@@ -125,6 +119,8 @@ public class BookGuideBizImpl implements BookGuideBiz {
@Value("${system.env}") @Value("${system.env}")
private String envStr; private String envStr;
@Autowired
private SelfRobotKeywordReplyDao selfRobotKeywordReplyDao;
@ParamLog("同意加好友发送欢迎语") @ParamLog("同意加好友发送欢迎语")
@Override @Override
...@@ -157,49 +153,28 @@ public class BookGuideBizImpl implements BookGuideBiz { ...@@ -157,49 +153,28 @@ public class BookGuideBizImpl implements BookGuideBiz {
bookGroupCipherUser.setAltId(agreeAddUserDTO.getRobotWxId()); bookGroupCipherUser.setAltId(agreeAddUserDTO.getRobotWxId());
//新增暗号对应记录 //新增暗号对应记录
bookGroupCipherUserDao.insert(bookGroupCipherUser); bookGroupCipherUserDao.insert(bookGroupCipherUser);
/* SendTextMessageVO addFriendVo = new SendTextMessageVO();
addFriendVo.setContent(dto.getAddFriendGuide());
addFriendVo.setCode(SendMessageTypeEnum.SELF.getCode());
addFriendVo.setWxId(agreeAddUserDTO.getRobotWxId());
addFriendVo.setAltId(agreeAddUserDTO.getRobotWxId());
addFriendVo.setWxGroupId(agreeAddUserDTO.getUserWxId());
addFriendVo.setIp(agreeAddUserDTO.getIp());
WxGroupSDK.sendTextMessage(addFriendVo);
log.info("临时demo发送个人号加好友欢迎语信息"+addFriendVo.toString());*/
//好友引导语 //好友引导语
sendFriendGuide(bookGroupId, agreeAddUserDTO); sendFriendGuide(bookGroupId, agreeAddUserDTO);
//回复关键词引导语 //回复关键词引导语
List<SelfRobotKeyword> selfRobotKeywords = selfRobotKeywordDao.getListByBookGroupId(bookGroupId); List<SelfRobotKeyword> selfRobotKeywords = selfRobotKeywordDao.getListByBookGroupId(bookGroupId);
if (!ListUtils.isEmpty(selfRobotKeywords)){ if (!ListUtils.isEmpty(selfRobotKeywords)){
/* try {
String content="现在你试试回复我定制一套【背单词】读书计划【 】内关键词来唤醒我";
SendTextMessageVO voh = new SendTextMessageVO();
voh.setContent(content);
voh.setCode(SendMessageTypeEnum.SELF.getCode());
voh.setWxId(agreeAddUserDTO.getRobotWxId());
voh.setAltId(agreeAddUserDTO.getRobotWxId());
voh.setWxGroupId(agreeAddUserDTO.getUserWxId());
voh.setIp(agreeAddUserDTO.getIp());
WxGroupSDK.sendTextMessage(voh);
log.info("临时demo发送个人号加好友信息唤醒"+voh.toString());
Thread.sleep(5000);
} catch (InterruptedException e) {
log.error("发消息休眠5秒出错", e);
}*/
ThreadPoolUtils.SEND_MESSAGE_THREAD_POOL.execute(()->{ ThreadPoolUtils.SEND_MESSAGE_THREAD_POOL.execute(()->{
for (SelfRobotKeyword selfRobotKeyword:selfRobotKeywords){ for (SelfRobotKeyword selfRobotKeyword:selfRobotKeywords){
try { try {
if ("长江作业本".equals(selfRobotKeyword.getKeyword())){ if ("长江作业本".equals(selfRobotKeyword.getKeyword())){
Thread.sleep(1000*60*10); Thread.sleep(1000*60*10);
} }
SendTextMessageVO vo = new SendTextMessageVO(); if (!StringUtil.isEmpty(selfRobotKeyword.getGuide())){
vo.setContent(selfRobotKeyword.getGuide()); SendTextMessageVO vo = new SendTextMessageVO();
vo.setCode(SendMessageTypeEnum.SELF.getCode()); vo.setContent(selfRobotKeyword.getGuide());
vo.setWxId(agreeAddUserDTO.getRobotWxId()); vo.setCode(SendMessageTypeEnum.SELF.getCode());
vo.setAltId(agreeAddUserDTO.getRobotWxId()); vo.setWxId(agreeAddUserDTO.getRobotWxId());
vo.setWxGroupId(agreeAddUserDTO.getUserWxId()); vo.setAltId(agreeAddUserDTO.getRobotWxId());
vo.setIp(agreeAddUserDTO.getIp()); vo.setWxGroupId(agreeAddUserDTO.getUserWxId());
WxGroupSDK.sendTextMessage(vo); vo.setIp(agreeAddUserDTO.getIp());
WxGroupSDK.sendTextMessage(vo);
log.info("临时demo发送个人号加好友信息"+vo.toString());
}
if ("学前".equals(selfRobotKeyword.getKeyword()) if ("学前".equals(selfRobotKeyword.getKeyword())
&&envStr.toUpperCase().equals("PRO")&&agreeAddUserDTO.getRobotWxId().equals("wxid_x8i897ryabo722")){ &&envStr.toUpperCase().equals("PRO")&&agreeAddUserDTO.getRobotWxId().equals("wxid_x8i897ryabo722")){
SendGroupInviteVO sendGroupInviteVO = new SendGroupInviteVO(); SendGroupInviteVO sendGroupInviteVO = new SendGroupInviteVO();
...@@ -211,19 +186,26 @@ public class BookGuideBizImpl implements BookGuideBiz { ...@@ -211,19 +186,26 @@ public class BookGuideBizImpl implements BookGuideBiz {
log.info("临时发送入群连接 sendGroupInviteVO:{}", sendGroupInviteVO); log.info("临时发送入群连接 sendGroupInviteVO:{}", sendGroupInviteVO);
} }
if ("教辅书单".equals(selfRobotKeyword.getKeyword())){ if ("教辅书单".equals(selfRobotKeyword.getKeyword())){
SendFileVO sendFileVO = new SendFileVO(); List<SelfRobotKeywordReply> replyList = selfRobotKeywordReplyDao.getListByKeywordId(selfRobotKeyword.getId());
Map<Long, ResourceDTO> map = resourceConsr.mapByIds(Arrays.asList(selfRobotKeyword.getResourceId())); if (ListUtils.isEmpty(replyList)){
ResourceDTO resourceDTO = map.get(selfRobotKeyword.getResourceId()); continue;
if (resourceDTO != null) { }
sendFileVO.setFileUrl(resourceDTO.getFileUrl()); for (SelfRobotKeywordReply keywordReply : replyList){
sendFileVO.setFileName(resourceDTO.getResourceName()); if (ReplyTypeEnum.RESOURCE.value.equals(keywordReply.getType())){
SendFileVO sendFileVO = new SendFileVO();
Map<Long, ResourceDTO> map = resourceConsr.mapByIds(Arrays.asList(keywordReply.getResourceId()));
ResourceDTO resourceDTO = map.get(keywordReply.getResourceId());
if (resourceDTO != null) {
sendFileVO.setFileUrl(resourceDTO.getFileUrl());
sendFileVO.setFileName(resourceDTO.getResourceName());
}
sendFileVO.setIp(agreeAddUserDTO.getIp());
sendFileVO.setAltId(agreeAddUserDTO.getRobotWxId());
sendFileVO.setWxId(agreeAddUserDTO.getUserWxId());
WxGroupSDK.sendFile(sendFileVO);
}
} }
sendFileVO.setIp(agreeAddUserDTO.getIp());
sendFileVO.setAltId(agreeAddUserDTO.getRobotWxId());
sendFileVO.setWxId(agreeAddUserDTO.getUserWxId());
WxGroupSDK.sendFile(sendFileVO);
} }
log.info("临时demo发送个人号加好友信息"+vo.toString());
Thread.sleep(1000*40); Thread.sleep(1000*40);
} catch (InterruptedException e) { } catch (InterruptedException e) {
log.error("发消息休眠5秒出错", e); log.error("发消息休眠5秒出错", e);
......
package com.pcloud.book.keywords.dao;
import com.pcloud.book.keywords.dto.MaxSeqNAndBGDTO;
import com.pcloud.book.keywords.entity.SelfRobotKeyword;
import com.pcloud.book.keywords.entity.SelfRobotKeywordReply;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* @Description
* @Author zhuyajie
* @Date 2020/02/03 11:39
**/
public interface SelfRobotKeywordReplyDao extends BaseDao<SelfRobotKeywordReply> {
void deleteByKeywordId(Long keywordId);
List<SelfRobotKeywordReply> getListByKeywordId(Long keywordId);
}
package com.pcloud.book.keywords.dao.impl;
import com.pcloud.book.keywords.dao.SelfRobotKeywordDao;
import com.pcloud.book.keywords.dao.SelfRobotKeywordReplyDao;
import com.pcloud.book.keywords.dto.MaxSeqNAndBGDTO;
import com.pcloud.book.keywords.entity.SelfRobotKeyword;
import com.pcloud.book.keywords.entity.SelfRobotKeywordReply;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description
* @Author zhuyajie
* @Date 2020/02/03 11:39
**/
@Component("selfRobotKeywordReplyDao")
public class SelfRobotKeywordReplyDaoImpl extends BaseDaoImpl<SelfRobotKeywordReply> implements SelfRobotKeywordReplyDao {
@Override
public void deleteByKeywordId(Long keywordId) {
getSessionTemplate().delete(getStatement("deleteByKeywordId"), keywordId);
}
@Override
public List<SelfRobotKeywordReply> getListByKeywordId(Long keywordId) {
return getSessionTemplate().selectList(getStatement("getListByKeywordId"), keywordId);
}
}
...@@ -27,66 +27,12 @@ public class SelfRobotKeyword extends BaseEntity { ...@@ -27,66 +27,12 @@ public class SelfRobotKeyword extends BaseEntity {
@ApiModelProperty("关键词") @ApiModelProperty("关键词")
private String keyword; private String keyword;
@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("排序值") @ApiModelProperty("排序值")
private Integer seqNum; private Integer seqNum;
@ApiModelProperty("创建人") @ApiModelProperty("创建人")
private Long createUser; private Long createUser;
@ApiModelProperty("应用或作品图片") @ApiModelProperty("关键词回复列表")
private String servePic; private List<SelfRobotKeywordReply> keywordReplyList;
@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("pdf转码后的单张图片集合")
private List<ResourcePdfItemDTO> resourcePdfItems;
@ApiModelProperty("文件转码后的单张图片集合")
private List<ResourceOfficeItemDTO> resourceOfficeItemDTOs;
} }
package com.pcloud.book.keywords.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/03 11:39
**/
@Data
@ApiModel("个人号关键词回复")
public class SelfRobotKeywordReply extends BaseEntity {
@ApiModelProperty("关键词id")
private Long keywordId;
@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("pdf转码后的单张图片集合")
private List<ResourcePdfItemDTO> resourcePdfItems;
@ApiModelProperty("文件转码后的单张图片集合")
private List<ResourceOfficeItemDTO> resourceOfficeItemDTOs;
}
...@@ -6,14 +6,6 @@ ...@@ -6,14 +6,6 @@
<result column="book_group_id" property="bookGroupId" jdbcType="BIGINT"/> <result column="book_group_id" property="bookGroupId" jdbcType="BIGINT"/>
<result column="guide" property="guide" jdbcType="VARCHAR"/> <result column="guide" property="guide" jdbcType="VARCHAR"/>
<result column="keyword" property="keyword" jdbcType="VARCHAR"/> <result column="keyword" property="keyword" jdbcType="VARCHAR"/>
<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="seq_num" property="seqNum" jdbcType="INTEGER"/>
<result column="create_user" property="createUser" jdbcType="BIGINT"/> <result column="create_user" property="createUser" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
...@@ -21,8 +13,7 @@ ...@@ -21,8 +13,7 @@
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, book_group_id, guide, keyword, type, content, description, link_url, pic_url, serve_id, id, book_group_id, guide, keyword, seq_num, create_user, create_time
serve_type, resource_id,seq_num,create_user, create_time
</sql> </sql>
<insert id="insert" parameterType="com.pcloud.book.keywords.entity.SelfRobotKeyword" useGeneratedKeys="true" <insert id="insert" parameterType="com.pcloud.book.keywords.entity.SelfRobotKeyword" useGeneratedKeys="true"
...@@ -32,14 +23,6 @@ ...@@ -32,14 +23,6 @@
book_group_id, book_group_id,
guide, guide,
keyword, keyword,
type,
content,
description,
link_url,
pic_url,
serve_id,
serve_type,
resource_id,
seq_num, seq_num,
create_user, create_user,
create_time create_time
...@@ -48,14 +31,6 @@ ...@@ -48,14 +31,6 @@
#{bookGroupId,jdbcType=BIGINT}, #{bookGroupId,jdbcType=BIGINT},
#{guide,jdbcType=VARCHAR}, #{guide,jdbcType=VARCHAR},
#{keyword,jdbcType=VARCHAR}, #{keyword,jdbcType=VARCHAR},
#{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}, #{seqNum,jdbcType=INTEGER},
#{createUser,jdbcType=BIGINT}, #{createUser,jdbcType=BIGINT},
NOW() NOW()
...@@ -68,14 +43,6 @@ ...@@ -68,14 +43,6 @@
book_group_id, book_group_id,
guide, guide,
keyword, keyword,
type,
content,
description,
link_url,
pic_url,
serve_id,
serve_type,
resource_id,
seq_num, seq_num,
create_user, create_user,
create_time create_time
...@@ -85,14 +52,6 @@ ...@@ -85,14 +52,6 @@
#{item.bookGroupId,jdbcType=BIGINT}, #{item.bookGroupId,jdbcType=BIGINT},
#{item.guide,jdbcType=VARCHAR}, #{item.guide,jdbcType=VARCHAR},
#{item.keyword,jdbcType=VARCHAR}, #{item.keyword,jdbcType=VARCHAR},
#{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.seqNum,jdbcType=INTEGER},
#{item.createUser,jdbcType=BIGINT}, #{item.createUser,jdbcType=BIGINT},
NOW() NOW()
...@@ -106,14 +65,6 @@ ...@@ -106,14 +65,6 @@
book_group_id = #{bookGroupId,jdbcType=BIGINT}, book_group_id = #{bookGroupId,jdbcType=BIGINT},
guide = #{guide,jdbcType=VARCHAR}, guide = #{guide,jdbcType=VARCHAR},
keyword = #{keyword,jdbcType=VARCHAR}, keyword = #{keyword,jdbcType=VARCHAR},
type = #{type,jdbcType=INTEGER},
content = #{content,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
link_url = #{linkUrl,jdbcType=VARCHAR},
pic_url = #{picUrl,jdbcType=VARCHAR},
serve_id = #{serveId,jdbcType=BIGINT},
serve_type = #{serveType,jdbcType=VARCHAR},
resource_id = #{resourceId,jdbcType=BIGINT},
seq_num = #{seqNum,jdbcType=INTEGER} seq_num = #{seqNum,jdbcType=INTEGER}
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
...@@ -203,4 +154,10 @@ ...@@ -203,4 +154,10 @@
${item} ${item}
</foreach> </foreach>
</select> </select>
<select id="getById" parameterType="long" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from self_robot_keyword
where id=#{id}
</select>
</mapper> </mapper>
\ No newline at end of file
<?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.keywords.dao.impl.SelfRobotKeywordReplyDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.keywords.entity.SelfRobotKeywordReply">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="keyword_id" property="keywordId" 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, keyword_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.keywords.entity.SelfRobotKeywordReply" useGeneratedKeys="true"
keyProperty="id">
insert into self_robot_keyword_reply
<trim prefix="(" suffix=")" suffixOverrides=",">
keyword_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=",">
#{keywordId,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.keywords.entity.SelfRobotKeywordReply" useGeneratedKeys="true" keyProperty="id">
insert into self_robot_keyword_reply (
keyword_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.keywordId,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="deleteByKeywordId" parameterType="map">
delete from self_robot_keyword_reply
where keyword_id = #{keywordId}
</delete>
<select id="getListByKeywordId" parameterType="long" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from self_robot_keyword_reply
where keyword_id = #{keywordId}
order by seq_num, id
</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