Search in sources :

Example 1 with ZTreeNode

use of cn.exrick.common.pojo.ZTreeNode in project xmall by Exrick.

the class ItemCatServiceImpl method getItemCatList.

@Override
public List<ZTreeNode> getItemCatList(int parentId) {
    TbItemCatExample example = new TbItemCatExample();
    TbItemCatExample.Criteria criteria = example.createCriteria();
    // 排序
    example.setOrderByClause("sort_order");
    // 条件查询
    criteria.andParentIdEqualTo(new Long(parentId));
    List<TbItemCat> list = tbItemCatMapper.selectByExample(example);
    // 转换成ZtreeNode
    List<ZTreeNode> resultList = new ArrayList<>();
    for (TbItemCat tbItemCat : list) {
        ZTreeNode node = DtoUtil.TbItemCat2ZTreeNode(tbItemCat);
        resultList.add(node);
    }
    return resultList;
}
Also used : TbItemCat(cn.exrick.manager.pojo.TbItemCat) ArrayList(java.util.ArrayList) ZTreeNode(cn.exrick.common.pojo.ZTreeNode) TbItemCatExample(cn.exrick.manager.pojo.TbItemCatExample)

Example 2 with ZTreeNode

use of cn.exrick.common.pojo.ZTreeNode in project xmall by Exrick.

the class PanelServiceImpl method getPanelList.

@Override
public List<ZTreeNode> getPanelList(int position, boolean showAll) {
    TbPanelExample example = new TbPanelExample();
    TbPanelExample.Criteria criteria = example.createCriteria();
    if (position == 0 && !showAll) {
        // 除去非轮播
        criteria.andTypeNotEqualTo(0);
    } else if (position == -1) {
        // 仅含轮播
        position = 0;
        criteria.andTypeEqualTo(0);
    }
    // 首页板块
    criteria.andPositionEqualTo(position);
    example.setOrderByClause("sort_order");
    List<TbPanel> panelList = tbPanelMapper.selectByExample(example);
    List<ZTreeNode> list = new ArrayList<>();
    for (TbPanel tbPanel : panelList) {
        ZTreeNode zTreeNode = DtoUtil.TbPanel2ZTreeNode(tbPanel);
        list.add(zTreeNode);
    }
    return list;
}
Also used : TbPanelExample(cn.exrick.manager.pojo.TbPanelExample) ArrayList(java.util.ArrayList) ZTreeNode(cn.exrick.common.pojo.ZTreeNode) TbPanel(cn.exrick.manager.pojo.TbPanel)

Example 3 with ZTreeNode

use of cn.exrick.common.pojo.ZTreeNode in project xmall by Exrick.

the class DtoUtil method TbContentCategory2ZTreeNode.

public static ZTreeNode TbContentCategory2ZTreeNode(TbContentCategory tbContentCategory) {
    ZTreeNode zTreeNode = new ZTreeNode();
    zTreeNode.setId(Math.toIntExact(tbContentCategory.getId()));
    zTreeNode.setIsParent(tbContentCategory.getIsParent());
    zTreeNode.setpId(Math.toIntExact(tbContentCategory.getParentId()));
    zTreeNode.setName(tbContentCategory.getName());
    zTreeNode.setIcon(tbContentCategory.getIcon());
    zTreeNode.setSortOrder(tbContentCategory.getSortOrder());
    zTreeNode.setStatus(tbContentCategory.getStatus());
    zTreeNode.setRemark(tbContentCategory.getRemark());
    zTreeNode.setNum(tbContentCategory.getNum());
    return zTreeNode;
}
Also used : ZTreeNode(cn.exrick.common.pojo.ZTreeNode)

Example 4 with ZTreeNode

use of cn.exrick.common.pojo.ZTreeNode in project xmall by Exrick.

the class ContentCatServiceImpl method getContentCatList.

@Override
public List<ZTreeNode> getContentCatList(Long parentId) {
    TbContentCategoryExample example = new TbContentCategoryExample();
    TbContentCategoryExample.Criteria criteria = example.createCriteria();
    criteria.andParentIdEqualTo(parentId);
    example.setOrderByClause("sort_order");
    List<TbContentCategory> catList = tbContentCategoryMapper.selectByExample(example);
    List<ZTreeNode> list = new ArrayList<>();
    for (int i = 0; i < catList.size(); i++) {
        ZTreeNode zTreeNode = DtoUtil.TbContentCategory2ZTreeNode(catList.get(i));
        list.add(zTreeNode);
    }
    return list;
}
Also used : TbContentCategoryExample(cn.exrick.manager.pojo.TbContentCategoryExample) TbContentCategory(cn.exrick.manager.pojo.TbContentCategory) ArrayList(java.util.ArrayList) ZTreeNode(cn.exrick.common.pojo.ZTreeNode)

Example 5 with ZTreeNode

use of cn.exrick.common.pojo.ZTreeNode in project xmall by Exrick.

the class DtoUtil method TbPanel2ZTreeNode.

public static ZTreeNode TbPanel2ZTreeNode(TbPanel tbPanel) {
    ZTreeNode zTreeNode = new ZTreeNode();
    zTreeNode.setId(tbPanel.getId());
    zTreeNode.setIsParent(false);
    zTreeNode.setpId(0);
    zTreeNode.setName(tbPanel.getName());
    zTreeNode.setSortOrder(tbPanel.getSortOrder());
    zTreeNode.setStatus(tbPanel.getStatus());
    zTreeNode.setRemark(tbPanel.getRemark());
    zTreeNode.setLimitNum(tbPanel.getLimitNum());
    zTreeNode.setType(tbPanel.getType());
    return zTreeNode;
}
Also used : ZTreeNode(cn.exrick.common.pojo.ZTreeNode)

Aggregations

ZTreeNode (cn.exrick.common.pojo.ZTreeNode)6 ArrayList (java.util.ArrayList)3 TbContentCategory (cn.exrick.manager.pojo.TbContentCategory)1 TbContentCategoryExample (cn.exrick.manager.pojo.TbContentCategoryExample)1 TbItemCat (cn.exrick.manager.pojo.TbItemCat)1 TbItemCatExample (cn.exrick.manager.pojo.TbItemCatExample)1 TbPanel (cn.exrick.manager.pojo.TbPanel)1 TbPanelExample (cn.exrick.manager.pojo.TbPanelExample)1