SknImageVectorsMapper.xml 3.24 KB
<?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.yoho.search.dal.SknImageVectorsMapper">

    <resultMap id="BaseResultMap" type="com.yoho.search.dal.model.SknImageVectors">
        <id column="product_skn" property="productSkn" jdbcType="INTEGER"/>
        <result column="img_url" property="imgUrl" jdbcType="VARCHAR"/>
        <result column="create_time" property="createTime" jdbcType="INTEGER"/>
        <result column="vectors_32" property="vectors_32" jdbcType="LONGVARCHAR"/>
        <result column="vectors_128" property="vectors_128" jdbcType="LONGVARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
    product_skn, img_url, create_time, vectors_32,vectors_128
  </sql>

    <insert id="insertBatch" parameterType="java.util.List" timeout="20000">
        insert ignore into skn_image_vectors (product_skn, img_url, create_time, vectors_32,vectors_128)
        values
        <foreach collection="list" item="item" index="index"
                 separator=",">
            (#{item.productSkn, jdbcType=INTEGER},
            #{item.imgUrl, jdbcType=VARCHAR},
            #{item.createTime, jdbcType=INTEGER},
            #{item.vectors_32, jdbcType=LONGVARCHAR},
            #{item.vectors_128, jdbcType=LONGVARCHAR})
        </foreach>
    </insert>

    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
        select
        <include refid="Base_Column_List"/>
        from skn_image_vectors
        where product_skn = #{productSkn,jdbcType=INTEGER}
        limit 1
    </select>

    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from skn_image_vectors
    where product_skn = #{productSkn,jdbcType=INTEGER}
  </delete>

    <insert id="insert" parameterType="com.yoho.search.dal.model.SknImageVectors">
    insert into skn_image_vectors (product_skn, img_url, create_time, 
      vectors_32,vectors_128)
    values (#{productSkn,jdbcType=INTEGER}, #{imgUrl,jdbcType=VARCHAR}, #{createTime,jdbcType=INTEGER}, 
      #{vectors_32,jdbcType=LONGVARCHAR},#{vectors_128,jdbcType=LONGVARCHAR})
  </insert>



    <update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.SknImageVectors">
        update skn_image_vectors
        <set>
            <if test="imgUrl != null">
                img_url = #{imgUrl,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=INTEGER},
            </if>
            <if test="vectors_32 != null">
                vectors_32 = #{vectors_32,jdbcType=LONGVARCHAR},
            </if>
            <if test="vectors_128 != null">
                vectors_128 = #{vectors_128,jdbcType=LONGVARCHAR},
            </if>
        </set>
        where product_skn = #{productSkn,jdbcType=INTEGER}
    </update>


    <select id="selectCount" resultType="java.lang.Integer" timeout="20000">
        SELECT count(*) FROM skn_image_vectors
    </select>

    <select id="selectPageLists" resultMap="BaseResultMap" timeout="20000">
        select
        <include refid="Base_Column_List"/>
        from skn_image_vectors limit #{offset},#{pageSize}
    </select>
</mapper>