refactor: 根包由 com.bestsch.bschclassmanage 重命名为 com.yunhai.bschclassmanage

- git mv src/main/java/com/bestsch/bschclassmanage -> src/main/java/com/yunhai/bschclassmanage
- 255 个 Java 文件的 package/import 同步替换为 com.yunhai.bschclassmanage
- pom.xml 项目 groupId 设为 com.yunhai(与外部依赖 com.bestsch:bsch-* 无关,未改动)
- IDE 缓存 workspace.xml 路径同步更新(外部依赖坐标 com.bestsch:bsch-* 保持不动)
This commit is contained in:
Allen
2026-08-12 17:21:22 +08:00
parent 66cd0f1515
commit dc217ca7a9
258 changed files with 1082 additions and 1067 deletions
@@ -0,0 +1,70 @@
package com.yunhai.bschclassmanage.controller;
import com.yunhai.bschclassmanage.model.vo.PageVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@Slf4j
public class BaseController {
/**
* 根据请求参数构建PageVO对象,设置当前页和每页大小,并提供默认值。
* @param page 页码字符串(从1开始)
* @param pageSize 每页大小字符串
* @return PageVO对象
*/
protected PageVO getPageVO(String page, String pageSize) {
int defaultPage = 1;
int defaultSize = 10;
int maxSize = 100; // 可配置
int current = defaultPage;
int size = defaultSize;
if (StringUtils.isNumeric(page)) {
try {
current = Integer.parseInt(page);
if (current < 1) {
current = defaultPage;
}
} catch (NumberFormatException ignored) {
// 保持默认
}
}
if (StringUtils.isNumeric(pageSize)) {
try {
size = Integer.parseInt(pageSize);
if (size < 1) {
size = defaultSize;
} else if (size > maxSize) {
size = maxSize;
}
} catch (NumberFormatException ignored) {
// 保持默认
}
}
PageVO pageVO = new PageVO();
pageVO.setCurrent(current);
pageVO.setPageSize(size);
return pageVO;
}
/**
* 安全地将字符串转换为Integer,若转换失败返回null。
* @param str 待转换字符串
* @return Integer值或null
*/
public static Integer getIntByString(String str) {
if (str == null || str.trim().isEmpty() || "null".equalsIgnoreCase(str.trim())) {
return null;
}
try {
return Integer.parseInt(str.trim());
} catch (NumberFormatException e) {
return null; // 静默失败,不抛异常
}
}
}