<?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.ruoyi.web.modules.goods.mapper.BizGoodsAttrMapper">

    <select id="selectByGoodsId" resultType="com.ruoyi.web.modules.goods.domain.BizGoodsAttr">
        select attr_id as attrId, goods_id as goodsId, attr_type as attrType,
               item_name as itemName, value_text as valueText, sort_no as sortNo
        from biz_goods_attr
        where goods_id = #{goodsId}
        order by attr_type asc, sort_no asc, attr_id asc
    </select>

    <delete id="deleteByGoodsId">
        delete from biz_goods_attr where goods_id = #{goodsId}
    </delete>

    <insert id="batchInsert">
        insert into biz_goods_attr (goods_id, attr_type, item_name, value_text, sort_no)
        values
        <foreach collection="list" item="item" separator=",">
            (#{item.goodsId}, #{item.attrType}, #{item.itemName}, #{item.valueText}, #{item.sortNo})
        </foreach>
    </insert>
</mapper>
