SmsContentLogDAO extends BaseIbatisDAO { public void saveBatch(final Map<String, Object> parameters) { if (LOG.isDebugEnabled()) { LOG.debug("Want to save,condition: " + parameters); } super.insert("SMS_CONTENT_LOG.batchCopy", parameters); }  SmsContentLog save(final SmsContentLog log); void saveBatch(final Map<String, Object> parameters); Object querySmsContentLogByPk(final Long id); @SuppressWarnings({"rawtypes" }) List query(final Map<String, Object> parameters); @SuppressWarnings({ "rawtypes", "unchecked" }) Page pagedQuery(final Map parameterObject, final int currentPage, final int limit); void increaseNumbers(final Serializable id); void updateReport(final Long serialId, final Integer reportStatus, final Date date, final String memo); void updateReport(final String beforeMemo, final Integer reportStatus, final Date date, final String memo); @SuppressWarnings("unchecked") List<SmsLogStat> queryStat(final Map<String, Object> parameters); long queryMMSStat(final Map<String, Object> parameters); void moveSmsContentLogToHis(final Map<String, Object> parameters); long count(final Map<String, Object> parameters); @SuppressWarnings("unchecked") List<SmsContentLog> getListByParams(Map<String, Object> params); Long getListCountByParams(Map<String, Object> params); int updateSmsLog(SmsContentLog smsContentLog); @SuppressWarnings("unchecked") List<SmsContentLog> getSmsLogListByParams(Map<String, Object> paramMap); @SuppressWarnings("unchecked") List<SmsContentLog> getResendSmsLogList();  }
@Test public void testSaveBatch() throws Exception { smsContentDAO.save(new SmsContent("Test Sms 1", "13917677725")); smsContentDAO.save(new SmsContent("Test Sms 2", "13917677725")); smsContentDAO.save(new SmsContent("Test Sms 3", "13917677725")); smsContentDAO.save(new SmsContent("Test Sms 4", "13917677725")); smsContentDAO.save(new SmsContent("Test Sms 5", "13012312657")); int rowCount = 0; ResultSet rs = conn.createStatement().executeQuery("select count(*) from sms_content_log"); rs.next(); rowCount = rs.getInt(1); Map<String,Object> parameters = new HashMap<String,Object>(); parameters.put("condition", "mobile = '13917677725'"); smsContentLogDAO.saveBatch(parameters); rs = conn.createStatement().executeQuery("select count(*) from sms_content_log"); rs.next(); Assert.assertEquals(rowCount + 4, rs.getInt(1)); rowCount += 4; parameters.put("failure", 1); smsContentLogDAO.saveBatch(parameters); rs = conn.createStatement().executeQuery("select count(*) from sms_content_log"); rs.next(); Assert.assertEquals(rowCount, rs.getInt(1)); }