Get the App
SLTechnology News&Howtos  ›  Database  › 

Mybatis-oracle (ssi2 Framework) batch increase

Shulou Source: shulou.com Published: 2022-06-01 10:23:54 10月02日 Update

1.student class

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 () {List studentslist=new ArrayList (); for (int I = 0; I < 10; iTunes +) {Student student=new Student (); student.setSid (I); student.setSname ("aa" + I); student.setSage (iTun10) Studentslist.add (student);} studentService.batchInsertStudent (studentslist); return "batchinsertstudent";}

3.studentMapper.xml

Insert into student (select # {item.sid}, # {item.sname}, # {item.sage} from dual)

Note: here sql does not have values, separator is union all and select-from dual

1. Pass a single parameter and is a list collection, and collection is list

two。 Leaflet parameter and array, collection is array

3. Pass a key with multiple parameters and map,collectin is map

Tags: Parameters flyers arrays frames Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Shulou Tech Info Apple Shulou Information MariaDB