关于遍历Enum并添加到Map

来源:11-2 卖家商品-修改表单提交

南船座

2019-11-05

是这样的 有一些数据比如product_category是单独作为表建立的
在管理系统前端下拉框页面对应的填充数据非常好获取
像下面就直接获取到

List<ProductCategory> productCategoryList = productCategoryService.findAll();
map.put("productInfo",productInfo);

页面遍历就行

<div class="form-group">
     <label for="productStock">所属类目</label>
     <select name="categoryType" id="categoryType" class="form-control">
         <#list productCategoryList as list>
             <option value="${list.categoryId}">${list.categoryName}系列</option>
         </#list>
     </select>
 </div>

但是像productStatus,payStatus 这样都是enum中维护的
怎么遍历enum并添加到Map 没什么思路
廖师兄可以给我个思路嘛(百度查也没看到很靠谱的)

写回答

1回答

廖师兄

2019-11-05

直接添加到map里呀,由freemarker遍历

https://blog.csdn.net/ylz663294/article/details/84596915

0
0

Spring Boot双版本(1.5/2.1) 打造企业级微信点餐系统

从0到1开发中小型企业级Java应用,并学会迭代重构技巧

6417 学习 · 5257 问题

查看课程