package category;
import java.util.List;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.lgx8.gateway.dao.ICategoryDao;
import com.lgx8.gateway.entities.AreaCategory;
import com.lgx8.gateway.entities.Category;
import com.lgx8.gateway.service.IGatewayService;
public class TestInitCategory {
/**
* @param args
*/
public static void main(String[] args) {
ApplicationContext ac = new ClassPathXmlApplicationContext("ApplicationContext.xml");
IGatewayService gatewayService = (IGatewayService) ac.getBean("gatewayService");
List<Category> categorys = gatewayService.findAllCategory();
System.out.println(categorys.get(0).getChilds());
/*AreaCategory areaCategory = new AreaCategory();
areaCategory.setName("共享良品");
areaCategory.setDescription("共享良品");
areaCategory.setUrl("liangpin");
gatewayService.createAreaCategory(areaCategory);
areaCategory = new AreaCategory();
areaCategory.setName("共享优品");
areaCategory.setDescription("共享优品");
areaCategory.setUrl("youpin");
gatewayService.createAreaCategory(areaCategory);
areaCategory = new AreaCategory();
areaCategory.setName("共享优品");
areaCategory.setDescription("共享优品");
areaCategory.setUrl("youpin");
gatewayService.createAreaCategory(areaCategory);
areaCategory = new AreaCategory();
areaCategory.setName("共享名品");
areaCategory.setDescription("共享名品");
areaCategory.setUrl("mingpin");
gatewayService.createAreaCategory(areaCategory);
areaCategory = new AreaCategory();
areaCategory.setName("共享奢品");
areaCategory.setDescription("共享奢品");
areaCategory.setUrl("shepin");
gatewayService.createAreaCategory(areaCategory);
areaCategory = new AreaCategory();
areaCategory.setName("共享同城");
areaCategory.setDescription("共享同城");
areaCategory.setUrl("tongcheng");
gatewayService.createAreaCategory(areaCategory);*/
/*Category category = new Category();
category.setName("图书、音乐、影视");
category.setDescription("图书、音乐、影视");
category.setUrl("fun");
gatewayService.createCategory(category);
Category child = new Category();
child.setName("音像");
child.setDescription("音像");
child.setUrl("music");
child.setParent(category);
gatewayService.createCategory(child);
category = new Category();
category.setName("家用电器、汽车用品");
category.setDescription("家用电器、汽车用品");
category.setUrl("ele");
gatewayService.createCategory(category);
child = new Category();
child.setName("家用电器");
child.setDescription("家用电器");
child.setUrl("famele");
child.setParent(category);
gatewayService.createCategory(child);
category = new Category();
category.setName("手机数码");
category.setDescription("手机数码");
category.setUrl("digital");
gatewayService.createCategory(category);
child = new Category();
child.setName("手机");
child.setDescription("手机");
child.setUrl("mobile");
child.setParent(category);
gatewayService.createCategory(child);
category = new Category();
category.setName("电脑办公");
category.setDescription("电脑办公");
category.setUrl("computeroffice");
gatewayService.createCategory(category);
child = new Category();
child.setName("电脑");
child.setDescription("电脑");
child.setUrl("computer");
child.setParent(category);
gatewayService.createCategory(child);
category = new Category();
category.setName("家居、厨具、家装");
category.setDescription("家居、厨具、家装");
category.setUrl("family");
gatewayService.createCategory(category);
child = new Category();
child.setName("家居");
child.setDescription("家居");
child.setUrl("fam");
child.setParent(category);
gatewayService.createCategory(child);
category = new Category();
category.setName("服装鞋帽");
category.setDescription("服装鞋帽");
category.setUrl("clothing");
gatewayService.createCategory(category);
child = new Category();
child.setName("鞋子");
child.setDescription("鞋子");
child.setUrl("shoe");
child.setParent(category);
gatewayService.createCategory(child);*/
}
}