id, content, book_id, agent_id, wx_id, wechat_user_id, hot_book_id, user_delete, create_time
SELECT FROM search_record_sale WHERE id = #{id}
SELECT FROM search_record_sale
INSERT INTO search_record_sale( content, book_id, agent_id, wx_id, wechat_user_id, hot_book_id, create_time, update_time ) VALUES ( #{content, jdbcType=VARCHAR}, #{bookId, jdbcType=INTEGER}, #{agentId, jdbcType=INTEGER}, #{wxId, jdbcType=VARCHAR}, #{wechatUserId, jdbcType=INTEGER}, #{hotBookId, jdbcType=INTEGER}, now(), now() )
INSERT INTO search_record_sale ( content, book_id, agent_id, wx_id, wechat_user_id, hot_book_id, create_time, update_time ) VALUES ( #{item.content, jdbcType=VARCHAR}, #{item.bookId, jdbcType=INTEGER}, #{item.agentId, jdbcType=INTEGER}, #{item.wxId, jdbcType=VARCHAR}, #{item.wechatUserId, jdbcType=INTEGER}, #{item.hotBookId, jdbcType=INTEGER}, now(), now() )
UPDATE search_record_sale content = #{content}, book_id = #{bookId}, agent_id = #{agentId}, wx_id = #{wxId}, wechat_user_id = #{wechatUserId}, hot_book_id = #{hotBookId}, user_delete = #{userDelete}, create_time = #{createTime}, update_time = #{updateTime}, WHERE id = #{id}
DELETE FROM search_record_sale where id = #{id}
select content, book_id bookId, agent_id agentId, count(1) searchCount from search_record_sale where 1=1 and content like CONCAT('%', #{content}, '%') group by content,book_id,agent_id
select from search_record_sale where content=#{content} and book_id=#{bookId} and agent_id=#{agentId}
delete from search_record_sale where wx_id=#{wxId}
select distinct wx_id from search_record_sale where book_id=#{bookId} limit 5
update search_record_sale set user_delete=#{userDelete} where wx_id=#{wxId}
select content bookName, book_id bookId, agent_id agentId from search_record_sale 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_sale set user_delete=#{userDelete}, update_time = now() where wechat_user_id=#{wechatUserId}
select ifnull(count(1),0) from( SELECT b.BOOK_ID bookId FROM (select book_id bookId from search_record_sale 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_sale 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_sale where book_id=#{bookId} and wechat_user_id>0