<?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.haha.mapper.ReplenisherDeviceMapper">

    <!-- 补货员-设备关联结果映射 -->
    <resultMap id="BaseResultMap" type="com.haha.entity.ReplenisherDevice">
        <id column="id" property="id"/>
        <result column="replenisher_id" property="replenisherId"/>
        <result column="device_id" property="deviceId"/>
        <result column="source" property="source"/>
        <result column="create_time" property="createTime"/>
    </resultMap>

    <!-- 批量插入关联（忽略已存在） -->
    <insert id="batchInsertIgnore">
        INSERT IGNORE INTO t_replenisher_device (id, replenisher_id, device_id, source, create_time)
        VALUES
        <foreach collection="list" item="item" separator=",">
            (#{item.id}, #{item.replenisherId}, #{item.deviceId}, #{item.source}, #{item.createTime})
        </foreach>
    </insert>

</mapper>
