一、mybatis批量插入数据private void saveTicketServiceImpl(int count) {

List<Ticket> ticketList=new ArrayList<Ticket>();

for (int i = 1,i <= count; i++){

Ticket ticket = new Ticket();

ticket.setNumber("MG--" + count);

ticketList.add(ticket);

}

ticketMapper.insertTickList(ticketList);} ------------------TicketMapper.xml--------------------------<insert id=" insertTickList" parameterType="java.util.List">

insert into ticket(id,number,create_time)

VALUES

<foreach collection="list" item="item" index= "index" separator="," >

( #{item.id},

#{item.number},

now())

</foreach></insert> 二、mybatis模糊查询(***.xml)name like CONCAT('%',#{name},'%') 

快照源:http://my.oschina.net/liuyaqian/blog/670189