UI

2.2.实现步骤: 1、按钮添加点击事件,弹出窗口,加载数据显示tree 2、将选择类目的组件封装起来,通过TT.iniit()初始化,最终调用initItemCat()方法进行初始化 3、创建数据库、以及tb _item_cat表,初始化数据 4、编写Controller、Service、Mapper 2.3.EasyUI tree数据结构 数据结构中必须包含: Id:节点id Text:节点名称 State:如果不是叶子节点就是close,叶子节点就是open。Close的节点点击后会在此发送请求查询子项目。 可以根据parentid查询分类列表。 2.4.Mapper 使用逆向工程生成的mapper文件。 2.5.Service @Service public class ItemCatServiceImpl implements ItemCatService { @Autowired private TbItemCatMapper itemCatMapper; @Override public List getItemCatList(Long parentId) throws Exception { TbItemCatExample example = new TbItemCatExample(); //设置查询条件 Criteria criteria = example.createCriteria(); //根据parentid查询子节点 criteria.andParentIdEqualTo(parentId); //返回子节点列表 List list = itemCatMapper.selectByExample(example); return list; } } 2.6.Controller @Controller @RequestMapping(“/item/cat”) public class ItemCatController { @Autowired private ItemCatService itemCatService; @SuppressWarnings({ “rawtypes”, “unchecked” }) @RequestMapping(“/list”) @ResponseBody //如果id为null是使用默认值,也就是parentid为0的分类列表 public List categoryList(@RequestParam(value=”id”, defaultValue=”0”) Long parentId) throws Exception { List catList = new ArrayList(); //查询数据库 List list = itemCatService.getItemCatList(parentId); for (TbItemCat tbItemCat : list) { Map node = new HashMap
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值