mirror of
https://gitee.com/bookshelfplus/bookshelfplus
synced 2025-10-07 00:15:15 +08:00
232 lines
8.1 KiB
XML
232 lines
8.1 KiB
XML
<?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="plus.bookshelf.Dao.Mapper.FileDOMapper">
|
|
<resultMap id="BaseResultMap" type="plus.bookshelf.Dao.DO.FileDO">
|
|
<!--
|
|
WARNING - @mbg.generated
|
|
This element is automatically generated by MyBatis Generator, do not modify.
|
|
-->
|
|
<id column="id" jdbcType="INTEGER" property="id" />
|
|
<result column="book_id" jdbcType="INTEGER" property="bookId" />
|
|
<result column="file_name" jdbcType="VARCHAR" property="fileName" />
|
|
<result column="file_ext" jdbcType="VARCHAR" property="fileExt" />
|
|
<result column="file_size" jdbcType="BIGINT" property="fileSize" />
|
|
<result column="file_sha1" jdbcType="VARCHAR" property="fileSha1" />
|
|
<result column="number_of_pages" jdbcType="INTEGER" property="numberOfPages" />
|
|
<result column="watermark" jdbcType="BIT" property="watermark" />
|
|
<result column="advertising" jdbcType="BIT" property="advertising" />
|
|
<result column="source" jdbcType="VARCHAR" property="source" />
|
|
<result column="file_create_at" jdbcType="TIMESTAMP" property="fileCreateAt" />
|
|
</resultMap>
|
|
<sql id="Base_Column_List">
|
|
<!--
|
|
WARNING - @mbg.generated
|
|
This element is automatically generated by MyBatis Generator, do not modify.
|
|
-->
|
|
id, book_id, file_name, file_ext, file_size, file_sha1, number_of_pages, watermark,
|
|
advertising, `source`, file_create_at
|
|
</sql>
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
<!--
|
|
WARNING - @mbg.generated
|
|
This element is automatically generated by MyBatis Generator, do not modify.
|
|
-->
|
|
select
|
|
<include refid="Base_Column_List" />
|
|
from file_info
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</select>
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
|
<!--
|
|
WARNING - @mbg.generated
|
|
This element is automatically generated by MyBatis Generator, do not modify.
|
|
-->
|
|
delete from file_info
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</delete>
|
|
<insert id="insert" parameterType="plus.bookshelf.Dao.DO.FileDO">
|
|
<!--
|
|
WARNING - @mbg.generated
|
|
This element is automatically generated by MyBatis Generator, do not modify.
|
|
-->
|
|
insert into file_info (id, book_id, file_name,
|
|
file_ext, file_size, file_sha1,
|
|
number_of_pages, watermark, advertising,
|
|
`source`, file_create_at)
|
|
values (#{id,jdbcType=INTEGER}, #{bookId,jdbcType=INTEGER}, #{fileName,jdbcType=VARCHAR},
|
|
#{fileExt,jdbcType=VARCHAR}, #{fileSize,jdbcType=BIGINT}, #{fileSha1,jdbcType=VARCHAR},
|
|
#{numberOfPages,jdbcType=INTEGER}, #{watermark,jdbcType=BIT}, #{advertising,jdbcType=BIT},
|
|
#{source,jdbcType=VARCHAR}, #{fileCreateAt,jdbcType=TIMESTAMP})
|
|
</insert>
|
|
<insert id="insertSelective" parameterType="plus.bookshelf.Dao.DO.FileDO">
|
|
<!--
|
|
WARNING - @mbg.generated
|
|
This element is automatically generated by MyBatis Generator, do not modify.
|
|
-->
|
|
insert into file_info
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">
|
|
id,
|
|
</if>
|
|
<if test="bookId != null">
|
|
book_id,
|
|
</if>
|
|
<if test="fileName != null">
|
|
file_name,
|
|
</if>
|
|
<if test="fileExt != null">
|
|
file_ext,
|
|
</if>
|
|
<if test="fileSize != null">
|
|
file_size,
|
|
</if>
|
|
<if test="fileSha1 != null">
|
|
file_sha1,
|
|
</if>
|
|
<if test="numberOfPages != null">
|
|
number_of_pages,
|
|
</if>
|
|
<if test="watermark != null">
|
|
watermark,
|
|
</if>
|
|
<if test="advertising != null">
|
|
advertising,
|
|
</if>
|
|
<if test="source != null">
|
|
`source`,
|
|
</if>
|
|
<if test="fileCreateAt != null">
|
|
file_create_at,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">
|
|
#{id,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="bookId != null">
|
|
#{bookId,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="fileName != null">
|
|
#{fileName,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="fileExt != null">
|
|
#{fileExt,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="fileSize != null">
|
|
#{fileSize,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="fileSha1 != null">
|
|
#{fileSha1,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="numberOfPages != null">
|
|
#{numberOfPages,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="watermark != null">
|
|
#{watermark,jdbcType=BIT},
|
|
</if>
|
|
<if test="advertising != null">
|
|
#{advertising,jdbcType=BIT},
|
|
</if>
|
|
<if test="source != null">
|
|
#{source,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="fileCreateAt != null">
|
|
#{fileCreateAt,jdbcType=TIMESTAMP},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
<update id="updateByPrimaryKeySelective" parameterType="plus.bookshelf.Dao.DO.FileDO">
|
|
<!--
|
|
WARNING - @mbg.generated
|
|
This element is automatically generated by MyBatis Generator, do not modify.
|
|
-->
|
|
update file_info
|
|
<set>
|
|
<if test="bookId != null">
|
|
book_id = #{bookId,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="fileName != null">
|
|
file_name = #{fileName,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="fileExt != null">
|
|
file_ext = #{fileExt,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="fileSize != null">
|
|
file_size = #{fileSize,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="fileSha1 != null">
|
|
file_sha1 = #{fileSha1,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="numberOfPages != null">
|
|
number_of_pages = #{numberOfPages,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="watermark != null">
|
|
watermark = #{watermark,jdbcType=BIT},
|
|
</if>
|
|
<if test="advertising != null">
|
|
advertising = #{advertising,jdbcType=BIT},
|
|
</if>
|
|
<if test="source != null">
|
|
`source` = #{source,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="fileCreateAt != null">
|
|
file_create_at = #{fileCreateAt,jdbcType=TIMESTAMP},
|
|
</if>
|
|
</set>
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
<update id="updateByPrimaryKey" parameterType="plus.bookshelf.Dao.DO.FileDO">
|
|
<!--
|
|
WARNING - @mbg.generated
|
|
This element is automatically generated by MyBatis Generator, do not modify.
|
|
-->
|
|
update file_info
|
|
set book_id = #{bookId,jdbcType=INTEGER},
|
|
file_name = #{fileName,jdbcType=VARCHAR},
|
|
file_ext = #{fileExt,jdbcType=VARCHAR},
|
|
file_size = #{fileSize,jdbcType=BIGINT},
|
|
file_sha1 = #{fileSha1,jdbcType=VARCHAR},
|
|
number_of_pages = #{numberOfPages,jdbcType=INTEGER},
|
|
watermark = #{watermark,jdbcType=BIT},
|
|
advertising = #{advertising,jdbcType=BIT},
|
|
`source` = #{source,jdbcType=VARCHAR},
|
|
file_create_at = #{fileCreateAt,jdbcType=TIMESTAMP}
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
<select id="selectAvailableByBookId" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List" />
|
|
from file_info
|
|
where book_id = #{bookId,jdbcType=INTEGER}
|
|
</select>
|
|
<select id="selectAll" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List" />
|
|
from file_info
|
|
</select>
|
|
<select id="selectBySha1WithNullValue" parameterType="java.lang.String" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List" />
|
|
from file_info
|
|
where file_sha1 = #{fileSha1,jdbcType=VARCHAR} or file_sha1 is null or file_sha1 = ''
|
|
</select>
|
|
<select id="selectBySha1" parameterType="java.lang.String" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List" />
|
|
from file_info
|
|
where file_sha1 = #{fileSha1,jdbcType=VARCHAR}
|
|
</select>
|
|
<select id="getLastInsertId" resultType="java.lang.Integer">
|
|
SELECT LAST_INSERT_ID();
|
|
</select>
|
|
<update id="unbindBook" parameterType="java.lang.Integer">
|
|
update file_info
|
|
set book_id = 0
|
|
where book_id = #{bookId,jdbcType=INTEGER}
|
|
</update>
|
|
<update id="updateFileSha1" parameterType="java.lang.Integer">
|
|
update file_info
|
|
set file_sha1 = #{fileSha1,jdbcType=VARCHAR}
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
</mapper> |