UfoProductMapper.xml 9.06 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.UfoProductMapper">

    <resultMap id="BaseResultMap" type="com.yoho.search.dal.model.ufo_product.Product">
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="product_name" property="productName" jdbcType="VARCHAR"/>
        <result column="product_code" property="productCode" jdbcType="VARCHAR"/>
        <result column="max_sort_id" property="maxSortId" jdbcType="SMALLINT"/>
        <result column="mid_sort_id" property="midSortId" jdbcType="SMALLINT"/>
        <result column="brand_id" property="brandId" jdbcType="SMALLINT"/>
        <result column="series_id" property="seriesId" jdbcType="SMALLINT"/>
        <result column="gender" property="gender" jdbcType="CHAR"/>
        <result column="sale_time" property="saleTime" jdbcType="INTEGER"/>
        <result column="min_price" property="minPrice" jdbcType="DECIMAL"/>
        <result column="max_price" property="maxPrice" jdbcType="DECIMAL"/>
        <result column="shelve_time" property="shelveTime" jdbcType="INTEGER"/>
        <result column="edit_time" property="editTime" jdbcType="INTEGER"/>
        <result column="shelve_status" property="shelveStatus" jdbcType="TINYINT"/>
        <result column="storage" property="storage" jdbcType="INTEGER"/>
        <result column="key_words" property="keyWords" jdbcType="VARCHAR"/>
        <result column="del_status" property="delStatus" jdbcType="TINYINT"/>
        <result column="order_by" property="orderBy" jdbcType="INTEGER"/>
    </resultMap>

    <sql id="Base_Column_List">
    id, product_name, product_code, max_sort_id,mid_sort_id, brand_id, series_id, gender, sale_time,
    min_price, max_price, shelve_time, edit_time, shelve_status,
    storage, key_words, del_status,order_by
    </sql>

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

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

    <insert id="insertSelective" parameterType="com.yoho.search.dal.model.ufo_product.Product" >
        insert into ufo_product
        <trim prefix="(" suffix=")" suffixOverrides="," >
            <if test="id != null" >
                id,
            </if>
            <if test="productName != null" >
                product_name,
            </if>
            <if test="productCode != null" >
                product_code,
            </if>
            <if test="maxSortId != null" >
                max_sort_id,
            </if>
            <if test="midSortId != null" >
                mid_sort_id,
            </if>
            <if test="brandId != null" >
                brand_id,
            </if>
            <if test="seriesId != null" >
                series_id,
            </if>
            <if test="gender != null" >
                gender,
            </if>
            <if test="saleTime != null" >
                sale_time,
            </if>
            <if test="minPrice != null" >
                min_price,
            </if>
            <if test="maxPrice != null" >
                max_price,
            </if>
            <if test="shelveTime != null" >
                shelve_time,
            </if>
            <if test="editTime != null" >
                edit_time,
            </if>
            <if test="shelveStatus != null" >
                shelve_status,
            </if>
            <if test="storage != null" >
                storage,
            </if>
            <if test="keyWords != null" >
                key_words,
            </if>
            <if test="delStatus != null" >
                del_status,
            </if>
            <if test="orderBy != null" >
                order_by,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides="," >
            <if test="id != null" >
                #{id,jdbcType=INTEGER},
            </if>
            <if test="productName != null" >
                #{productName,jdbcType=VARCHAR},
            </if>
            <if test="productCode != null" >
                #{productCode,jdbcType=VARCHAR},
            </if>
            <if test="maxSortId != null" >
                #{maxSortId,jdbcType=SMALLINT},
            </if>
            <if test="midSortId != null" >
                #{midSortId,jdbcType=SMALLINT},
            </if>
            <if test="brandId != null" >
                #{brandId,jdbcType=SMALLINT},
            </if>
            <if test="seriesId != null" >
                #{seriesId,jdbcType=SMALLINT},
            </if>
            <if test="gender != null" >
                #{gender,jdbcType=CHAR},
            </if>
            <if test="saleTime != null" >
                #{saleTime,jdbcType=INTEGER},
            </if>
            <if test="minPrice != null" >
                #{minPrice,jdbcType=DECIMAL},
            </if>
            <if test="maxPrice != null" >
                #{maxPrice,jdbcType=DECIMAL},
            </if>
            <if test="shelveTime != null" >
                #{shelveTime,jdbcType=INTEGER},
            </if>
            <if test="editTime != null" >
                #{editTime,jdbcType=INTEGER},
            </if>
            <if test="shelveStatus != null" >
                #{shelveStatus,jdbcType=TINYINT},
            </if>
            <if test="storage != null" >
                #{storage,jdbcType=INTEGER},
            </if>
            <if test="keyWords != null" >
                #{keyWords,jdbcType=VARCHAR},
            </if>
            <if test="delStatus != null" >
                #{delStatus,jdbcType=TINYINT},
            </if>
            <if test="orderBy != null" >
                #{orderBy,jdbcType=INTEGER},
            </if>
        </trim>
    </insert>

    <update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.ufo_product.Product">
        update ufo_product
        <set>
            <if test="productName != null">
                product_name = #{productName,jdbcType=VARCHAR},
            </if>
            <if test="productCode != null">
                product_code = #{productCode,jdbcType=VARCHAR},
            </if>
            <if test="maxSortId != null">
                max_sort_id = #{maxSortId,jdbcType=SMALLINT},
            </if>
            <if test="midSortId != null">
                mid_sort_id = #{midSortId,jdbcType=SMALLINT},
            </if>
            <if test="brandId != null">
                brand_id = #{brandId,jdbcType=SMALLINT},
            </if>
            <if test="seriesId != null">
                series_id = #{seriesId,jdbcType=SMALLINT},
            </if>
            <if test="gender != null">
                gender = #{gender,jdbcType=CHAR},
            </if>
            <if test="saleTime != null">
                sale_time = #{saleTime,jdbcType=INTEGER},
            </if>
            <if test="minPrice != null">
                min_price = #{minPrice,jdbcType=DECIMAL},
            </if>
            <if test="maxPrice != null">
                max_price = #{maxPrice,jdbcType=DECIMAL},
            </if>
            <if test="shelveTime != null">
                shelve_time = #{shelveTime,jdbcType=INTEGER},
            </if>
            <if test="editTime != null">
                edit_time = #{editTime,jdbcType=INTEGER},
            </if>
            <if test="shelveStatus != null">
                shelve_status = #{shelveStatus,jdbcType=TINYINT},
            </if>
            <if test="storage != null">
                storage = #{storage,jdbcType=INTEGER},
            </if>
            <if test="keyWords != null">
                key_words = #{keyWords,jdbcType=VARCHAR},
            </if>
            <if test="delStatus != null">
                del_status = #{delStatus,jdbcType=TINYINT},
            </if>
            <if test="orderBy != null">
                order_by = #{orderBy,jdbcType=INTEGER},
            </if>
        </set>
        where id = #{id,jdbcType=INTEGER}
    </update>

    <select id="selectCount" resultType="java.lang.Integer" timeout="20000">
    select count(*) from ufo_product
    </select>

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

    <select id="selectByIdList" resultMap="BaseResultMap" timeout="20000">
        select
        <include refid="Base_Column_List"/>
        from ufo_product
        WHERE
        id in
        <foreach item="item" index="index" collection="list"
                 open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>

    <select id="selectByBrandId" resultMap="BaseResultMap" timeout="20000">
        select
        <include refid="Base_Column_List"/>
        from ufo_product
        where brand_id = #{brandId,jdbcType=INTEGER}
    </select>
</mapper>