ProductMapper.xml 16.3 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.ProductMapper">
    <resultMap id="BaseResultMap" type="com.yoho.search.dal.model.Product">
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="shop_id" property="shopId" jdbcType="INTEGER"/>
        <result column="erp_product_id" property="erpProductId" jdbcType="INTEGER"/>
        <result column="product_name" property="productName" jdbcType="VARCHAR"/>
        <result column="cn_alphabet" property="cnAlphabet" jdbcType="VARCHAR"/>
        <result column="phrase" property="phrase" jdbcType="VARCHAR"/>
        <result column="sales_phrase" property="salesPhrase" jdbcType="VARCHAR"/>
        <result column="brand_id" property="brandId" jdbcType="INTEGER"/>
        <result column="max_sort_id" property="maxSortId" jdbcType="INTEGER"/>
        <result column="middle_sort_id" property="middleSortId" jdbcType="INTEGER"/>
        <result column="small_sort_id" property="smallSortId" jdbcType="INTEGER"/>
        <result column="series_id" property="seriesId" jdbcType="INTEGER"/>
        <result column="gender" property="gender" jdbcType="CHAR"/>
        <result column="style" property="style" jdbcType="VARCHAR"/>
        <result column="pattern" property="pattern" jdbcType="VARCHAR"/>
        <result column="material" property="material" jdbcType="VARCHAR"/>
        <result column="is_new" property="isNew" jdbcType="CHAR"/>
        <result column="is_limited" property="isLimited" jdbcType="CHAR"/>
        <result column="is_hot" property="isHot" jdbcType="CHAR"/>
        <result column="is_special" property="isSpecial" jdbcType="CHAR"/>
        <result column="is_sales" property="isSales" jdbcType="CHAR"/>
        <result column="is_replenishment" property="isReplenishment" jdbcType="INTEGER"/>
        <result column="is_advance" property="isAdvance" jdbcType="CHAR"/>
        <result column="is_deposit_advance" property="isDepositAdvance" jdbcType="CHAR"/>
        <result column="is_limitbuy" property="isLimitbuy" jdbcType="CHAR"/>
        <result column="is_retrieval" property="isRetrieval" jdbcType="CHAR"/>
        <result column="is_auditing" property="isAuditing" jdbcType="CHAR"/>
        <result column="is_recommend" property="isRecommend" jdbcType="CHAR"/>
        <result column="is_promotion" property="isPromotion" jdbcType="INTEGER"/>
        <result column="attribute" property="attribute" jdbcType="INTEGER"/>
        <result column="seasons" property="seasons" jdbcType="CHAR"/>
        <result column="salable_time" property="salableTime" jdbcType="VARCHAR"/>
        <result column="first_shelve_time" property="firstShelveTime" jdbcType="INTEGER"/>
        <result column="shelve_time" property="shelveTime" jdbcType="INTEGER"/>
        <result column="expect_arrival_time" property="expectArrivalTime" jdbcType="INTEGER"/>
        <result column="create_time" property="createTime" jdbcType="INTEGER"/>
        <result column="arrival_time" property="arrivalTime" jdbcType="INTEGER"/>
        <result column="edit_time" property="editTime" jdbcType="INTEGER"/>
        <result column="auditing_time" property="auditingTime" jdbcType="INTEGER"/>
        <result column="is_down" property="isDown" jdbcType="CHAR"/>
        <result column="status" property="status" jdbcType="INTEGER"/>
        <result column="is_edit" property="isEdit" jdbcType="INTEGER"/>
        <result column="vip_discount_type" property="vipDiscountType" jdbcType="INTEGER"/>
        <result column="storage" property="storage" jdbcType="INTEGER"/>
        <result column="is_outlets" property="isOutlets" jdbcType="CHAR"/>
        <result column="folder_id" property="folderId" jdbcType="INTEGER"/>
        <result column="sell_channels" property="sellChannels" jdbcType="CHAR"/>
        <result column="elements" property="elements" jdbcType="VARCHAR"/>
        <result column="age_level" property="ageLevel" jdbcType="VARCHAR"/>
        <result column="app_type" property="appType" jdbcType="INTEGER"/>
        <result column="is_instalment" property="isInstalment" jdbcType="VARCHAR"/>
        <result column="is_seckill" property="isSeckill" jdbcType="CHAR"/>
        <result column="market_phrase" property="marketPhrase" jdbcType="VARCHAR"/>
        <result column="bundle_type" property="bundleType" jdbcType="INTEGER"/>
    </resultMap>
    <sql id="Base_Column_List">
		id, erp_product_id,shop_id, product_name, cn_alphabet,
		phrase, sales_phrase, brand_id, max_sort_id, middle_sort_id,
		small_sort_id, series_id, gender, style, pattern, 
		material, is_new, is_limited, is_hot, is_special, 
		is_sales, is_replenishment, is_advance, is_retrieval,is_auditing,
		is_recommend, is_promotion, attribute, seasons, salable_time,
		first_shelve_time,shelve_time,expect_arrival_time, create_time, arrival_time,
		edit_time, auditing_time, is_down, status, is_edit, 
		vip_discount_type, storage,is_outlets,folder_id,sell_channels,
		elements, age_level,app_type,is_instalment,is_seckill,is_limitbuy,is_deposit_advance,market_phrase,bundle_type
	</sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
            parameterType="java.lang.Integer" timeout="20000">
        select
        <include refid="Base_Column_List"/>
        from product
        where id = #{id,jdbcType=INTEGER}
    </select>
    <select id="selectBySkn" resultMap="BaseResultMap"
            parameterType="java.lang.Integer" timeout="20000">
        select
        <include refid="Base_Column_List"/>
        from product
        where erp_product_id = #{skn,jdbcType=INTEGER}
        limit 1
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"
            timeout="20000">
		delete from product
		where id = #{id,jdbcType=INTEGER}
	</delete>
    <insert id="insert" parameterType="com.yoho.search.dal.model.Product"
            timeout="20000">
		insert ignore into product (id, erp_product_id,shop_id,
		product_name,
		cn_alphabet, phrase, sales_phrase,
		brand_id, max_sort_id,
		middle_sort_id,
		small_sort_id, series_id, gender,
		style, pattern,
		material,
		is_new, is_limited, is_hot, is_special,
		is_sales,
		is_replenishment, is_advance,
		is_retrieval, is_auditing, is_recommend,
		is_promotion, attribute, seasons,
		salable_time, first_shelve_time,
		shelve_time,
		expect_arrival_time, create_time, arrival_time,
		edit_time,
		auditing_time, is_down,
		status, is_edit, vip_discount_type,
		storage,
		is_outlets, folder_id,
		sell_channels, elements,age_level,app_type,is_instalment,is_seckill,is_deposit_advance,is_limitbuy,market_phrase,bundle_type)
		values
		(#{id,jdbcType=INTEGER},
		#{erpProductId,jdbcType=INTEGER},
		#{shopId,jdbcType=INTEGER},
		#{productName,jdbcType=VARCHAR},
		#{cnAlphabet,jdbcType=VARCHAR},
		#{phrase,jdbcType=VARCHAR}, #{salesPhrase,jdbcType=VARCHAR},
		#{brandId,jdbcType=INTEGER}, #{maxSortId,jdbcType=INTEGER},
		#{middleSortId,jdbcType=INTEGER},
		#{smallSortId,jdbcType=INTEGER},
		#{seriesId,jdbcType=INTEGER}, #{gender,jdbcType=CHAR},
		#{style,jdbcType=VARCHAR}, #{pattern,jdbcType=VARCHAR},
		#{material,jdbcType=VARCHAR},
		#{isNew,jdbcType=CHAR},
		#{isLimited,jdbcType=CHAR}, #{isHot,jdbcType=CHAR},
		#{isSpecial,jdbcType=CHAR},
		#{isSales,jdbcType=CHAR},
		#{isReplenishment,jdbcType=INTEGER}, #{isAdvance,jdbcType=CHAR},
		#{isRetrieval,jdbcType=CHAR}, #{isAuditing,jdbcType=CHAR},
		#{isRecommend,jdbcType=CHAR},
		#{isPromotion,jdbcType=INTEGER},
		#{attribute,jdbcType=INTEGER}, #{seasons,jdbcType=CHAR},
		#{salableTime,jdbcType=VARCHAR}, #{firstShelveTime,jdbcType=INTEGER},
		#{shelveTime,jdbcType=INTEGER},
		#{expectArrivalTime,jdbcType=INTEGER},
		#{createTime,jdbcType=INTEGER}, #{arrivalTime,jdbcType=INTEGER},
		#{editTime,jdbcType=INTEGER}, #{auditingTime,jdbcType=INTEGER},
		#{isDown,jdbcType=CHAR},
		#{status,jdbcType=INTEGER},
		#{isEdit,jdbcType=INTEGER}, #{vipDiscountType,jdbcType=INTEGER},
		#{storage,jdbcType=INTEGER}, #{isOutlets,jdbcType=CHAR},
		#{folderId,jdbcType=INTEGER},
		#{sellChannels,jdbcType=CHAR},
		#{elements,jdbcType=VARCHAR},
		#{ageLevel,jdbcType=VARCHAR},
		#{appType,jdbcType=INTEGER},
		#{isInstalment,jdbcType=VARCHAR},
		#{isSeckill,jdbcType=CHAR},
		#{isDepositAdvance,jdbcType=CHAR},
		#{isLimitbuy,jdbcType=CHAR},
		#{marketPhrase,jdbcType=VARCHAR},
		#{bundleType,jdbcType=INTEGER}
		)
	</insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.Product"
            timeout="20000">
        update product
        <set>
            <if test="erpProductId != null">
                erp_product_id = #{erpProductId,jdbcType=INTEGER},
            </if>
            <if test="shopId != null">
                shop_id = #{shopId,jdbcType=INTEGER},
            </if>
            <if test="productName != null">
                product_name = #{productName,jdbcType=VARCHAR},
            </if>
            <if test="cnAlphabet != null">
                cn_alphabet = #{cnAlphabet,jdbcType=VARCHAR},
            </if>
            <if test="phrase != null">
                phrase = #{phrase,jdbcType=VARCHAR},
            </if>
            <if test="salesPhrase != null">
                sales_phrase = #{salesPhrase,jdbcType=VARCHAR},
            </if>
            <if test="brandId != null">
                brand_id = #{brandId,jdbcType=INTEGER},
            </if>
            <if test="maxSortId != null">
                max_sort_id = #{maxSortId,jdbcType=INTEGER},
            </if>
            <if test="middleSortId != null">
                middle_sort_id = #{middleSortId,jdbcType=INTEGER},
            </if>
            <if test="smallSortId != null">
                small_sort_id = #{smallSortId,jdbcType=INTEGER},
            </if>
            <if test="seriesId != null">
                series_id = #{seriesId,jdbcType=INTEGER},
            </if>
            <if test="gender != null">
                gender = #{gender,jdbcType=CHAR},
            </if>
            <if test="style != null">
                style = #{style,jdbcType=VARCHAR},
            </if>
            <if test="pattern != null">
                pattern = #{pattern,jdbcType=VARCHAR},
            </if>
            <if test="material != null">
                material = #{material,jdbcType=VARCHAR},
            </if>
            <if test="isNew != null">
                is_new = #{isNew,jdbcType=CHAR},
            </if>
            <if test="isLimited != null">
                is_limited = #{isLimited,jdbcType=CHAR},
            </if>
            <if test="isHot != null">
                is_hot = #{isHot,jdbcType=CHAR},
            </if>
            <if test="isSpecial != null">
                is_special = #{isSpecial,jdbcType=CHAR},
            </if>
            <if test="isSales != null">
                is_sales = #{isSales,jdbcType=CHAR},
            </if>
            <if test="isReplenishment != null">
                is_replenishment = #{isReplenishment,jdbcType=INTEGER},
            </if>
            <if test="isAdvance != null">
                is_advance = #{isAdvance,jdbcType=CHAR},
            </if>
            <if test="isRetrieval != null">
                is_retrieval = #{isRetrieval,jdbcType=CHAR},
            </if>
            <if test="isAuditing != null">
                is_auditing = #{isAuditing,jdbcType=CHAR},
            </if>
            <if test="isRecommend != null">
                is_recommend = #{isRecommend,jdbcType=CHAR},
            </if>
            <if test="isPromotion != null">
                is_promotion = #{isPromotion,jdbcType=INTEGER},
            </if>
            <if test="attribute != null">
                attribute = #{attribute,jdbcType=INTEGER},
            </if>
            <if test="seasons != null">
                seasons = #{seasons,jdbcType=CHAR},
            </if>
            <if test="salableTime != null">
                salable_time = #{salableTime,jdbcType=VARCHAR},
            </if>
            <if test="firstShelveTime != null">
                first_shelve_time = #{firstShelveTime,jdbcType=INTEGER},
            </if>
            <if test="shelveTime != null">
                shelve_time = #{shelveTime,jdbcType=INTEGER},
            </if>
            <if test="expectArrivalTime != null">
                expect_arrival_time =
                #{expectArrivalTime,jdbcType=INTEGER},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=INTEGER},
            </if>
            <if test="arrivalTime != null">
                arrival_time = #{arrivalTime,jdbcType=INTEGER},
            </if>
            <if test="editTime != null">
                edit_time = #{editTime,jdbcType=INTEGER},
            </if>
            <if test="auditingTime != null">
                auditing_time = #{auditingTime,jdbcType=INTEGER},
            </if>
            <if test="isDown != null">
                is_down = #{isDown,jdbcType=CHAR},
            </if>
            <if test="status != null">
                status = #{status,jdbcType=INTEGER},
            </if>
            <if test="isEdit != null">
                is_edit = #{isEdit,jdbcType=INTEGER},
            </if>
            <if test="vipDiscountType != null">
                vip_discount_type = #{vipDiscountType,jdbcType=INTEGER},
            </if>
            <if test="storage != null">
                storage = #{storage,jdbcType=INTEGER},
            </if>
            <if test="isOutlets != null">
                is_outlets = #{isOutlets,jdbcType=CHAR},
            </if>
            <if test="folderId != null">
                folder_id = #{folderId,jdbcType=INTEGER},
            </if>
            <if test="sellChannels != null">
                sell_channels = #{sellChannels,jdbcType=CHAR},
            </if>
            <if test="elements != null">
                elements = #{elements,jdbcType=VARCHAR},
            </if>
            <if test="ageLevel != null">
                age_level = #{ageLevel,jdbcType=VARCHAR},
            </if>
            <if test="appType != null">
                app_type = #{appType,jdbcType=INTEGER},
            </if>
            <if test="isInstalment != null">
                is_instalment = #{isInstalment,jdbcType=VARCHAR},
            </if>
            <if test="isSeckill != null">
                is_seckill = #{isSeckill,jdbcType=CHAR},
            </if>
            <if test="isDepositAdvance != null">
                is_deposit_advance = #{isDepositAdvance,jdbcType=CHAR},
            </if>
            <if test="isLimitbuy != null">
                is_limitbuy = #{isLimitbuy,jdbcType=CHAR},
            </if>
            <if test="marketPhrase != null">
                market_phrase = #{marketPhrase,jdbcType=CHAR},
            </if>
            <if test="bundleType != null">
                bundle_type = #{bundleType,jdbcType=INTEGER},
            </if>
        </set>
        where id = #{id,jdbcType=INTEGER}
    </update>
    <select id="count" resultType="java.lang.Integer" timeout="20000">
		SELECT count(*) FROM product
	</select>
    <select id="selectProductIdBySkn" resultType="java.lang.Integer"
            parameterType="java.lang.Integer" timeout="20000">
		SELECT id FROM product where
		erp_product_id =
		#{productSkn,jdbcType=INTEGER}
	</select>
    <select id="selectSknByProductId" resultType="java.lang.Integer"
            parameterType="java.lang.Integer" timeout="20000">
        SELECT erp_product_id FROM product where
        id =
        #{id,jdbcType=INTEGER}
    </select>
    <select id="getPageLists" resultMap="BaseResultMap" timeout="20000">
        select
        <include refid="Base_Column_List"/>
        from product limit #{offset},#{pageSize}
    </select>
    <select id="getAll" resultMap="BaseResultMap" timeout="20000">
        select
        <include refid="Base_Column_List"/>
        from product
    </select>
    <select id="selectBySkns" resultMap="BaseResultMap">
        Select
        <include refid="Base_Column_List"/>
        from product where erp_product_id in
        <foreach item="item" index="index" collection="list"
                 open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>
    <select id="selectListByIds" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from product where id in
    <foreach item="item" index="index" collection="list"
             open="(" separator="," close=")">
        #{item}
    </foreach>
    </select>
</mapper>