5 天以前 0d7d874912d0147376826b55667a1deb6547ed91
src/main/java/com/ruoyi/framework/web/controller/BaseController.java
@@ -11,11 +11,12 @@
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.sql.SqlUtil;
import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.domain.R;
import com.ruoyi.framework.web.page.PageDomain;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.framework.web.page.TableSupport;
@@ -51,15 +52,7 @@
     */
    protected void startPage()
    {
        PageDomain pageDomain = TableSupport.buildPageRequest();
        Integer pageNum = pageDomain.getPageNum();
        Integer pageSize = pageDomain.getPageSize();
        if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
        {
            String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
            Boolean reasonable = pageDomain.getReasonable();
            PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
        }
        PageUtils.startPage();
    }
    /**
@@ -73,6 +66,14 @@
            String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
            PageHelper.orderBy(orderBy);
        }
    }
    /**
     * 清理分页的线程变量
     */
    protected void clearPage()
    {
        PageUtils.clearPage();
    }
    /**
@@ -92,53 +93,69 @@
    /**
     * 返回成功
     */
    public AjaxResult success()
    public R<?> success()
    {
        return AjaxResult.success();
    }
    /**
     * 返回失败消息
     */
    public AjaxResult error()
    {
        return AjaxResult.error();
        return R.ok();
    }
    /**
     * 返回成功消息
     */
    public AjaxResult success(String message)
    public R<?> success(String message)
    {
        return AjaxResult.success(message);
        return R.ok(null, message);
    }
    /**
     * 返回成功消息
     */
    public R<?> success(Object data)
    {
        return R.ok(data);
    }
    /**
     * 返回失败消息
     */
    public AjaxResult error(String message)
    public R<?> error()
    {
        return AjaxResult.error(message);
        return R.fail();
    }
    /**
     * 返回失败消息
     */
    public R<?> error(String message)
    {
        return R.fail(message);
    }
    /**
     * 返回警告消息
     */
    public R<?> warn(String message)
    {
        return R.fail(HttpStatus.WARN, message);
    }
    /**
     * 响应返回结果
     *
     *
     * @param rows 影响行数
     * @return 操作结果
     */
    protected AjaxResult toAjax(int rows)
    protected R<?> toAjax(int rows)
    {
        return rows > 0 ? AjaxResult.success() : AjaxResult.error();
        return rows > 0 ? R.ok() : R.fail();
    }
    /**
     * 响应返回结果
     *
     *
     * @param result 结果
     * @return 操作结果
     */
    protected AjaxResult toAjax(boolean result)
    protected R<?> toAjax(boolean result)
    {
        return result ? success() : error();
    }
@@ -162,9 +179,9 @@
    /**
     * 获取登录部门id
     */
    public Long getDeptId()
    public Long [] getDeptId()
    {
        return getLoginUser().getDeptId();
        return getLoginUser().getDeptIds();
    }
    /**