6 天以前 0c23c1e9b9e06ffc570edac28ee45555b772b99c
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
package com.ruoyi.safety.controller;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.framework.web.domain.AjaxResult;
 
/**
 * 安环管理 Controller 公共方法。
 */
public abstract class SafetyControllerSupport {
 
    /**
     * 兼容 MyBatis Plus 的 current/size 与文档中的 pageNum/pageSize 分页参数。
     */
    protected <T> Page<T> buildPage(Page<T> page, Long pageNum, Long pageSize) {
        Page<T> result = page == null ? new Page<T>() : page;
        if (pageNum != null) {
            result.setCurrent(pageNum);
        }
        if (pageSize != null) {
            result.setSize(pageSize);
        }
        return result;
    }
 
    /**
     * 将布尔处理结果转换为统一响应。
     */
    protected AjaxResult toAjax(boolean success) {
        return success ? AjaxResult.success() : AjaxResult.error();
    }
}