mybatis批量插入数据

mybatis XML代码


        
            INSERT INTO scene_device(sceneId,deviceId) VALUES(#{SceneDevice.sceneId}, #{SceneDevice.deviceId})
        
repo中的代码

public void  batchAddDevice(@Param("list") List list);
java service 中的代码

SceneDevice sceneDevice = new SceneDevice();
List sceneDevicesList = new ArrayList<>();

sceneDevice.setSceneId(sceneId);
sceneDevice.setDeviceId(deviceId);
sceneDevicesList.add(sceneDevice);
curdRepo.batchAddDevice(sceneDevicesList);


你可能感兴趣的:(datebase)