TblProductMapper.xml 10.9 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.TblProductMapper">
    <resultMap id="BaseResultMap" type="com.yoho.search.dal.model.TblProduct">
        <id column="product_skn" property="productSkn" jdbcType="INTEGER"/>
        <result column="product_name" property="productName" jdbcType="VARCHAR"/>
        <result column="source" property="source" jdbcType="CHAR"/>
        <result column="brand_id" property="brandId" jdbcType="INTEGER"/>
        <result column="sort_one" property="sortOne" jdbcType="INTEGER"/>
        <result column="sort_two" property="sortTwo" jdbcType="INTEGER"/>
        <result column="sort_three" property="sortThree" jdbcType="INTEGER"/>
        <result column="sort_four" property="sortFour" jdbcType="INTEGER"/>
        <result column="site_id" property="siteId" jdbcType="INTEGER"/>
        <result column="is_limited" property="isLimited" jdbcType="CHAR"/>
        <result column="country_id" property="countryId" jdbcType="INTEGER"/>
        <result column="gender" property="gender" jdbcType="CHAR"/>
        <result column="currency_id" property="currencyId" jdbcType="TINYINT"/>
        <result column="tag_price" property="tagPrice" jdbcType="DECIMAL"/>
        <result column="orign_price" property="orignPrice" jdbcType="DECIMAL"/>
        <result column="sell_price" property="sellPrice" jdbcType="DECIMAL"/>
        <result column="goods_price" property="goodsPrice" jdbcType="DECIMAL"/>
        <result column="got_price" property="gotPrice" jdbcType="DECIMAL"/>
        <result column="weight" property="weight" jdbcType="INTEGER"/>
        <result column="size_info" property="sizeInfo" jdbcType="VARCHAR"/>
        <result column="status" property="status" jdbcType="TINYINT"/>
        <result column="url_status" property="urlStatus" jdbcType="CHAR"/>
        <result column="stock_status" property="stockStatus" jdbcType="CHAR"/>
        <result column="operate_userid" property="operateUserid" jdbcType="INTEGER"/>
        <result column="supplier_id" property="supplierId" jdbcType="INTEGER"/>
        <result column="order" property="order" jdbcType="INTEGER"/>
        <result column="create_time" property="createTime" jdbcType="INTEGER"/>
        <result column="update_time" property="updateTime" jdbcType="INTEGER"/>
        <result column="shelf_time" property="shelfTime" jdbcType="INTEGER"/>
        <result column="offshelf_time" property="offshelfTime" jdbcType="INTEGER"/>
        <result column="auto_shelf" property="autoShelf" jdbcType="CHAR"/>
        <result column="declare_unit" property="declareUnit" jdbcType="TINYINT"/>
        <result column="declare_quantity" property="declareQuantity" jdbcType="INTEGER"/>
        <result column="product_url" property="productUrl" jdbcType="LONGVARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
    product_skn, product_name, source, brand_id, sort_one, sort_two, sort_three, sort_four,
    site_id, is_limited, country_id, gender, currency_id, tag_price, orign_price, sell_price,
    goods_price, got_price, weight, size_info, status, url_status, stock_status, operate_userid,
    supplier_id, `order`, create_time, update_time, shelf_time, offshelf_time, auto_shelf,
    declare_unit, declare_quantity,product_url
    </sql>

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

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

    <insert id="insert" parameterType="com.yoho.search.dal.model.TblProduct">
    insert into tbl_product (product_skn, product_name, source, 
      brand_id, sort_one, sort_two, 
      sort_three, sort_four, site_id, 
      is_limited, country_id, gender, 
      currency_id, tag_price, orign_price, 
      sell_price, goods_price, got_price, 
      weight, size_info, status, 
      url_status, stock_status, operate_userid, 
      supplier_id, `order`, create_time,
      update_time, shelf_time, offshelf_time, 
      auto_shelf, declare_unit, declare_quantity, 
      product_url)
    values (#{productSkn,jdbcType=INTEGER}, #{productName,jdbcType=VARCHAR}, #{source,jdbcType=CHAR}, 
      #{brandId,jdbcType=INTEGER}, #{sortOne,jdbcType=INTEGER}, #{sortTwo,jdbcType=INTEGER}, 
      #{sortThree,jdbcType=INTEGER}, #{sortFour,jdbcType=INTEGER}, #{siteId,jdbcType=INTEGER}, 
      #{isLimited,jdbcType=CHAR}, #{countryId,jdbcType=INTEGER}, #{gender,jdbcType=CHAR}, 
      #{currencyId,jdbcType=TINYINT}, #{tagPrice,jdbcType=DECIMAL}, #{orignPrice,jdbcType=DECIMAL}, 
      #{sellPrice,jdbcType=DECIMAL}, #{goodsPrice,jdbcType=DECIMAL}, #{gotPrice,jdbcType=DECIMAL}, 
      #{weight,jdbcType=INTEGER}, #{sizeInfo,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT}, 
      #{urlStatus,jdbcType=CHAR}, #{stockStatus,jdbcType=CHAR}, #{operateUserid,jdbcType=INTEGER}, 
      #{supplierId,jdbcType=INTEGER}, #{order,jdbcType=INTEGER}, #{createTime,jdbcType=INTEGER}, 
      #{updateTime,jdbcType=INTEGER}, #{shelfTime,jdbcType=INTEGER}, #{offshelfTime,jdbcType=INTEGER}, 
      #{autoShelf,jdbcType=CHAR}, #{declareUnit,jdbcType=TINYINT}, #{declareQuantity,jdbcType=INTEGER}, 
      #{productUrl,jdbcType=LONGVARCHAR})
    </insert>

    <update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.TblProduct">
        update tbl_product
        <set>
            <if test="productName != null">
                product_name = #{productName,jdbcType=VARCHAR},
            </if>
            <if test="source != null">
                source = #{source,jdbcType=CHAR},
            </if>
            <if test="brandId != null">
                brand_id = #{brandId,jdbcType=INTEGER},
            </if>
            <if test="sortOne != null">
                sort_one = #{sortOne,jdbcType=INTEGER},
            </if>
            <if test="sortTwo != null">
                sort_two = #{sortTwo,jdbcType=INTEGER},
            </if>
            <if test="sortThree != null">
                sort_three = #{sortThree,jdbcType=INTEGER},
            </if>
            <if test="sortFour != null">
                sort_four = #{sortFour,jdbcType=INTEGER},
            </if>
            <if test="siteId != null">
                site_id = #{siteId,jdbcType=INTEGER},
            </if>
            <if test="isLimited != null">
                is_limited = #{isLimited,jdbcType=CHAR},
            </if>
            <if test="countryId != null">
                country_id = #{countryId,jdbcType=INTEGER},
            </if>
            <if test="gender != null">
                gender = #{gender,jdbcType=CHAR},
            </if>
            <if test="currencyId != null">
                currency_id = #{currencyId,jdbcType=TINYINT},
            </if>
            <if test="tagPrice != null">
                tag_price = #{tagPrice,jdbcType=DECIMAL},
            </if>
            <if test="orignPrice != null">
                orign_price = #{orignPrice,jdbcType=DECIMAL},
            </if>
            <if test="sellPrice != null">
                sell_price = #{sellPrice,jdbcType=DECIMAL},
            </if>
            <if test="goodsPrice != null">
                goods_price = #{goodsPrice,jdbcType=DECIMAL},
            </if>
            <if test="gotPrice != null">
                got_price = #{gotPrice,jdbcType=DECIMAL},
            </if>
            <if test="weight != null">
                weight = #{weight,jdbcType=INTEGER},
            </if>
            <if test="sizeInfo != null">
                size_info = #{sizeInfo,jdbcType=VARCHAR},
            </if>
            <if test="status != null">
                status = #{status,jdbcType=TINYINT},
            </if>
            <if test="urlStatus != null">
                url_status = #{urlStatus,jdbcType=CHAR},
            </if>
            <if test="stockStatus != null">
                stock_status = #{stockStatus,jdbcType=CHAR},
            </if>
            <if test="operateUserid != null">
                operate_userid = #{operateUserid,jdbcType=INTEGER},
            </if>
            <if test="supplierId != null">
                supplier_id = #{supplierId,jdbcType=INTEGER},
            </if>
            <if test="order != null">
                `order` = #{order,jdbcType=INTEGER},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=INTEGER},
            </if>
            <if test="updateTime != null">
                update_time = #{updateTime,jdbcType=INTEGER},
            </if>
            <if test="shelfTime != null">
                shelf_time = #{shelfTime,jdbcType=INTEGER},
            </if>
            <if test="offshelfTime != null">
                offshelf_time = #{offshelfTime,jdbcType=INTEGER},
            </if>
            <if test="autoShelf != null">
                auto_shelf = #{autoShelf,jdbcType=CHAR},
            </if>
            <if test="declareUnit != null">
                declare_unit = #{declareUnit,jdbcType=TINYINT},
            </if>
            <if test="declareQuantity != null">
                declare_quantity = #{declareQuantity,jdbcType=INTEGER},
            </if>
            <if test="productUrl != null">
                product_url = #{productUrl,jdbcType=LONGVARCHAR},
            </if>
        </set>
        where product_skn = #{productSkn,jdbcType=INTEGER}
    </update>

    <select id="count" resultType="java.lang.Integer" timeout="20000">
        SELECT count(product_skn) FROM tbl_product
    </select>

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

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

    <resultMap id="SknsByBrandId" type="Integer">
        <result column="product_skn" property="productSkn" jdbcType="INTEGER"/>
    </resultMap>
    <select id="selectSknsByBrandId" resultMap="SknsByBrandId" timeout="20000">
        select
        product_skn
        from tbl_product
        WHERE brand_id = #{brandId,jdbcType=INTEGER}
    </select>

    <resultMap id="SknsBySiteId" type="Integer">
        <result column="product_skn" property="productSkn" jdbcType="INTEGER"/>
    </resultMap>
    <select id="selectSknsBySiteId" resultMap="SknsBySiteId" timeout="20000">
        select
        product_skn
        from tbl_product
        WHERE site_id = #{siteId,jdbcType=INTEGER}
    </select>

</mapper>