tsurumure 9 mēneši atpakaļ
vecāks
revīzija
50d3207a87

+ 6 - 3
src/main/java/com/backendsys/modules/system/controller/SysUserV2Controller.java

@@ -6,13 +6,11 @@ import com.backendsys.modules.common.config.security.enums.SecurityEnum;
 import com.backendsys.modules.common.config.security.utils.SecurityUtil;
 import com.backendsys.modules.common.utils.Result;
 import com.backendsys.modules.system.entity.SysUser.SysUserDTO;
-import com.backendsys.modules.system.entity.SysUser.SysUserInfo;
 import com.backendsys.modules.system.service.SysUserV2Service;
 import com.backendsys.service.System.SysUserService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.validation.constraints.NotEmpty;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
@@ -25,7 +23,6 @@ public class SysUserV2Controller {
 
     @Autowired
     private SysUserService sysUserService;
-
     @Autowired
     private SysUserV2Service sysUserV2Service;
 
@@ -36,6 +33,12 @@ public class SysUserV2Controller {
         return Result.success().put("data", sysUserV2Service.selectUserList(sysUserDTO));
     }
 
+//    @PreAuthorize("@ss.hasPermi('3.1')")
+//    @GetMapping("/api/v2/system/user/getUserOnlineList")
+//    public Result getUserOnlineList(@Validated PageDTO pageDTO, @Validated com.backendsys.entity.System.SysUserDTO sysUserDTO) {
+//        return Result.success().put("data", sysUserService.queryUserWithLogined(pageDTO.getPage_num(), pageDTO.getPage_size(), sysUserDTO));
+//    }
+
     /**
      * 权限:
      * - 查询用户信息 (3.2.1)

+ 19 - 43
src/main/java/com/backendsys/utils/v2/PageDomain.java

@@ -5,79 +5,55 @@ import cn.hutool.core.util.StrUtil;
 /**
  * 分页数据
  */
-public class PageDomain
-{
-    /** 当前记录起始索引 */
-    private Integer page_num;
-
-    /** 每页显示记录数 */
-    private Integer page_size;
-
-    /** 排序列 */
-    private String order_by_column;
-
-    /** 排序的方向desc或者asc */
-    private String is_asc = "asc";
-
-    /** 分页参数合理化 */
-    private Boolean reasonable = true;
-
-    public String getOrderBy()
-    {
-        if (StrUtil.isEmpty(order_by_column))
-        {
-            return "";
-        }
+public class PageDomain {
+    private Integer page_num;               // 当前记录起始索引
+    private Integer page_size;              // 每页显示记录数
+    private String order_by_column;         // 排序列 (默认升序)
+    private String is_asc = "asc";          // 排序的方向desc或者asc
+    private Boolean reasonable = true;      // 分页参数合理化
+
+    public String getOrderBy() {
+        if (StrUtil.isEmpty(order_by_column)) return "";
         return StrUtil.toUnderlineCase(order_by_column) + " " + is_asc;
     }
 
-    public Integer getPageNum()
-    {
+    public Integer getPageNum() {
         return page_num;
     }
 
-    public void setPageNum(Integer page_num)
-    {
+    public void setPageNum(Integer page_num) {
         this.page_num = page_num;
     }
 
-    public Integer getPageSize()
-    {
+    public Integer getPageSize() {
         return page_size;
     }
 
-    public void setPageSize(Integer page_size)
-    {
+    public void setPageSize(Integer page_size) {
         this.page_size = page_size;
     }
 
-    public String getOrderByColumn()
-    {
+    public String getOrderByColumn() {
         return order_by_column;
     }
 
-    public void setOrderByColumn(String order_by_column)
-    {
+    public void setOrderByColumn(String order_by_column) {
         this.order_by_column = order_by_column;
     }
 
-    public String getIsAsc()
-    {
+    public String getIsAsc() {
         return is_asc;
     }
 
-    public void setIsAsc(String isAsc)
-    {
+    public void setIsAsc(String isAsc) {
         this.is_asc = is_asc;
     }
 
-    public Boolean getReasonable()
-    {
+    public Boolean getReasonable() {
         return reasonable;
     }
 
-    public void setReasonable(Boolean reasonable)
-    {
+    public void setReasonable(Boolean reasonable) {
         this.reasonable = reasonable;
     }
 }

+ 5 - 6
src/main/java/com/backendsys/utils/v2/PageUtils.java

@@ -10,22 +10,21 @@ public class PageUtils extends PageHelper
     /**
      * 设置请求分页数据
      */
-    public static void startPage()
-    {
+    public static void startPage() {
         PageDomain pageDomain = TableSupport.buildPageRequest();
         Integer pageNum = pageDomain.getPageNum();
         Integer pageSize = pageDomain.getPageSize();
         String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
         Boolean reasonable = pageDomain.getReasonable();
-
-        PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
+        if (pageNum != null && pageSize != null) {
+            PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
+        }
     }
 
     /**
      * 清理分页的线程变量
      */
-    public static void clearPage()
-    {
+    public static void clearPage() {
         PageHelper.clearPage();
     }
 }

+ 10 - 34
src/main/java/com/backendsys/utils/v2/TableSupport.java

@@ -4,52 +4,28 @@ import cn.hutool.core.convert.Convert;
 
 /**
  * 表格数据处理
- *
- * @author ruoyi
  */
-public class TableSupport
-{
-    /**
-     * 当前记录起始索引
-     */
-    public static final String PAGE_NUM = "page_num";
-
-    /**
-     * 每页显示记录数
-     */
-    public static final String PAGE_SIZE = "page_size";
-
-    /**
-     * 排序列
-     */
-    public static final String ORDER_BY_COLUMN = "order_by_column";
-
-    /**
-     * 排序的方向 "desc" 或者 "asc".
-     */
-    public static final String IS_ASC = "is_asc";
-
-    /**
-     * 分页参数合理化
-     */
-    public static final String REASONABLE = "reasonable";
+public class TableSupport {
+    public static final String PAGE_NUM = "page_num";                   // 当前记录起始索引
+    public static final String PAGE_SIZE = "page_size";                 // 每页显示记录数
+    public static final String ORDER_BY_COLUMN = "order_by_column";     // 排序列
+    public static final String IS_ASC = "is_asc";                       // 排序的方向 "desc" 或者 "asc".
+    public static final String REASONABLE = "reasonable";               // 分页参数合理化
 
     /**
      * 封装分页对象
      */
-    public static PageDomain getPageDomain()
-    {
+    public static PageDomain getPageDomain() {
         PageDomain pageDomain = new PageDomain();
-        pageDomain.setPageNum(Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1));
-        pageDomain.setPageSize(Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10));
+        pageDomain.setPageNum(Convert.toInt(ServletUtils.getParameter(PAGE_NUM), null));    // defaultValue: 1
+        pageDomain.setPageSize(Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), null));  // defaultValue: 10
         pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN));
         pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC));
         pageDomain.setReasonable(ServletUtils.getParameterToBool(REASONABLE));
         return pageDomain;
     }
 
-    public static PageDomain buildPageRequest()
-    {
+    public static PageDomain buildPageRequest() {
         return getPageDomain();
     }
 }