Search in sources :

Example 1 with ZTreeNode

use of build.dream.catering.beans.ZTreeNode in project erp-catering by liuyandong33.

the class GoodsService method listCategories.

@Transactional(readOnly = true)
public ApiRest listCategories(ListCategoriesModel listCategoriesModel) {
    SearchModel searchModel = new SearchModel(true);
    searchModel.addSearchCondition("tenant_id", Constants.SQL_OPERATION_SYMBOL_EQUALS, listCategoriesModel.getTenantId());
    searchModel.addSearchCondition("branch_id", Constants.SQL_OPERATION_SYMBOL_EQUALS, listCategoriesModel.getBranchId());
    List<GoodsCategory> goodsCategories = goodsCategoryMapper.findAll(searchModel);
    List<ZTreeNode> zTreeNodes = new ArrayList<ZTreeNode>();
    for (GoodsCategory goodsCategory : goodsCategories) {
        zTreeNodes.add(new ZTreeNode(goodsCategory.getId().toString(), goodsCategory.getName(), goodsCategory.getParentId().toString()));
    }
    return new ApiRest(zTreeNodes, "查询菜品分类成功!");
}
Also used : SearchModel(build.dream.common.utils.SearchModel) ArrayList(java.util.ArrayList) ZTreeNode(build.dream.catering.beans.ZTreeNode) ApiRest(build.dream.common.api.ApiRest) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

ZTreeNode (build.dream.catering.beans.ZTreeNode)1 ApiRest (build.dream.common.api.ApiRest)1 SearchModel (build.dream.common.utils.SearchModel)1 ArrayList (java.util.ArrayList)1 Transactional (org.springframework.transaction.annotation.Transactional)1