File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
moss-extension/src/main/java/org/xujin/moss/controller Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments