BrandMapper.xml 7.15 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.BrandMapper">
	<resultMap id="BaseResultMap" type="com.yoho.search.dal.model.Brand">
		<id column="id" property="id" jdbcType="INTEGER" />
		<result column="brand_name" property="brandName" jdbcType="VARCHAR" />
		<result column="brand_domain" property="brandDomain" jdbcType="VARCHAR" />
		<result column="brand_alif" property="brandAlif" jdbcType="VARCHAR" />
		<result column="brand_ico" property="brandIco" jdbcType="VARCHAR" />
		<result column="is_hot" property="isHot" jdbcType="CHAR" />
		<result column="brand_name_cn" jdbcType="VARCHAR" property="brandNameCn" />
		<result column="brand_name_en" jdbcType="VARCHAR" property="brandNameEn" />
		<result column="brand_keyword" jdbcType="VARCHAR" property="brandKeyword" />
		<result column="hot_keyword" jdbcType="VARCHAR" property="hotKeyword" />
		<result column="status" property="status" jdbcType="INTEGER" />
		<result column="country_id" property="countryId" jdbcType="INTEGER" />
	</resultMap>
	<sql id="Base_Column_List">
		id, brand_name, brand_domain, brand_alif, brand_ico,
		is_hot,
		brand_name_cn, brand_name_en,
		brand_keyword, hot_keyword,status,country_id
	</sql>
	<select id="selectByPrimaryKey" resultMap="BaseResultMap"
		parameterType="java.lang.Integer" timeout="20000">
		select
		<include refid="Base_Column_List" />
		from brand
		where id = #{id,jdbcType=INTEGER}
	</select>
	<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"
		timeout="20000">
		delete from brand
		where id = #{id,jdbcType=INTEGER}
	</delete>
	<insert id="insert" parameterType="com.yoho.search.dal.model.Brand"
		timeout="20000">
		insert ignore into brand (id, brand_name, brand_domain,
		brand_alif,
		brand_ico, is_hot,
		brand_name_cn, brand_name_en, brand_keyword,
		hot_keyword,status,country_id)
		values (#{id,jdbcType=INTEGER},
		#{brandName,jdbcType=VARCHAR},
		#{brandDomain,jdbcType=VARCHAR},
		#{brandAlif,jdbcType=VARCHAR}, #{brandIco,jdbcType=VARCHAR},
		#{isHot,jdbcType=CHAR},
		#{brandNameCn,jdbcType=VARCHAR},
		#{brandNameEn,jdbcType=VARCHAR},
		#{brandKeyword,jdbcType=VARCHAR},
		#{hotKeyword,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},#{countryId,jdbcType=INTEGER})
	</insert>
	<insert id="insertbatch" parameterType="java.util.List" timeout="20000">
		insert ignore into brand (id, brand_name, brand_domain,
		brand_alif, brand_ico,
		is_hot,
		brand_name_cn, brand_name_en, brand_keyword,
		hot_keyword,status,country_id) values
		<foreach collection="list" item="item" index="index"
			separator=",">
			(#{item.id,jdbcType=INTEGER},
			#{item.brandName,jdbcType=VARCHAR},
			#{item.brandDomain,jdbcType=VARCHAR},
			#{item.brandAlif,jdbcType=VARCHAR},
			#{item.brandIco,jdbcType=VARCHAR}, #{item.isHot,jdbcType=CHAR},
			#{item.brandNameCn,jdbcType=VARCHAR},
			#{item.brandNameEn,jdbcType=VARCHAR},
			#{item.brandKeyword,jdbcType=VARCHAR},
			#{item.hotKeyword,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},#{item.countryId,jdbcType=INTEGER}
			)
		</foreach>
	</insert>
	<insert id="insertSelective" parameterType="com.yoho.search.dal.model.Brand"
		timeout="20000">
		insert ignore into brand
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="id != null">
				id,
			</if>
			<if test="brandName != null">
				brand_name,
			</if>
			<if test="brandDomain != null">
				brand_domain,
			</if>
			<if test="brandAlif != null">
				brand_alif,
			</if>
			<if test="brandIco != null">
				brand_ico,
			</if>
			<if test="isHot != null">
				is_hot,
			</if>
			<if test="brandNameCn != null">
				brand_name_cn,
			</if>
			<if test="brandNameEn != null">
				brand_name_en,
			</if>
			<if test="brandKeyword != null">
				brand_keyword,
			</if>
			<if test="hotKeyword != null">
				hot_keyword,
			</if>
			<if test="status != null">
				status,
			</if>
			<if test="countryId != null">
				country_id,
			</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="id != null">
				#{id,jdbcType=INTEGER},
			</if>
			<if test="brandName != null">
				#{brandName,jdbcType=VARCHAR},
			</if>
			<if test="brandDomain != null">
				#{brandDomain,jdbcType=VARCHAR},
			</if>
			<if test="brandAlif != null">
				#{brandAlif,jdbcType=VARCHAR},
			</if>
			<if test="brandIco != null">
				#{brandIco,jdbcType=VARCHAR},
			</if>
			<if test="isHot != null">
				#{isHot,jdbcType=CHAR},
			</if>
			<if test="brandNameCn != null">
				#{brandNameCn,jdbcType=VARCHAR},
			</if>
			<if test="brandNameEn != null">
				#{brandNameEn,jdbcType=VARCHAR},
			</if>
			<if test="brandKeyword != null">
				#{brandKeyword,jdbcType=VARCHAR},
			</if>
			<if test="hotKeyword != null">
				#{hotKeyword,jdbcType=VARCHAR},
			</if>
			<if test="status != null">
				#{status,jdbcType=INTEGER},
			</if>
			<if test="countryId != null">
				#{countryId,jdbcType=INTEGER},
			</if>
		</trim>
	</insert>
	<update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.Brand"
	timeout="20000">
	update brand
		<set>
			<if test="brandName != null">
				brand_name = #{brandName,jdbcType=VARCHAR},
			</if>
			<if test="brandDomain != null">
				brand_domain = #{brandDomain,jdbcType=VARCHAR},
			</if>
			<if test="brandAlif != null">
				brand_alif = #{brandAlif,jdbcType=VARCHAR},
			</if>
			<if test="brandIco != null">
				brand_ico = #{brandIco,jdbcType=VARCHAR},
			</if>
			<if test="isHot != null">
				is_hot = #{isHot,jdbcType=CHAR},
			</if>
			<if test="brandNameCn != null">
				brand_name_cn = #{brandNameCn,jdbcType=VARCHAR},
			</if>
			<if test="brandNameEn != null">
				brand_name_en = #{brandNameEn,jdbcType=VARCHAR},
			</if>
			<if test="brandKeyword != null">
				brand_keyword = #{brandKeyword,jdbcType=VARCHAR},
			</if>
			<if test="hotKeyword != null">
				hot_keyword = #{hotKeyword,jdbcType=VARCHAR},
			</if>
			<if test="status != null">
				status = #{status,jdbcType=INTEGER},
			</if>
			<if test="countryId != null">
				country_id = #{countryId,jdbcType=INTEGER},
			</if>
		</set>
		where id = #{id,jdbcType=INTEGER}
	</update>
	<update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.Brand" timeout="20000">
		update brand
		set
		brand_name = #{brandName,jdbcType=VARCHAR},
		brand_domain =
		#{brandDomain,jdbcType=VARCHAR},
		brand_alif =
		#{brandAlif,jdbcType=VARCHAR},
		brand_ico =
		#{brandIco,jdbcType=VARCHAR},
		is_hot = #{isHot,jdbcType=CHAR},
		brand_name_cn = #{brandNameCn,jdbcType=VARCHAR},
		brand_name_en =
		#{brandNameEn,jdbcType=VARCHAR},
		brand_keyword =
		#{brandKeyword,jdbcType=VARCHAR},
		hot_keyword =
		#{hotKeyword,jdbcType=VARCHAR},
		status = #{status,jdbcType=INTEGER},
		country_id = #{countryId,jdbcType=INTEGER}
		where id = #{id,jdbcType=INTEGER}
	</update>
	<select id="count" resultType="java.lang.Integer" timeout="20000" >
		SELECT count(1) FROM brand
	</select>
	<select id="getBrandPageLists" resultMap="BaseResultMap" timeout="20000">
		select
		<include refid="Base_Column_List" />
		from brand limit #{offset},#{pageSize}
	</select>
	<select id="getAll" resultMap="BaseResultMap" timeout="20000">
		select
		<include refid="Base_Column_List" />
		from brand
	</select>
</mapper>