mirror of
https://github.com/201206030/novel-plus.git
synced 2025-04-27 01:30:51 +00:00
74 lines
2.5 KiB
Java
74 lines
2.5 KiB
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.FrontBookMapper">
|
|
|
|
<select id="searchByPage" parameterType="com.java2nb.novel.vo.BookSpVO" resultType="com.java2nb.novel.vo.BookVO">
|
|
select
|
|
id,cat_id,cat_name,book_name,author_id,author_name,word_count,last_index_id,last_index_name,score,pic_url,book_status,last_index_update_time,book_desc
|
|
from book where word_count > 0
|
|
<if test="keyword != null and keyword != ''">
|
|
and (book_name like concat('%',#{keyword},'%') or author_name like concat('%',#{keyword},'%'))
|
|
</if>
|
|
<if test="workDirection != null">
|
|
and work_direction = #{workDirection}
|
|
</if>
|
|
<if test="catId != null">
|
|
and cat_id = #{catId}
|
|
</if>
|
|
<if test="isVip != null">
|
|
and is_vip = #{isVip}
|
|
</if>
|
|
<if test="bookStatus != null">
|
|
and book_status = #{bookStatus}
|
|
</if>
|
|
<if test="wordCountMin != null">
|
|
and word_count >= #{wordCountMin}
|
|
</if>
|
|
<if test="wordCountMax != null">
|
|
and word_count <![CDATA[ < ]]> #{wordCountMax}
|
|
</if>
|
|
<if test="updateTimeMin != null">
|
|
and last_index_update_time >= #{updateTimeMin}
|
|
</if>
|
|
|
|
</select>
|
|
|
|
<update id="addVisitCount">
|
|
update book
|
|
set visit_count = visit_count + ${visitCount}
|
|
where id = #{bookId}
|
|
</update>
|
|
|
|
<select id="listRecBookByCatId" parameterType="int" resultType="com.java2nb.novel.entity.Book">
|
|
select id, pic_url, book_name, book_desc
|
|
from book
|
|
where cat_id = #{catId}
|
|
and word_count > 0
|
|
order by RAND() LIMIT 4
|
|
</select>
|
|
|
|
|
|
<update id="addCommentCount" parameterType="long">
|
|
update book
|
|
set comment_count = comment_count + 1
|
|
where id = #{bookId}
|
|
</update>
|
|
|
|
<select id="queryNetworkPicBooks" resultType="com.java2nb.novel.entity.Book">
|
|
select id,
|
|
pic_url
|
|
from book
|
|
where pic_url like 'http%'
|
|
and pic_url not like concat('%', #{localPicPrefix}, '%')
|
|
limit #{limit}
|
|
</select>
|
|
|
|
<select id="selectIdsByScoreAndRandom" parameterType="int" resultType="com.java2nb.novel.entity.Book">
|
|
|
|
select id, book_name, author_name, pic_url, book_desc, score
|
|
from book
|
|
ORDER BY score, RAND() LIMIT #{limit};
|
|
</select>
|
|
|
|
</mapper> |