集成后台管理系统,上线智能爬虫程序

This commit is contained in:
xxy
2019-11-15 07:15:20 +08:00
parent 7b861d2fb0
commit 53cff722d1
1125 changed files with 275618 additions and 62 deletions

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<context id="books" targetRuntime="MyBatis3">
<commentGenerator>
<!-- 是否去除自动生成的注释 true false:否 -->
<property name="suppressAllComments" value="true" />
</commentGenerator>
<jdbcConnection
connectionURL="jdbc:mysql://localhost:3306/books?useUnicode=true&amp;characterEncoding=utf-8"
driverClass="com.mysql.jdbc.Driver" password="books"
userId="books" />
<!-- 默认false把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer 为 true时把JDBC DECIMAL
和 NUMERIC 类型解析为java.math.BigDecimal -->
<javaTypeResolver>
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<!-- targetProject:生成PO类的位置 -->
<javaModelGenerator
targetPackage="xyz.zinglizingli.books.po"
targetProject="src/main/java">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
<!-- 从数据库返回的值被清理前后的空格 -->
<property name="trimStrings" value="true" />
</javaModelGenerator>
<!-- targetProject:mapper映射文件生成的位置 -->
<sqlMapGenerator targetPackage="mybatis.mapping"
targetProject="src/main/resources">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
</sqlMapGenerator>
<!-- targetPackagemapper接口生成的位置 -->
<javaClientGenerator
targetPackage="xyz.zinglizingli.books.mapper"
targetProject="src/main/java" type="XMLMAPPER">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
</javaClientGenerator>
<table schema="books" tableName="book_content"/>
<!-- 指定数据库表 -->
<!--<table schema="jly" tableName="job_position" domainObjectName="JobPositionTest"/>-->
</context>
</generatorConfiguration>

View File

