<?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.dgtly.goods.mapper.GoodsSizeMapper">
    
    <resultMap type="GoodsSize" id="GoodsSizeResult">
        <result property="id"    column="id"    />
        <result property="goodsId"    column="goods_id"    />
        <result property="size"    column="size"    />
    </resultMap>

    <sql id="selectGoodsSizeVo">
        select id, goods_id, size from goods_size
    </sql>


    <insert id="insertGoodsSize" parameterType="GoodsSize">
        insert into goods_size
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null ">id,</if>
            <if test="goodsId != null ">goods_id,</if>
            <if test="size != null  and size != ''">size,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null ">#{id},</if>
            <if test="goodsId != null ">#{goodsId},</if>
            <if test="size != null  and size != ''">#{size},</if>
         </trim>
    </insert>

    <insert id="insertGoodsSizeList" >
        insert into goods_size (goods_id,size) values
        <foreach collection="list" item="item" index="index"
                 separator=",">
            (
            #{goodsId},
            #{item.size}
            )

        </foreach>
    </insert>

    
</mapper>