Esempio n. 1
0
 public void deleteGoods() throws Exception {
   GoodsCategory category = this.goodsService.getCategory("JUnit-TEST");
   List<PropertyFilter> filters = new ArrayList<PropertyFilter>();
   filters.add(new PropertyFilter("EQS_category.sign", category.getSign()));
   for (Goods goods : this.goodsService.find(filters, "sn", "asc", 0, 10)) {
     this.goodsService.deleteGoods(goods.getId());
   }
 }
Esempio n. 2
0
  public void save() throws Exception {
    GoodsCategory category = this.goodsService.getCategory("JUnit-TEST");

    if (category != null) {
      this.deleteGoods();
      this.deleteCategory();
    }

    category = new GoodsCategory();
    category.setSign("JUnit-TEST");
    category.setName("JUnit测试");
    OgnlUtil.getInstance().setValue("parent.sign", category, "ROOT");
    this.goodsService.save(category);

    Assert.assertNotNull(category.getId());

    Goods goods = new Goods();
    goods.setEngname("test goods");
    goods.setName("测试商品");
    goods.setCategory(category);
    goods.setMarketPrice(BigDecimal.valueOf(0.5));
    goods.setPrice(BigDecimal.valueOf(0.5));
    this.goodsService.save(goods);

    logger.debug("goods sn = " + goods.getSn());
  }