12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package com.yihu.wlyy.web.common.system;
- import com.yihu.wlyy.entity.dict.SystemDict;
- import com.yihu.wlyy.service.system.SystemDictService;
- import com.yihu.wlyy.web.BaseController;
- import io.swagger.annotations.Api;
- import org.json.JSONArray;
- import org.json.JSONObject;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.http.MediaType;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.ResponseBody;
- import java.util.List;
- /**
- * Created by Administrator on 2016/8/13.
- */
- @Controller
- @RequestMapping(value = "/common", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
- @Api(description = "系统字典")
- public class SystemDictController extends BaseController {
- @Autowired
- private SystemDictService systemDictService;
- /**
- * 根據dictname查找DictName
- * @param name
- * @return
- */
- @ResponseBody
- @RequestMapping(value = "/getDictByDictName")
- public String getDictByDictName(String name){
- try {
- List<SystemDict> list=systemDictService.getDictByDictName(name);
- JSONArray ja=new JSONArray();
- for (SystemDict systemDict:list){
- JSONObject jo=new JSONObject();
- jo.put("code",systemDict.getCode());
- jo.put("value",systemDict.getValue());
- ja.put(jo);
- }
- return write(200,"查询成功","list",ja);
- } catch (Exception e) {
- error(e);
- return error(-1, "验证码检查失败!");
- }
- }
- }
|