|
@@ -0,0 +1,115 @@
|
|
|
|
+<?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.book.dao.cps.mapper.SignedRecommandMapper">
|
|
|
|
+ <resultMap id="BaseResultMap" type="com.book.dao.cps.pojo.SignedRecommand">
|
|
|
|
+ <id column="id" jdbcType="INTEGER" property="id" />
|
|
|
|
+ <result column="book_id" jdbcType="BIGINT" property="bookId" />
|
|
|
|
+ <result column="book_name" jdbcType="VARCHAR" property="bookName" />
|
|
|
|
+ <result column="sex" jdbcType="OTHER" property="sex" />
|
|
|
|
+ <result column="status" jdbcType="OTHER" property="status" />
|
|
|
|
+ <result column="createtime" jdbcType="INTEGER" property="createtime" />
|
|
|
|
+ <result column="updatetime" jdbcType="INTEGER" property="updatetime" />
|
|
|
|
+ </resultMap>
|
|
|
|
+ <sql id="Base_Column_List">
|
|
|
|
+ id, book_id, book_name, sex, `status`, createtime, updatetime
|
|
|
|
+ </sql>
|
|
|
|
+ <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
|
|
+ select
|
|
|
|
+ <include refid="Base_Column_List" />
|
|
|
|
+ from signed_recommand
|
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
|
+ </select>
|
|
|
|
+ <select id="selectRandom" resultMap="BaseResultMap">
|
|
|
|
+ select * from sign_recommand where status= 'normal' and `sex` = #{sex} order by rand() limit 1
|
|
|
|
+
|
|
|
|
+ </select>
|
|
|
|
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
|
|
|
+ delete from signed_recommand
|
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
|
+ </delete>
|
|
|
|
+ <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.book.dao.cps.pojo.SignedRecommand" useGeneratedKeys="true">
|
|
|
|
+ insert into signed_recommand (book_id, book_name, sex,
|
|
|
|
+ `status`, createtime, updatetime
|
|
|
|
+ )
|
|
|
|
+ values (#{bookId,jdbcType=BIGINT}, #{bookName,jdbcType=VARCHAR}, #{sex,jdbcType=OTHER},
|
|
|
|
+ #{status,jdbcType=OTHER}, #{createtime,jdbcType=INTEGER}, #{updatetime,jdbcType=INTEGER}
|
|
|
|
+ )
|
|
|
|
+ </insert>
|
|
|
|
+ <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.book.dao.cps.pojo.SignedRecommand" useGeneratedKeys="true">
|
|
|
|
+ insert into signed_recommand
|
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
+ <if test="bookId != null">
|
|
|
|
+ book_id,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="bookName != null">
|
|
|
|
+ book_name,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="sex != null">
|
|
|
|
+ sex,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="status != null">
|
|
|
|
+ `status`,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="createtime != null">
|
|
|
|
+ createtime,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="updatetime != null">
|
|
|
|
+ updatetime,
|
|
|
|
+ </if>
|
|
|
|
+ </trim>
|
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
+ <if test="bookId != null">
|
|
|
|
+ #{bookId,jdbcType=BIGINT},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="bookName != null">
|
|
|
|
+ #{bookName,jdbcType=VARCHAR},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="sex != null">
|
|
|
|
+ #{sex,jdbcType=OTHER},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="status != null">
|
|
|
|
+ #{status,jdbcType=OTHER},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="createtime != null">
|
|
|
|
+ #{createtime,jdbcType=INTEGER},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="updatetime != null">
|
|
|
|
+ #{updatetime,jdbcType=INTEGER},
|
|
|
|
+ </if>
|
|
|
|
+ </trim>
|
|
|
|
+ </insert>
|
|
|
|
+ <update id="updateByPrimaryKeySelective" parameterType="com.book.dao.cps.pojo.SignedRecommand">
|
|
|
|
+ update signed_recommand
|
|
|
|
+ <set>
|
|
|
|
+ <if test="bookId != null">
|
|
|
|
+ book_id = #{bookId,jdbcType=BIGINT},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="bookName != null">
|
|
|
|
+ book_name = #{bookName,jdbcType=VARCHAR},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="sex != null">
|
|
|
|
+ sex = #{sex,jdbcType=OTHER},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="status != null">
|
|
|
|
+ `status` = #{status,jdbcType=OTHER},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="createtime != null">
|
|
|
|
+ createtime = #{createtime,jdbcType=INTEGER},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="updatetime != null">
|
|
|
|
+ updatetime = #{updatetime,jdbcType=INTEGER},
|
|
|
|
+ </if>
|
|
|
|
+ </set>
|
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
|
+ </update>
|
|
|
|
+ <update id="updateByPrimaryKey" parameterType="com.book.dao.cps.pojo.SignedRecommand">
|
|
|
|
+ update signed_recommand
|
|
|
|
+ set book_id = #{bookId,jdbcType=BIGINT},
|
|
|
|
+ book_name = #{bookName,jdbcType=VARCHAR},
|
|
|
|
+ sex = #{sex,jdbcType=OTHER},
|
|
|
|
+ `status` = #{status,jdbcType=OTHER},
|
|
|
|
+ createtime = #{createtime,jdbcType=INTEGER},
|
|
|
|
+ updatetime = #{updatetime,jdbcType=INTEGER}
|
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
|
+ </update>
|
|
|
|
+</mapper>
|