refactor(system): 重构系统模块的数据查询和分页功能

This commit is contained in:
2026-01-12 15:12:40 +08:00
parent e511ccdd6d
commit ff22d3072c
49 changed files with 102 additions and 211 deletions
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.odboy.annotation;
import java.lang.annotation.Documented;
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.odboy.annotation;
import java.lang.annotation.Documented;
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.odboy.annotation;
import java.lang.annotation.Documented;
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.odboy.annotation;
import java.lang.annotation.Documented;
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.odboy.annotation;
import java.lang.annotation.Documented;
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.odboy.base;
import jakarta.validation.constraints.NotNull;
@@ -13,12 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.odboy.base;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import lombok.EqualsAndHashCode;
import lombok.Getter;
@@ -29,8 +28,7 @@ import lombok.Setter;
@EqualsAndHashCode(callSuper = false)
public class KitBaseCreateTimeTb extends KitObject {
@Schema(name = "创建时间: yyyy-MM-dd HH:mm:ss", hidden = true)
@TableField(fill = FieldFill.INSERT)
private Date
createTime;
@ApiModelProperty(value = "创建时间: yyyy-MM-dd HH:mm:ss", hidden = true)
private Date createTime;
}
@@ -13,12 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.odboy.base;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import lombok.EqualsAndHashCode;
import lombok.Getter;
@@ -30,11 +29,9 @@ import lombok.Setter;
public class KitBaseTimeTb extends KitObject {
@TableField(fill = FieldFill.INSERT)
@Schema(name = "创建时间: yyyy-MM-dd HH:mm:ss", hidden = true)
private Date
createTime;
@ApiModelProperty(value = "创建时间: yyyy-MM-dd HH:mm:ss", hidden = true)
private Date createTime;
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(name = "更新时间: yyyy-MM-dd HH:mm:ss", hidden = true)
@ApiModelProperty(value = "更新时间: yyyy-MM-dd HH:mm:ss", hidden = true)
private Date updateTime;
}
@@ -13,12 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.odboy.base;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import lombok.EqualsAndHashCode;
import lombok.Getter;
@@ -29,7 +28,7 @@ import lombok.Setter;
@EqualsAndHashCode(callSuper = false)
public class KitBaseUpdateTimeTb extends KitObject {
@Schema(name = "更新时间: yyyy-MM-dd HH:mm:ss", hidden = true)
@TableField(fill = FieldFill.INSERT_UPDATE)
@ApiModelProperty(value = "更新时间: yyyy-MM-dd HH:mm:ss", hidden = true)
private Date updateTime;
}
@@ -13,12 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.odboy.base;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.annotations.ApiModelProperty;
import java.lang.reflect.Field;
import java.util.Date;
import lombok.EqualsAndHashCode;
@@ -34,13 +33,12 @@ public class KitBaseUserCreateTimeTb extends KitObject {
@CreatedBy
@TableField(fill = FieldFill.INSERT)
@Schema(name = "创建人", hidden = true)
private String createBy;
@ApiModelProperty(value = "创建人", hidden = true)
private String
createBy;
@TableField(fill = FieldFill.INSERT)
@Schema(name = "创建时间: yyyy-MM-dd HH:mm:ss", hidden = true)
private Date
createTime;
@ApiModelProperty(value = "创建时间: yyyy-MM-dd HH:mm:ss", hidden = true)
private Date createTime;
@Override
public String toString() {
@@ -13,13 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.odboy.base;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import lombok.Getter;
import lombok.Setter;
@@ -38,21 +37,21 @@ public class KitBaseUserTimeLogicTb extends KitObject {
@CreatedBy
@TableField(value = "create_by", fill = FieldFill.INSERT)
@Schema(name = "创建人", hidden = true)
@ApiModelProperty(value = "创建人", hidden = true)
private String createBy;
@LastModifiedBy
@TableField(value = "update_by", fill = FieldFill.INSERT_UPDATE)
@Schema(name = "更新人", hidden = true)
@ApiModelProperty(value = "更新人", hidden = true)
private String updateBy;
@TableField(value = "create_time", fill = FieldFill.INSERT)
@Schema(name = "创建时间", hidden = true)
private Date
createTime;
@ApiModelProperty(value = "创建时间", hidden = true)
private Date createTime;
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
@Schema(name = "更新时间", hidden = true)
@ApiModelProperty(value = "更新时间", hidden = true)
private Date updateTime;
@Schema(name = "数据有效性", hidden = true)
@ApiModelProperty(value = "数据有效性", hidden = true)
@TableLogic
@TableField("available")
private Integer available;
private Integer
available;
}
@@ -13,12 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.odboy.base;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.annotations.ApiModelProperty;
import java.lang.reflect.Field;
import java.util.Date;
import lombok.EqualsAndHashCode;
@@ -35,22 +34,18 @@ public class KitBaseUserTimeTb extends KitObject {
@CreatedBy
@TableField(fill = FieldFill.INSERT)
@Schema(name = "创建人", hidden = true)
private String createBy;
@ApiModelProperty(value = "创建人", hidden = true)
private String
createBy;
@LastModifiedBy
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(name = "更新人", hidden = true)
private String
updateBy;
@ApiModelProperty(value = "更新人", hidden = true)
private String updateBy;
@TableField(fill = FieldFill.INSERT)
@Schema(name = "创建时间: yyyy-MM-dd HH:mm:ss", hidden = true)
private Date
createTime;
@ApiModelProperty(value = "创建时间: yyyy-MM-dd HH:mm:ss", hidden = true)
private Date createTime;
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(name = "更新时间: yyyy-MM-dd HH:mm:ss", hidden = true)
@ApiModelProperty(value = "更新时间: yyyy-MM-dd HH:mm:ss", hidden = true)
private Date updateTime;
@Override
@@ -13,10 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.odboy.base;
import java.io.Serial;
import java.io.Serializable;
/**
@@ -27,6 +25,5 @@ import java.io.Serializable;
*/
public class KitObject implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
}
@@ -13,13 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.odboy.base;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -37,11 +36,11 @@ public class KitPageArgs<T> implements Serializable {
@NotNull(message = "参数page不能为空")
@Min(value = 1, message = "参数page最小值为1")
@Schema(name = "页码", example = "1")
@ApiModelProperty(value = "页码", example = "1")
private Integer page;
@NotNull(message = "参数size不能为空")
@Min(value = 1, message = "参数size最小值为1")
@Schema(name = "每页数据量", example = "10")
@ApiModelProperty(value = "每页数据量", example = "10")
private Integer size;
private T args;
}
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.odboy.base;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.odboy.base;
import java.util.Map;
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.odboy.constant;
/**
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.odboy.constant;
import lombok.AllArgsConstructor;
@@ -24,7 +23,6 @@ import lombok.Getter;
public enum FileTypeEnum {
/* 文件类型 */
IMAGE("image", "图片"), DOC("doc", "文档"), VOICE("voice", "音频"), VIDEO("video", "视频"), OTHER("other", "其他");
private final String code;
private final String description;
}
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.odboy.constant;
import lombok.AllArgsConstructor;
@@ -22,37 +21,30 @@ import lombok.Getter;
@Getter
@AllArgsConstructor
public enum RequestMethodEnum {
/**
* 搜寻 @AnonymousGetMapping
*/
GET("GET"),
/**
* 搜寻 @AnonymousPostMapping
*/
POST("POST"),
/**
* 搜寻 @AnonymousPutMapping
*/
PUT("PUT"),
/**
* 搜寻 @AnonymousPatchMapping
*/
PATCH("PATCH"),
/**
* 搜寻 @AnonymousDeleteMapping
*/
DELETE("DELETE"),
/**
* 否则就是所有 Request 接口都放行
*/
ALL("All");
/**
* Request 类型
*/
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.odboy.constant;
/**
@@ -25,22 +24,18 @@ public interface SystemConst {
* win 系统
*/
String WIN = "win";
/**
* mac 系统
*/
String MAC = "mac";
/**
* 请求头名称
*/
String HEADER_NAME = "Authorization";
/**
* Token前缀
*/
String TOKEN_PREFIX = "Bearer";
/**
* 小数点
*/
@@ -48,7 +48,7 @@ public class KitAnonTagUtil {
RequestMappingHandlerMapping requestMappingHandlerMapping =
(RequestMappingHandlerMapping) applicationContext.getBean("requestMappingHandlerMapping");
Map<RequestMappingInfo, HandlerMethod> handlerMethodMap = requestMappingHandlerMapping.getHandlerMethods();
Map<String, Set<String>> anonymousUrls = new HashMap<>(8);
Map<String, java.util.Set<String>> anonymousUrls = new HashMap<>(8);
// 获取匿名标记
Set<String> get = new HashSet<>();
Set<String> post = new HashSet<>();
@@ -17,6 +17,7 @@ package cn.odboy.util;
import cn.hutool.core.collection.CollUtil;
import cn.odboy.base.KitSelectOptionVo;
import cn.odboy.framework.exception.BadRequestException;
import com.alibaba.fastjson2.JSON;
import java.lang.reflect.Field;
import java.math.BigDecimal;
@@ -39,7 +40,7 @@ import lombok.experimental.UtilityClass;
* @date 2022-11-09
*/
@UtilityClass
public final class KitCollUtil extends CollUtil {
public final class KitCollUtil extends cn.hutool.core.collection.CollUtil {
private static <T, K> Predicate<T> distinctPredicate(Function<? super T, ? extends K> keyMapper) {
Map<Object, Boolean> map = new HashMap<>(3);
@@ -28,9 +28,6 @@ import cn.hutool.poi.excel.ExcelUtil;
import cn.odboy.constant.FileTypeEnum;
import cn.odboy.constant.SystemConst;
import cn.odboy.framework.exception.BadRequestException;
import jakarta.servlet.ServletOutputStream;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -45,6 +42,9 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import jakarta.servlet.ServletOutputStream;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.experimental.UtilityClass;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.util.IOUtils;