ProductAttributeMapper.xml 9.58 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.ProductAttributeMapper" >
  <resultMap id="BaseResultMap" type="com.yoho.search.dal.model.ProductAttribute" >
    <id column="attribute_id" property="attributeId" jdbcType="INTEGER" />
    <result column="attribute_name" property="attributeName" jdbcType="VARCHAR" />
    <result column="category_id" property="categoryId" jdbcType="INTEGER" />
    <result column="sale_type" property="saleType" jdbcType="INTEGER" />
    <result column="input_type" property="inputType" jdbcType="CHAR" />
    <result column="attribute_type" property="attributeType" jdbcType="TINYINT" />
    <result column="is_must" property="isMust" jdbcType="CHAR" />
    <result column="is_search" property="isSearch" jdbcType="CHAR" />
    <result column="max_value_len" property="maxValueLen" jdbcType="SMALLINT" />
    <result column="is_color" property="isColor" jdbcType="CHAR" />
    <result column="is_allow_alias" property="isAllowAlias" jdbcType="CHAR" />
    <result column="order_by" property="orderBy" jdbcType="INTEGER" />
    <result column="state" property="state" jdbcType="TINYINT" />
    <result column="remark" property="remark" jdbcType="VARCHAR" />
    <result column="attribute_values" property="attributeValues" jdbcType="VARCHAR" />
    <result column="belong" property="belong" jdbcType="TINYINT" />
    <result column="create_time" property="createTime" jdbcType="INTEGER" />
    <result column="display_position" property="displayPosition" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Base_Column_List" >
    attribute_id, attribute_name, category_id, sale_type, input_type, attribute_type, 
    is_must, is_search, max_value_len, is_color, is_allow_alias, order_by, state, remark, 
    attribute_values, belong, create_time, display_position
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from product_attribute
    where attribute_id = #{attributeId,jdbcType=INTEGER}
  </select>
  <select id="selectByAttributeIds" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from product_attribute
    where attribute_id in 
    <foreach item="item" index="index" collection="ids"
             open="(" separator="," close=")">
      #{item}
    </foreach>
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from product_attribute
    where attribute_id = #{attributeId,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.yoho.search.dal.model.ProductAttribute" >
    insert into product_attribute (attribute_id, attribute_name, category_id, 
      sale_type, input_type, attribute_type, 
      is_must, is_search, max_value_len, 
      is_color, is_allow_alias, order_by, 
      state, remark, attribute_values, 
      belong, create_time, display_position
      )
    values (#{attributeId,jdbcType=INTEGER}, #{attributeName,jdbcType=VARCHAR}, #{categoryId,jdbcType=INTEGER}, 
      #{saleType,jdbcType=INTEGER}, #{inputType,jdbcType=CHAR}, #{attributeType,jdbcType=TINYINT}, 
      #{isMust,jdbcType=CHAR}, #{isSearch,jdbcType=CHAR}, #{maxValueLen,jdbcType=SMALLINT}, 
      #{isColor,jdbcType=CHAR}, #{isAllowAlias,jdbcType=CHAR}, #{orderBy,jdbcType=INTEGER}, 
      #{state,jdbcType=TINYINT}, #{remark,jdbcType=VARCHAR}, #{attributeValues,jdbcType=VARCHAR}, 
      #{belong,jdbcType=TINYINT}, #{createTime,jdbcType=INTEGER}, #{displayPosition,jdbcType=INTEGER}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.yoho.search.dal.model.ProductAttribute" >
    insert into product_attribute
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="attributeId != null" >
        attribute_id,
      </if>
      <if test="attributeName != null" >
        attribute_name,
      </if>
      <if test="categoryId != null" >
        category_id,
      </if>
      <if test="saleType != null" >
        sale_type,
      </if>
      <if test="inputType != null" >
        input_type,
      </if>
      <if test="attributeType != null" >
        attribute_type,
      </if>
      <if test="isMust != null" >
        is_must,
      </if>
      <if test="isSearch != null" >
        is_search,
      </if>
      <if test="maxValueLen != null" >
        max_value_len,
      </if>
      <if test="isColor != null" >
        is_color,
      </if>
      <if test="isAllowAlias != null" >
        is_allow_alias,
      </if>
      <if test="orderBy != null" >
        order_by,
      </if>
      <if test="state != null" >
        state,
      </if>
      <if test="remark != null" >
        remark,
      </if>
      <if test="attributeValues != null" >
        attribute_values,
      </if>
      <if test="belong != null" >
        belong,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="displayPosition != null" >
        display_position,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="attributeId != null" >
        #{attributeId,jdbcType=INTEGER},
      </if>
      <if test="attributeName != null" >
        #{attributeName,jdbcType=VARCHAR},
      </if>
      <if test="categoryId != null" >
        #{categoryId,jdbcType=INTEGER},
      </if>
      <if test="saleType != null" >
        #{saleType,jdbcType=INTEGER},
      </if>
      <if test="inputType != null" >
        #{inputType,jdbcType=CHAR},
      </if>
      <if test="attributeType != null" >
        #{attributeType,jdbcType=TINYINT},
      </if>
      <if test="isMust != null" >
        #{isMust,jdbcType=CHAR},
      </if>
      <if test="isSearch != null" >
        #{isSearch,jdbcType=CHAR},
      </if>
      <if test="maxValueLen != null" >
        #{maxValueLen,jdbcType=SMALLINT},
      </if>
      <if test="isColor != null" >
        #{isColor,jdbcType=CHAR},
      </if>
      <if test="isAllowAlias != null" >
        #{isAllowAlias,jdbcType=CHAR},
      </if>
      <if test="orderBy != null" >
        #{orderBy,jdbcType=INTEGER},
      </if>
      <if test="state != null" >
        #{state,jdbcType=TINYINT},
      </if>
      <if test="remark != null" >
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="attributeValues != null" >
        #{attributeValues,jdbcType=VARCHAR},
      </if>
      <if test="belong != null" >
        #{belong,jdbcType=TINYINT},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=INTEGER},
      </if>
      <if test="displayPosition != null" >
        #{displayPosition,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.ProductAttribute" >
    update product_attribute
    <set >
      <if test="attributeName != null" >
        attribute_name = #{attributeName,jdbcType=VARCHAR},
      </if>
      <if test="categoryId != null" >
        category_id = #{categoryId,jdbcType=INTEGER},
      </if>
      <if test="saleType != null" >
        sale_type = #{saleType,jdbcType=INTEGER},
      </if>
      <if test="inputType != null" >
        input_type = #{inputType,jdbcType=CHAR},
      </if>
      <if test="attributeType != null" >
        attribute_type = #{attributeType,jdbcType=TINYINT},
      </if>
      <if test="isMust != null" >
        is_must = #{isMust,jdbcType=CHAR},
      </if>
      <if test="isSearch != null" >
        is_search = #{isSearch,jdbcType=CHAR},
      </if>
      <if test="maxValueLen != null" >
        max_value_len = #{maxValueLen,jdbcType=SMALLINT},
      </if>
      <if test="isColor != null" >
        is_color = #{isColor,jdbcType=CHAR},
      </if>
      <if test="isAllowAlias != null" >
        is_allow_alias = #{isAllowAlias,jdbcType=CHAR},
      </if>
      <if test="orderBy != null" >
        order_by = #{orderBy,jdbcType=INTEGER},
      </if>
      <if test="state != null" >
        state = #{state,jdbcType=TINYINT},
      </if>
      <if test="remark != null" >
        remark = #{remark,jdbcType=VARCHAR},
      </if>
      <if test="attributeValues != null" >
        attribute_values = #{attributeValues,jdbcType=VARCHAR},
      </if>
      <if test="belong != null" >
        belong = #{belong,jdbcType=TINYINT},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=INTEGER},
      </if>
      <if test="displayPosition != null" >
        display_position = #{displayPosition,jdbcType=INTEGER},
      </if>
    </set>
    where attribute_id = #{attributeId,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.ProductAttribute" >
    update product_attribute
    set attribute_name = #{attributeName,jdbcType=VARCHAR},
      category_id = #{categoryId,jdbcType=INTEGER},
      sale_type = #{saleType,jdbcType=INTEGER},
      input_type = #{inputType,jdbcType=CHAR},
      attribute_type = #{attributeType,jdbcType=TINYINT},
      is_must = #{isMust,jdbcType=CHAR},
      is_search = #{isSearch,jdbcType=CHAR},
      max_value_len = #{maxValueLen,jdbcType=SMALLINT},
      is_color = #{isColor,jdbcType=CHAR},
      is_allow_alias = #{isAllowAlias,jdbcType=CHAR},
      order_by = #{orderBy,jdbcType=INTEGER},
      state = #{state,jdbcType=TINYINT},
      remark = #{remark,jdbcType=VARCHAR},
      attribute_values = #{attributeValues,jdbcType=VARCHAR},
      belong = #{belong,jdbcType=TINYINT},
      create_time = #{createTime,jdbcType=INTEGER},
      display_position = #{displayPosition,jdbcType=INTEGER}
    where attribute_id = #{attributeId,jdbcType=INTEGER}
  </update>
</mapper>