wzy
2022-08-14 b141df9bf9764db8567efebed48006e12ab1f657
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package com.xzx.gc.role.controller;
 
 
import com.xzx.gc.common.constant.Constants;
import com.xzx.gc.entity.CoreDict;
import com.xzx.gc.model.JsonResult;
import com.xzx.gc.role.service.CoreDictService;
import com.xzx.gc.role.service.CorePlatformService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
 
import java.util.List;
 
@Controller
@SuppressWarnings("unchecked")
public class CoreDictController {
    private final Log log = LogFactory.getLog(this.getClass());
 
    @Autowired
    CorePlatformService platformService;
 
    @Autowired
    CoreDictService dictService;
 
 
 
    /**
     * 查看字典类型对应的列表
     * @param type
     * @return
     */
    @RequestMapping(Constants.ADMIN_VIEW_PREFIX + "/core/dict/view.json")
    @ResponseBody
    public JsonResult<List<CoreDict>> view(String type) {
        List<CoreDict> list = dictService.findAllByType(type);
        return  JsonResult.success(list);
    }
    
    /**
     * 查看字典值的子字典
     * @param value
     * @return
     */
  
    @RequestMapping(Constants.ADMIN_VIEW_PREFIX + "/core/dict/viewChildren.json")
    @ResponseBody
    public JsonResult<List<CoreDict>> viewChild(String group,String value) {
        CoreDict dict = dictService.findCoreDict(group,value);
        List<CoreDict> list = dictService.findChildByParent(dict.getId());
        return  JsonResult.success(list);
    }
    
    
 
}