Commit d2681852 authored by tangwei's avatar tangwei

增加缓存

parent 7d860341
package com.yeejoin.amos.boot.module.jcs.biz.controller;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
......@@ -41,6 +42,8 @@ public class AlertFormController extends BaseController {
IAlertFormService iAlertFormService;
@Autowired
FormList FormList;
@Autowired
RedisUtils redisUtils;
/**
* 新增警情表单
* @return
......@@ -102,18 +105,22 @@ public class AlertFormController extends BaseController {
*/
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/from/{code}", method = RequestMethod.GET)
@RequestMapping(value = "/form/{code}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据表态类型code查询表单数据项", notes = "根据表态类型code查询表单数据项")
public ResponseModel selectFormdItem(HttpServletRequest request, @PathVariable String code){
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("alert_type_code", code);
//警情动态表单数据
List<AlertForm> alertFormValue = iAlertFormService.list(queryWrapper);
List<AlertFormVo> list= FormList.getFormlist(alertFormValue);
return CommonResponseUtil.success(list);
List<AlertFormVo> list=null;
if(redisUtils.hasKey("form_"+code)){
Object obj= redisUtils.get("form_"+code);
return CommonResponseUtil.success(obj);
}else{
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("alert_type_code", code);
//警情动态表单数据
List<AlertForm> alertFormValue = iAlertFormService.list(queryWrapper);
list= FormList.getFormlist(alertFormValue);
redisUtils.set("form_"+code,list,86400);
return CommonResponseUtil.success(list);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment