Skip to content

Commit e6dffb0

Browse files
committed
通过字典类型查询字典项
1 parent ff22736 commit e6dffb0

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package org.xujin.moss.controller;
2+
3+
import org.apache.commons.collections.CollectionUtils;
4+
import org.springframework.beans.factory.annotation.Autowired;
5+
import org.springframework.web.bind.annotation.GetMapping;
6+
import org.springframework.web.bind.annotation.PathVariable;
7+
import org.springframework.web.bind.annotation.RequestMapping;
8+
import org.springframework.web.bind.annotation.RestController;
9+
import org.xujin.moss.common.ResultData;
10+
import org.xujin.moss.constant.Constants;
11+
import org.xujin.moss.model.MetaDataModel;
12+
import org.xujin.moss.service.DictService;
13+
14+
import java.util.List;
15+
16+
/**
17+
* 字典控制器
18+
* @author homeant
19+
* @date 2019-05-26 10:32:07
20+
*/
21+
@RestController
22+
@RequestMapping("dist")
23+
public class DictController extends BaseController {
24+
25+
@Autowired
26+
DictService dictService;
27+
28+
/**
29+
* 通过类型获取字典项
30+
* @param type
31+
* @return
32+
*/
33+
@GetMapping("{type}")
34+
public ResultData fecthDict(@PathVariable("type") String type){
35+
List<MetaDataModel> dictLists = dictService.findDictDataByDictCodeAndStatus(Constants.DICT_DATA_STATUS_TRUE, type);
36+
if(CollectionUtils.isNotEmpty(dictLists)){
37+
return ResultData.ok(dictLists).build();
38+
}else{
39+
return ResultData.noContent().build();
40+
}
41+
}
42+
}

0 commit comments

Comments
 (0)