sgj
5 天以前 8678e9973f5a1d537f1b23fb99eb8d951eb97a91
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
60
package com.fzzy.sys.controller.security.snap;
 
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.SnapRecord;
import com.fzzy.sys.manager.security.snap.SnapRecordManager;
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/snap/snapRecord")
public class SnapRecordController {
 
    private static final String prefix = "security/snap/snapRecord";
 
    @Resource
    private SnapRecordManager snapRecordManager;
 
    @GetMapping
    public String getSnapRecord(
            Model model) {
 
        IgdsBaseParam param = new IgdsBaseParam();
        param.setPage(1);
        param.setLimit(6);
        Page<SnapRecord> images = snapRecordManager.pageData(param);
        model.addAttribute("snapRecordList", images.getRecords());
        model.addAttribute("currentPage", images.getCurrent());
        model.addAttribute("totalItems", images.getTotal());
        model.addAttribute("pageSize", images.getSize());
        return prefix + "/snapRecord";
    }
 
    /**
     * 分页获取数据
     *
     * @param param
     * @return
     */
    @RequestMapping("/pageData")
    @ResponseBody
    public PageResponse<Page<SnapRecord>> pageData(@RequestBody IgdsBaseParam param) {
        Page<SnapRecord> snapRecordPage = snapRecordManager.pageData(param);
        if (null == snapRecordPage.getRecords() || snapRecordPage.getRecords().isEmpty()) {
            return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(), "获取到数据信息为空");
        }
        return new PageResponse<>(RespCodeEnum.CODE_0000, snapRecordPage);
    }
}