LetterUserMessageDAO extends BaseIbatisDAO { public List<LetterUserMessage> batchInsertUserLetter(final List<LetterUserMessage> list) { super.execute(new SqlMapClientCallback<Object>() { public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException { executor.startBatch(); for (LetterUserMessage message : list) { executor.insert("ONLINE_LETTER_USER_MESSAGE.insertTemplate", message); } return executor.executeBatch(); } }); return list; }  List<LetterUserMessage> batchInsertUserLetter(final List<LetterUserMessage> list); int updateUserLetter(Long id); int batchDeleteUserLetter(Map<String, Object> parameters); List<LetterUserMessage> queryMessage(Map<String, Object> parameters); Long countMessage(Map<String, Object> parameters);  }
@Test public void testBatchInsertUserLetter() { LetterUserMessage message = new LetterUserMessage(); message.setMessageType(Constant.ONLINE_LETTER_TYPE.PROCLAMATION.name()); message.setMessageContent("中华民族到了最危险的时候"); message.setTemplateId(5L); message.setUserId(12L); List<LetterUserMessage> list = new ArrayList<LetterUserMessage>(); list.add(message); letterUserMessageDAO.batchInsertUserLetter(list); }