package com.fzzy.sys.controller.security.eventInfo;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.fzzy.igds.constant.RespCodeEnum;
|
import com.fzzy.igds.data.IgdsBaseParam;
|
import com.fzzy.igds.data.PageResponse;
|
import com.fzzy.igds.domain.EventInfo;
|
import com.fzzy.sys.manager.security.eventInfo.EventInfoManager;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.ui.Model;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import javax.annotation.Resource;
|
|
@Slf4j
|
@Controller
|
@RequestMapping("/security/eventInfo")
|
public class EventInfoController {
|
|
private static final String prefix = "security/eventInfo";
|
|
@Resource
|
private EventInfoManager eventInfoManager;
|
|
@GetMapping
|
public String getEventInfo(
|
Model model) {
|
|
IgdsBaseParam param = new IgdsBaseParam();
|
param.setPage(1);
|
param.setLimit(6);
|
Page<EventInfo> events = eventInfoManager.pageData(param);
|
model.addAttribute("eventInfoList", events.getRecords());
|
model.addAttribute("currentPage", events.getCurrent());
|
model.addAttribute("totalItems", events.getTotal());
|
model.addAttribute("pageSize", events.getSize());
|
return prefix + "/eventInfo";
|
}
|
|
/**
|
* 分页获取数据
|
*
|
* @param param
|
* @return
|
*/
|
@RequestMapping("/pageData")
|
@ResponseBody
|
public PageResponse<Page<EventInfo>> pageData(@RequestBody IgdsBaseParam param) {
|
Page<EventInfo> eventInfoPage = eventInfoManager.pageData(param);
|
if (null == eventInfoPage.getRecords() || eventInfoPage.getRecords().isEmpty()) {
|
return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(), "获取到数据信息为空");
|
}
|
return new PageResponse<>(RespCodeEnum.CODE_0000, eventInfoPage);
|
}
|
}
|