<?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.cyksj.mapper.shop.YhShopUserPlatDistributeRateMapper">

    <insert id="batchInsertGoodsRate">
        insert
        ignore into yh_shop_user_plat_distribute_rate(`user_id`,`goods_id`,`rate`,`second_rate`,`created_time`,`update_time`)
        select user_id, goods_id, rate, second_rate, now(), now()
        from user_distribute ud
                 inner join user_plat_distribute_rate ur
                            on ur.distribute_id = ud.id and ud.deleted is true and ud.user_id = #{userId}
    </insert>
</mapper>