<?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.neusoft.smart.pos.inventory.persistent.mapper.inventoryGoodsThirdpartyExtendMapper">
  <resultMap id="BaseResultMap" type="com.neusoft.smart.pos.inventory.persistent.domain.inventoryGoodsThirdpartyExtend">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="goods_id" jdbcType="INTEGER" property="goodsId" />
    <result column="type_code" jdbcType="VARCHAR" property="typeCode" />
    <result column="goods_code" jdbcType="VARCHAR" property="goodsCode" />
    <result column="code_extend_1" jdbcType="VARCHAR" property="codeExtend1" />
    <result column="code_extend_2" jdbcType="VARCHAR" property="codeExtend2" />
    <result column="code_extend_3" jdbcType="VARCHAR" property="codeExtend3" />
  </resultMap>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.neusoft.smart.pos.inventory.persistent.domain.inventoryGoodsThirdpartyExtend">
    <result column="thirdparty_data" jdbcType="LONGVARCHAR" property="thirdpartyData" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    id, goods_id, type_code, goods_code, code_extend_1, code_extend_2, code_extend_3
  </sql>
  <sql id="Blob_Column_List">
    thirdparty_data
  </sql>
  <select id="selectByExampleWithBLOBs" parameterType="com.neusoft.smart.pos.inventory.persistent.domain.inventoryGoodsThirdpartyExtendExample" resultMap="ResultMapWithBLOBs">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from inventory_goods_thirdparty_extend
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
    <if test="offset != null and limit != null">
      limit ${offset}, ${limit}
    </if>
  </select>
  <select id="selectByExample" parameterType="com.neusoft.smart.pos.inventory.persistent.domain.inventoryGoodsThirdpartyExtendExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from inventory_goods_thirdparty_extend
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
    <if test="offset != null and limit != null">
      limit ${offset}, ${limit}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from inventory_goods_thirdparty_extend
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from inventory_goods_thirdparty_extend
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.neusoft.smart.pos.inventory.persistent.domain.inventoryGoodsThirdpartyExtendExample">
    delete from inventory_goods_thirdparty_extend
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.neusoft.smart.pos.inventory.persistent.domain.inventoryGoodsThirdpartyExtend" useGeneratedKeys="true">
    insert into inventory_goods_thirdparty_extend (goods_id, type_code, goods_code, 
      code_extend_1, code_extend_2, code_extend_3, 
      thirdparty_data)
    values (#{goodsId,jdbcType=INTEGER}, #{typeCode,jdbcType=VARCHAR}, #{goodsCode,jdbcType=VARCHAR}, 
      #{codeExtend1,jdbcType=VARCHAR}, #{codeExtend2,jdbcType=VARCHAR}, #{codeExtend3,jdbcType=VARCHAR}, 
      #{thirdpartyData,jdbcType=LONGVARCHAR})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.neusoft.smart.pos.inventory.persistent.domain.inventoryGoodsThirdpartyExtend" useGeneratedKeys="true">
    insert into inventory_goods_thirdparty_extend
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="goodsId != null">
        goods_id,
      </if>
      <if test="typeCode != null">
        type_code,
      </if>
      <if test="goodsCode != null">
        goods_code,
      </if>
      <if test="codeExtend1 != null">
        code_extend_1,
      </if>
      <if test="codeExtend2 != null">
        code_extend_2,
      </if>
      <if test="codeExtend3 != null">
        code_extend_3,
      </if>
      <if test="thirdpartyData != null">
        thirdparty_data,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="goodsId != null">
        #{goodsId,jdbcType=INTEGER},
      </if>
      <if test="typeCode != null">
        #{typeCode,jdbcType=VARCHAR},
      </if>
      <if test="goodsCode != null">
        #{goodsCode,jdbcType=VARCHAR},
      </if>
      <if test="codeExtend1 != null">
        #{codeExtend1,jdbcType=VARCHAR},
      </if>
      <if test="codeExtend2 != null">
        #{codeExtend2,jdbcType=VARCHAR},
      </if>
      <if test="codeExtend3 != null">
        #{codeExtend3,jdbcType=VARCHAR},
      </if>
      <if test="thirdpartyData != null">
        #{thirdpartyData,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.neusoft.smart.pos.inventory.persistent.domain.inventoryGoodsThirdpartyExtendExample" resultType="java.lang.Integer">
    select count(*) from inventory_goods_thirdparty_extend
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update inventory_goods_thirdparty_extend
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.goodsId != null">
        goods_id = #{record.goodsId,jdbcType=INTEGER},
      </if>
      <if test="record.typeCode != null">
        type_code = #{record.typeCode,jdbcType=VARCHAR},
      </if>
      <if test="record.goodsCode != null">
        goods_code = #{record.goodsCode,jdbcType=VARCHAR},
      </if>
      <if test="record.codeExtend1 != null">
        code_extend_1 = #{record.codeExtend1,jdbcType=VARCHAR},
      </if>
      <if test="record.codeExtend2 != null">
        code_extend_2 = #{record.codeExtend2,jdbcType=VARCHAR},
      </if>
      <if test="record.codeExtend3 != null">
        code_extend_3 = #{record.codeExtend3,jdbcType=VARCHAR},
      </if>
      <if test="record.thirdpartyData != null">
        thirdparty_data = #{record.thirdpartyData,jdbcType=LONGVARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExampleWithBLOBs" parameterType="map">
    update inventory_goods_thirdparty_extend
    set id = #{record.id,jdbcType=INTEGER},
      goods_id = #{record.goodsId,jdbcType=INTEGER},
      type_code = #{record.typeCode,jdbcType=VARCHAR},
      goods_code = #{record.goodsCode,jdbcType=VARCHAR},
      code_extend_1 = #{record.codeExtend1,jdbcType=VARCHAR},
      code_extend_2 = #{record.codeExtend2,jdbcType=VARCHAR},
      code_extend_3 = #{record.codeExtend3,jdbcType=VARCHAR},
      thirdparty_data = #{record.thirdpartyData,jdbcType=LONGVARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update inventory_goods_thirdparty_extend
    set id = #{record.id,jdbcType=INTEGER},
      goods_id = #{record.goodsId,jdbcType=INTEGER},
      type_code = #{record.typeCode,jdbcType=VARCHAR},
      goods_code = #{record.goodsCode,jdbcType=VARCHAR},
      code_extend_1 = #{record.codeExtend1,jdbcType=VARCHAR},
      code_extend_2 = #{record.codeExtend2,jdbcType=VARCHAR},
      code_extend_3 = #{record.codeExtend3,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.neusoft.smart.pos.inventory.persistent.domain.inventoryGoodsThirdpartyExtend">
    update inventory_goods_thirdparty_extend
    <set>
      <if test="goodsId != null">
        goods_id = #{goodsId,jdbcType=INTEGER},
      </if>
      <if test="typeCode != null">
        type_code = #{typeCode,jdbcType=VARCHAR},
      </if>
      <if test="goodsCode != null">
        goods_code = #{goodsCode,jdbcType=VARCHAR},
      </if>
      <if test="codeExtend1 != null">
        code_extend_1 = #{codeExtend1,jdbcType=VARCHAR},
      </if>
      <if test="codeExtend2 != null">
        code_extend_2 = #{codeExtend2,jdbcType=VARCHAR},
      </if>
      <if test="codeExtend3 != null">
        code_extend_3 = #{codeExtend3,jdbcType=VARCHAR},
      </if>
      <if test="thirdpartyData != null">
        thirdparty_data = #{thirdpartyData,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.neusoft.smart.pos.inventory.persistent.domain.inventoryGoodsThirdpartyExtend">
    update inventory_goods_thirdparty_extend
    set goods_id = #{goodsId,jdbcType=INTEGER},
      type_code = #{typeCode,jdbcType=VARCHAR},
      goods_code = #{goodsCode,jdbcType=VARCHAR},
      code_extend_1 = #{codeExtend1,jdbcType=VARCHAR},
      code_extend_2 = #{codeExtend2,jdbcType=VARCHAR},
      code_extend_3 = #{codeExtend3,jdbcType=VARCHAR},
      thirdparty_data = #{thirdpartyData,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.neusoft.smart.pos.inventory.persistent.domain.inventoryGoodsThirdpartyExtend">
    update inventory_goods_thirdparty_extend
    set goods_id = #{goodsId,jdbcType=INTEGER},
      type_code = #{typeCode,jdbcType=VARCHAR},
      goods_code = #{goodsCode,jdbcType=VARCHAR},
      code_extend_1 = #{codeExtend1,jdbcType=VARCHAR},
      code_extend_2 = #{codeExtend2,jdbcType=VARCHAR},
      code_extend_3 = #{codeExtend3,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <insert id="batchInsert">
    <if test="items.get(0) != null">
            insert into inventory_goods_thirdparty_extend  (goods_id, type_code, goods_code, 
        code_extend_1, code_extend_2, code_extend_3, 
        thirdparty_data)
      values
      <foreach collection="items" item="item" index="index" separator=",">
      (#{item.goodsId,jdbcType=INTEGER}, #{item.typeCode,jdbcType=VARCHAR}, #{item.goodsCode,jdbcType=VARCHAR}, 
        #{item.codeExtend1,jdbcType=VARCHAR}, #{item.codeExtend2,jdbcType=VARCHAR}, #{item.codeExtend3,jdbcType=VARCHAR}, 
        #{item.thirdpartyData,jdbcType=LONGVARCHAR})
      </foreach>
    </if>
  </insert>
</mapper>