首页>代码>Spring MVC、Vue、layui、layer等成熟技术开发个人博客网站>/ExcellentCodeProject/src/main/java/com/ecp/common/communal/controller/PortalDictController.java
package com.ecp.common.communal.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ecp.common.communal.util.KeywordsUtils;
import com.ecp.internal.dict.service.DictService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
* 用于不需要登录或者权限认证即可调用获取字典信息
*/
@Controller
@RequestMapping(path = {"/common/communal/portal/dict/"})
public class PortalDictController {
private static final Logger logger = LoggerFactory.getLogger(PortalDictController.class);
@Resource
DictService dictService;
/**
* 获取字典列表信息
* @param request
* @param response
* @param paramsJsonStr
*/
@RequestMapping(path = {"list"}, method = {RequestMethod.GET, RequestMethod.POST})
@ResponseBody
public void getPortalDictList (HttpServletRequest request, HttpSession session,
ModelAndView modelAndView, HttpServletResponse response, String paramsJsonStr) {
try {
request.setCharacterEncoding(KeywordsUtils.UTF_8);
response.setCharacterEncoding(KeywordsUtils.UTF_8);
System.out.println("==========前端传过来的参数:" + paramsJsonStr);
JSONObject paramsJO = new JSONObject();
if (StringUtils.isNotBlank(paramsJsonStr)) {
paramsJO = JSONObject.parseObject(paramsJsonStr);
}
System.out.println("==========前端传过来的参数转化成JSONObject:" + paramsJO);
JSONArray ja = dictService.getDictList(paramsJO);
System.out.println(ja);
response.getWriter().print(ja);
} catch (Exception e) {
e.printStackTrace();
}
}
}
最近下载更多
1690356080 LV38
2023年11月12日
123456nty LV37
2022年4月8日
ljm2s LV3
2021年9月24日
seve980508 LV1
2020年5月26日
499755609 LV8
2020年4月7日
jiajia91323 LV23
2019年12月13日
powerful LV7
2019年12月4日
admin123456686 LV10
2019年11月1日
xiongtianming18 LV12
2019年9月26日
wzsq20 LV12
2019年9月22日

最近浏览