mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-10-09 04:57:11 +08:00
Merge branch 'dev' into 2.0.x
# Conflicts: # continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/query/SortQuery.java # continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/query/LoginLogQuery.java # continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/query/OperationLogQuery.java # continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/query/SystemLogQuery.java # continew-admin-system/src/main/java/top/charles7c/cnadmin/auth/model/query/OnlineUserQuery.java # continew-admin-system/src/main/java/top/charles7c/cnadmin/system/model/query/DeptQuery.java # continew-admin-system/src/main/java/top/charles7c/cnadmin/system/model/query/MenuQuery.java # continew-admin-system/src/main/java/top/charles7c/cnadmin/system/model/query/RoleQuery.java # continew-admin-system/src/main/java/top/charles7c/cnadmin/system/model/query/UserQuery.java
This commit is contained in:
@@ -75,7 +75,7 @@ public abstract class BaseController<S extends BaseService<V, D, Q, C>, V, D, Q,
|
||||
@Operation(summary = "分页查询列表")
|
||||
@ResponseBody
|
||||
@GetMapping
|
||||
public R<PageDataVO<V>> page(@Validated Q query, @Validated PageQuery pageQuery) {
|
||||
public R<PageDataVO<V>> page(Q query, @Validated PageQuery pageQuery) {
|
||||
this.checkPermission("list");
|
||||
PageDataVO<V> pageDataVO = baseService.page(query, pageQuery);
|
||||
return R.ok(pageDataVO);
|
||||
@@ -93,7 +93,7 @@ public abstract class BaseController<S extends BaseService<V, D, Q, C>, V, D, Q,
|
||||
@Operation(summary = "查询树列表")
|
||||
@ResponseBody
|
||||
@GetMapping("/tree")
|
||||
public R<List<Tree<Long>>> tree(@Validated Q query, @Validated SortQuery sortQuery) {
|
||||
public R<List<Tree<Long>>> tree(Q query, SortQuery sortQuery) {
|
||||
this.checkPermission("list");
|
||||
List<Tree<Long>> list = baseService.tree(query, sortQuery, false);
|
||||
return R.ok(list);
|
||||
@@ -111,7 +111,7 @@ public abstract class BaseController<S extends BaseService<V, D, Q, C>, V, D, Q,
|
||||
@Operation(summary = "查询列表")
|
||||
@ResponseBody
|
||||
@GetMapping("/list")
|
||||
public R<List<V>> list(@Validated Q query, @Validated SortQuery sortQuery) {
|
||||
public R<List<V>> list(Q query, SortQuery sortQuery) {
|
||||
this.checkPermission("list");
|
||||
List<V> list = baseService.list(query, sortQuery);
|
||||
return R.ok(list);
|
||||
@@ -197,7 +197,7 @@ public abstract class BaseController<S extends BaseService<V, D, Q, C>, V, D, Q,
|
||||
*/
|
||||
@Operation(summary = "导出数据")
|
||||
@GetMapping("/export")
|
||||
public void export(@Validated Q query, @Validated SortQuery sortQuery, HttpServletResponse response) {
|
||||
public void export(Q query, SortQuery sortQuery, HttpServletResponse response) {
|
||||
this.checkPermission("export");
|
||||
baseService.export(query, sortQuery, response);
|
||||
}
|
||||
|
@@ -32,7 +32,10 @@ import top.charles7c.cnadmin.common.model.dto.LoginUser;
|
||||
import top.charles7c.cnadmin.common.model.dto.RoleDTO;
|
||||
import top.charles7c.cnadmin.common.util.helper.LoginHelper;
|
||||
|
||||
import net.sf.jsqlparser.expression.*;
|
||||
import net.sf.jsqlparser.expression.Expression;
|
||||
import net.sf.jsqlparser.expression.Function;
|
||||
import net.sf.jsqlparser.expression.LongValue;
|
||||
import net.sf.jsqlparser.expression.Parenthesis;
|
||||
import net.sf.jsqlparser.expression.operators.conditional.AndExpression;
|
||||
import net.sf.jsqlparser.expression.operators.conditional.OrExpression;
|
||||
import net.sf.jsqlparser.expression.operators.relational.EqualsTo;
|
||||
@@ -45,7 +48,7 @@ import net.sf.jsqlparser.statement.select.SelectExpressionItem;
|
||||
import net.sf.jsqlparser.statement.select.SubSelect;
|
||||
|
||||
/**
|
||||
* 数据权限处理器实现类
|
||||
* 数据权限处理器实现
|
||||
* <p>
|
||||
* 来源:<a href="https://gitee.com/baomidou/mybatis-plus/issues/I37I90">DataPermissionInterceptor 如何使用?</a>
|
||||
* </p>
|
||||
|
@@ -50,30 +50,24 @@ public class PageQuery extends SortQuery {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
/** 默认页码:1 */
|
||||
private static final int DEFAULT_PAGE = 1;
|
||||
/** 默认每页条数:10 */
|
||||
private static final int DEFAULT_SIZE = 10;
|
||||
|
||||
/**
|
||||
* 页码
|
||||
*/
|
||||
@Schema(description = "页码")
|
||||
@Min(value = 1, message = "页码最小值为 {value}")
|
||||
private Integer page;
|
||||
private Integer page = DEFAULT_PAGE;
|
||||
|
||||
/**
|
||||
* 每页条数
|
||||
*/
|
||||
@Schema(description = "每页条数")
|
||||
@Range(min = 1, max = 1000, message = "每页条数(取值范围 {min}-{max})")
|
||||
private Integer size;
|
||||
|
||||
/** 默认页码:1 */
|
||||
private static final int DEFAULT_PAGE = 1;
|
||||
/** 默认每页条数:10 */
|
||||
private static final int DEFAULT_SIZE = 10;
|
||||
|
||||
public PageQuery(Integer page, Integer size) {
|
||||
this.setPage(page);
|
||||
this.setSize(size);
|
||||
}
|
||||
private Integer size = DEFAULT_SIZE;
|
||||
|
||||
/**
|
||||
* 基于分页查询条件转换为 MyBatis Plus 分页条件
|
||||
@@ -95,12 +89,4 @@ public class PageQuery extends SortQuery {
|
||||
}
|
||||
return mybatisPage;
|
||||
}
|
||||
|
||||
public void setPage(Integer page) {
|
||||
this.page = page == null ? DEFAULT_PAGE : page;
|
||||
}
|
||||
|
||||
public void setSize(Integer size) {
|
||||
this.size = size == null ? DEFAULT_SIZE : size;
|
||||
}
|
||||
}
|
||||
|
@@ -16,7 +16,6 @@
|
||||
|
||||
package top.charles7c.cnadmin.common.model.query;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -25,7 +24,6 @@ import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.data.domain.Sort;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
@@ -40,11 +38,9 @@ import top.charles7c.cnadmin.common.constant.StringConsts;
|
||||
* @since 2023/2/12 21:30
|
||||
*/
|
||||
@Data
|
||||
@ParameterObject
|
||||
@Schema(description = "排序查询条件")
|
||||
public class SortQuery implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user