YohoodProductMapper.xml 7.91 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.YohoodProductMapper">
	<resultMap id="BaseResultMap" type="com.yoho.search.dal.model.YohoodProduct">
		<id column="product_sku" property="productSku" jdbcType="INTEGER" />
		<result column="product_skc" property="productSkc" jdbcType="INTEGER" />
		<result column="product_skn" property="productSkn" jdbcType="INTEGER" />
		<result column="gender" property="gender" jdbcType="INTEGER" />
		<result column="sort_id" property="sortId" jdbcType="INTEGER" />
		<result column="brand_id" property="brandId" jdbcType="INTEGER" />
		<result column="is_recommend" property="isRecommend" jdbcType="CHAR" />
		<result column="buy_number" property="buyNumber" jdbcType="INTEGER" />
		<result column="preset_number" property="presetNumber"
			jdbcType="INTEGER" />
		<result column="is_vote" property="isVote" jdbcType="CHAR" />
		<result column="founder" property="founder" jdbcType="INTEGER" />
		<result column="status" property="status" jdbcType="INTEGER" />
		<result column="create_time" property="createTime" jdbcType="INTEGER" />
		<result column="middle_sort_id" property="middleSortId"
			jdbcType="INTEGER" />
		<result column="is_online" property="isOnline" jdbcType="CHAR" />
	</resultMap>
	<sql id="Base_Column_List">
		product_sku, product_skc, product_skn, gender, sort_id,
		brand_id, is_recommend,
		buy_number,
		preset_number, is_vote, founder,
		status, create_time, middle_sort_id, is_online
	</sql>
	<select id="selectByPrimaryKey" resultMap="BaseResultMap"
		parameterType="java.lang.Integer" timeout="20000">
		select
		<include refid="Base_Column_List" />
		from yohood_product
		where product_sku = #{productSku,jdbcType=INTEGER}
	</select>
	<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"
		timeout="20000">
		delete from yohood_product
		where product_sku =
		#{productSku,jdbcType=INTEGER}
	</delete>
	<insert id="insert" parameterType="com.yoho.search.dal.model.YohoodProduct"
		timeout="20000">
		insert ignore into yohood_product (product_sku, product_skc,
		product_skn,
		gender, sort_id, brand_id,
		is_recommend, buy_number,
		preset_number,
		is_vote, founder, status,
		create_time, middle_sort_id,
		is_online
		)
		values (#{productSku,jdbcType=INTEGER},
		#{productSkc,jdbcType=INTEGER},
		#{productSkn,jdbcType=INTEGER},
		#{gender,jdbcType=INTEGER}, #{sortId,jdbcType=INTEGER},
		#{brandId,jdbcType=INTEGER},
		#{isRecommend,jdbcType=CHAR},
		#{buyNumber,jdbcType=INTEGER},
		#{presetNumber,jdbcType=INTEGER},
		#{isVote,jdbcType=CHAR}, #{founder,jdbcType=INTEGER},
		#{status,jdbcType=INTEGER},
		#{createTime,jdbcType=INTEGER},
		#{middleSortId,jdbcType=INTEGER},
		#{isOnline,jdbcType=CHAR}
		)
	</insert>
	<insert id="insertSelective" parameterType="com.yoho.search.dal.model.YohoodProduct"
		timeout="20000">
		insert ignore into yohood_product
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="productSku != null">
				product_sku,
			</if>
			<if test="productSkc != null">
				product_skc,
			</if>
			<if test="productSkn != null">
				product_skn,
			</if>
			<if test="gender != null">
				gender,
			</if>
			<if test="sortId != null">
				sort_id,
			</if>
			<if test="brandId != null">
				brand_id,
			</if>
			<if test="isRecommend != null">
				is_recommend,
			</if>
			<if test="buyNumber != null">
				buy_number,
			</if>
			<if test="presetNumber != null">
				preset_number,
			</if>
			<if test="isVote != null">
				is_vote,
			</if>
			<if test="founder != null">
				founder,
			</if>
			<if test="status != null">
				status,
			</if>
			<if test="createTime != null">
				create_time,
			</if>
			<if test="middleSortId != null">
				middle_sort_id,
			</if>
			<if test="isOnline != null">
				is_online,
			</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="productSku != null">
				#{productSku,jdbcType=INTEGER},
			</if>
			<if test="productSkc != null">
				#{productSkc,jdbcType=INTEGER},
			</if>
			<if test="productSkn != null">
				#{productSkn,jdbcType=INTEGER},
			</if>
			<if test="gender != null">
				#{gender,jdbcType=INTEGER},
			</if>
			<if test="sortId != null">
				#{sortId,jdbcType=INTEGER},
			</if>
			<if test="brandId != null">
				#{brandId,jdbcType=INTEGER},
			</if>
			<if test="isRecommend != null">
				#{isRecommend,jdbcType=CHAR},
			</if>
			<if test="buyNumber != null">
				#{buyNumber,jdbcType=INTEGER},
			</if>
			<if test="presetNumber != null">
				#{presetNumber,jdbcType=INTEGER},
			</if>
			<if test="isVote != null">
				#{isVote,jdbcType=CHAR},
			</if>
			<if test="founder != null">
				#{founder,jdbcType=INTEGER},
			</if>
			<if test="status != null">
				#{status,jdbcType=INTEGER},
			</if>
			<if test="createTime != null">
				#{createTime,jdbcType=INTEGER},
			</if>
			<if test="middleSortId != null">
				#{middleSortId,jdbcType=INTEGER},
			</if>
			<if test="isOnline != null">
				#{isOnline,jdbcType=CHAR},
			</if>
		</trim>
	</insert>
	<update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.YohoodProduct"
		timeout="20000">
		update yohood_product
		<set>
			<if test="productSkc != null">
				product_skc = #{productSkc,jdbcType=INTEGER},
			</if>
			<if test="productSkn != null">
				product_skn = #{productSkn,jdbcType=INTEGER},
			</if>
			<if test="gender != null">
				gender = #{gender,jdbcType=INTEGER},
			</if>
			<if test="sortId != null">
				sort_id = #{sortId,jdbcType=INTEGER},
			</if>
			<if test="brandId != null">
				brand_id = #{brandId,jdbcType=INTEGER},
			</if>
			<if test="isRecommend != null">
				is_recommend = #{isRecommend,jdbcType=CHAR},
			</if>
			<if test="buyNumber != null">
				buy_number = #{buyNumber,jdbcType=INTEGER},
			</if>
			<if test="presetNumber != null">
				preset_number = #{presetNumber,jdbcType=INTEGER},
			</if>
			<if test="isVote != null">
				is_vote = #{isVote,jdbcType=CHAR},
			</if>
			<if test="founder != null">
				founder = #{founder,jdbcType=INTEGER},
			</if>
			<if test="status != null">
				status = #{status,jdbcType=INTEGER},
			</if>
			<if test="createTime != null">
				create_time = #{createTime,jdbcType=INTEGER},
			</if>
			<if test="middleSortId != null">
				middle_sort_id = #{middleSortId,jdbcType=INTEGER},
			</if>
			<if test="isOnline != null">
				is_online = #{isOnline,jdbcType=CHAR},
			</if>
		</set>
		where product_sku = #{productSku,jdbcType=INTEGER}
	</update>
	<update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.YohoodProduct"
		timeout="20000">
		update yohood_product
		set product_skc =
		#{productSkc,jdbcType=INTEGER},
		product_skn =
		#{productSkn,jdbcType=INTEGER},
		gender = #{gender,jdbcType=INTEGER},
		sort_id = #{sortId,jdbcType=INTEGER},
		brand_id =
		#{brandId,jdbcType=INTEGER},
		is_recommend =
		#{isRecommend,jdbcType=CHAR},
		buy_number =
		#{buyNumber,jdbcType=INTEGER},
		preset_number =
		#{presetNumber,jdbcType=INTEGER},
		is_vote = #{isVote,jdbcType=CHAR},
		founder = #{founder,jdbcType=INTEGER},
		status =
		#{status,jdbcType=INTEGER},
		create_time =
		#{createTime,jdbcType=INTEGER},
		middle_sort_id =
		#{middleSortId,jdbcType=INTEGER},
		is_online = #{isOnline,jdbcType=CHAR}
		where product_sku = #{productSku,jdbcType=INTEGER}
	</update>

	<resultMap id="yohoodMap" type="java.util.Map">
		<id column="id" property="id" jdbcType="INTEGER" />
		<result column="product_id" property="productId" jdbcType="INTEGER" />
		<result column="is_yohood" property="isYohood" jdbcType="VARCHAR" />
	</resultMap>
	<select id="selectIsYohood" resultMap="yohoodMap" parameterType="java.lang.Integer"
		timeout="20000">
    <![CDATA[
        SELECT p.id AS product_id, yp.`product_skn`,IF(yp.`product_skn` IS NULL,"N", "Y") AS `is_yohood`
        FROM product p
        LEFT JOIN yohood_product yp
        ON p.`erp_product_id`=yp.`product_skn` WHERE p.erp_product_id=#{productSkn,jdbcType=INTEGER}  LIMIT 0,1
     ]]>
	</select>
</mapper>