ShopProductDAO extends BaseIbatisDAO { public Long count(final Map<String, Object> parameters) { return (Long) super.queryForObject("SHOP_PRODUCT.count", parameters); }  @SuppressWarnings("unchecked") List<ShopProduct> query(final Map<String, Object> parameters); Long count(final Map<String, Object> parameters); ShopProduct queryByPk(final Long id); ShopProduct queryDetailByPk(final Long id); Long insert(final ShopProduct product); Long insert(final ShopProductCoupon couponProduct); Long update(final ShopProduct product); Long update(final ShopProductCoupon couponProduct); void reduceStocks(final Map<String, Object> parameters); @SuppressWarnings("unchecked") List<ShopProductCondition> getShopProductConditionByShopProductId(Long productId); ShopProductCondition insertShopProductCondition(ShopProductCondition entity); void deleteShopProductConditionByProductId(Long productId);  }
@Test public void testCount(){ ShopProduct product = new ShopProduct(); product.setContent("content"); product.setIsValid("Y"); product.setIsRecommend("Y"); product.setIsHotProduct("Y"); product.setMarketPrice(Long.valueOf(11L)); product.setPointChange(Long.valueOf(12L)); product.setStocks(Long.valueOf(13L)); product.setPictures("pictures"); product.setProductCode("productCode"); product.setProductName("productName"); product.setProductType("C"); shopProductDAO.insert(product); product = new ShopProduct(); product.setContent("content"); product.setIsValid("Y"); product.setIsRecommend("Y"); product.setIsHotProduct("Y"); product.setMarketPrice(Long.valueOf(11L)); product.setPointChange(Long.valueOf(12L)); product.setStocks(Long.valueOf(13L)); product.setPictures("pictures"); product.setProductCode("productCode"); product.setProductName("productName321231"); product.setProductType("C"); shopProductDAO.insert(product); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("productType", "C"); Long count_1 = shopProductDAO.count(parameters); Assert.assertEquals(2, count_1.intValue()); parameters.put("productName", "productName321231"); Long count_2 = shopProductDAO.count(parameters); Assert.assertEquals(1, count_2.intValue()); }