@ -0,0 +1,228 @@
<?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="xyz.zinglizingli.books.mapper.BookContentMapper">
<resultMap id="BaseResultMap" type="xyz.zinglizingli.books.po.BookContent">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="book_id" property="bookId" jdbcType="BIGINT"/>
<result column="index_id" property="indexId" jdbcType="BIGINT"/>
<result column="index_num" property="indexNum" jdbcType="INTEGER"/>
<result column="content" property="content" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" suffix=")" prefixOverrides="and">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")"
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" suffix=")" prefixOverrides="and">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")"
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, book_id, index_id, index_num, content
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="xyz.zinglizingli.books.po.BookContentExample">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from book_content
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<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_content
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from book_content
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="xyz.zinglizingli.books.po.BookContentExample">
delete from book_content
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="xyz.zinglizingli.books.po.BookContent">
insert into book_content (id, book_id, index_id,
index_num, content)
values (#{id,jdbcType=BIGINT}, #{bookId,jdbcType=BIGINT}, #{indexId,jdbcType=BIGINT},
#{indexNum,jdbcType=INTEGER}, #{content,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="xyz.zinglizingli.books.po.BookContent">
insert into book_content
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="bookId != null">
book_id,
</if>
<if test="indexId != null">
index_id,
</if>
<if test="indexNum != null">
index_num,
</if>
<if test="content != null">
content,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="bookId != null">
#{bookId,jdbcType=BIGINT},
</if>
<if test="indexId != null">
#{indexId,jdbcType=BIGINT},
</if>
<if test="indexNum != null">
#{indexNum,jdbcType=INTEGER},
</if>
<if test="content != null">
#{content,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="xyz.zinglizingli.books.po.BookContentExample"
resultType="java.lang.Integer">
select count(*) from book_content
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update book_content
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.bookId != null">
book_id = #{record.bookId,jdbcType=BIGINT},
</if>
<if test="record.indexId != null">
index_id = #{record.indexId,jdbcType=BIGINT},
</if>
<if test="record.indexNum != null">
index_num = #{record.indexNum,jdbcType=INTEGER},
</if>
<if test="record.content != null">
content = #{record.content,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
update book_content
set id = #{record.id,jdbcType=BIGINT},
book_id = #{record.bookId,jdbcType=BIGINT},
index_id = #{record.indexId,jdbcType=BIGINT},
index_num = #{record.indexNum,jdbcType=INTEGER},
content = #{record.content,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="xyz.zinglizingli.books.po.BookContent">
update book_content
<set>
<if test="bookId != null">
book_id = #{bookId,jdbcType=BIGINT},
</if>
<if test="indexId != null">
index_id = #{indexId,jdbcType=BIGINT},
</if>
<if test="indexNum != null">
index_num = #{indexNum,jdbcType=INTEGER},
</if>
<if test="content != null">
content = #{content,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="xyz.zinglizingli.books.po.BookContent">
update book_content
set book_id = #{bookId,jdbcType=BIGINT},
index_id = #{indexId,jdbcType=BIGINT},
index_num = #{indexNum,jdbcType=INTEGER},
content = #{content,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<insert id="insertBatch" parameterType="java.util.List">
insert into book_content (book_id, index_num, content)
values
<foreach collection="list" item="item" index="index"
separator=",">
<trim prefix="(" suffix=")" suffixOverrides=",">
#{item.bookId,jdbcType=VARCHAR},
#{item.indexNum,jdbcType=VARCHAR},
#{item.content,jdbcType=VARCHAR},
</trim>
</foreach>
</insert>
</mapper>

View File

@ -0,0 +1,223 @@
<?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="xyz.zinglizingli.books.mapper.BookIndexMapper">
<resultMap id="BaseResultMap" type="xyz.zinglizingli.books.po.BookIndex">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="book_id" property="bookId" jdbcType="BIGINT"/>
<result column="index_num" property="indexNum" jdbcType="INTEGER"/>
<result column="index_name" property="indexName" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" suffix=")" prefixOverrides="and">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")"
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" suffix=")" prefixOverrides="and">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")"
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, book_id, index_num, index_name
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="xyz.zinglizingli.books.po.BookIndexExample">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from book_index
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<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_index
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from book_index
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="xyz.zinglizingli.books.po.BookIndexExample">
delete from book_index
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="xyz.zinglizingli.books.po.BookIndex">
insert into book_index (id, book_id, index_num,
index_name)
values (#{id,jdbcType=BIGINT}, #{bookId,jdbcType=BIGINT}, #{indexNum,jdbcType=INTEGER},
#{indexName,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="xyz.zinglizingli.books.po.BookIndex" useGeneratedKeys="true"
keyProperty="id">
insert into book_index
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="bookId != null">
book_id,
</if>
<if test="indexNum != null">
index_num,
</if>
<if test="indexName != null">
index_name,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="bookId != null">
#{bookId,jdbcType=BIGINT},
</if>
<if test="indexNum != null">
#{indexNum,jdbcType=INTEGER},
</if>
<if test="indexName != null">
#{indexName,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="xyz.zinglizingli.books.po.BookIndexExample"
resultType="java.lang.Integer">
select count(*) from book_index
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update book_index
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.bookId != null">
book_id = #{record.bookId,jdbcType=BIGINT},
</if>
<if test="record.indexNum != null">
index_num = #{record.indexNum,jdbcType=INTEGER},
</if>
<if test="record.indexName != null">
index_name = #{record.indexName,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
update book_index
set id = #{record.id,jdbcType=BIGINT},
book_id = #{record.bookId,jdbcType=BIGINT},
index_num = #{record.indexNum,jdbcType=INTEGER},
index_name = #{record.indexName,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="xyz.zinglizingli.books.po.BookIndex">
update book_index
<set>
<if test="bookId != null">
book_id = #{bookId,jdbcType=BIGINT},
</if>
<if test="indexNum != null">
index_num = #{indexNum,jdbcType=INTEGER},
</if>
<if test="indexName != null">
index_name = #{indexName,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="xyz.zinglizingli.books.po.BookIndex">
update book_index
set book_id = #{bookId,jdbcType=BIGINT},
index_num = #{indexNum,jdbcType=INTEGER},
index_name = #{indexName,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<insert id="insertBatch" parameterType="java.util.List">
insert into book_index (book_id, index_num, index_name)
values
<foreach collection="list" item="item" index="index"
separator=",">
<trim prefix="(" suffix=")" suffixOverrides=",">
#{item.bookId,jdbcType=VARCHAR},
#{item.indexNum,jdbcType=VARCHAR},
#{item.indexName,jdbcType=VARCHAR},
</trim>
</foreach>
</insert>
<select id="queryNewstIndexName" parameterType="long" resultType="string">
select index_name from book_index where book_id = #{bookId,jdbcType=BIGINT} order by index_num desc limit 1
</select>
</mapper>

View File

@ -0,0 +1,391 @@
<?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="xyz.zinglizingli.books.mapper.BookMapper">
<resultMap id="BaseResultMap" type="xyz.zinglizingli.books.po.Book">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="catId" property="catid" jdbcType="INTEGER"/>
<result column="pic_url" property="picUrl" jdbcType="VARCHAR"/>
<result column="book_name" property="bookName" jdbcType="VARCHAR"/>
<result column="author" property="author" jdbcType="VARCHAR"/>
<result column="book_desc" property="bookDesc" jdbcType="VARCHAR"/>
<result column="score" property="score" jdbcType="REAL"/>
<result column="book_status" property="bookStatus" jdbcType="VARCHAR"/>
<result column="visit_count" property="visitCount" jdbcType="BIGINT"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
<result column="update_time_str" property="updateTimeStr" jdbcType="VARCHAR"/>
<result column="soft_cat" property="softCat" jdbcType="INTEGER"/>
<result column="soft_tag" property="softTag" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" suffix=")" prefixOverrides="and">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")"
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" suffix=")" prefixOverrides="and">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")"
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, catId, pic_url, book_name, author, book_desc, score, book_status, visit_count,
update_time,soft_cat,soft_tag
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="xyz.zinglizingli.books.po.BookExample">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from book
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<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
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from book
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="xyz.zinglizingli.books.po.BookExample">
delete from book
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="xyz.zinglizingli.books.po.Book">
insert into book (id, catId, pic_url,
book_name, author, book_desc,
score, book_status, visit_count,
update_time)
values (#{id,jdbcType=BIGINT}, #{catid,jdbcType=INTEGER}, #{picUrl,jdbcType=VARCHAR},
#{bookName,jdbcType=VARCHAR}, #{author,jdbcType=VARCHAR}, #{bookDesc,jdbcType=VARCHAR},
#{score,jdbcType=REAL}, #{bookStatus,jdbcType=VARCHAR}, #{visitCount,jdbcType=BIGINT},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="xyz.zinglizingli.books.po.Book" useGeneratedKeys="true"
keyProperty="id">
insert into book
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="catid != null">
catId,
</if>
<if test="picUrl != null">
pic_url,
</if>
<if test="bookName != null">
book_name,
</if>
<if test="author != null">
author,
</if>
<if test="bookDesc != null">
book_desc,
</if>
<if test="score != null">
score,
</if>
<if test="bookStatus != null">
book_status,
</if>
<if test="visitCount != null">
visit_count,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="catid != null">
#{catid,jdbcType=INTEGER},
</if>
<if test="picUrl != null">
#{picUrl,jdbcType=VARCHAR},
</if>
<if test="bookName != null">
#{bookName,jdbcType=VARCHAR},
</if>
<if test="author != null">
#{author,jdbcType=VARCHAR},
</if>
<if test="bookDesc != null">
#{bookDesc,jdbcType=VARCHAR},
</if>
<if test="score != null">
#{score,jdbcType=REAL},
</if>
<if test="bookStatus != null">
#{bookStatus,jdbcType=VARCHAR},
</if>
<if test="visitCount != null">
#{visitCount,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="xyz.zinglizingli.books.po.BookExample" resultType="java.lang.Integer">
select count(*) from book
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update book
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.catid != null">
catId = #{record.catid,jdbcType=INTEGER},
</if>
<if test="record.picUrl != null">
pic_url = #{record.picUrl,jdbcType=VARCHAR},
</if>
<if test="record.bookName != null">
book_name = #{record.bookName,jdbcType=VARCHAR},
</if>
<if test="record.author != null">
author = #{record.author,jdbcType=VARCHAR},
</if>
<if test="record.bookDesc != null">
book_desc = #{record.bookDesc,jdbcType=VARCHAR},
</if>
<if test="record.score != null">
score = #{record.score,jdbcType=REAL},
</if>
<if test="record.bookStatus != null">
book_status = #{record.bookStatus,jdbcType=VARCHAR},
</if>
<if test="record.visitCount != null">
visit_count = #{record.visitCount,jdbcType=BIGINT},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
update book
set id = #{record.id,jdbcType=BIGINT},
catId = #{record.catid,jdbcType=INTEGER},
pic_url = #{record.picUrl,jdbcType=VARCHAR},
book_name = #{record.bookName,jdbcType=VARCHAR},
author = #{record.author,jdbcType=VARCHAR},
book_desc = #{record.bookDesc,jdbcType=VARCHAR},
score = #{record.score,jdbcType=REAL},
book_status = #{record.bookStatus,jdbcType=VARCHAR},
visit_count = #{record.visitCount,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="xyz.zinglizingli.books.po.Book">
update book
<set>
<if test="catid != null">
catId = #{catid,jdbcType=INTEGER},
</if>
<if test="picUrl != null">
pic_url = #{picUrl,jdbcType=VARCHAR},
</if>
<if test="bookName != null">
book_name = #{bookName,jdbcType=VARCHAR},
</if>
<if test="author != null">
author = #{author,jdbcType=VARCHAR},
</if>
<if test="bookDesc != null">
book_desc = #{bookDesc,jdbcType=VARCHAR},
</if>
<if test="score != null">
score = #{score,jdbcType=REAL},
</if>
<if test="bookStatus != null">
book_status = #{bookStatus,jdbcType=VARCHAR},
</if>
<if test="visitCount != null">
visit_count = #{visitCount,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="xyz.zinglizingli.books.po.Book">
update book
set catId = #{catid,jdbcType=INTEGER},
pic_url = #{picUrl,jdbcType=VARCHAR},
book_name = #{bookName,jdbcType=VARCHAR},
author = #{author,jdbcType=VARCHAR},
book_desc = #{bookDesc,jdbcType=VARCHAR},
score = #{score,jdbcType=REAL},
book_status = #{bookStatus,jdbcType=VARCHAR},
visit_count = #{visitCount,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
<select id="search" resultMap="BaseResultMap">
select book.id,book.catId,book.book_name,book.pic_url,book.author,book.book_desc,
book.score,book.book_status,book.update_time,book.soft_cat,book.soft_tag
from book
<if test="userId != null and userId != ''.toString()">
inner join user_ref_book on book.id = user_ref_book.book_id
</if>
<where>
<if test="userId != null and userId != ''.toString()">
AND user_ref_book.user_id = #{userId,jdbcType=BIGINT}
</if>
<if test="ids != null and ids != ''.toString()">
AND book.id in (${ids})
</if>
<if test="softCat != null">
AND book.soft_cat = #{softCat,jdbcType=INTEGER}
</if>
<choose>
<when test="catId != null">
AND book.catId = #{catId,jdbcType=INTEGER}
</when>
<otherwise><!-- 我的书架和我的阅读记录查询所有记录,不分版块-->
<if test="(ids == null or ids == ''.toString()) and (userId == null or userId == ''.toString())">
AND book.catId <![CDATA[ <> ]]> 8
</if>
</otherwise>
</choose>
<if test="softTag != null and softTag != ''.toString()">
AND book.soft_tag like concat('%',#{softTag,jdbcType=VARCHAR},'%')
</if>
<if test="keyword != null and keyword != ''.toString()">
AND (book.book_name like concat('%',#{keyword,jdbcType=VARCHAR},'%') or book.author like
concat('%',#{keyword,jdbcType=VARCHAR},'%'))
</if>
<if test="bookStatus != null and bookStatus != ''.toString()">
AND book.book_status = #{bookStatus,jdbcType=VARCHAR}
</if>
</where>
</select>
<update id="addVisitCount" parameterType="java.lang.Long">
update book set visit_count = visit_count + 1
where id = #{bookId,jdbcType=BIGINT}
</update>
<select id="queryRandomBook" resultMap="BaseResultMap">
select id,book_name,book_desc,author from book order by rand() limit 1
</select>
<select id="queryNewstBook" resultMap="BaseResultMap">
select id,book_name,book_desc,author from book
<foreach collection="collection" item="item"
open="where id not in(" close=")" separator=",">
#{item}
</foreach>
order by rand() desc limit 1
</select>
<select id="queryNewstBookIdList" resultType="string">
select id from book ORDER BY update_time desc limit 30
</select>
<select id="queryEndBookIdList" resultType="string">
select id from book/* where book_status like '%完成%'*/
</select>
<select id="queryRecBooks" parameterType="java.util.List" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from book
<where>
<foreach collection="list" item="item" index="index"
separator="or">
<trim prefix="(" suffix=")">
book_name = #{item.bookName,jdbcType=VARCHAR} and
author = #{item.bookAuthor,jdbcType=VARCHAR}
</trim>
</foreach>
</where>
limit 3
</select>
</mapper>

View File

@ -0,0 +1,211 @@
<?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="xyz.zinglizingli.books.mapper.CategoryMapper" >
<resultMap id="BaseResultMap" type="xyz.zinglizingli.books.po.Category" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="name" property="name" jdbcType="VARCHAR" />
<result column="sort" property="sort" jdbcType="TINYINT" />
<result column="get_url" property="getUrl" jdbcType="VARCHAR" />
<result column="req_url" property="reqUrl" jdbcType="VARCHAR" />
</resultMap>
<sql id="Example_Where_Clause" >
<where >
<foreach collection="oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause" >
<where >
<foreach collection="example.oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List" >
id, name, sort, get_url, req_url
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="xyz.zinglizingli.books.po.CategoryExample" >
select
<if test="distinct" >
distinct
</if>
<include refid="Base_Column_List" />
from category
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null" >
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from category
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from category
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="xyz.zinglizingli.books.po.CategoryExample" >
delete from category
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="xyz.zinglizingli.books.po.Category" >
insert into category (id, name, sort,
get_url, req_url)
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{sort,jdbcType=TINYINT},
#{getUrl,jdbcType=VARCHAR}, #{reqUrl,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="xyz.zinglizingli.books.po.Category" >
insert into category
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="name != null" >
name,
</if>
<if test="sort != null" >
sort,
</if>
<if test="getUrl != null" >
get_url,
</if>
<if test="reqUrl != null" >
req_url,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="name != null" >
#{name,jdbcType=VARCHAR},
</if>
<if test="sort != null" >
#{sort,jdbcType=TINYINT},
</if>
<if test="getUrl != null" >
#{getUrl,jdbcType=VARCHAR},
</if>
<if test="reqUrl != null" >
#{reqUrl,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="xyz.zinglizingli.books.po.CategoryExample" resultType="java.lang.Integer" >
select count(*) from category
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map" >
update category
<set >
<if test="record.id != null" >
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.name != null" >
name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.sort != null" >
sort = #{record.sort,jdbcType=TINYINT},
</if>
<if test="record.getUrl != null" >
get_url = #{record.getUrl,jdbcType=VARCHAR},
</if>
<if test="record.reqUrl != null" >
req_url = #{record.reqUrl,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map" >
update category
set id = #{record.id,jdbcType=INTEGER},
name = #{record.name,jdbcType=VARCHAR},
sort = #{record.sort,jdbcType=TINYINT},
get_url = #{record.getUrl,jdbcType=VARCHAR},
req_url = #{record.reqUrl,jdbcType=VARCHAR}
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="xyz.zinglizingli.books.po.Category" >
update category
<set >
<if test="name != null" >
name = #{name,jdbcType=VARCHAR},
</if>
<if test="sort != null" >
sort = #{sort,jdbcType=TINYINT},
</if>
<if test="getUrl != null" >
get_url = #{getUrl,jdbcType=VARCHAR},
</if>
<if test="reqUrl != null" >
req_url = #{reqUrl,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="xyz.zinglizingli.books.po.Category" >
update category
set name = #{name,jdbcType=VARCHAR},
sort = #{sort,jdbcType=TINYINT},
get_url = #{getUrl,jdbcType=VARCHAR},
req_url = #{reqUrl,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -0,0 +1,196 @@
<?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="xyz.zinglizingli.books.mapper.ScreenBulletMapper" >
<resultMap id="BaseResultMap" type="xyz.zinglizingli.books.po.ScreenBullet" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="content_id" property="contentId" jdbcType="BIGINT" />
<result column="screen_bullet" property="screenBullet" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Example_Where_Clause" >
<where >
<foreach collection="oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause" >
<where >
<foreach collection="example.oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List" >
id, content_id, screen_bullet, create_time
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="xyz.zinglizingli.books.po.ScreenBulletExample" >
select
<if test="distinct" >
distinct
</if>
<include refid="Base_Column_List" />
from screen_bullet
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
<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 screen_bullet
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from screen_bullet
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="xyz.zinglizingli.books.po.ScreenBulletExample" >
delete from screen_bullet
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="xyz.zinglizingli.books.po.ScreenBullet" >
insert into screen_bullet (id, content_id, screen_bullet,
create_time)
values (#{id,jdbcType=BIGINT}, #{contentId,jdbcType=BIGINT}, #{screenBullet,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="xyz.zinglizingli.books.po.ScreenBullet" >
insert into screen_bullet
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="contentId != null" >
content_id,
</if>
<if test="screenBullet != null" >
screen_bullet,
</if>
<if test="createTime != null" >
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=BIGINT},
</if>
<if test="contentId != null" >
#{contentId,jdbcType=BIGINT},
</if>
<if test="screenBullet != null" >
#{screenBullet,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="xyz.zinglizingli.books.po.ScreenBulletExample" resultType="java.lang.Integer" >
select count(*) from screen_bullet
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map" >
update screen_bullet
<set >
<if test="record.id != null" >
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.contentId != null" >
content_id = #{record.contentId,jdbcType=BIGINT},
</if>
<if test="record.screenBullet != null" >
screen_bullet = #{record.screenBullet,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null" >
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map" >
update screen_bullet
set id = #{record.id,jdbcType=BIGINT},
content_id = #{record.contentId,jdbcType=BIGINT},
screen_bullet = #{record.screenBullet,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP}
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="xyz.zinglizingli.books.po.ScreenBullet" >
update screen_bullet
<set >
<if test="contentId != null" >
content_id = #{contentId,jdbcType=BIGINT},
</if>
<if test="screenBullet != null" >
screen_bullet = #{screenBullet,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="xyz.zinglizingli.books.po.ScreenBullet" >
update screen_bullet
set content_id = #{contentId,jdbcType=BIGINT},
screen_bullet = #{screenBullet,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -0,0 +1,181 @@
<?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="xyz.zinglizingli.books.mapper.UserMapper" >
<resultMap id="BaseResultMap" type="xyz.zinglizingli.books.po.User" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="login_name" property="loginName" jdbcType="VARCHAR" />
<result column="password" property="password" jdbcType="VARCHAR" />
</resultMap>
<sql id="Example_Where_Clause" >
<where >
<foreach collection="oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause" >
<where >
<foreach collection="example.oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List" >
id, login_name, password
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="xyz.zinglizingli.books.po.UserExample" >
select
<if test="distinct" >
distinct
</if>
<include refid="Base_Column_List" />
from user
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
<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 user
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from user
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="xyz.zinglizingli.books.po.UserExample" >
delete from user
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="xyz.zinglizingli.books.po.User" >
insert into user (id, login_name, password
)
values (#{id,jdbcType=BIGINT}, #{loginName,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="xyz.zinglizingli.books.po.User" useGeneratedKeys="true" keyProperty="id">
insert into user
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="loginName != null" >
login_name,
</if>
<if test="password != null" >
password,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=BIGINT},
</if>
<if test="loginName != null" >
#{loginName,jdbcType=VARCHAR},
</if>
<if test="password != null" >
#{password,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="xyz.zinglizingli.books.po.UserExample" resultType="java.lang.Integer" >
select count(*) from user
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map" >
update user
<set >
<if test="record.id != null" >
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.loginName != null" >
login_name = #{record.loginName,jdbcType=VARCHAR},
</if>
<if test="record.password != null" >
password = #{record.password,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map" >
update user
set id = #{record.id,jdbcType=BIGINT},
login_name = #{record.loginName,jdbcType=VARCHAR},
password = #{record.password,jdbcType=VARCHAR}
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="xyz.zinglizingli.books.po.User" >
update user
<set >
<if test="loginName != null" >
login_name = #{loginName,jdbcType=VARCHAR},
</if>
<if test="password != null" >
password = #{password,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="xyz.zinglizingli.books.po.User" >
update user
set login_name = #{loginName,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -0,0 +1,181 @@
<?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="xyz.zinglizingli.books.mapper.UserRefBookMapper" >
<resultMap id="BaseResultMap" type="xyz.zinglizingli.books.po.UserRefBook" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="user_id" property="userId" jdbcType="BIGINT" />
<result column="book_id" property="bookId" jdbcType="BIGINT" />
</resultMap>
<sql id="Example_Where_Clause" >
<where >
<foreach collection="oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause" >
<where >
<foreach collection="example.oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List" >
id, user_id, book_id
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="xyz.zinglizingli.books.po.UserRefBookExample" >
select
<if test="distinct" >
distinct
</if>
<include refid="Base_Column_List" />
from user_ref_book
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
<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 user_ref_book
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from user_ref_book
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="xyz.zinglizingli.books.po.UserRefBookExample" >
delete from user_ref_book
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="xyz.zinglizingli.books.po.UserRefBook" >
insert into user_ref_book (id, user_id, book_id
)
values (#{id,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{bookId,jdbcType=BIGINT}
)
</insert>
<insert id="insertSelective" parameterType="xyz.zinglizingli.books.po.UserRefBook" >
insert into user_ref_book
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="userId != null" >
user_id,
</if>
<if test="bookId != null" >
book_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=BIGINT},
</if>
<if test="userId != null" >
#{userId,jdbcType=BIGINT},
</if>
<if test="bookId != null" >
#{bookId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="xyz.zinglizingli.books.po.UserRefBookExample" resultType="java.lang.Integer" >
select count(*) from user_ref_book
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map" >
update user_ref_book
<set >
<if test="record.id != null" >
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.userId != null" >
user_id = #{record.userId,jdbcType=BIGINT},
</if>
<if test="record.bookId != null" >
book_id = #{record.bookId,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map" >
update user_ref_book
set id = #{record.id,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT},
book_id = #{record.bookId,jdbcType=BIGINT}
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="xyz.zinglizingli.books.po.UserRefBook" >
update user_ref_book
<set >
<if test="userId != null" >
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="bookId != null" >
book_id = #{bookId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="xyz.zinglizingli.books.po.UserRefBook" >
update user_ref_book
set user_id = #{userId,jdbcType=BIGINT},
book_id = #{bookId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>