refactor(framework): 优化Bean拷贝工具类并更新相关实体类结构
This commit is contained in:
+4
-5
@@ -13,10 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.framework.mybatisplus.core;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.odboy.util.KitBeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -42,7 +41,7 @@ public class KitMpAnyQUtil {
|
||||
if (mapperTarget == null) {
|
||||
return null;
|
||||
}
|
||||
return BeanUtil.copyProperties(mapperTarget, mapperClazz);
|
||||
return KitBeanUtil.copyToClass(mapperTarget, mapperClazz);
|
||||
}
|
||||
|
||||
public static <T> List<T> selectList(BaseMapper<T> baseMapper, Object queryParams) {
|
||||
@@ -56,7 +55,7 @@ public class KitMpAnyQUtil {
|
||||
if (mapperTarget == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return BeanUtil.copyToList(mapperTarget, mapperClazz);
|
||||
return KitBeanUtil.copyToList(mapperTarget, mapperClazz);
|
||||
}
|
||||
|
||||
public static <T> Long selectCount(BaseMapper<T> baseMapper, Object queryParams) {
|
||||
@@ -74,7 +73,7 @@ public class KitMpAnyQUtil {
|
||||
QueryWrapper<T> queryWrapper = KitMpQUtil.build(queryParams);
|
||||
Page<T> tPage = baseMapper.selectPage(page, queryWrapper);
|
||||
Page<M> mapperTarget = new Page<>();
|
||||
mapperTarget.setRecords(BeanUtil.copyToList(tPage.getRecords(), mapperClazz));
|
||||
mapperTarget.setRecords(KitBeanUtil.copyToList(tPage.getRecords(), mapperClazz));
|
||||
mapperTarget.setTotal(tPage.getTotal());
|
||||
mapperTarget.setSize(tPage.getSize());
|
||||
mapperTarget.setCurrent(tPage.getCurrent());
|
||||
|
||||
-1
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.framework.mybatisplus.core;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
+47
-20
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.framework.mybatisplus.core;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
@@ -27,14 +26,15 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
@@ -84,21 +84,47 @@ public class KitMpQUtil {
|
||||
private static <R> void handleWrapper(KitMpQuery q, QueryWrapper<R> queryWrapper, String attributeName,
|
||||
Object fieldVal) {
|
||||
switch (q.type()) {
|
||||
case EQUAL -> queryWrapper.eq(attributeName, fieldVal);
|
||||
case GREATER_THAN -> queryWrapper.ge(attributeName, fieldVal);
|
||||
case LESS_THAN -> queryWrapper.le(attributeName, fieldVal);
|
||||
case LESS_THAN_NQ -> queryWrapper.lt(attributeName, fieldVal);
|
||||
case INNER_LIKE -> queryWrapper.like(attributeName, fieldVal);
|
||||
case LEFT_LIKE -> queryWrapper.likeLeft(attributeName, fieldVal);
|
||||
case RIGHT_LIKE -> queryWrapper.likeRight(attributeName, fieldVal);
|
||||
case IN -> handleInOrNotQuery(true, queryWrapper, attributeName, fieldVal);
|
||||
case NOT_IN -> handleInOrNotQuery(false, queryWrapper, attributeName, fieldVal);
|
||||
case NOT_EQUAL -> queryWrapper.ne(attributeName, fieldVal);
|
||||
case NOT_NULL -> queryWrapper.isNotNull(attributeName);
|
||||
case IS_NULL -> queryWrapper.isNull(attributeName);
|
||||
case BETWEEN -> handleBetweenQuery(queryWrapper, fieldVal, attributeName);
|
||||
default -> {
|
||||
}
|
||||
case EQUAL:
|
||||
queryWrapper.eq(attributeName, fieldVal);
|
||||
break;
|
||||
case GREATER_THAN:
|
||||
queryWrapper.ge(attributeName, fieldVal);
|
||||
break;
|
||||
case LESS_THAN:
|
||||
queryWrapper.le(attributeName, fieldVal);
|
||||
break;
|
||||
case LESS_THAN_NQ:
|
||||
queryWrapper.lt(attributeName, fieldVal);
|
||||
break;
|
||||
case INNER_LIKE:
|
||||
queryWrapper.like(attributeName, fieldVal);
|
||||
break;
|
||||
case LEFT_LIKE:
|
||||
queryWrapper.likeLeft(attributeName, fieldVal);
|
||||
break;
|
||||
case RIGHT_LIKE:
|
||||
queryWrapper.likeRight(attributeName, fieldVal);
|
||||
break;
|
||||
case IN:
|
||||
handleInOrNotQuery(true, queryWrapper, attributeName, fieldVal);
|
||||
break;
|
||||
case NOT_IN:
|
||||
handleInOrNotQuery(false, queryWrapper, attributeName, fieldVal);
|
||||
break;
|
||||
case NOT_EQUAL:
|
||||
queryWrapper.ne(attributeName, fieldVal);
|
||||
break;
|
||||
case NOT_NULL:
|
||||
queryWrapper.isNotNull(attributeName);
|
||||
break;
|
||||
case IS_NULL:
|
||||
queryWrapper.isNull(attributeName);
|
||||
break;
|
||||
case BETWEEN:
|
||||
handleBetweenQuery(queryWrapper, fieldVal, attributeName);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +178,8 @@ public class KitMpQUtil {
|
||||
* @param <R> /
|
||||
*/
|
||||
private static <R> void handleBlurryQuery(QueryWrapper<R> queryWrapper, String blurry, Object fieldVal) {
|
||||
List<String> blurryList = Arrays.stream(blurry.split(",")).filter(StrUtil::isNotBlank).distinct().toList();
|
||||
List<String> blurryList =
|
||||
Arrays.stream(blurry.split(",")).filter(StrUtil::isNotBlank).distinct().collect(Collectors.toList());
|
||||
queryWrapper.and(wrapper -> {
|
||||
for (String blurryItem : blurryList) {
|
||||
String column = StrUtil.toUnderlineCase(blurryItem);
|
||||
@@ -171,7 +198,7 @@ public class KitMpQUtil {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
QueryWrapper<TestDomain> query = new QueryWrapper<>();
|
||||
QueryWrapper<TestDomain> query = new QueryWrapper<TestDomain>();
|
||||
query.or(wrapper -> wrapper.eq("username", 1).or().eq("nickname", 2));
|
||||
query.eq("id", 1);
|
||||
query.orderByDesc("id");
|
||||
|
||||
+6
-7
@@ -13,13 +13,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.framework.mybatisplus.core.interfaces;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.util.KitBeanUtil;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
@@ -111,7 +110,7 @@ public interface KitMpMapper<E> extends BaseMapper<E> {
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return BeanUtil.copyToList(list, clazz);
|
||||
return KitBeanUtil.copyToList(list, clazz);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,7 +125,7 @@ public interface KitMpMapper<E> extends BaseMapper<E> {
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return BeanUtil.copyToList(list, clazz);
|
||||
return KitBeanUtil.copyToList(list, clazz);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -147,7 +146,7 @@ public interface KitMpMapper<E> extends BaseMapper<E> {
|
||||
if (CollUtil.isEmpty(pageInfo.getRecords())) {
|
||||
return new KitPageResult<>(new ArrayList<>(), pageInfo.getTotal());
|
||||
}
|
||||
return new KitPageResult<>(BeanUtil.copyToList(pageInfo.getRecords(), clazz), pageInfo.getTotal());
|
||||
return new KitPageResult<>(KitBeanUtil.copyToList(pageInfo.getRecords(), clazz), pageInfo.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -168,7 +167,7 @@ public interface KitMpMapper<E> extends BaseMapper<E> {
|
||||
if (CollUtil.isEmpty(pageInfo.getRecords())) {
|
||||
return KitPageUtil.emptyListData();
|
||||
}
|
||||
return new KitPageResult<>(BeanUtil.copyToList(pageInfo.getRecords(), clazz), pageInfo.getTotal());
|
||||
return new KitPageResult<>(KitBeanUtil.copyToList(pageInfo.getRecords(), clazz), pageInfo.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -183,6 +182,6 @@ public interface KitMpMapper<E> extends BaseMapper<E> {
|
||||
if (e == null) {
|
||||
return null;
|
||||
}
|
||||
return BeanUtil.copyProperties(e, clazz);
|
||||
return KitBeanUtil.copyToClass(e, clazz);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-5
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.framework.mybatisplus.core.interfaces;
|
||||
|
||||
import cn.odboy.base.KitPageResult;
|
||||
@@ -49,11 +48,11 @@ public interface KitMpService<T> extends IService<T> {
|
||||
|
||||
<G> List<G> queryFeatureClazzListByIds(List<Serializable> ids, Class<G> targetClazz);
|
||||
|
||||
<Q> List<T> queryClazzListByArgs(Q criteria);
|
||||
<Q> List<T> queryClazzListByArgs(Q args);
|
||||
|
||||
List<T> queryClazzListByArgs(LambdaQueryWrapper<T> wrapper);
|
||||
|
||||
<G, Q> List<G> queryFeatureClazzListByArgs(Q criteria, Class<G> targetClazz);
|
||||
<G, Q> List<G> queryFeatureClazzListByArgs(Q args, Class<G> targetClazz);
|
||||
|
||||
<G> List<G> queryFeatureClazzListByArgs(LambdaQueryWrapper<T> wrapper, Class<G> targetClazz);
|
||||
|
||||
@@ -62,9 +61,9 @@ public interface KitMpService<T> extends IService<T> {
|
||||
<G> KitPageResult<G> queryFeatureClazzPageByArgs(LambdaQueryWrapper<T> wrapper, IPage<T> pageable,
|
||||
Class<G> targetClazz);
|
||||
|
||||
<G, Q> KitPageResult<G> queryFeatureClazzPageByArgs(Q criteria, IPage<T> pageable, Class<G> targetClazz);
|
||||
<G, Q> KitPageResult<G> queryFeatureClazzPageByArgs(Q args, IPage<T> pageable, Class<G> targetClazz);
|
||||
|
||||
<Q> KitPageResult<T> queryClazzPageByArgs(Q criteria, IPage<T> pageable);
|
||||
<Q> KitPageResult<T> queryClazzPageByArgs(Q args, IPage<T> pageable);
|
||||
|
||||
int modifyClazzByArgs(LambdaQueryWrapper<T> wrapper, T entity);
|
||||
|
||||
|
||||
+22
-24
@@ -13,14 +13,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.framework.mybatisplus.core.interfaces;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.framework.mybatisplus.core.KitMpQUtil;
|
||||
import cn.odboy.util.KitBeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.enums.SqlMethod;
|
||||
@@ -46,7 +45,7 @@ public class KitMpServiceImpl<M extends KitMpMapper<T>, T> extends ServiceImpl<M
|
||||
* @param resources /
|
||||
*/
|
||||
public <G> int saveFeatureClazz(G resources) {
|
||||
return getBaseMapper().insert(BeanUtil.copyProperties(resources, this.getEntityClass()));
|
||||
return getBaseMapper().insert(KitBeanUtil.copyToClass(resources, this.getEntityClass()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,7 +54,7 @@ public class KitMpServiceImpl<M extends KitMpMapper<T>, T> extends ServiceImpl<M
|
||||
* @param resources /
|
||||
*/
|
||||
public <G> int saveFeatureClazzList(List<G> resources) {
|
||||
return getBaseMapper().insertBatchSomeColumn(BeanUtil.copyToList(resources, this.getEntityClass()));
|
||||
return getBaseMapper().insertBatchSomeColumn(KitBeanUtil.copyToList(resources, this.getEntityClass()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,7 +63,7 @@ public class KitMpServiceImpl<M extends KitMpMapper<T>, T> extends ServiceImpl<M
|
||||
* @param resources /
|
||||
*/
|
||||
public <G> int modifyFeatureClazzById(G resources) {
|
||||
return getBaseMapper().updateById(BeanUtil.copyProperties(resources, this.getEntityClass()));
|
||||
return getBaseMapper().updateById(KitBeanUtil.copyToClass(resources, this.getEntityClass()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,7 +76,7 @@ public class KitMpServiceImpl<M extends KitMpMapper<T>, T> extends ServiceImpl<M
|
||||
String sqlStatement = this.getSqlStatement(SqlMethod.UPDATE_BY_ID);
|
||||
return this.executeBatch(resources, batchSize, (sqlSession, entity) -> {
|
||||
MapperMethod.ParamMap<T> param = new MapperMethod.ParamMap<>();
|
||||
param.put("et", BeanUtil.copyProperties(entity, this.getEntityClass()));
|
||||
param.put("et", KitBeanUtil.copyToClass(entity, this.getEntityClass()));
|
||||
sqlSession.update(sqlStatement, param);
|
||||
});
|
||||
}
|
||||
@@ -90,7 +89,7 @@ public class KitMpServiceImpl<M extends KitMpMapper<T>, T> extends ServiceImpl<M
|
||||
*/
|
||||
public <G> G queryFeatureClazzById(Serializable id, Class<G> targetClazz) {
|
||||
T entity = this.getById(id);
|
||||
return entity == null ? null : BeanUtil.copyProperties(entity, targetClazz);
|
||||
return entity == null ? null : KitBeanUtil.copyToClass(entity, targetClazz);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,7 +126,7 @@ public class KitMpServiceImpl<M extends KitMpMapper<T>, T> extends ServiceImpl<M
|
||||
if (ts.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return BeanUtil.copyProperties(ts.stream().findFirst().get(), clazz);
|
||||
return KitBeanUtil.copyToClass(ts.stream().findFirst().get(), clazz);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -138,17 +137,16 @@ public class KitMpServiceImpl<M extends KitMpMapper<T>, T> extends ServiceImpl<M
|
||||
*/
|
||||
public <G> List<G> queryFeatureClazzListByIds(List<Serializable> ids, Class<G> targetClazz) {
|
||||
List<T> entitys = this.listByIds(ids);
|
||||
return entitys == null || entitys.isEmpty() ? CollUtil.newArrayList()
|
||||
: BeanUtil.copyToList(entitys, targetClazz);
|
||||
return entitys == null || entitys.isEmpty() ? CollUtil.newArrayList() : KitBeanUtil.copyToList(entitys, targetClazz);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查有关的数据
|
||||
*
|
||||
* @param criteria 动态条件
|
||||
* @param args 动态条件
|
||||
*/
|
||||
public <Q> List<T> queryClazzListByArgs(Q criteria) {
|
||||
QueryWrapper<T> predicate = KitMpQUtil.build(criteria);
|
||||
public <Q> List<T> queryClazzListByArgs(Q args) {
|
||||
QueryWrapper<T> predicate = KitMpQUtil.build(args);
|
||||
return baseMapper.selectList(predicate);
|
||||
}
|
||||
|
||||
@@ -167,13 +165,13 @@ public class KitMpServiceImpl<M extends KitMpMapper<T>, T> extends ServiceImpl<M
|
||||
/**
|
||||
* 查有关的数据并转成目标类型的数据
|
||||
*
|
||||
* @param criteria 动态条件
|
||||
* @param args 动态条件
|
||||
* @param targetClazz 目标类型
|
||||
*/
|
||||
public <G, Q> List<G> queryFeatureClazzListByArgs(Q criteria, Class<G> targetClazz) {
|
||||
QueryWrapper<T> predicate = KitMpQUtil.build(criteria);
|
||||
public <G, Q> List<G> queryFeatureClazzListByArgs(Q args, Class<G> targetClazz) {
|
||||
QueryWrapper<T> predicate = KitMpQUtil.build(args);
|
||||
List<T> data = baseMapper.selectList(predicate);
|
||||
return BeanUtil.copyToList(data, targetClazz);
|
||||
return KitBeanUtil.copyToList(data, targetClazz);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -186,7 +184,7 @@ public class KitMpServiceImpl<M extends KitMpMapper<T>, T> extends ServiceImpl<M
|
||||
if (wrapper == null) {
|
||||
wrapper = new LambdaQueryWrapper<>();
|
||||
}
|
||||
return BeanUtil.copyToList(baseMapper.selectList(wrapper), targetClazz);
|
||||
return KitBeanUtil.copyToList(baseMapper.selectList(wrapper), targetClazz);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -216,19 +214,19 @@ public class KitMpServiceImpl<M extends KitMpMapper<T>, T> extends ServiceImpl<M
|
||||
wrapper = new LambdaQueryWrapper<>();
|
||||
}
|
||||
IPage<T> originPageData = baseMapper.selectPage(pageable, wrapper);
|
||||
return new KitPageResult<>(BeanUtil.copyToList(originPageData.getRecords(), targetClazz),
|
||||
return new KitPageResult<>(KitBeanUtil.copyToList(originPageData.getRecords(), targetClazz),
|
||||
originPageData.getTotal());
|
||||
}
|
||||
|
||||
public <G, Q> KitPageResult<G> queryFeatureClazzPageByArgs(Q criteria, IPage<T> pageable, Class<G> targetClazz) {
|
||||
QueryWrapper<T> wrapper = KitMpQUtil.build(criteria);
|
||||
public <G, Q> KitPageResult<G> queryFeatureClazzPageByArgs(Q args, IPage<T> pageable, Class<G> targetClazz) {
|
||||
QueryWrapper<T> wrapper = KitMpQUtil.build(args);
|
||||
IPage<T> originPageData = baseMapper.selectPage(pageable, wrapper);
|
||||
return new KitPageResult<>(BeanUtil.copyToList(originPageData.getRecords(), targetClazz),
|
||||
return new KitPageResult<>(KitBeanUtil.copyToList(originPageData.getRecords(), targetClazz),
|
||||
originPageData.getTotal());
|
||||
}
|
||||
|
||||
public <Q> KitPageResult<T> queryClazzPageByArgs(Q criteria, IPage<T> pageable) {
|
||||
QueryWrapper<T> wrapper = KitMpQUtil.build(criteria);
|
||||
public <Q> KitPageResult<T> queryClazzPageByArgs(Q args, IPage<T> pageable) {
|
||||
QueryWrapper<T> wrapper = KitMpQUtil.build(args);
|
||||
IPage<T> originPageData = baseMapper.selectPage(pageable, wrapper);
|
||||
return new KitPageResult<>(originPageData.getRecords(), originPageData.getTotal());
|
||||
}
|
||||
|
||||
+23
-13
@@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2021-2025 Odboy
|
||||
*
|
||||
@@ -14,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import cn.odboy.annotation.AnonymousAccess;
|
||||
@@ -30,7 +28,7 @@ import lombok.experimental.UtilityClass;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.mvc.condition.PathPatternsRequestCondition;
|
||||
import org.springframework.web.servlet.mvc.condition.PatternsRequestCondition;
|
||||
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
||||
|
||||
@@ -48,9 +46,9 @@ public class KitAnonTagUtil {
|
||||
*/
|
||||
public static Map<String, Set<String>> getAnonymousUrl(final ApplicationContext applicationContext) {
|
||||
RequestMappingHandlerMapping requestMappingHandlerMapping =
|
||||
applicationContext.getBean(RequestMappingHandlerMapping.class);
|
||||
(RequestMappingHandlerMapping) applicationContext.getBean("requestMappingHandlerMapping");
|
||||
Map<RequestMappingInfo, HandlerMethod> handlerMethodMap = requestMappingHandlerMapping.getHandlerMethods();
|
||||
Map<String, java.util.Set<String>> anonymousUrls = new HashMap<>(8);
|
||||
Map<String, Set<String>> anonymousUrls = new HashMap<>(8);
|
||||
// 获取匿名标记
|
||||
Set<String> get = new HashSet<>();
|
||||
Set<String> post = new HashSet<>();
|
||||
@@ -66,15 +64,27 @@ public class KitAnonTagUtil {
|
||||
new ArrayList<>(infoEntry.getKey().getMethodsCondition().getMethods());
|
||||
RequestMethodEnum request = RequestMethodEnum.find(
|
||||
requestMethods.isEmpty() ? RequestMethodEnum.ALL.getType() : requestMethods.get(0).name());
|
||||
PathPatternsRequestCondition pathPatternsCondition = infoEntry.getKey().getPathPatternsCondition();
|
||||
if (pathPatternsCondition != null) {
|
||||
PatternsRequestCondition patternsCondition = infoEntry.getKey().getPatternsCondition();
|
||||
if (patternsCondition != null) {
|
||||
switch (Objects.requireNonNull(request)) {
|
||||
case GET -> get.addAll(pathPatternsCondition.getPatternValues());
|
||||
case POST -> post.addAll(pathPatternsCondition.getPatternValues());
|
||||
case PUT -> put.addAll(pathPatternsCondition.getPatternValues());
|
||||
case PATCH -> patch.addAll(pathPatternsCondition.getPatternValues());
|
||||
case DELETE -> delete.addAll(pathPatternsCondition.getPatternValues());
|
||||
default -> all.addAll(pathPatternsCondition.getPatternValues());
|
||||
case GET:
|
||||
get.addAll(patternsCondition.getPatterns());
|
||||
break;
|
||||
case POST:
|
||||
post.addAll(patternsCondition.getPatterns());
|
||||
break;
|
||||
case PUT:
|
||||
put.addAll(patternsCondition.getPatterns());
|
||||
break;
|
||||
case PATCH:
|
||||
patch.addAll(patternsCondition.getPatterns());
|
||||
break;
|
||||
case DELETE:
|
||||
delete.addAll(patternsCondition.getPatterns());
|
||||
break;
|
||||
default:
|
||||
all.addAll(patternsCondition.getPatterns());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import cn.hutool.core.codec.Base64Encoder;
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package cn.odboy.util;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
/**
|
||||
* Bean拷贝相关
|
||||
*
|
||||
* @author odboy
|
||||
* @date 2026-01-06
|
||||
*/
|
||||
@UtilityClass
|
||||
public class KitBeanUtil {
|
||||
|
||||
public static <T> T copyToClass(Object source, Class<T> tClass) {
|
||||
return BeanUtil.copyProperties(source, tClass);
|
||||
}
|
||||
|
||||
public static void copyToTarget(Object source, Object target) {
|
||||
BeanUtil.copyProperties(source, target, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
||||
public static <T> List<T> copyToList(Collection<?> collection, Class<T> targetType) {
|
||||
List<T> ts = BeanUtil.copyToList(collection, targetType);
|
||||
if (ts == null) {
|
||||
return new ArrayList<>(0);
|
||||
}
|
||||
return ts;
|
||||
}
|
||||
}
|
||||
+8
-13
@@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2021-2025 Odboy
|
||||
*
|
||||
@@ -14,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -34,14 +32,14 @@ public final class KitBigDecimalUtil {
|
||||
* @return 转换后的 BigDecimal
|
||||
*/
|
||||
private static BigDecimal toBigDecimal(Object obj) {
|
||||
if (obj instanceof BigDecimal b) {
|
||||
return b;
|
||||
} else if (obj instanceof Long l) {
|
||||
return BigDecimal.valueOf(l);
|
||||
} else if (obj instanceof Integer i) {
|
||||
return BigDecimal.valueOf(i);
|
||||
} else if (obj instanceof Double d) {
|
||||
return new BigDecimal(d);
|
||||
if (obj instanceof BigDecimal) {
|
||||
return (BigDecimal) obj;
|
||||
} else if (obj instanceof Long) {
|
||||
return BigDecimal.valueOf((Long) obj);
|
||||
} else if (obj instanceof Integer) {
|
||||
return BigDecimal.valueOf((Integer) obj);
|
||||
} else if (obj instanceof Double) {
|
||||
return new BigDecimal(String.valueOf(obj));
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported type");
|
||||
}
|
||||
@@ -138,15 +136,12 @@ public final class KitBigDecimalUtil {
|
||||
public static void main(String[] args) {
|
||||
BigDecimal num1 = new BigDecimal("10.123");
|
||||
BigDecimal num2 = new BigDecimal("2.456");
|
||||
|
||||
System.out.println("加法结果: " + add(num1, num2));
|
||||
System.out.println("减法结果: " + subtract(num1, num2));
|
||||
System.out.println("乘法结果: " + multiply(num1, num2));
|
||||
System.out.println("除法结果: " + divide(num1, num2));
|
||||
|
||||
Long cents = 12345L;
|
||||
System.out.println("分转元结果: " + centsToYuan(cents));
|
||||
|
||||
BigDecimal yuan = new BigDecimal("123.45");
|
||||
System.out.println("元转分结果: " + yuanToCents(yuan));
|
||||
}
|
||||
|
||||
+1
-2
@@ -13,14 +13,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import cn.hutool.http.useragent.UserAgent;
|
||||
import cn.hutool.http.useragent.UserAgentUtil;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2021-2025 Odboy
|
||||
*
|
||||
@@ -14,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2021-2025 Odboy
|
||||
*
|
||||
@@ -14,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import java.io.Closeable;
|
||||
|
||||
+3
-4
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import cn.odboy.base.KitSelectOptionVo;
|
||||
@@ -52,7 +51,7 @@ public final class KitCollUtil extends cn.hutool.core.collection.CollUtil {
|
||||
* 使用方式: list = CollUtil.streamDistinct(list, Object::getXXX)
|
||||
*/
|
||||
public static <T, K> List<T> streamDistinct(List<T> data, Function<? super T, ? extends K> keyMapper) {
|
||||
return data.stream().filter(distinctPredicate(keyMapper)).toList();
|
||||
return data.stream().filter(distinctPredicate(keyMapper)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,7 +67,7 @@ public final class KitCollUtil extends cn.hutool.core.collection.CollUtil {
|
||||
*/
|
||||
public static <T, U extends Comparable<? super U>> List<T> streamAscSort(List<T> data,
|
||||
Function<? super T, ? extends U> keyExtractor) {
|
||||
return data.stream().sorted(Comparator.comparing(keyExtractor)).toList();
|
||||
return data.stream().sorted(Comparator.comparing(keyExtractor)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,7 +83,7 @@ public final class KitCollUtil extends cn.hutool.core.collection.CollUtil {
|
||||
*/
|
||||
public static <T, U extends Comparable<? super U>> List<T> streamDescSort(List<T> data,
|
||||
Function<? super T, ? extends U> keyExtractor) {
|
||||
return data.stream().sorted(Comparator.comparing(keyExtractor).reversed()).toList();
|
||||
return data.stream().sorted(Comparator.comparing(keyExtractor).reversed()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-20
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
@@ -69,32 +68,24 @@ public class KitDateUtil {
|
||||
// 什么都不返回
|
||||
return "";
|
||||
}
|
||||
|
||||
long betweenSeconds = DateUtil.between(startTime, endTime, cn.hutool.core.date.DateUnit.SECOND);
|
||||
|
||||
long days = betweenSeconds / (24 * 60 * 60);
|
||||
long hours = (betweenSeconds % (24 * 60 * 60)) / (60 * 60);
|
||||
long minutes = (betweenSeconds % (60 * 60)) / 60;
|
||||
long seconds = betweenSeconds % 60;
|
||||
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
||||
if (days > 0) {
|
||||
result.append(days).append("天");
|
||||
}
|
||||
|
||||
if (hours > 0) {
|
||||
result.append(hours).append("时");
|
||||
}
|
||||
|
||||
if (minutes > 0) {
|
||||
result.append(minutes).append("分");
|
||||
}
|
||||
|
||||
if (seconds > 0 || result.isEmpty()) {
|
||||
if (seconds > 0 || result.length() == 0) {
|
||||
result.append(seconds).append("秒");
|
||||
}
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
@@ -110,41 +101,32 @@ public class KitDateUtil {
|
||||
// 什么都不返回
|
||||
return "";
|
||||
}
|
||||
|
||||
long betweenMs = DateUtil.betweenMs(startTime, endTime);
|
||||
long days = betweenMs / (24 * 60 * 60 * 1000);
|
||||
long hours = (betweenMs % (24 * 60 * 60 * 1000)) / (60 * 60 * 1000);
|
||||
long minutes = (betweenMs % (60 * 60 * 1000)) / (60 * 1000);
|
||||
long seconds = (betweenMs % (60 * 1000)) / 1000;
|
||||
long milliseconds = betweenMs % 1000;
|
||||
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
||||
if (days > 0) {
|
||||
result.append(days).append("天");
|
||||
}
|
||||
|
||||
if (hours > 0) {
|
||||
result.append(hours).append("时");
|
||||
}
|
||||
|
||||
if (minutes > 0) {
|
||||
result.append(minutes).append("分");
|
||||
}
|
||||
|
||||
if (seconds > 0) {
|
||||
result.append(seconds).append("秒");
|
||||
}
|
||||
|
||||
if (milliseconds > 0) {
|
||||
result.append(milliseconds).append("毫秒");
|
||||
}
|
||||
|
||||
// 如果所有单位都是0,则显示0毫秒
|
||||
if (result.isEmpty()) {
|
||||
if (result.length() == 0) {
|
||||
result.append("0毫秒");
|
||||
}
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
}
|
||||
|
||||
-2
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@@ -93,4 +92,3 @@ public final class KitDesEncryptUtil {
|
||||
return b2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-9
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
@@ -43,7 +42,6 @@ public final class KitDistributedIdUtil {
|
||||
* 序列号所占位数
|
||||
*/
|
||||
private final long sequenceBits;
|
||||
|
||||
/**
|
||||
* 数据中心 ID 最大值
|
||||
*/
|
||||
@@ -56,7 +54,6 @@ public final class KitDistributedIdUtil {
|
||||
* 序列号最大值
|
||||
*/
|
||||
private final long sequenceMask;
|
||||
|
||||
/**
|
||||
* 机器 ID 向左移位数
|
||||
*/
|
||||
@@ -69,7 +66,6 @@ public final class KitDistributedIdUtil {
|
||||
* 时间戳向左移位数
|
||||
*/
|
||||
private final long timestampLeftShift;
|
||||
|
||||
/**
|
||||
* 数据中心 ID
|
||||
*/
|
||||
@@ -101,15 +97,12 @@ public final class KitDistributedIdUtil {
|
||||
this.dataCenterIdBits = dataCenterIdBits;
|
||||
this.workerIdBits = workerIdBits;
|
||||
this.sequenceBits = sequenceBits;
|
||||
|
||||
this.maxDataCenterId = ~(-1L << dataCenterIdBits);
|
||||
this.maxWorkerId = ~(-1L << workerIdBits);
|
||||
this.sequenceMask = ~(-1L << sequenceBits);
|
||||
|
||||
this.workerIdShift = sequenceBits;
|
||||
this.dataCenterIdShift = sequenceBits + workerIdBits;
|
||||
this.timestampLeftShift = sequenceBits + workerIdBits + dataCenterIdBits;
|
||||
|
||||
if (dataCenterId > maxDataCenterId || dataCenterId < 0) {
|
||||
throw new IllegalArgumentException(
|
||||
"Data center ID can't be greater than " + maxDataCenterId + " or less than 0");
|
||||
@@ -153,14 +146,12 @@ public final class KitDistributedIdUtil {
|
||||
*/
|
||||
public long nextId() {
|
||||
long currentTimestamp = System.currentTimeMillis();
|
||||
|
||||
// 如果当前时间戳小于上一次生成 ID 的时间戳, 说明时钟回拨,抛出异常
|
||||
if (currentTimestamp < lastTimestamp.get()) {
|
||||
throw new BadRequestException(
|
||||
"Clock moved backwards. Refusing to generate id for " + (lastTimestamp.get() - currentTimestamp) +
|
||||
" milliseconds");
|
||||
}
|
||||
|
||||
long lastTimestampValue = lastTimestamp.get();
|
||||
if (currentTimestamp == lastTimestampValue) {
|
||||
// 同一毫秒内,序列号自增
|
||||
|
||||
+3
-3
@@ -27,9 +27,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;
|
||||
@@ -44,6 +41,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;
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import cn.odboy.framework.context.KitSpringBeanHolder;
|
||||
|
||||
+2
-3
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
@@ -32,12 +31,12 @@ import lombok.experimental.UtilityClass;
|
||||
public final class KitJsonUtil {
|
||||
|
||||
public static <K, V> Map<K, V> toMap(String jsonStr, Class<K> kClass, Class<V> vClass) {
|
||||
return JSON.parseObject(jsonStr, new TypeReference<>() {
|
||||
return JSON.parseObject(jsonStr, new TypeReference<Map<K, V>>() {
|
||||
});
|
||||
}
|
||||
|
||||
public static <V> List<V> toList(String jsonStr, Class<V> vClass) {
|
||||
return JSON.parseObject(jsonStr, new TypeReference<>() {
|
||||
return JSON.parseObject(jsonStr, new TypeReference<List<V>>() {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
@@ -41,7 +40,7 @@ public final class KitListUtil {
|
||||
*/
|
||||
public static <T, K> List<T> distinctByArgs(List<T> items, Function<? super T, ? extends K> classifier) {
|
||||
return items.stream().collect(Collectors.groupingBy(classifier)).values().stream()
|
||||
.map(monitorItem -> monitorItem.iterator().next()).toList();
|
||||
.map(monitorItem -> monitorItem.iterator().next()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import cn.odboy.base.KitPageResult;
|
||||
|
||||
-1
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import cn.hutool.core.lang.Dict;
|
||||
|
||||
-2
@@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2021-2025 Odboy
|
||||
*
|
||||
@@ -14,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
-1
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
-12
@@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2021-2025 Odboy
|
||||
*
|
||||
@@ -14,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import java.util.Calendar;
|
||||
@@ -40,14 +38,11 @@ public final class KitStringUtil {
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
s = s.toLowerCase();
|
||||
|
||||
StringBuilder sb = new StringBuilder(s.length());
|
||||
boolean upperCase = false;
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char c = s.charAt(i);
|
||||
|
||||
if (c == SEPARATOR) {
|
||||
upperCase = true;
|
||||
} else if (upperCase) {
|
||||
@@ -57,7 +52,6 @@ public final class KitStringUtil {
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@@ -83,18 +77,14 @@ public final class KitStringUtil {
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
boolean upperCase = false;
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char c = s.charAt(i);
|
||||
|
||||
boolean nextUpperCase = true;
|
||||
|
||||
if (i < (s.length() - 1)) {
|
||||
nextUpperCase = Character.isUpperCase(s.charAt(i + 1));
|
||||
}
|
||||
|
||||
if ((i > 0) && Character.isUpperCase(c)) {
|
||||
if (!upperCase || !nextUpperCase) {
|
||||
sb.append(SEPARATOR);
|
||||
@@ -103,10 +93,8 @@ public final class KitStringUtil {
|
||||
} else {
|
||||
upperCase = false;
|
||||
}
|
||||
|
||||
sb.append(Character.toLowerCase(c));
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2021-2025 Odboy
|
||||
*
|
||||
@@ -14,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import oshi.SystemInfo;
|
||||
|
||||
+2
-3
@@ -13,17 +13,16 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.Validation;
|
||||
import jakarta.validation.Validator;
|
||||
import jakarta.validation.ValidatorFactory;
|
||||
import jakarta.validation.groups.Default;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -3,12 +3,12 @@ package cn.odboy.util.xlsx;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.idev.excel.EasyExcel;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* EasyExcel 导出增强工具类 (支持普通/分页模式)
|
||||
|
||||
+1
-1
@@ -6,13 +6,13 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.idev.excel.FastExcel;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user