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();
|
}
|
}
|