id,content,book_id,agent_id,wx_id,wechat_user_id,hot_book_id,user_delete,create_time
insert into search_record content, book_id, agent_id, wx_id, wechat_user_id, hot_book_id, create_time #{content,jdbcType=VARCHAR}, #{bookId,jdbcType=BIGINT}, #{agentId,jdbcType=BIGINT}, #{wxId,jdbcType=VARCHAR}, #{wechatUserId,jdbcType=BIGINT}, #{hotBookId,jdbcType=BIGINT}, NOW()
select content, book_id bookId, agent_id agentId, count(1) searchCount from search_record where 1=1 and content like CONCAT('%', #{content}, '%') group by content,book_id,agent_id
select from search_record where content=#{content} and book_id=#{bookId} and agent_id=#{agentId}
delete from search_record where wx_id=#{wxId}
select distinct wx_id from search_record where book_id=#{bookId} limit 5
update search_record set user_delete=#{userDelete} where wx_id=#{wxId}
select content bookName, book_id bookId, agent_id agentId from search_record where book_id is not null and agent_id is not null group by book_id,agent_id order by count(1) desc limit #{top}
update search_record set user_delete=#{userDelete} where wechat_user_id=#{wechatUserId}
select ifnull(count(1),0) from( SELECT b.BOOK_ID bookId FROM (select book_id bookId from search_record where wechat_user_id>0 and book_id>0 GROUP BY book_id)c INNER JOIN book_adviser a on c.bookId=a.book_id INNER JOIN book b ON b.BOOK_ID = a.BOOK_ID AND b.IS_DELETE = 0 WHERE 1=1 AND (b.BOOK_NAME LIKE CONCAT('%', #{keyword}, '%') or b.ISBN LIKE CONCAT(#{keyword},'%')) GROUP BY b.BOOK_ID )t
SELECT b.BOOK_ID bookId, b.ISBN isbn, b.BOOK_NAME bookName, a.ADVISER_ID adviserId FROM (select book_id bookId from search_record where wechat_user_id>0 and book_id>0 GROUP BY book_id)c INNER JOIN book_adviser a on c.bookId=a.book_id INNER JOIN book b ON b.BOOK_ID = a.BOOK_ID AND b.IS_DELETE = 0 WHERE 1=1 AND (b.BOOK_NAME LIKE CONCAT('%', #{keyword}, '%') or b.ISBN LIKE CONCAT(#{keyword},'%')) group by b.BOOK_ID order by count(1) desc limit #{pageNum}, #{numPerPage}
select distinct wechat_user_id from search_record where book_id in #{item} and wechat_user_id>0