Files
novel-plus/novel-crawl/src/main/resources/mybatis/mapping/BookMapper.xml
2020-11-03 08:41:48 +08:00

31 lines
1012 B
Java

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.java2nb.novel.mapper.CrawlBookMapper">
<select id="queryNeedUpdateBook" resultType="com.java2nb.novel.entity.Book">
select id,crawl_source_id,crawl_book_id,crawl_last_time,pic_url
from book where last_index_update_time > #{startDate} and crawl_source_id is not null
order by crawl_last_time
limit ${limit}
</select>
<select id="queryTotalWordCount" parameterType="long" resultType="int">
select sum(t2.word_count) from book t1 inner join book_index t2
on t1.id = t2.book_id and t1.id = #{bookId}
</select>
<update id="updateCrawlLastTime">
update book set crawl_last_time = #{currentDate}
where id in
<foreach item="book" collection="books" open="(" separator="," close=")">
#{book.id}
</foreach>
</update>
</mapper>