Mybatis循环List

第一步、Mapper.java接口

void subInsert(List> list);

第二步、对应的statement标签:


	
		INSERT INTO table_name
		(id,start_time,balance)VALUES
		
			(
			NULL,
			#{item.start_time},
			#{item.balance}
			)
		
	

第三步、jdbc链接添加&allowMultiQueries=TRUE,因为Mabatis默认不支持一个statement标签写多个sql,案例如下:

jdbc.url=jdbc:mysql://192.168.1.110/data_test?useUnicode=TRUE&characterEncoding=utf-8&allowMultiQueries=TRUE

 

你可能感兴趣的:(MySQL)