mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-04 04:08:43 +08:00 
			
		
		
		
	1. RoleDO 字段的调整和优化
2. 初始化 Role 模块相关接口的 VO 类
This commit is contained in:
		@@ -3,6 +3,7 @@ package com.ruoyi.common.core.controller;
 | 
			
		||||
import java.beans.PropertyEditorSupport;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
import org.springframework.web.bind.WebDataBinder;
 | 
			
		||||
@@ -23,54 +24,21 @@ import com.ruoyi.common.utils.sql.SqlUtil;
 | 
			
		||||
 *
 | 
			
		||||
 * @author ruoyi
 | 
			
		||||
 */
 | 
			
		||||
public class BaseController
 | 
			
		||||
{
 | 
			
		||||
public class BaseController {
 | 
			
		||||
    protected final Logger logger = LoggerFactory.getLogger(BaseController.class);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 将前台传递过来的日期格式的字符串,自动转化为Date类型
 | 
			
		||||
     */
 | 
			
		||||
    @InitBinder
 | 
			
		||||
    public void initBinder(WebDataBinder binder)
 | 
			
		||||
    {
 | 
			
		||||
    public void initBinder(WebDataBinder binder) {
 | 
			
		||||
        // Date 类型转换
 | 
			
		||||
        binder.registerCustomEditor(Date.class, new PropertyEditorSupport()
 | 
			
		||||
        {
 | 
			
		||||
        binder.registerCustomEditor(Date.class, new PropertyEditorSupport() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void setAsText(String text)
 | 
			
		||||
            {
 | 
			
		||||
            public void setAsText(String text) {
 | 
			
		||||
                setValue(DateUtils.parseDate(text));
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设置请求分页数据
 | 
			
		||||
     */
 | 
			
		||||
    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());
 | 
			
		||||
            PageHelper.startPage(pageNum, pageSize, orderBy);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 响应请求分页数据
 | 
			
		||||
     */
 | 
			
		||||
    @SuppressWarnings({ "rawtypes", "unchecked" })
 | 
			
		||||
    protected TableDataInfo getDataTable(List<?> list)
 | 
			
		||||
    {
 | 
			
		||||
        TableDataInfo rspData = new TableDataInfo();
 | 
			
		||||
        rspData.setCode(HttpStatus.SUCCESS);
 | 
			
		||||
        rspData.setMsg("查询成功");
 | 
			
		||||
        rspData.setRows(list);
 | 
			
		||||
        rspData.setTotal(new PageInfo(list).getTotal());
 | 
			
		||||
        return rspData;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,33 +0,0 @@
 | 
			
		||||
package com.ruoyi.common.core.page;
 | 
			
		||||
 | 
			
		||||
import com.ruoyi.common.utils.StringUtils;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 分页数据
 | 
			
		||||
 *
 | 
			
		||||
 * @author ruoyi
 | 
			
		||||
 */
 | 
			
		||||
public class PageDomain
 | 
			
		||||
{
 | 
			
		||||
    /** 当前记录起始索引 */
 | 
			
		||||
    private Integer pageNum;
 | 
			
		||||
 | 
			
		||||
    /** 每页显示记录数 */
 | 
			
		||||
    private Integer pageSize;
 | 
			
		||||
 | 
			
		||||
    /** 排序列 */
 | 
			
		||||
    private String orderByColumn;
 | 
			
		||||
 | 
			
		||||
    /** 排序的方向desc或者asc */
 | 
			
		||||
    private String isAsc = "asc";
 | 
			
		||||
 | 
			
		||||
    public String getOrderBy()
 | 
			
		||||
    {
 | 
			
		||||
        if (StringUtils.isEmpty(orderByColumn))
 | 
			
		||||
        {
 | 
			
		||||
            return "";
 | 
			
		||||
        }
 | 
			
		||||
        return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,27 +0,0 @@
 | 
			
		||||
package com.ruoyi.common.core.page;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 表格分页数据对象
 | 
			
		||||
 *
 | 
			
		||||
 * @author ruoyi
 | 
			
		||||
 */
 | 
			
		||||
public class TableDataInfo implements Serializable
 | 
			
		||||
{
 | 
			
		||||
    private static final long serialVersionUID = 1L;
 | 
			
		||||
 | 
			
		||||
    /** 总记录数 */
 | 
			
		||||
    private long total;
 | 
			
		||||
 | 
			
		||||
    /** 列表数据 */
 | 
			
		||||
    private List<?> rows;
 | 
			
		||||
 | 
			
		||||
    /** 消息状态码 */
 | 
			
		||||
    private int code;
 | 
			
		||||
 | 
			
		||||
    /** 消息内容 */
 | 
			
		||||
    private String msg;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,32 +0,0 @@
 | 
			
		||||
package com.ruoyi.common.core.page;
 | 
			
		||||
 | 
			
		||||
import com.ruoyi.common.utils.ServletUtils;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 表格数据处理
 | 
			
		||||
 *
 | 
			
		||||
 * @author ruoyi
 | 
			
		||||
 */
 | 
			
		||||
public class TableSupport
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * 当前记录起始索引
 | 
			
		||||
     */
 | 
			
		||||
    public static final String PAGE_NUM = "pageNum";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 每页显示记录数
 | 
			
		||||
     */
 | 
			
		||||
    public static final String PAGE_SIZE = "pageSize";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 排序列
 | 
			
		||||
     */
 | 
			
		||||
    public static final String ORDER_BY_COLUMN = "orderByColumn";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 排序的方向 "desc" 或者 "asc".
 | 
			
		||||
     */
 | 
			
		||||
    public static final String IS_ASC = "isAsc";
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user