1.student类
站在用户的角度思考问题,与客户深入沟通,找到叠彩网站设计与叠彩网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:做网站、成都网站设计、企业官网、英文网站、手机端网站、网站推广、国际域名空间、网页空间、企业邮箱。业务覆盖叠彩地区。
package com.test.hou.po; public class Student { private int sid; private String sname; private int sage; public int getSid() { return sid; } public void setSid(int sid) { this.sid = sid; } public String getSname() { return sname; } public void setSname(String sname) { this.sname = sname; } public int getSage() { return sage; } public void setSage(int sage) { this.sage = sage; } }
2.StudentAction
public String batchInsertStudent(){ Liststudentslist=new ArrayList (); for (int i = 0; i < 10; i++) { Student student=new Student(); student.setSid(i); student.setSname("aa"+i); student.setSage(i+10); studentslist.add(student); } studentService.batchInsertStudent(studentslist); return "batchinsertstudent"; }
3.studentMapper.xml
insert into student (select #{item.sid},#{item.sname},#{item.sage} from dual )
注意:此处sql没有values, separator 为union all和select ----from dual
1.传递单参数且为list集合,collection 为list
2.传单参数且为数组,collection为array
3.传多参数且为map,collectin 为map的key