SmsContentLogDAO extends BaseIbatisDAO { public SmsContentLog save(final SmsContentLog log) { if (LOG.isDebugEnabled()) { LOG.debug("Want to save " + log); } super.insert("SMS_CONTENT_LOG.insert", log); if (LOG.isDebugEnabled()) { LOG.debug("save " + log + " successfully!"); } return log; }  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 testSave() throws Exception { SmsContentLog log = new SmsContentLog("This is a test log","13917677725"); smsContentLogDAO.save(log); Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery("select * from sms_content_log where content = 'This is a test log' and mobile = '13917677725'"); rs.next(); Assert.assertNotNull(rs.getLong("id")); Assert.assertEquals("This is a test log", rs.getString("content")); Assert.assertEquals("13917677725", rs.getString("mobile")); Assert.assertEquals(5, rs.getInt("priority")); Assert.assertNull(rs.getString("type")); Assert.assertNotNull(rs.getDate("send_date")); Assert.assertEquals(0, rs.getInt("failure")); Assert.assertEquals(1, rs.getInt("numbers")); if (rs.next()) { fail("插入了多条数据!"); } }