mirror of
https://github.com/201206030/novel.git
synced 2025-04-27 07:30:50 +00:00
优化
This commit is contained in:
parent
d7e3dee2af
commit
8aa724bd69
@ -7,12 +7,14 @@ import org.springframework.boot.web.servlet.ServletComponentScan;
|
|||||||
import org.springframework.cache.annotation.EnableCaching;
|
import org.springframework.cache.annotation.EnableCaching;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.scheduling.TaskScheduler;
|
import org.springframework.scheduling.TaskScheduler;
|
||||||
|
import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableCaching
|
@EnableCaching
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
|
@EnableAsync
|
||||||
@MapperScan({"xyz.zinglizingli.*.mapper"})
|
@MapperScan({"xyz.zinglizingli.*.mapper"})
|
||||||
@ServletComponentScan
|
@ServletComponentScan
|
||||||
public class BookApplication {
|
public class BookApplication {
|
||||||
|
@ -27,4 +27,15 @@ public interface BookParseLogMapper {
|
|||||||
int updateByPrimaryKeySelective(BookParseLog record);
|
int updateByPrimaryKeySelective(BookParseLog record);
|
||||||
|
|
||||||
int updateByPrimaryKey(BookParseLog record);
|
int updateByPrimaryKey(BookParseLog record);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 增加小说更新次数
|
||||||
|
*
|
||||||
|
* @param logs*/
|
||||||
|
void addBookUpdateCount(List<BookParseLog> logs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询解析日志
|
||||||
|
* */
|
||||||
|
List<BookParseLog> queryBookParseLogs();
|
||||||
}
|
}
|
@ -15,6 +15,8 @@ public class BookParseLog {
|
|||||||
|
|
||||||
private Byte priority;
|
private Byte priority;
|
||||||
|
|
||||||
|
private Byte updateCount;
|
||||||
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@ -62,4 +64,12 @@ public class BookParseLog {
|
|||||||
public void setPriority(Byte priority) {
|
public void setPriority(Byte priority) {
|
||||||
this.priority = priority;
|
this.priority = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Byte getUpdateCount() {
|
||||||
|
return updateCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateCount(Byte updateCount) {
|
||||||
|
this.updateCount = updateCount;
|
||||||
|
}
|
||||||
}
|
}
|
@ -484,6 +484,66 @@ public class BookParseLogExample {
|
|||||||
addCriterion("priority not between", value1, value2, "priority");
|
addCriterion("priority not between", value1, value2, "priority");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Criteria andUpdateCountIsNull() {
|
||||||
|
addCriterion("update_count is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUpdateCountIsNotNull() {
|
||||||
|
addCriterion("update_count is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUpdateCountEqualTo(Byte value) {
|
||||||
|
addCriterion("update_count =", value, "updateCount");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUpdateCountNotEqualTo(Byte value) {
|
||||||
|
addCriterion("update_count <>", value, "updateCount");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUpdateCountGreaterThan(Byte value) {
|
||||||
|
addCriterion("update_count >", value, "updateCount");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUpdateCountGreaterThanOrEqualTo(Byte value) {
|
||||||
|
addCriterion("update_count >=", value, "updateCount");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUpdateCountLessThan(Byte value) {
|
||||||
|
addCriterion("update_count <", value, "updateCount");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUpdateCountLessThanOrEqualTo(Byte value) {
|
||||||
|
addCriterion("update_count <=", value, "updateCount");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUpdateCountIn(List<Byte> values) {
|
||||||
|
addCriterion("update_count in", values, "updateCount");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUpdateCountNotIn(List<Byte> values) {
|
||||||
|
addCriterion("update_count not in", values, "updateCount");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUpdateCountBetween(Byte value1, Byte value2) {
|
||||||
|
addCriterion("update_count between", value1, value2, "updateCount");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUpdateCountNotBetween(Byte value1, Byte value2) {
|
||||||
|
addCriterion("update_count not between", value1, value2, "updateCount");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Criteria extends GeneratedCriteria {
|
public static class Criteria extends GeneratedCriteria {
|
||||||
|
@ -5,6 +5,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import tk.mybatis.orderbyhelper.OrderByHelper;
|
import tk.mybatis.orderbyhelper.OrderByHelper;
|
||||||
@ -457,13 +458,19 @@ public class BookService {
|
|||||||
* 查询解析日志
|
* 查询解析日志
|
||||||
* */
|
* */
|
||||||
public List<BookParseLog> queryBookParseLogs() {
|
public List<BookParseLog> queryBookParseLogs() {
|
||||||
PageHelper.startPage(1,100);
|
List<BookParseLog> logs = bookParseLogMapper.queryBookParseLogs();
|
||||||
BookParseLogExample example = new BookParseLogExample();
|
SpringUtil.getBean(BookService.class).addBookUpdateCount(logs);
|
||||||
example.setOrderByClause("priority asc,create_time desc");
|
|
||||||
List<BookParseLog> logs = bookParseLogMapper.selectByExample(example);
|
|
||||||
return logs;
|
return logs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 增加小说更新次数
|
||||||
|
* */
|
||||||
|
@Async
|
||||||
|
public void addBookUpdateCount(List<BookParseLog> logs) {
|
||||||
|
bookParseLogMapper.addBookUpdateCount(logs);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除已经成功更新的解析日志
|
* 删除已经成功更新的解析日志
|
||||||
* */
|
* */
|
||||||
|
@ -1,228 +1,268 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?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" >
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
<mapper namespace="xyz.zinglizingli.books.mapper.BookParseLogMapper" >
|
<mapper namespace="xyz.zinglizingli.books.mapper.BookParseLogMapper">
|
||||||
<resultMap id="BaseResultMap" type="xyz.zinglizingli.books.po.BookParseLog" >
|
<resultMap id="BaseResultMap" type="xyz.zinglizingli.books.po.BookParseLog">
|
||||||
<id column="id" property="id" jdbcType="BIGINT" />
|
<id column="id" property="id" jdbcType="BIGINT"/>
|
||||||
<result column="book_url" property="bookUrl" jdbcType="VARCHAR" />
|
<result column="book_url" property="bookUrl" jdbcType="VARCHAR"/>
|
||||||
<result column="book_name" property="bookName" jdbcType="VARCHAR" />
|
<result column="book_name" property="bookName" jdbcType="VARCHAR"/>
|
||||||
<result column="score" property="score" jdbcType="REAL" />
|
<result column="score" property="score" jdbcType="REAL"/>
|
||||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
||||||
<result column="priority" property="priority" jdbcType="TINYINT" />
|
<result column="priority" property="priority" jdbcType="TINYINT"/>
|
||||||
</resultMap>
|
<result column="update_count" property="updateCount" jdbcType="TINYINT"/>
|
||||||
<sql id="Example_Where_Clause" >
|
</resultMap>
|
||||||
<where >
|
<sql id="Example_Where_Clause">
|
||||||
<foreach collection="oredCriteria" item="criteria" separator="or" >
|
<where>
|
||||||
<if test="criteria.valid" >
|
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||||
<trim prefix="(" suffix=")" prefixOverrides="and" >
|
<if test="criteria.valid">
|
||||||
<foreach collection="criteria.criteria" item="criterion" >
|
<trim prefix="(" suffix=")" prefixOverrides="and">
|
||||||
<choose >
|
<foreach collection="criteria.criteria" item="criterion">
|
||||||
<when test="criterion.noValue" >
|
<choose>
|
||||||
and ${criterion.condition}
|
<when test="criterion.noValue">
|
||||||
</when>
|
and ${criterion.condition}
|
||||||
<when test="criterion.singleValue" >
|
</when>
|
||||||
and ${criterion.condition} #{criterion.value}
|
<when test="criterion.singleValue">
|
||||||
</when>
|
and ${criterion.condition} #{criterion.value}
|
||||||
<when test="criterion.betweenValue" >
|
</when>
|
||||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
<when test="criterion.betweenValue">
|
||||||
</when>
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||||
<when test="criterion.listValue" >
|
</when>
|
||||||
and ${criterion.condition}
|
<when test="criterion.listValue">
|
||||||
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
|
and ${criterion.condition}
|
||||||
#{listItem}
|
<foreach collection="criterion.value" item="listItem" open="(" close=")"
|
||||||
</foreach>
|
separator=",">
|
||||||
</when>
|
#{listItem}
|
||||||
</choose>
|
</foreach>
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</foreach>
|
||||||
|
</trim>
|
||||||
|
</if>
|
||||||
</foreach>
|
</foreach>
|
||||||
</trim>
|
</where>
|
||||||
</if>
|
</sql>
|
||||||
</foreach>
|
<sql id="Update_By_Example_Where_Clause">
|
||||||
</where>
|
<where>
|
||||||
</sql>
|
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||||
<sql id="Update_By_Example_Where_Clause" >
|
<if test="criteria.valid">
|
||||||
<where >
|
<trim prefix="(" suffix=")" prefixOverrides="and">
|
||||||
<foreach collection="example.oredCriteria" item="criteria" separator="or" >
|
<foreach collection="criteria.criteria" item="criterion">
|
||||||
<if test="criteria.valid" >
|
<choose>
|
||||||
<trim prefix="(" suffix=")" prefixOverrides="and" >
|
<when test="criterion.noValue">
|
||||||
<foreach collection="criteria.criteria" item="criterion" >
|
and ${criterion.condition}
|
||||||
<choose >
|
</when>
|
||||||
<when test="criterion.noValue" >
|
<when test="criterion.singleValue">
|
||||||
and ${criterion.condition}
|
and ${criterion.condition} #{criterion.value}
|
||||||
</when>
|
</when>
|
||||||
<when test="criterion.singleValue" >
|
<when test="criterion.betweenValue">
|
||||||
and ${criterion.condition} #{criterion.value}
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||||
</when>
|
</when>
|
||||||
<when test="criterion.betweenValue" >
|
<when test="criterion.listValue">
|
||||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
and ${criterion.condition}
|
||||||
</when>
|
<foreach collection="criterion.value" item="listItem" open="(" close=")"
|
||||||
<when test="criterion.listValue" >
|
separator=",">
|
||||||
and ${criterion.condition}
|
#{listItem}
|
||||||
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
|
</foreach>
|
||||||
#{listItem}
|
</when>
|
||||||
</foreach>
|
</choose>
|
||||||
</when>
|
</foreach>
|
||||||
</choose>
|
</trim>
|
||||||
|
</if>
|
||||||
</foreach>
|
</foreach>
|
||||||
</trim>
|
</where>
|
||||||
|
</sql>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, book_url, book_name, score, create_time, priority, update_count
|
||||||
|
</sql>
|
||||||
|
<select id="selectByExample" resultMap="BaseResultMap"
|
||||||
|
parameterType="xyz.zinglizingli.books.po.BookParseLogExample">
|
||||||
|
select
|
||||||
|
<if test="distinct">
|
||||||
|
distinct
|
||||||
</if>
|
</if>
|
||||||
</foreach>
|
<include refid="Base_Column_List"/>
|
||||||
</where>
|
from book_parse_log
|
||||||
</sql>
|
<if test="_parameter != null">
|
||||||
<sql id="Base_Column_List" >
|
<include refid="Example_Where_Clause"/>
|
||||||
id, book_url, book_name, score, create_time, priority
|
</if>
|
||||||
</sql>
|
<if test="orderByClause != null">
|
||||||
<select id="selectByExample" resultMap="BaseResultMap" parameterType="xyz.zinglizingli.books.po.BookParseLogExample" >
|
order by ${orderByClause}
|
||||||
select
|
</if>
|
||||||
<if test="distinct" >
|
</select>
|
||||||
distinct
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">
|
||||||
</if>
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List"/>
|
||||||
from book_parse_log
|
from book_parse_log
|
||||||
<if test="_parameter != null" >
|
where id = #{id,jdbcType=BIGINT}
|
||||||
<include refid="Example_Where_Clause" />
|
</select>
|
||||||
</if>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||||
<if test="orderByClause != null" >
|
|
||||||
order by ${orderByClause}
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
|
|
||||||
select
|
|
||||||
<include refid="Base_Column_List" />
|
|
||||||
from book_parse_log
|
|
||||||
where id = #{id,jdbcType=BIGINT}
|
|
||||||
</select>
|
|
||||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
|
|
||||||
delete from book_parse_log
|
delete from book_parse_log
|
||||||
where id = #{id,jdbcType=BIGINT}
|
where id = #{id,jdbcType=BIGINT}
|
||||||
</delete>
|
</delete>
|
||||||
<delete id="deleteByExample" parameterType="xyz.zinglizingli.books.po.BookParseLogExample" >
|
<delete id="deleteByExample" parameterType="xyz.zinglizingli.books.po.BookParseLogExample">
|
||||||
delete from book_parse_log
|
delete from book_parse_log
|
||||||
<if test="_parameter != null" >
|
<if test="_parameter != null">
|
||||||
<include refid="Example_Where_Clause" />
|
<include refid="Example_Where_Clause"/>
|
||||||
</if>
|
</if>
|
||||||
</delete>
|
</delete>
|
||||||
<insert id="insert" parameterType="xyz.zinglizingli.books.po.BookParseLog" >
|
<insert id="insert" parameterType="xyz.zinglizingli.books.po.BookParseLog">
|
||||||
insert into book_parse_log (id, book_url, book_name,
|
insert into book_parse_log (id, book_url, book_name,
|
||||||
score, create_time, priority
|
score, create_time, priority,
|
||||||
)
|
update_count)
|
||||||
values (#{id,jdbcType=BIGINT}, #{bookUrl,jdbcType=VARCHAR}, #{bookName,jdbcType=VARCHAR},
|
values (#{id,jdbcType=BIGINT}, #{bookUrl,jdbcType=VARCHAR}, #{bookName,jdbcType=VARCHAR},
|
||||||
#{score,jdbcType=REAL}, #{createTime,jdbcType=TIMESTAMP}, #{priority,jdbcType=TINYINT}
|
#{score,jdbcType=REAL}, #{createTime,jdbcType=TIMESTAMP}, #{priority,jdbcType=TINYINT},
|
||||||
)
|
#{updateCount,jdbcType=TINYINT})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="xyz.zinglizingli.books.po.BookParseLog" >
|
<insert id="insertSelective" parameterType="xyz.zinglizingli.books.po.BookParseLog">
|
||||||
insert into book_parse_log
|
insert into book_parse_log
|
||||||
<trim prefix="(" suffix=")" suffixOverrides="," >
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null" >
|
<if test="id != null">
|
||||||
id,
|
id,
|
||||||
</if>
|
</if>
|
||||||
<if test="bookUrl != null" >
|
<if test="bookUrl != null">
|
||||||
book_url,
|
book_url,
|
||||||
</if>
|
</if>
|
||||||
<if test="bookName != null" >
|
<if test="bookName != null">
|
||||||
book_name,
|
book_name,
|
||||||
</if>
|
</if>
|
||||||
<if test="score != null" >
|
<if test="score != null">
|
||||||
score,
|
score,
|
||||||
</if>
|
</if>
|
||||||
<if test="createTime != null" >
|
<if test="createTime != null">
|
||||||
create_time,
|
create_time,
|
||||||
</if>
|
</if>
|
||||||
<if test="priority != null" >
|
<if test="priority != null">
|
||||||
priority,
|
priority,
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
<if test="updateCount != null">
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
update_count,
|
||||||
<if test="id != null" >
|
</if>
|
||||||
#{id,jdbcType=BIGINT},
|
</trim>
|
||||||
</if>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="bookUrl != null" >
|
<if test="id != null">
|
||||||
#{bookUrl,jdbcType=VARCHAR},
|
#{id,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
<if test="bookName != null" >
|
<if test="bookUrl != null">
|
||||||
#{bookName,jdbcType=VARCHAR},
|
#{bookUrl,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="score != null" >
|
<if test="bookName != null">
|
||||||
#{score,jdbcType=REAL},
|
#{bookName,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="createTime != null" >
|
<if test="score != null">
|
||||||
#{createTime,jdbcType=TIMESTAMP},
|
#{score,jdbcType=REAL},
|
||||||
</if>
|
</if>
|
||||||
<if test="priority != null" >
|
<if test="createTime != null">
|
||||||
#{priority,jdbcType=TINYINT},
|
#{createTime,jdbcType=TIMESTAMP},
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
<if test="priority != null">
|
||||||
</insert>
|
#{priority,jdbcType=TINYINT},
|
||||||
<select id="countByExample" parameterType="xyz.zinglizingli.books.po.BookParseLogExample" resultType="java.lang.Integer" >
|
</if>
|
||||||
select count(*) from book_parse_log
|
<if test="updateCount != null">
|
||||||
<if test="_parameter != null" >
|
#{updateCount,jdbcType=TINYINT},
|
||||||
<include refid="Example_Where_Clause" />
|
</if>
|
||||||
</if>
|
</trim>
|
||||||
</select>
|
</insert>
|
||||||
<update id="updateByExampleSelective" parameterType="map" >
|
<select id="countByExample" parameterType="xyz.zinglizingli.books.po.BookParseLogExample"
|
||||||
update book_parse_log
|
resultType="java.lang.Integer">
|
||||||
<set >
|
select count(*) from book_parse_log
|
||||||
<if test="record.id != null" >
|
<if test="_parameter != null">
|
||||||
id = #{record.id,jdbcType=BIGINT},
|
<include refid="Example_Where_Clause"/>
|
||||||
</if>
|
</if>
|
||||||
<if test="record.bookUrl != null" >
|
</select>
|
||||||
|
<update id="updateByExampleSelective" parameterType="map">
|
||||||
|
update book_parse_log
|
||||||
|
<set>
|
||||||
|
<if test="record.id != null">
|
||||||
|
id = #{record.id,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="record.bookUrl != null">
|
||||||
|
book_url = #{record.bookUrl,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.bookName != null">
|
||||||
|
book_name = #{record.bookName,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.score != null">
|
||||||
|
score = #{record.score,jdbcType=REAL},
|
||||||
|
</if>
|
||||||
|
<if test="record.createTime != null">
|
||||||
|
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="record.priority != null">
|
||||||
|
priority = #{record.priority,jdbcType=TINYINT},
|
||||||
|
</if>
|
||||||
|
<if test="record.updateCount != null">
|
||||||
|
update_count = #{record.updateCount,jdbcType=TINYINT},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
<if test="_parameter != null">
|
||||||
|
<include refid="Update_By_Example_Where_Clause"/>
|
||||||
|
</if>
|
||||||
|
</update>
|
||||||
|
<update id="updateByExample" parameterType="map">
|
||||||
|
update book_parse_log
|
||||||
|
set id = #{record.id,jdbcType=BIGINT},
|
||||||
book_url = #{record.bookUrl,jdbcType=VARCHAR},
|
book_url = #{record.bookUrl,jdbcType=VARCHAR},
|
||||||
</if>
|
|
||||||
<if test="record.bookName != null" >
|
|
||||||
book_name = #{record.bookName,jdbcType=VARCHAR},
|
book_name = #{record.bookName,jdbcType=VARCHAR},
|
||||||
</if>
|
|
||||||
<if test="record.score != null" >
|
|
||||||
score = #{record.score,jdbcType=REAL},
|
score = #{record.score,jdbcType=REAL},
|
||||||
</if>
|
|
||||||
<if test="record.createTime != null" >
|
|
||||||
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
||||||
</if>
|
|
||||||
<if test="record.priority != null" >
|
|
||||||
priority = #{record.priority,jdbcType=TINYINT},
|
priority = #{record.priority,jdbcType=TINYINT},
|
||||||
</if>
|
update_count = #{record.updateCount,jdbcType=TINYINT}
|
||||||
</set>
|
<if test="_parameter != null">
|
||||||
<if test="_parameter != null" >
|
<include refid="Update_By_Example_Where_Clause"/>
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
</if>
|
||||||
</if>
|
</update>
|
||||||
</update>
|
<update id="updateByPrimaryKeySelective" parameterType="xyz.zinglizingli.books.po.BookParseLog">
|
||||||
<update id="updateByExample" parameterType="map" >
|
update book_parse_log
|
||||||
update book_parse_log
|
<set>
|
||||||
set id = #{record.id,jdbcType=BIGINT},
|
<if test="bookUrl != null">
|
||||||
book_url = #{record.bookUrl,jdbcType=VARCHAR},
|
book_url = #{bookUrl,jdbcType=VARCHAR},
|
||||||
book_name = #{record.bookName,jdbcType=VARCHAR},
|
</if>
|
||||||
score = #{record.score,jdbcType=REAL},
|
<if test="bookName != null">
|
||||||
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
book_name = #{bookName,jdbcType=VARCHAR},
|
||||||
priority = #{record.priority,jdbcType=TINYINT}
|
</if>
|
||||||
<if test="_parameter != null" >
|
<if test="score != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
score = #{score,jdbcType=REAL},
|
||||||
</if>
|
</if>
|
||||||
</update>
|
<if test="createTime != null">
|
||||||
<update id="updateByPrimaryKeySelective" parameterType="xyz.zinglizingli.books.po.BookParseLog" >
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||||
update book_parse_log
|
</if>
|
||||||
<set >
|
<if test="priority != null">
|
||||||
<if test="bookUrl != null" >
|
priority = #{priority,jdbcType=TINYINT},
|
||||||
book_url = #{bookUrl,jdbcType=VARCHAR},
|
</if>
|
||||||
</if>
|
<if test="updateCount != null">
|
||||||
<if test="bookName != null" >
|
update_count = #{updateCount,jdbcType=TINYINT},
|
||||||
book_name = #{bookName,jdbcType=VARCHAR},
|
</if>
|
||||||
</if>
|
</set>
|
||||||
<if test="score != null" >
|
where id = #{id,jdbcType=BIGINT}
|
||||||
score = #{score,jdbcType=REAL},
|
</update>
|
||||||
</if>
|
<update id="updateByPrimaryKey" parameterType="xyz.zinglizingli.books.po.BookParseLog">
|
||||||
<if test="createTime != null" >
|
|
||||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="priority != null" >
|
|
||||||
priority = #{priority,jdbcType=TINYINT},
|
|
||||||
</if>
|
|
||||||
</set>
|
|
||||||
where id = #{id,jdbcType=BIGINT}
|
|
||||||
</update>
|
|
||||||
<update id="updateByPrimaryKey" parameterType="xyz.zinglizingli.books.po.BookParseLog" >
|
|
||||||
update book_parse_log
|
update book_parse_log
|
||||||
set book_url = #{bookUrl,jdbcType=VARCHAR},
|
set book_url = #{bookUrl,jdbcType=VARCHAR},
|
||||||
book_name = #{bookName,jdbcType=VARCHAR},
|
book_name = #{bookName,jdbcType=VARCHAR},
|
||||||
score = #{score,jdbcType=REAL},
|
score = #{score,jdbcType=REAL},
|
||||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||||
priority = #{priority,jdbcType=TINYINT}
|
priority = #{priority,jdbcType=TINYINT},
|
||||||
|
update_count = #{updateCount,jdbcType=TINYINT}
|
||||||
where id = #{id,jdbcType=BIGINT}
|
where id = #{id,jdbcType=BIGINT}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="addBookUpdateCount">
|
||||||
|
|
||||||
|
update book_parse_log set update_count = update_count + 1
|
||||||
|
where id in
|
||||||
|
<foreach collection="list" item="log" separator="," open="(" close=")">
|
||||||
|
#{log.id}
|
||||||
|
</foreach>
|
||||||
|
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="queryBookParseLogs" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List"/>
|
||||||
|
from book_parse_log
|
||||||
|
where update_count <![CDATA[ < ]]> 5
|
||||||
|
order by priority asc,create_time desc
|
||||||
|
limit 100
|
||||||
|
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
1
sql/2020-04-22.sql
Normal file
1
sql/2020-04-22.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
alter table book_parse_log add column `update_count` TINYINT(2) not null default 0 ;
|
Loading…
x
Reference in New Issue
Block a user