1
0
mirror of https://gitee.com/bookshelfplus/bookshelfplus synced 2025-09-21 01:10:39 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
Files
bookshelfplus/bookshelfplus/src/main/resources/mapping/UserFavoritesDOMapper.xml

124 lines
4.5 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.UserFavoritesDOMapper">
<resultMap id="BaseResultMap" type="plus.bookshelf.Dao.DO.UserFavoritesDO">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="user_id" jdbcType="INTEGER" property="userId" />
<result column="book_id" jdbcType="INTEGER" property="bookId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, user_id, book_id, create_time
</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 user_book_favorites_relation
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 user_book_favorites_relation
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="plus.bookshelf.Dao.DO.UserFavoritesDO">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into user_book_favorites_relation (id, user_id, book_id,
create_time)
values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{bookId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="plus.bookshelf.Dao.DO.UserFavoritesDO">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into user_book_favorites_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="bookId != null">
book_id,
</if>
<if test="createTime != null">
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="userId != null">
#{userId,jdbcType=INTEGER},
</if>
<if test="bookId != null">
#{bookId,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="plus.bookshelf.Dao.DO.UserFavoritesDO">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update user_book_favorites_relation
<set>
<if test="userId != null">
user_id = #{userId,jdbcType=INTEGER},
</if>
<if test="bookId != null">
book_id = #{bookId,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="plus.bookshelf.Dao.DO.UserFavoritesDO">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update user_book_favorites_relation
set user_id = #{userId,jdbcType=INTEGER},
book_id = #{bookId,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<delete id="deleteByUserIdAndBookId" parameterType="java.lang.Integer">
delete from user_book_favorites_relation
where user_id = #{userId,jdbcType=INTEGER} and book_id = #{bookId,jdbcType=INTEGER} limit 1
</delete>
<select id="selectCountByUserIdAndBookId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from user_book_favorites_relation
where user_id = #{userId,jdbcType=INTEGER} and book_id = #{bookId,jdbcType=INTEGER}
</select>
</mapper>