SkuDAO extends MyBatisDAO<Sku> { @Cached(name = CACHE_NAME, key = DEFAULT_KEY, expire = Constant.EXPIRE_15M) public Sku findById(Long id) { return getSqlSession().selectOne(sqlId("findById"), id); }  @Cached(name = CACHE_NAME, key = DEFAULT_KEY, expire = Constant.EXPIRE_15M) Sku findById(Long id); @Cached(name = SKU_ID_CACHE_NAME, key = "#itemId", expire = Constant.EXPIRE_15M) List<Long> findSkuIdByItemId(Long itemId); @CacheInvalidate(name = SKU_ID_CACHE_NAME, key = "#itemId") void releaseItemIdIndex(Long itemId); @CacheInvalidate(name = CACHE_NAME, key = DEFAULT_KEY) boolean updateStatus(Long id, Integer version, Integer status, Long updatedBy); List<Sku> findByItemId(Long itemId); List<Long> findSkuId(Long itemId); Long findItemId(Long skuId); @CacheInvalidate(name = CACHE_NAME, key = DEFAULT_KEY) Boolean updateStatusCheckSellerId(Long id, Integer version, Integer status, Long sellerId, Long updatedBy); static final String DEFAULT_KEY; }
@Test public void testCrud() { Sku found = sku.findById(init.getId()); assertThat(found).isNotNull(); }