OperationLogIbatisDao extends SqlMapClientDaoSupport implements OperationLogDao { @Override public String getLogKey(int logId, String key) { String selectClause = null; if ("key1".equals(key)) { selectClause = "OperationLog.getOpLogKey1"; } else if ("key2".equals(key)) { selectClause = "OperationLog.getOpLogKey2"; } else if ("key3".equals(key)) { selectClause = "OperationLog.getOpLogKey3"; } else if ("key4".equals(key)) { selectClause = "OperationLog.getOpLogKey4"; } else if ("key5".equals(key)) { selectClause = "OperationLog.getOpLogKey5"; } else if ("key6".equals(key)) { selectClause = "OperationLog.getOpLogKey6"; } else { return null; } return (String) getSqlMapClientTemplate().queryForObject(selectClause, Maps.entry("id", logId).get()); }  @Override long getLogCount(OperationLogCriteria logCriteria, Paginater<OperationLog> paginater); @SuppressWarnings("unchecked") @Override List<OperationLog> getLogList(OperationLogCriteria logCriteria, Paginater<OperationLog> paginater); @Override int insertOpLog(OperationLog oplog); @Override String getLogKey(int logId, String key);  }
@Test public void testGetLogKey() throws Exception { String logKey = operationLogDao.getLogKey(log1Id, "key1"); assertEquals(Log1_Key1, logKey); logKey = operationLogDao.getLogKey(log1Id, "key6"); assertEquals(Log1_Key6, logKey); logKey = operationLogDao.getLogKey(log2Id, "key1"); assertEquals(Log2_Key1, logKey); logKey = operationLogDao.getLogKey(-1000, "key1"); assertNull(logKey); }