<?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.younike.system.mapper.GoodsServerDimensionMapper">
    <select id="selectGoodsServerDimensionByServerIdAndGoodsId" resultMap="GoodsServerDimensionResult">
        <include refid="selectGoodsServerDimensionVo"/>
        WHERE goods_id = #{goodsId} AND server_id = #{serverId}
    </select>

    <update id="updateGoodsServerDimensions">
        <foreach collection="list" item="item" index="index" separator=";">
            update goods_server_dimension set score = #{item.score}
            where id = #{item.id}
        </foreach>
    </update>

    <insert id="insertGoodsServerDimensions">
        <foreach collection="list" item="item" index="index" separator=";">
            INSERT INTO goods_server_dimension (`goods_id`, `dimension_id`, `server_id`, `score`)
            VALUES (#{item.goodsId}, #{item.dimensionId}, #{item.serverId}, #{item.score})
        </foreach>
    </insert>
</mapper>
