diff --git a/cutejava-front/src/views/system/quartzJob/index.vue b/cutejava-front/src/views/system/quartzJob/index.vue index 5881f689..6c38fdbc 100644 --- a/cutejava-front/src/views/system/quartzJob/index.vue +++ b/cutejava-front/src/views/system/quartzJob/index.vue @@ -28,6 +28,7 @@ >日志 + Cron在线表达式生成 diff --git a/cutejava-front/src/views/system/user/center.vue b/cutejava-front/src/views/system/user/center.vue index 417f2d6e..dabee521 100644 --- a/cutejava-front/src/views/system/user/center.vue +++ b/cutejava-front/src/views/system/user/center.vue @@ -104,9 +104,9 @@ %s;", RED, now, RESET, GREEN, Thread.currentThread().getName(), BLUE, elapsed, RESET, sql); } -} \ No newline at end of file +} diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/config/MpInsertBatchSqlInjector.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/config/MpInsertBatchSqlInjector.java index 504d8629..3c5fe44d 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/config/MpInsertBatchSqlInjector.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/config/MpInsertBatchSqlInjector.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,4 +42,4 @@ public class MpInsertBatchSqlInjector extends DefaultSqlInjector { methodList.add(new AlwaysUpdateSomeColumnById(i -> i.getFieldFill() != FieldFill.INSERT)); return methodList; } -} \ No newline at end of file +} diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/config/MybatisPlusConfig.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/config/MybatisPlusConfig.java index 812875dd..8a43e558 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/config/MybatisPlusConfig.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/config/MybatisPlusConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/config/RemoveDruidAdConfig.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/config/RemoveDruidAdConfig.java index 92275c9f..70d57d88 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/config/RemoveDruidAdConfig.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/config/RemoveDruidAdConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/KitMpAnyQUtil.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/KitMpAnyQUtil.java index efa02dd6..1c2cd08b 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/KitMpAnyQUtil.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/KitMpAnyQUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/KitMpCmdGenUtil.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/KitMpCmdGenUtil.java index c24f1b46..3e219e93 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/KitMpCmdGenUtil.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/KitMpCmdGenUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -210,4 +210,4 @@ public class KitMpCmdGenUtil { .serviceImpl("service.impl").controller("controller") .pathInfo(Collections.singletonMap(OutputFile.xml, mapperPath)); } -} \ No newline at end of file +} diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/KitMpQUtil.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/KitMpQUtil.java index c97387b4..125f8312 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/KitMpQUtil.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/KitMpQUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ */ package cn.odboy.framework.mybatisplus.core; -import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.odboy.base.KitBaseUserTimeTb; @@ -26,6 +26,8 @@ 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; @@ -33,8 +35,7 @@ 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.Data; import lombok.extern.slf4j.Slf4j; /** @@ -131,7 +132,7 @@ public class KitMpQUtil { private static void handleInOrNotQuery(boolean b, QueryWrapper queryWrapper, String attributeName, Object fieldVal) { Collection wrapNotInVal = (Collection) fieldVal; - if (CollectionUtil.isNotEmpty(wrapNotInVal)) { + if (CollUtil.isNotEmpty(wrapNotInVal)) { Optional anyValOptional = wrapNotInVal.stream().findAny(); if (anyValOptional.isPresent()) { Object o = anyValOptional.get(); @@ -159,7 +160,7 @@ public class KitMpQUtil { if (fieldVal instanceof List) { List between = new ArrayList<>((List) fieldVal); int minLength = 2; - if (CollectionUtil.isNotEmpty(between) && between.size() >= minLength) { + if (CollUtil.isNotEmpty(between) && between.size() >= minLength) { queryWrapper.between(finalAttributeName, between.get(0), between.get(1)); } else { throw new BadRequestException("BETWEEN类型的对象列表长度必须 >= 2"); @@ -179,7 +180,7 @@ public class KitMpQUtil { */ private static void handleBlurryQuery(QueryWrapper queryWrapper, String blurry, Object fieldVal) { List blurryList = - Arrays.stream(blurry.split(",")).filter(StrUtil::isNotBlank).distinct().toList(); + Arrays.stream(blurry.split(",")).filter(StrUtil::isNotBlank).distinct().collect(Collectors.toList()); queryWrapper.and(wrapper -> { for (String blurryItem : blurryList) { String column = StrUtil.toUnderlineCase(blurryItem); @@ -198,7 +199,7 @@ public class KitMpQUtil { } public static void main(String[] args) { - QueryWrapper query = new QueryWrapper(); + QueryWrapper query = new QueryWrapper<>(); query.or(wrapper -> wrapper.eq("username", 1).or().eq("nickname", 2)); query.eq("id", 1); query.orderByDesc("id"); @@ -214,13 +215,13 @@ public class KitMpQUtil { System.err.println(query.getTargetSql()); } + @Data @TableName("test_domain") private static class TestDomain { @NotNull(groups = KitBaseUserTimeTb.Update.class) @TableId(value = "user_id", type = IdType.AUTO) - private Long - id; + private Long id; @TableField(value = "dept_id") private Long deptId; @NotBlank diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/interfaces/KitMpMapper.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/interfaces/KitMpMapper.java index 2bd4a2c9..ec61e36c 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/interfaces/KitMpMapper.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/interfaces/KitMpMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/interfaces/KitMpService.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/interfaces/KitMpService.java index 5610b2f5..b30ea30b 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/interfaces/KitMpService.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/interfaces/KitMpService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/interfaces/KitMpServiceImpl.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/interfaces/KitMpServiceImpl.java index 9be39c97..ac0e1f04 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/interfaces/KitMpServiceImpl.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/interfaces/KitMpServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/AppProperties.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/AppProperties.java index b91ef77c..80749ddb 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/AppProperties.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/AppProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/CaptchaModel.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/CaptchaModel.java index d55448a6..5c43beec 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/CaptchaModel.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/CaptchaModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/ContentRsaEncodeSettingModel.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/ContentRsaEncodeSettingModel.java index 77430f95..6715946f 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/ContentRsaEncodeSettingModel.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/ContentRsaEncodeSettingModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/JwtAuthSettingModel.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/JwtAuthSettingModel.java index 03072879..db09e5f8 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/JwtAuthSettingModel.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/JwtAuthSettingModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/OSSConfigModel.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/OSSConfigModel.java index b88d6967..7acb41ea 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/OSSConfigModel.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/OSSConfigModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/StorageOSSModel.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/StorageOSSModel.java index 5261b425..64486555 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/StorageOSSModel.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/StorageOSSModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/ThreadPoolSettingModel.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/ThreadPoolSettingModel.java index 76d8bc7f..189ab2fb 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/ThreadPoolSettingModel.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/ThreadPoolSettingModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/UserLoginCaptchaSettingModel.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/UserLoginCaptchaSettingModel.java index be6b46a5..2f2c1535 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/UserLoginCaptchaSettingModel.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/UserLoginCaptchaSettingModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/UserLoginSettingModel.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/UserLoginSettingModel.java index 917601c1..9e0df68b 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/UserLoginSettingModel.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/UserLoginSettingModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/quartz/config/QuartzConfig.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/quartz/config/QuartzConfig.java index c61848c2..c8289c84 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/quartz/config/QuartzConfig.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/quartz/config/QuartzConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/quartz/core/QuartzRunnable.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/quartz/core/QuartzRunnable.java index 1a04912d..d9fe23dc 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/quartz/core/QuartzRunnable.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/quartz/core/QuartzRunnable.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,7 +49,7 @@ public class QuartzRunnable implements Callable { if (StringUtils.isNotBlank(params)) { return method.invoke(target, params); } else { - return method.invoke(target, ""); + return method.invoke(target, null); } } } diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/redis/KitRedisHelper.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/redis/KitRedisHelper.java index af0ba20a..c4963f0a 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/redis/KitRedisHelper.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/redis/KitRedisHelper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/redis/RedisConfiguration.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/redis/RedisConfiguration.java index 9eff808a..dd0696f5 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/redis/RedisConfiguration.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/redis/RedisConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -194,4 +194,4 @@ public class RedisConfiguration { return JSON.parseObject(str, clazz); } } -} \ No newline at end of file +} diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/server/config/AsyncTheadPoolConfig.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/server/config/AsyncTheadPoolConfig.java index 97f5465c..281d1e7b 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/server/config/AsyncTheadPoolConfig.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/server/config/AsyncTheadPoolConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/server/converters/DateStringArraysToListDateConverter.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/server/converters/DateStringArraysToListDateConverter.java index ea239380..89c711df 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/server/converters/DateStringArraysToListDateConverter.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/server/converters/DateStringArraysToListDateConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/server/converters/DateStringToDateConverter.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/server/converters/DateStringToDateConverter.java index 5f96d041..93587068 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/server/converters/DateStringToDateConverter.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/server/converters/DateStringToDateConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/server/core/ConfigurerAdapter.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/server/core/ConfigurerAdapter.java index 8cdd9bbc..e1cda590 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/server/core/ConfigurerAdapter.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/server/core/ConfigurerAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/server/core/KitFileLocalUploadHelper.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/server/core/KitFileLocalUploadHelper.java index e76f110c..8a74ca81 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/server/core/KitFileLocalUploadHelper.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/server/core/KitFileLocalUploadHelper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/websocket/config/UndertowWebSocketConfig.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/websocket/config/UndertowWebSocketConfig.java index c25a58e2..69d3f475 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/websocket/config/UndertowWebSocketConfig.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/websocket/config/UndertowWebSocketConfig.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.framework.websocket.config; import io.undertow.server.DefaultByteBufferPool; @@ -41,4 +56,4 @@ public class UndertowWebSocketConfig implements WebServerFactoryCustomizer>> getDictDetailMaps(@RequestParam String dictName) { - Map> dictMap = systemDictDetailService.getDictDetailMap(dictName); - return ResponseEntity.ok(dictMap); - } - @OperationLog @ApiOperation("新增字典详情") @PostMapping(value = "/saveDictDetail") diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemEmailController.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemEmailController.java index 81d64ba1..445fba64 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemEmailController.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemEmailController.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemJobController.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemJobController.java index 0ab929cf..f0364ecc 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemJobController.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemJobController.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,8 +25,6 @@ import cn.odboy.system.service.SystemJobService; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import java.util.Set; -import jakarta.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; @@ -36,6 +34,8 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import jakarta.servlet.http.HttpServletResponse; +import java.util.Set; @RestController @Api(tags = "系统:岗位管理") diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemLocalStorageController.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemLocalStorageController.java index 938b7d18..c55c1b94 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemLocalStorageController.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemLocalStorageController.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,6 @@ import cn.odboy.system.service.SystemLocalStorageService; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import jakarta.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; @@ -36,6 +35,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import jakarta.servlet.http.HttpServletResponse; @RestController @Api(tags = "工具:本地存储管理") @@ -74,7 +74,7 @@ public class SystemLocalStorageController { @ApiOperation("上传图片") @PostMapping("/uploadPicture") public ResponseEntity uploadPicture(@RequestParam MultipartFile file) { - SystemLocalStorageTb localStorage = localStorageService.uploadPictureV1(file); + SystemLocalStorageTb localStorage = localStorageService.uploadPicture(file); return ResponseEntity.ok(localStorage); } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemMenuController.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemMenuController.java index 992eebd3..73ade6c6 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemMenuController.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemMenuController.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,9 +27,6 @@ import cn.odboy.system.service.SystemMenuService; import cn.odboy.util.KitPageUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import java.util.List; -import java.util.Set; -import jakarta.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; @@ -40,6 +37,9 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import jakarta.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Set; @RestController @Api(tags = "系统:菜单管理") @@ -67,8 +67,8 @@ public class SystemMenuController { @ApiOperation("返回全部的菜单") @PostMapping(value = "/listMenuByPid") @PreAuthorize("@el.check('menu:list','roles:list')") - public ResponseEntity> listMenuByPid(@RequestParam Long pid) { - List systemMenuTbs = systemMenuService.listMenuByPid(pid); + public ResponseEntity> listMenuByPid(@RequestParam Long pid) { + List systemMenuTbs = systemMenuService.listMenuByPid(pid); return ResponseEntity.ok(systemMenuTbs); } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemMonitorController.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemMonitorController.java index 7f387c68..305e9456 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemMonitorController.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemMonitorController.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,13 +19,13 @@ import cn.odboy.system.framework.operalog.OperationLog; import cn.odboy.system.service.SystemMonitorService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.Map; @RestController @Api(tags = "系统-服务监控管理") diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemOnlineController.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemOnlineController.java index 2ccc1927..39798607 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemOnlineController.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemOnlineController.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,8 +24,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import java.util.Set; -import jakarta.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; @@ -35,6 +33,8 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import jakarta.servlet.http.HttpServletResponse; +import java.util.Set; @RestController @RequestMapping("/api/user/online") diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemOperationLogController.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemOperationLogController.java index ac087351..aec892b9 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemOperationLogController.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemOperationLogController.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.controller; import cn.odboy.base.KitPageArgs; diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemOssStorageController.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemOssStorageController.java index d45d5361..34b1bf84 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemOssStorageController.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemOssStorageController.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,6 @@ import cn.odboy.system.service.SystemOssStorageService; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import jakarta.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; @@ -38,6 +37,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import jakarta.servlet.http.HttpServletResponse; @Slf4j @RestController diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemQuartzJobController.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemQuartzJobController.java index 43d90df4..def140c3 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemQuartzJobController.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemQuartzJobController.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,11 +24,10 @@ import cn.odboy.system.dal.model.request.SystemUpdateQuartzJobArgs; import cn.odboy.system.dal.model.response.SystemQuartzJobVo; import cn.odboy.system.framework.operalog.OperationLog; import cn.odboy.system.service.SystemQuartzJobService; +import cn.odboy.util.KitBeanUtil; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import java.util.Set; -import jakarta.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; @@ -40,6 +39,8 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import jakarta.servlet.http.HttpServletResponse; +import java.util.Set; @Slf4j @RestController @@ -86,7 +87,7 @@ public class SystemQuartzJobController { @ApiOperation("新增定时任务") @PostMapping(value = "/createQuartzJob") @PreAuthorize("@el.check('quartzJob:add')") - public ResponseEntity createQuartzJob(@Validated @RequestBody SystemQuartzJobVo args) { + public ResponseEntity createQuartzJob(@Validated @RequestBody SystemQuartzJobTb args) { systemQuartzJobService.createJob(args); return ResponseEntity.ok(null); } @@ -106,7 +107,9 @@ public class SystemQuartzJobController { @PostMapping(value = "/switchQuartzJobStatus/{id}") @PreAuthorize("@el.check('quartzJob:edit')") public ResponseEntity switchQuartzJobStatus(@PathVariable Long id) { - systemQuartzJobService.switchQuartzJobStatus(systemQuartzJobService.getQuartzJobById(id)); + SystemQuartzJobTb quartzJobTb = systemQuartzJobService.getQuartzJobById(id); + SystemQuartzJobVo quartzJobVo = KitBeanUtil.copyToClass(quartzJobTb, SystemQuartzJobVo.class); + systemQuartzJobService.switchQuartzJobStatus(quartzJobVo); return ResponseEntity.ok(null); } @@ -115,7 +118,9 @@ public class SystemQuartzJobController { @PostMapping(value = "/startQuartzJob/{id}") @PreAuthorize("@el.check('quartzJob:edit')") public ResponseEntity startQuartzJob(@PathVariable Long id) { - systemQuartzJobService.startQuartzJob(systemQuartzJobService.getQuartzJobById(id)); + SystemQuartzJobTb quartzJobTb = systemQuartzJobService.getQuartzJobById(id); + SystemQuartzJobVo quartzJobVo = KitBeanUtil.copyToClass(quartzJobTb, SystemQuartzJobVo.class); + systemQuartzJobService.startQuartzJob(quartzJobVo); return ResponseEntity.ok(null); } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemRoleController.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemRoleController.java index d90d44e5..4976e91b 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemRoleController.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemRoleController.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,9 +27,6 @@ import cn.odboy.system.service.SystemRoleService; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import java.util.List; -import java.util.Set; -import jakarta.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; @@ -39,6 +36,9 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import jakarta.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Set; @RestController @Api(tags = "系统:角色管理") @@ -52,7 +52,7 @@ public class SystemRoleController { @PostMapping(value = "/getRoleById") @PreAuthorize("@el.check('roles:list')") public ResponseEntity getRoleById(@RequestBody SystemRoleTb args) { - return ResponseEntity.ok(systemRoleService.getRoleById(args.getId())); + return ResponseEntity.ok(systemRoleService.getRoleVoById(args.getId())); } @ApiOperation("导出角色数据") diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemUserController.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemUserController.java index aa1358c9..ce25a15b 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemUserController.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemUserController.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,9 +30,6 @@ import cn.odboy.system.service.SystemUserService; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import java.util.List; -import java.util.Set; -import jakarta.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; @@ -45,6 +42,9 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import jakarta.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Set; @Api(tags = "系统:用户管理") @RestController diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemDeptTb.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemDeptTb.java index b7daf633..6098ddfc 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemDeptTb.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemDeptTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,10 +20,10 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModelProperty; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.NotNull; import lombok.Getter; import lombok.Setter; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; import java.util.Objects; @Getter @@ -79,4 +79,4 @@ public class SystemDeptTb extends KitBaseUserTimeTb { public String getLabel() { return name; } -} \ No newline at end of file +} diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemDictDetailTb.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemDictDetailTb.java index caab4087..11dc5427 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemDictDetailTb.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemDictDetailTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,4 +43,4 @@ public class SystemDictDetailTb extends KitBaseUserTimeTb { private String value; @ApiModelProperty(value = "排序") private Integer dictSort = 999; -} \ No newline at end of file +} diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemDictTb.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemDictTb.java index d80bffd0..50b6c8fd 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemDictTb.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemDictTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,4 +42,4 @@ public class SystemDictTb extends KitBaseUserTimeTb { @ApiModelProperty(value = "描述") @TableField(updateStrategy = FieldStrategy.ALWAYS) private String description; -} \ No newline at end of file +} diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemEmailConfigTb.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemEmailConfigTb.java index 13fa3848..b91b65ad 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemEmailConfigTb.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemEmailConfigTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemJobTb.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemJobTb.java index 39574cb0..758a05b4 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemJobTb.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemJobTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,4 +61,4 @@ public class SystemJobTb extends KitBaseUserTimeTb { public int hashCode() { return Objects.hash(id); } -} \ No newline at end of file +} diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemLocalStorageTb.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemLocalStorageTb.java index 92c19c3b..b89b097c 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemLocalStorageTb.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemLocalStorageTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ package cn.odboy.system.dal.dataobject; import cn.odboy.base.KitBaseUserTimeTb; -import cn.odboy.util.KitBeanUtil; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; @@ -46,8 +45,4 @@ public class SystemLocalStorageTb extends KitBaseUserTimeTb { private String size; @ApiModelProperty(value = "日期分组") private String dateGroup; - - public void copy(SystemLocalStorageTb source) { - KitBeanUtil.copyToTarget(source, this); - } -} \ No newline at end of file +} diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemMenuTb.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemMenuTb.java index 3f7d1cd7..527084fe 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemMenuTb.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemMenuTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemOperationLogTb.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemOperationLogTb.java index 345c7887..d24e9967 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemOperationLogTb.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemOperationLogTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemOssStorageTb.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemOssStorageTb.java index 999af688..b6f9c3f3 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemOssStorageTb.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemOssStorageTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemQuartzJobTb.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemQuartzJobTb.java index fe865114..51010e21 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemQuartzJobTb.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemQuartzJobTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,4 +63,4 @@ public class SystemQuartzJobTb extends KitBaseUserTimeTb { @ApiModelProperty(value = "备注") @TableField(updateStrategy = FieldStrategy.ALWAYS) private String description; -} \ No newline at end of file +} diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemQuartzLogTb.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemQuartzLogTb.java index 3a82a0a6..b0790f6c 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemQuartzLogTb.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemQuartzLogTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemRoleDeptTb.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemRoleDeptTb.java index 92b7be14..0015432f 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemRoleDeptTb.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemRoleDeptTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,4 +30,4 @@ public class SystemRoleDeptTb extends KitObject { private Long roleId; @TableField(value = "dept_id") private Long deptId; -} \ No newline at end of file +} diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemRoleMenuTb.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemRoleMenuTb.java index ebfeb4b5..0f35f183 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemRoleMenuTb.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemRoleMenuTb.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.dataobject; import com.baomidou.mybatisplus.annotation.TableField; diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemRoleTb.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemRoleTb.java index 342e3371..890e0e9d 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemRoleTb.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemRoleTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemUserJobTb.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemUserJobTb.java index 7c2c964f..68d9b3bd 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemUserJobTb.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemUserJobTb.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.dataobject; import com.baomidou.mybatisplus.annotation.TableField; diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemUserRoleTb.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemUserRoleTb.java index 6d7a137b..d07ce33e 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemUserRoleTb.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemUserRoleTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,4 +30,4 @@ public class SystemUserRoleTb extends KitObject { private Long userId; @TableField(value = "role_id") private Long roleId; -} \ No newline at end of file +} diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemUserTb.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemUserTb.java index b89748d3..d316ffe8 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemUserTb.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemUserTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -86,4 +86,4 @@ public class SystemUserTb extends KitBaseUserTimeTb { public int hashCode() { return Objects.hash(id, username); } -} \ No newline at end of file +} diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemDeptExportRowVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemDeptExportRowVo.java index 8173a6d6..ee234576 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemDeptExportRowVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemDeptExportRowVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.export; import cn.idev.excel.annotation.ExcelProperty; diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemDictExportRowVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemDictExportRowVo.java index a9ecf480..0df68de8 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemDictExportRowVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemDictExportRowVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.export; import cn.idev.excel.annotation.ExcelProperty; diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemJobExportRowVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemJobExportRowVo.java index bfba86f8..c54d90ce 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemJobExportRowVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemJobExportRowVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.export; import cn.idev.excel.annotation.ExcelProperty; diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemLocalStorageExportRowVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemLocalStorageExportRowVo.java index 232e082b..7bec3a35 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemLocalStorageExportRowVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemLocalStorageExportRowVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.export; import cn.idev.excel.annotation.ExcelProperty; diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemMenuExportRowVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemMenuExportRowVo.java index 8e5c4c71..bb32d88c 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemMenuExportRowVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemMenuExportRowVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.export; import cn.idev.excel.annotation.ExcelProperty; diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemOssStorageExportRowVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemOssStorageExportRowVo.java index 552737ed..86da25e1 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemOssStorageExportRowVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemOssStorageExportRowVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.export; import cn.idev.excel.annotation.ExcelProperty; diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemQuartzJobExportRowVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemQuartzJobExportRowVo.java index 1e773828..eb3dd3b4 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemQuartzJobExportRowVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemQuartzJobExportRowVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.export; import cn.idev.excel.annotation.ExcelProperty; diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemQuartzLogExportRowVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemQuartzLogExportRowVo.java index 5f536e7a..c1d546c1 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemQuartzLogExportRowVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemQuartzLogExportRowVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.export; import cn.idev.excel.annotation.ExcelProperty; diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemRoleExportRowVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemRoleExportRowVo.java index 155b57e8..cf89fb2e 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemRoleExportRowVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemRoleExportRowVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.export; import cn.idev.excel.annotation.ExcelProperty; diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemUserExportRowVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemUserExportRowVo.java index 2ffcecae..c8f4a375 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemUserExportRowVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemUserExportRowVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.export; import cn.idev.excel.annotation.ExcelProperty; diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemUserOnlineExportRowVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemUserOnlineExportRowVo.java index 15c386c0..330524f7 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemUserOnlineExportRowVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemUserOnlineExportRowVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.export; import cn.idev.excel.annotation.ExcelProperty; @@ -21,4 +36,4 @@ public class SystemUserOnlineExportRowVo extends KitObject { private String browser; @ExcelProperty("登录日期") private String loginTime; -} \ No newline at end of file +} diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCheckEmailCaptchaArgs.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCheckEmailCaptchaArgs.java index 97a0e8b3..47bf284b 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCheckEmailCaptchaArgs.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCheckEmailCaptchaArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateDeptArgs.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateDeptArgs.java index 6a4db862..56c481b5 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateDeptArgs.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateDeptArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateDictArgs.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateDictArgs.java index a18a0341..b2ea87f6 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateDictArgs.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateDictArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateDictDetailArgs.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateDictDetailArgs.java index 20b2d686..008a7565 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateDictDetailArgs.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateDictDetailArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateJobArgs.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateJobArgs.java index 3cf210f1..82007e9c 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateJobArgs.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateJobArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateRoleArgs.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateRoleArgs.java index f9526661..c60d9143 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateRoleArgs.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateRoleArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryDeptArgs.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryDeptArgs.java index 73b2b8c5..9669b314 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryDeptArgs.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryDeptArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryDictArgs.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryDictArgs.java index 95ca97d1..fc938a2a 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryDictArgs.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryDictArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryDictDetailArgs.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryDictDetailArgs.java index d05f55de..83d726b9 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryDictDetailArgs.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryDictDetailArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,4 +28,4 @@ public class SystemQueryDictDetailArgs extends KitObject { private String label; @ApiModelProperty(value = "字典名称") private String dictName; -} \ No newline at end of file +} diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryJobArgs.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryJobArgs.java index 84dd329f..fe7f27d6 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryJobArgs.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryJobArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryMenuArgs.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryMenuArgs.java index 8c2b881e..d5a3de73 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryMenuArgs.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryMenuArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryOperationLogArgs.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryOperationLogArgs.java index 2d26cc23..8825d4eb 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryOperationLogArgs.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryOperationLogArgs.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.request; import cn.odboy.base.KitObject; diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryQuartzJobArgs.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryQuartzJobArgs.java index 421a34fa..45e63cb8 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryQuartzJobArgs.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryQuartzJobArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryRoleArgs.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryRoleArgs.java index 38e0aff3..b424c5be 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryRoleArgs.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryRoleArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryStorageArgs.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryStorageArgs.java index befe3996..78d69aa2 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryStorageArgs.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryStorageArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryUserArgs.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryUserArgs.java index 134c29de..6af6f08e 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryUserArgs.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryUserArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemSendEmailArgs.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemSendEmailArgs.java index e289dd29..33e2580d 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemSendEmailArgs.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemSendEmailArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemUpdateQuartzJobArgs.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemUpdateQuartzJobArgs.java index dbe967f3..3dd546a1 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemUpdateQuartzJobArgs.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemUpdateQuartzJobArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemUpdateUserPasswordArgs.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemUpdateUserPasswordArgs.java index d8284b75..c33aa8c3 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemUpdateUserPasswordArgs.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemUpdateUserPasswordArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemUserLoginArgs.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemUserLoginArgs.java index 7ffa5127..636b9dd3 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemUserLoginArgs.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemUserLoginArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemAuthVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemAuthVo.java index 9024d26e..24f6cb3a 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemAuthVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemAuthVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.response; import cn.odboy.base.KitObject; diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemCaptchaVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemCaptchaVo.java index 6f6dc84a..6bc528e8 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemCaptchaVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemCaptchaVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.response; import cn.odboy.base.KitObject; diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemDeptVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemDeptVo.java index e88f92b9..1f1d19b5 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemDeptVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemDeptVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.response; import cn.odboy.base.KitBaseUserTimeTb; diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemDictDetailVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemDictDetailVo.java index 45fdb903..fa6e56a4 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemDictDetailVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemDictDetailVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,4 +40,4 @@ public class SystemDictDetailVo extends KitBaseUserTimeTb { */ @ApiModelProperty(value = "字典") private SystemDictTb dict; -} \ No newline at end of file +} diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemMenuMetaVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemMenuMetaVo.java index a49bd485..64078814 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemMenuMetaVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemMenuMetaVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemMenuRouterVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemMenuRouterVo.java index e2303138..61d9a9ea 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemMenuRouterVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemMenuRouterVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemMenuVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemMenuVo.java index fbb7e339..b967e836 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemMenuVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemMenuVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.response; import cn.odboy.base.KitBaseUserTimeTb; diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemOssStorageVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemOssStorageVo.java index 503cfddf..910304c4 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemOssStorageVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemOssStorageVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemProductLineTreeVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemProductLineTreeVo.java index 417025d5..891ee082 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemProductLineTreeVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemProductLineTreeVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemProductLineVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemProductLineVo.java index e358907b..6b0291c2 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemProductLineVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemProductLineVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemQuartzJobVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemQuartzJobVo.java index caf2e513..19633561 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemQuartzJobVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemQuartzJobVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.response; import cn.odboy.base.KitBaseUserTimeTb; @@ -8,6 +23,7 @@ import lombok.Setter; @Getter @Setter public class SystemQuartzJobVo extends KitBaseUserTimeTb { + private Long id; @ApiModelProperty(value = "定时器名称") private String jobName; diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemRoleCodeVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemRoleCodeVo.java index 2fb55924..52710c8e 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemRoleCodeVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemRoleCodeVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemRoleVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemRoleVo.java index 92eba2c6..9c57efe8 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemRoleVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemRoleVo.java @@ -1,8 +1,24 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.response; import cn.odboy.base.KitBaseUserTimeTb; import cn.odboy.system.constant.SystemDataScopeEnum; import cn.odboy.system.dal.dataobject.SystemDeptTb; +import cn.odboy.system.dal.dataobject.SystemMenuTb; import cn.odboy.system.dal.dataobject.SystemUserTb; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; @@ -30,7 +46,7 @@ public class SystemRoleVo extends KitBaseUserTimeTb { @ApiModelProperty(value = "用户", hidden = true) private Set users; @ApiModelProperty(value = "菜单", hidden = true) - private Set menus; + private Set menus; @ApiModelProperty(value = "部门", hidden = true) private Set depts; @@ -51,5 +67,4 @@ public class SystemRoleVo extends KitBaseUserTimeTb { return Objects.hash(id); } - } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemSimpleUserVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemSimpleUserVo.java index 4b2aef64..75862f38 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemSimpleUserVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemSimpleUserVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,4 +52,4 @@ public class SystemSimpleUserVo extends KitObject { private Boolean enabled; @ApiModelProperty(value = "是否为admin账号", hidden = true) private Boolean isAdmin = false; -} \ No newline at end of file +} diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserInfoVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserInfoVo.java index 4d4a6bff..9a203890 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserInfoVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserInfoVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserJwtVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserJwtVo.java index 5f9c064c..9d406451 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserJwtVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserJwtVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserOnlineVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserOnlineVo.java index 1d66b684..b4faeaa4 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserOnlineVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserOnlineVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserVo.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserVo.java index 3aa00bfb..15c889ec 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserVo.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.response; import cn.odboy.base.KitBaseUserTimeTb; diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemDeptMapper.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemDeptMapper.java index 336b291a..a95b7246 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemDeptMapper.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemDeptMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemDictDetailMapper.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemDictDetailMapper.java index 7771e651..424eecd7 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemDictDetailMapper.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemDictDetailMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ import java.util.List; @Mapper public interface SystemDictDetailMapper extends BaseMapper { - IPage selectPageByArgs(Page page, @Param("args") SystemQueryDictDetailArgs args); + IPage selectPageByArgs(Page page, @Param("args") SystemQueryDictDetailArgs args); - List listDictDetailByName(@Param("name") String name); + List listDictDetailByName(@Param("name") String name); } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemDictMapper.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemDictMapper.java index 7ee9e177..00409d3a 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemDictMapper.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemDictMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemEmailConfigMapper.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemEmailConfigMapper.java index c1c1b926..c34b909b 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemEmailConfigMapper.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemEmailConfigMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemJobMapper.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemJobMapper.java index 63f88e6b..779fad51 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemJobMapper.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemJobMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemLocalStorageMapper.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemLocalStorageMapper.java index 90088b7e..2f0355c4 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemLocalStorageMapper.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemLocalStorageMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemMenuMapper.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemMenuMapper.java index d044834a..b19e4afe 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemMenuMapper.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemMenuMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package cn.odboy.system.dal.mysql; import cn.odboy.system.dal.dataobject.SystemMenuTb; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; +import java.util.List; /** * 菜单 Mapper @@ -27,4 +28,7 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface SystemMenuMapper extends BaseMapper { + default List listAll() { + return selectList(null); + } } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemOperationLogMapper.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemOperationLogMapper.java index 6dc2ecab..c79cc894 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemOperationLogMapper.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemOperationLogMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemOssStorageMapper.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemOssStorageMapper.java index 30b893b4..24cac74e 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemOssStorageMapper.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemOssStorageMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemQuartzJobMapper.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemQuartzJobMapper.java index c420ffe1..1cc5a5b7 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemQuartzJobMapper.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemQuartzJobMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package cn.odboy.system.dal.mysql; import cn.odboy.system.dal.dataobject.SystemQuartzJobTb; -import cn.odboy.system.dal.model.response.SystemQuartzJobVo; -import cn.odboy.util.KitBeanUtil; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; @@ -29,7 +27,4 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface SystemQuartzJobMapper extends BaseMapper { - default SystemQuartzJobVo selectVoById(String id) { - return KitBeanUtil.copyToClass(selectById(id), SystemQuartzJobVo.class); - } } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemQuartzLogMapper.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemQuartzLogMapper.java index 66091347..0913d583 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemQuartzLogMapper.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemQuartzLogMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemRoleDeptMapper.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemRoleDeptMapper.java index 0d5740b4..ddec61d7 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemRoleDeptMapper.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemRoleDeptMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemRoleMapper.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemRoleMapper.java index c9bb0662..8de3bf3c 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemRoleMapper.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemRoleMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,8 @@ package cn.odboy.system.dal.mysql; import cn.odboy.system.dal.dataobject.SystemRoleTb; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import java.util.List; /** * 角色 Mapper @@ -27,4 +29,5 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface SystemRoleMapper extends BaseMapper { + List listRoleLevelByRoleIds(@Param("roleIds") List roleIds); } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemRoleMenuMapper.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemRoleMenuMapper.java index 252db638..544d56e3 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemRoleMenuMapper.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemRoleMenuMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,9 +15,13 @@ */ package cn.odboy.system.dal.mysql; +import cn.odboy.system.dal.dataobject.SystemMenuTb; import cn.odboy.system.dal.dataobject.SystemRoleMenuTb; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import java.util.List; +import java.util.Set; /** * 角色菜单关联 Mapper @@ -27,4 +31,9 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface SystemRoleMenuMapper extends BaseMapper { + Set listMenuPermissionByRoleIds(@Param("roleIds") Set roleIds); + + List listMenuWithRoleIdsNeButton(@Param("roleIds") Set roleIds); + + List listMenuWithRoleIds(@Param("roleIds") Set roleIds); } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemUserJobMapper.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemUserJobMapper.java index cb38efbc..415c15c9 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemUserJobMapper.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemUserJobMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemUserMapper.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemUserMapper.java index 1676257e..d23f4744 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemUserMapper.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemUserMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,8 @@ import cn.odboy.system.dal.dataobject.SystemUserTb; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import java.util.List; import java.util.Set; /** @@ -49,4 +51,6 @@ public interface SystemUserMapper extends BaseMapper { wrapper.set(SystemUserTb::getPassword, password); update(null, wrapper); } + + List listUsernameByIds(@Param("userIds") Set userIds); } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemUserRoleMapper.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemUserRoleMapper.java index d3937f9c..698fb37f 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemUserRoleMapper.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemUserRoleMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,4 +26,8 @@ import java.util.Set; public interface SystemUserRoleMapper extends BaseMapper { Set listUserRoleByUserId(@Param("userId") Long userId); + + Set listUserRoleLevelByUserId(@Param("userId") Long userId); + + Set listUserRoleIdByUserId(@Param("userId") Long userId); } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemCacheKey.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemCacheKey.java index 7a73436b..b12bcce5 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemCacheKey.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemCacheKey.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,50 +20,12 @@ package cn.odboy.system.dal.redis; */ public interface SystemCacheKey { - /** - * 用户 - */ - String USER_ID = "user::id:"; - /** - * 数据 - */ - String DATA_USER = "data::user:"; - /** - * 菜单 - */ - String MENU_ID = "menu::id:"; - String MENU_USER = "menu::user:"; - /** - * 角色授权 - */ - String ROLE_AUTH = "role::auth:"; - String ROLE_USER = "role::user:"; - /** - * 角色信息 - */ - String ROLE_ID = "role::id:"; - /** - * 部门 - */ - String DEPT_ID = "dept::id:"; - /** - * 岗位 - */ - String JOB_ID = "job::id:"; - /** - * 数据字典 - */ - String DICT_NAME = "dict::name:"; /** * 在线用户 */ - String ONLINE_USER = "online::token:"; + String ONLINE_USER = "user::token:"; /** * 登录验证码 */ String CAPTCHA_LOGIN = "captcha::login:"; - /** - * 用户信息 - */ - String USER_INFO = "user::info:"; } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemRedisKey.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemRedisKey.java index e8eb9240..1ffeb347 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemRedisKey.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemRedisKey.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.redis; /** diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemUserInfoDAO.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemUserInfoDAO.java index ccb32148..b52f0f77 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemUserInfoDAO.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemUserInfoDAO.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.redis; import cn.hutool.core.util.RandomUtil; diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemUserOnlineInfoDAO.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemUserOnlineInfoDAO.java index 88a7990e..2aac9cb9 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemUserOnlineInfoDAO.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemUserOnlineInfoDAO.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.redis; import cn.hutool.core.util.StrUtil; diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/bizlock/BizLock.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/bizlock/BizLock.java index 037f8b47..78624073 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/bizlock/BizLock.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/bizlock/BizLock.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/bizlock/BizLockAspect.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/bizlock/BizLockAspect.java index 4d0e1e3b..8ae55e4c 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/bizlock/BizLockAspect.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/bizlock/BizLockAspect.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,4 +84,4 @@ public class BizLockAspect { // 组合最终的key: bizName:解析后的key return String.format("%s:%s", bizLock.bizName(), value); } -} \ No newline at end of file +} diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/mybatisplus/MpMetaObjectHandler.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/mybatisplus/MpMetaObjectHandler.java index dafb9801..e6a01d5e 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/mybatisplus/MpMetaObjectHandler.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/mybatisplus/MpMetaObjectHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLog.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLog.java index a7486382..c9d09332 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLog.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLog.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLogAspect.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLogAspect.java index 87652ac1..6e36dfed 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLogAspect.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLogAspect.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ import cn.odboy.util.KitIPUtil; import com.alibaba.fastjson2.JSON; import io.swagger.annotations.ApiOperation; import jakarta.servlet.http.HttpServletRequest; +import java.lang.reflect.Method; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; @@ -35,7 +36,6 @@ import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.reflect.MethodSignature; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.lang.reflect.Method; /** * 捕捉操作日志 @@ -48,7 +48,8 @@ import java.lang.reflect.Method; @Component public class OperationLogAspect { - @Autowired private SystemOperationLogMapper systemOperationLogMapper; + @Autowired + private SystemOperationLogMapper systemOperationLogMapper; @Around("@annotation(operationLog)") public Object operationLogCatch(ProceedingJoinPoint joinPoint, OperationLog operationLog) diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/config/AuthorityConfig.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/config/AuthorityConfig.java index ac3b7ef7..62fdc2cc 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/config/AuthorityConfig.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/config/AuthorityConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/config/SpringSecurityConfig.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/config/SpringSecurityConfig.java index b3081541..b80a830b 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/config/SpringSecurityConfig.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/config/SpringSecurityConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -125,4 +125,4 @@ public class SpringSecurityConfig { // 所有请求都需要认证 .anyRequest().authenticated()).build(); } -} \ No newline at end of file +} diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/config/TokenConfigurer.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/config/TokenConfigurer.java index e7da8e26..9c05ad8f 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/config/TokenConfigurer.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/config/TokenConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/KitSecurityHelper.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/KitSecurityHelper.java index 4cf28c71..d5aa94b9 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/KitSecurityHelper.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/KitSecurityHelper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/JwtAccessDeniedHandler.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/JwtAccessDeniedHandler.java index 019fcd3d..57e76267 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/JwtAccessDeniedHandler.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/JwtAccessDeniedHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/JwtAuthenticationEntryPoint.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/JwtAuthenticationEntryPoint.java index e17e14db..bc0594ce 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/JwtAuthenticationEntryPoint.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/JwtAuthenticationEntryPoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/TokenFilter.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/TokenFilter.java index 629cf88a..3046d0bc 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/TokenFilter.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/TokenFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/TokenProvider.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/TokenProvider.java index c713c8c4..b61835ee 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/TokenProvider.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/TokenProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/UserDetailsHandler.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/UserDetailsHandler.java index a32d1c94..b7ad2260 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/UserDetailsHandler.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/UserDetailsHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/quartz/ActiveJobRegister.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/quartz/ActiveJobRegister.java index 5ddc3b19..2a0f4641 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/quartz/ActiveJobRegister.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/quartz/ActiveJobRegister.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,8 +15,10 @@ */ package cn.odboy.system.framework.quartz; +import cn.odboy.system.dal.dataobject.SystemQuartzJobTb; import cn.odboy.system.dal.model.response.SystemQuartzJobVo; import cn.odboy.system.service.SystemQuartzJobService; +import cn.odboy.util.KitBeanUtil; import java.util.List; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -40,8 +42,9 @@ public class ActiveJobRegister implements ApplicationRunner { */ @Override public void run(ApplicationArguments applicationArguments) { - List quartzJobs = systemQuartzJobService.listEnableQuartzJob(); - quartzJobs.forEach(quartzManage::addJob); + List quartzJobTbs = systemQuartzJobService.listEnableQuartzJob(); + List quartzJobVos = KitBeanUtil.copyToList(quartzJobTbs, SystemQuartzJobVo.class); + quartzJobVos.forEach(quartzManage::addJob); log.info("Timing task injection complete"); } } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/quartz/ExecutionJobBean.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/quartz/ExecutionJobBean.java index 7aba1d5f..2d9f4f3a 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/quartz/ExecutionJobBean.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/quartz/ExecutionJobBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/quartz/QuartzManage.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/quartz/QuartzManage.java index 6b80b97d..415f9946 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/quartz/QuartzManage.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/quartz/QuartzManage.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package cn.odboy.system.framework.quartz; import cn.odboy.framework.exception.BadRequestException; import cn.odboy.system.dal.dataobject.SystemQuartzJobTb; import cn.odboy.system.dal.model.response.SystemQuartzJobVo; +import cn.odboy.util.KitBeanUtil; import java.util.Date; import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; @@ -45,12 +46,17 @@ public class QuartzManage { public void addJob(SystemQuartzJobVo quartzJob) { try { + String uuid = JOB_NAME + quartzJob.getId(); // 构建job信息 - JobDetail jobDetail = - JobBuilder.newJob(ExecutionJobBean.class).withIdentity(JOB_NAME + quartzJob.getId()).build(); + JobDetail jobDetail = JobBuilder.newJob(ExecutionJobBean.class) + .withIdentity(uuid) + .build(); // 通过触发器名和cron 表达式创建 Trigger - Trigger trigger = TriggerBuilder.newTrigger().withIdentity(JOB_NAME + quartzJob.getId()).startNow() - .withSchedule(CronScheduleBuilder.cronSchedule(quartzJob.getCronExpression())).build(); + Trigger trigger = TriggerBuilder.newTrigger() + .withIdentity(uuid) + .startNow() + .withSchedule(CronScheduleBuilder.cronSchedule(quartzJob.getCronExpression())) + .build(); trigger.getJobDataMap().put(SystemQuartzJobTb.JOB_KEY, quartzJob); // 重置启动时间 ((CronTriggerImpl) trigger).setStartTime(new Date()); @@ -75,24 +81,25 @@ public class QuartzManage { * * @param quartzJob / */ - public void updateJobCron(SystemQuartzJobVo quartzJob) { + public void updateJobCron(SystemQuartzJobTb quartzJob) { try { - TriggerKey triggerKey = TriggerKey.triggerKey(JOB_NAME + quartzJob.getId()); + SystemQuartzJobVo quartzJobVo = KitBeanUtil.copyToClass(quartzJob, SystemQuartzJobVo.class); + TriggerKey triggerKey = TriggerKey.triggerKey(JOB_NAME + quartzJobVo.getId()); CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey); // 如果不存在则创建一个定时任务 if (trigger == null) { - addJob(quartzJob); + addJob(quartzJobVo); trigger = (CronTrigger) scheduler.getTrigger(triggerKey); } - CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(quartzJob.getCronExpression()); + CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(quartzJobVo.getCronExpression()); trigger = trigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(scheduleBuilder).build(); // 重置启动时间 ((CronTriggerImpl) trigger).setStartTime(new Date()); - trigger.getJobDataMap().put(SystemQuartzJobTb.JOB_KEY, quartzJob); + trigger.getJobDataMap().put(SystemQuartzJobTb.JOB_KEY, quartzJobVo); scheduler.rescheduleJob(triggerKey, trigger); // 暂停任务 - if (quartzJob.getIsPause()) { - pauseJob(quartzJob); + if (quartzJobVo.getIsPause()) { + pauseJob(quartzJobVo); } } catch (Exception e) { log.error("更新定时任务失败", e); @@ -144,7 +151,8 @@ public class QuartzManage { */ public void runJobNow(SystemQuartzJobVo quartzJob) { try { - TriggerKey triggerKey = TriggerKey.triggerKey(JOB_NAME + quartzJob.getId()); + String uuid = JOB_NAME + quartzJob.getId(); + TriggerKey triggerKey = TriggerKey.triggerKey(uuid); CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey); // 如果不存在则创建一个定时任务 if (trigger == null) { @@ -152,7 +160,7 @@ public class QuartzManage { } JobDataMap dataMap = new JobDataMap(); dataMap.put(SystemQuartzJobTb.JOB_KEY, quartzJob); - JobKey jobKey = JobKey.jobKey(JOB_NAME + quartzJob.getId()); + JobKey jobKey = JobKey.jobKey(uuid); scheduler.triggerJob(jobKey, dataMap); } catch (Exception e) { log.error("定时任务执行失败", e); diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/storage/OssStorageConfiguration.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/storage/OssStorageConfiguration.java index bbe8bb97..5c2a8737 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/storage/OssStorageConfiguration.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/storage/OssStorageConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/storage/local/MultipartConfig.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/storage/local/MultipartConfig.java index 63e0c30f..180512bc 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/storage/local/MultipartConfig.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/storage/local/MultipartConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,4 +53,4 @@ public class MultipartConfig { factory.setLocation(location); return factory.createMultipartConfig(); } -} \ No newline at end of file +} diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/storage/minio/MinioRepository.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/storage/minio/MinioRepository.java index 8980a0d4..fc55cb47 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/storage/minio/MinioRepository.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/storage/minio/MinioRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,13 +43,13 @@ import io.minio.Result; import io.minio.http.Method; import io.minio.messages.Bucket; import io.minio.messages.Item; +import jakarta.servlet.ServletOutputStream; +import jakarta.servlet.http.HttpServletResponse; import java.io.File; import java.io.InputStream; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import jakarta.servlet.ServletOutputStream; -import jakarta.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/job/TestTask.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/job/TestTask.java index 6c11473b..e2bfb4af 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/job/TestTask.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/job/TestTask.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/openapi/OpenCaptchaController.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/openapi/OpenCaptchaController.java index 88ef9508..7b299d4a 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/openapi/OpenCaptchaController.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/openapi/OpenCaptchaController.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemAuthService.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemAuthService.java index feb4c08b..801d9dab 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemAuthService.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemAuthService.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.service; import cn.odboy.constant.SystemConst; @@ -14,13 +29,13 @@ import cn.odboy.system.framework.permission.core.handler.UserDetailsHandler; import cn.odboy.util.KitBeanUtil; import cn.odboy.util.KitRsaEncryptUtil; import cn.odboy.util.KitValidUtil; -import jakarta.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; +import jakarta.servlet.http.HttpServletRequest; /** * 用户认证 @@ -28,76 +43,81 @@ import org.springframework.stereotype.Service; @Service public class SystemAuthService { - @Autowired - private AppProperties properties; - @Autowired - private SystemUserOnlineInfoDAO systemUserOnlineInfoDAO; - @Autowired - private TokenProvider tokenProvider; - @Autowired - private PasswordEncoder passwordEncoder; - @Autowired - private UserDetailsHandler userDetailsService; - @Autowired - private SystemCaptchaService systemCaptchaService; + @Autowired + private AppProperties properties; + @Autowired + private SystemUserOnlineInfoDAO systemUserOnlineInfoDAO; + @Autowired + private TokenProvider tokenProvider; + @Autowired + private PasswordEncoder passwordEncoder; + @Autowired + private UserDetailsHandler userDetailsService; + @Autowired + private SystemCaptchaService systemCaptchaService; - /** - * 登录 -> TestPassed - */ - public SystemAuthVo doLogin(SystemUserLoginArgs loginArgs, HttpServletRequest request) throws Exception { - KitValidUtil.notNull(loginArgs); + /** + * 登录 -> TestPassed + * + * @param loginArgs / + * @param request / + */ + public SystemAuthVo doLogin(SystemUserLoginArgs loginArgs, HttpServletRequest request) throws Exception { + KitValidUtil.notNull(loginArgs); - // 密码解密 - String password = - KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), loginArgs.getPassword()); - // 校验验证码 - systemCaptchaService.validate(loginArgs.getUuid(), loginArgs.getCode()); - // 获取用户信息 - SystemUserJwtVo jwtUser = userDetailsService.loadUserByUsername(loginArgs.getUsername()); - // 验证用户密码 - if (!passwordEncoder.matches(password, jwtUser.getPassword())) { - throw new BadRequestException("登录密码错误"); - } - - // 登录验证 - Authentication authentication = - new UsernamePasswordAuthenticationToken(jwtUser, null, jwtUser.getAuthorities()); - SecurityContextHolder.getContext().setAuthentication(authentication); - - // 生成令牌 - String token = tokenProvider.createToken(jwtUser); - // 返回 token 与 用户信息 - SystemAuthVo authInfo = new SystemAuthVo(); - authInfo.setToken(String.format("%s %s", SystemConst.TOKEN_PREFIX, token)); - /// 这里是为了清空密码 - authInfo.setUser(KitBeanUtil.copyToClass(jwtUser, SystemUserInfoVo.class)); - - if (properties.getLogin().isSingle()) { - // 踢掉之前已经登录的token - systemUserOnlineInfoDAO.kickOutByUsername(loginArgs.getUsername()); - } - // 保存在线信息 - systemUserOnlineInfoDAO.saveUserJwtModelByToken(jwtUser, token, request); - // 返回登录信息 - return authInfo; + // 密码解密 + String password = + KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), loginArgs.getPassword()); + // 校验验证码 + systemCaptchaService.validate(loginArgs.getUuid(), loginArgs.getCode()); + // 查询用户信息 + SystemUserJwtVo jwtUser = userDetailsService.loadUserByUsername(loginArgs.getUsername()); + // 验证用户密码 + if (!passwordEncoder.matches(password, jwtUser.getPassword())) { + throw new BadRequestException("登录密码错误"); } - /** - * 获取当前登录人信息 -> TestPassed - */ - public SystemUserJwtVo getCurrentUserInfo() { - SystemUserJwtVo jwtUser = (SystemUserJwtVo)KitSecurityHelper.getCurrentUser(); - if (jwtUser.getUser() != null) { - jwtUser.getUser().setPassword(null); - } - return jwtUser; - } + // 登录验证 + Authentication authentication = + new UsernamePasswordAuthenticationToken(jwtUser, null, jwtUser.getAuthorities()); + SecurityContextHolder.getContext().setAuthentication(authentication); - /** - * 退出登录 -> TestPassed - */ - public void doLogout(HttpServletRequest request) { - String token = tokenProvider.getToken(request); - systemUserOnlineInfoDAO.logoutByToken(token); + // 生成令牌 + String token = tokenProvider.createToken(jwtUser); + // 返回 token 与 用户信息 + SystemAuthVo authInfo = new SystemAuthVo(); + authInfo.setToken(String.format("%s %s", SystemConst.TOKEN_PREFIX, token)); + /// 这里是为了清空密码 + authInfo.setUser(KitBeanUtil.copyToClass(jwtUser, SystemUserInfoVo.class)); + + if (properties.getLogin().isSingle()) { + // 踢掉之前已经登录的token + systemUserOnlineInfoDAO.kickOutByUsername(loginArgs.getUsername()); } + // 保存在线信息 + systemUserOnlineInfoDAO.saveUserJwtModelByToken(jwtUser, token, request); + // 返回登录信息 + return authInfo; + } + + /** + * 查询当前登录人信息 -> TestPassed + */ + public SystemUserJwtVo getCurrentUserInfo() { + SystemUserJwtVo jwtUser = (SystemUserJwtVo) KitSecurityHelper.getCurrentUser(); + if (jwtUser.getUser() != null) { + jwtUser.getUser().setPassword(null); + } + return jwtUser; + } + + /** + * 退出登录 -> TestPassed + * + * @param request / + */ + public void doLogout(HttpServletRequest request) { + String token = tokenProvider.getToken(request); + systemUserOnlineInfoDAO.logoutByToken(token); + } } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemCaptchaService.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemCaptchaService.java index 2a6776e3..91d2ac7e 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemCaptchaService.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemCaptchaService.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.service; import cn.hutool.core.util.IdUtil; @@ -20,50 +35,49 @@ import java.util.concurrent.TimeUnit; @Service public class SystemCaptchaService { - @Autowired - private KitRedisHelper redisHelper; - @Autowired - private AppProperties properties; + @Autowired + private KitRedisHelper redisHelper; + @Autowired + private AppProperties properties; - /** - * 获取登录验证码 -> TestPassed - */ - public SystemCaptchaVo getLoginCaptcha() { - // 获取运算的结果 - Captcha captcha = properties.getLogin().getCaptchaSetting().getCaptcha(); - String uuid = SystemCacheKey.CAPTCHA_LOGIN + IdUtil.simpleUUID(); - //当验证码类型为 arithmetic时且长度 >= 2 时, captcha.text()的结果有几率为浮点型 - String captchaValue = captcha.text(); - if (captcha.getCharType() - 1 == CaptchaCodeEnum.ARITHMETIC.ordinal() && captchaValue.contains( - SystemConst.SYMBOL_DOT)) { - captchaValue = captchaValue.split("\\.")[0]; - } - // 保存 - redisHelper.set(uuid, captchaValue, properties.getLogin().getCaptchaSetting().getExpiration(), - TimeUnit.MINUTES); - // 验证码信息 - SystemCaptchaVo captchaVo = new SystemCaptchaVo(); - captchaVo.setUuid(uuid); - captchaVo.setImg(captcha.toBase64()); - return captchaVo; + /** + * 查询登录验证码 -> TestPassed + */ + public SystemCaptchaVo getLoginCaptcha() { + // 查询运算的结果 + Captcha captcha = properties.getLogin().getCaptchaSetting().getCaptcha(); + String uuid = SystemCacheKey.CAPTCHA_LOGIN + IdUtil.simpleUUID(); + //当验证码类型为 arithmetic时且长度 >= 2 时, captcha.text()的结果有几率为浮点型 + String captchaValue = captcha.text(); + if (captcha.getCharType() - 1 == CaptchaCodeEnum.ARITHMETIC.ordinal() && captchaValue.contains( + SystemConst.SYMBOL_DOT)) { + captchaValue = captchaValue.split("\\.")[0]; } + // 保存 + redisHelper.set(uuid, captchaValue, properties.getLogin().getCaptchaSetting().getExpiration(), TimeUnit.MINUTES); + // 验证码信息 + SystemCaptchaVo captchaVo = new SystemCaptchaVo(); + captchaVo.setUuid(uuid); + captchaVo.setImg(captcha.toBase64()); + return captchaVo; + } - /** - * 验证验证码 -> TestPassed - * - * @param uuid 验证码uuid - * @param inputCode 用户输入的验证码 - */ - public void validate(String uuid, String inputCode) { - // 查询验证码 - String code = redisHelper.get(uuid, String.class); - if (StrUtil.isBlank(code)) { - throw new BadRequestException("验证码不存在或已过期"); - } - // 清除验证码 - redisHelper.del(uuid); - if (StrUtil.isBlank(inputCode) || !code.equalsIgnoreCase(inputCode)) { - throw new BadRequestException("验证码错误"); - } + /** + * 验证验证码 -> TestPassed + * + * @param uuid 验证码uuid + * @param inputCode 用户输入的验证码 + */ + public void validate(String uuid, String inputCode) { + // 查询验证码 + String code = redisHelper.get(uuid, String.class); + if (StrUtil.isBlank(code)) { + throw new BadRequestException("验证码不存在或已过期"); } + // 清除验证码 + redisHelper.del(uuid); + if (StrUtil.isBlank(inputCode) || !code.equalsIgnoreCase(inputCode)) { + throw new BadRequestException("验证码错误"); + } + } } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDataService.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDataService.java index fa552094..5e1a39ee 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDataService.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDataService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,61 +37,60 @@ import java.util.stream.Collectors; @Service public class SystemDataService { - @Autowired - private SystemUserRoleService systemUserRoleService; - @Autowired - private SystemDeptService systemDeptService; - @Autowired - private SystemRoleDeptService systemRoleDeptService; + @Autowired + private SystemUserRoleService systemUserRoleService; + @Autowired + private SystemDeptService systemDeptService; + @Autowired + private SystemRoleDeptService systemRoleDeptService; - /** - * 获取数据权限 -> TestPassed - * - * @param user / - * @return / - */ - public List queryDeptIdByArgs(SystemUserVo user) { - List deptIds = new ArrayList<>(); - // 查询用户角色 - Set roleList = systemUserRoleService.listUserRoleByUserId(user.getId()); - // 获取对应的部门ID - for (SystemRoleTb role : roleList) { - SystemDataScopeEnum dataScopeEnum = SystemDataScopeEnum.find(role.getDataScope()); - switch (Objects.requireNonNull(dataScopeEnum)) { - case THIS_LEVEL: - Long currentDeptId = user.getDept().getId(); - deptIds.add(currentDeptId); - break; - case CUSTOMIZE: - // 优化 283ms -> 51 ms - List customDeptIds = this.queryCustomDataPermissionByArgs(deptIds, role.getId()); - deptIds.addAll(customDeptIds); - break; - default: - return new ArrayList<>(); - } - } - return deptIds.stream().distinct().collect(Collectors.toList()); + /** + * 查询数据权限 -> TestPassed + * + * @param user / + * @return / + */ + public List queryDeptIdByArgs(SystemUserVo user) { + List deptIds = new ArrayList<>(); + // 查询用户角色 + Set roleList = systemUserRoleService.listUserRoleByUserId(user.getId()); + // 查询对应的部门ID + for (SystemRoleTb role : roleList) { + SystemDataScopeEnum dataScopeEnum = SystemDataScopeEnum.find(role.getDataScope()); + switch (Objects.requireNonNull(dataScopeEnum)) { + case THIS_LEVEL: + Long currentDeptId = user.getDept().getId(); + deptIds.add(currentDeptId); + break; + case CUSTOMIZE: + // 优化 283ms -> 51 ms + List customDeptIds = this.queryCustomDataPermissionByArgs(deptIds, role.getId()); + deptIds.addAll(customDeptIds); + break; + default: + return new ArrayList<>(); + } } + return deptIds.stream().distinct().collect(Collectors.toList()); + } - /** - * 获取自定义的数据权限 -> TestPassed - * - * @param deptIds 部门ID(外部数据) - * @param roleId 角色ID - * @return 数据权限ID(所有部门ID数据) - */ - private List queryCustomDataPermissionByArgs(List deptIds, Long roleId) { - Set deptList = systemRoleDeptService.listUserDeptByRoleId(roleId); - Map> deptPidMap = - systemDeptService.listPidNonNull().stream().collect(Collectors.groupingBy(SystemDeptTb::getPid)); - for (SystemDeptTb dept : deptList) { - deptIds.add(dept.getId()); - List deptChildren = deptPidMap.getOrDefault(dept.getId(), null); - if (CollUtil.isNotEmpty(deptChildren)) { - deptIds.addAll(systemDeptService.queryChildDeptIdByDeptIds(deptChildren, deptPidMap)); - } - } - return deptIds; + /** + * 查询自定义的数据权限 -> TestPassed + * + * @param deptIds 部门ID(外部数据) + * @param roleId 角色ID + * @return 数据权限ID(所有部门ID数据) + */ + private List queryCustomDataPermissionByArgs(List deptIds, Long roleId) { + Set deptList = systemRoleDeptService.listUserDeptByRoleId(roleId); + Map> deptPidMap = systemDeptService.listPidNonNull().stream().collect(Collectors.groupingBy(SystemDeptTb::getPid)); + for (SystemDeptTb dept : deptList) { + deptIds.add(dept.getId()); + List deptChildren = deptPidMap.getOrDefault(dept.getId(), null); + if (CollUtil.isNotEmpty(deptChildren)) { + deptIds.addAll(systemDeptService.queryChildDeptIdByDeptIds(deptChildren, deptPidMap)); + } } + return deptIds; + } } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDeptService.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDeptService.java index f784329f..9fd4905d 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDeptService.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDeptService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,454 +55,454 @@ import java.util.stream.Collectors; @Service public class SystemDeptService { - @Autowired - private SystemDeptMapper systemDeptMapper; - @Autowired - private SystemUserDeptService systemUserDeptService; - @Autowired - private SystemRoleDeptService systemRoleDeptService; + @Autowired + private SystemDeptMapper systemDeptMapper; + @Autowired + private SystemUserDeptService systemUserDeptService; + @Autowired + private SystemRoleDeptService systemRoleDeptService; - /** - * 创建 -> TestPassed - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void saveDept(SystemCreateDeptArgs args) { - KitValidUtil.notNull(args); + /** + * 创建 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void saveDept(SystemCreateDeptArgs args) { + KitValidUtil.notNull(args); - SystemDeptTb record = KitBeanUtil.copyToClass(args, SystemDeptTb.class); - systemDeptMapper.insert(record); + SystemDeptTb record = KitBeanUtil.copyToClass(args, SystemDeptTb.class); + systemDeptMapper.insert(record); - this.updateDeptSubCnt(args.getPid()); + this.updateDeptSubCnt(args.getPid()); + } + + /** + * 编辑 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void updateDeptById(SystemDeptTb args) { + KitValidUtil.notNull(args); + // 旧的父部门 + Long oldPid = this.getDeptById(args.getId()).getPid(); + // 新的父部门 + Long newPid = args.getPid(); + if (args.getPid() != null && args.getId().equals(args.getPid())) { + throw new BadRequestException("上级不能为自己"); } + SystemDeptTb dept = systemDeptMapper.selectById(args.getId()); + args.setId(dept.getId()); + systemDeptMapper.updateById(args); + this.updateDeptSubCnt(oldPid); + this.updateDeptSubCnt(newPid); + } - /** - * 编辑 -> TestPassed - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void updateDeptById(SystemDeptTb args) { - KitValidUtil.notNull(args); - // 旧的父部门 - Long oldPid = this.getDeptById(args.getId()).getPid(); - // 新的父部门 - Long newPid = args.getPid(); - if (args.getPid() != null && args.getId().equals(args.getPid())) { - throw new BadRequestException("上级不能为自己"); + /** + * 根据部门id查询部门信息 -> TestPassed + * + * @param id 部门id + * @return / + */ + private SystemDeptTb getDeptById(Long id) { + return systemDeptMapper.selectById(id); + } + + /** + * 删除 + * + * @param ids / + */ + @Transactional(rollbackFor = Exception.class) + public void deleteDeptByIds(Set ids) { + // 查询部门, 和其所有子部门 + Set depts = this.traverseDeptByIdWithPids(ids); + // 验证是否被角色或用户关联 + this.verifyBindRelationByIds(depts); + for (SystemDeptVo dept : depts) { + systemDeptMapper.deleteById(dept.getId()); + this.updateDeptSubCnt(dept.getPid()); + } + } + + /** + * 更新父节点中子节点数目 -> TestPassed + * + * @param deptId 部门id + */ + @Transactional(rollbackFor = Exception.class) + public void updateDeptSubCnt(Long deptId) { + if (deptId != null) { + long count = this.countDeptByPid(deptId); + systemDeptMapper.updateDeptSubCountById(count, deptId); + } + } + + private long countDeptByPid(Long pid) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemDeptTb::getPid, pid); + return systemDeptMapper.selectCount(wrapper); + } + + /** + * 筛选出 list 中没有父部门(即 pid 不在其他部门 id 列表中的部门)的部门列表 + */ + private List deduplication(List list) { + List deptList = new ArrayList<>(); + // 使用 Set 存储所有部门的 id + Set idSet = list.stream().map(SystemDeptTb::getId).collect(Collectors.toSet()); + // 遍历部门列表, 筛选出没有父部门的部门 + for (SystemDeptTb dept : list) { + if (!idSet.contains(dept.getPid())) { + deptList.add(dept); + } + } + return deptList; + } + + private List queryDeptByArgs(SystemQueryDeptArgs args) { + KitValidUtil.notNull(args); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(CollUtil.isNotEmpty(args.getIds()), SystemDeptTb::getId, args.getIds()); + wrapper.like(StrUtil.isNotBlank(args.getName()), SystemDeptTb::getName, args.getName()); + wrapper.eq(args.getEnabled() != null, SystemDeptTb::getEnabled, args.getEnabled()); + wrapper.eq(args.getPid() != null, SystemDeptTb::getPid, args.getPid()); + wrapper.isNull(args.getPidIsNull() != null, SystemDeptTb::getPid); + if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { + wrapper.between(SystemDeptTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); + } + wrapper.orderByAsc(SystemDeptTb::getDeptSort); + return systemDeptMapper.selectList(wrapper); + } + + /** + * 查询所有数据 + * + * @param args / + * @param isQuery / + * @return / + * @throws Exception / + */ + public List queryAllDeptByArgs(SystemQueryDeptArgs args, Boolean isQuery) throws Exception { + String dataScopeType = KitSecurityHelper.getDataScopeType(); + if (isQuery) { + if (dataScopeType.equals(SystemDataScopeEnum.ALL.getValue())) { + args.setPidIsNull(true); + } + List fields = KitClassUtil.getAllFields(args.getClass(), new ArrayList<>()); + List fieldNames = new ArrayList<>() {{ + add("pidIsNull"); + add("enabled"); + }}; + for (Field field : fields) { + // 设置对象的访问权限, 保证对private的属性的访问 + field.setAccessible(true); + Object val = field.get(args); + if (fieldNames.contains(field.getName())) { + continue; } - SystemDeptTb dept = systemDeptMapper.selectById(args.getId()); - args.setId(dept.getId()); - systemDeptMapper.updateById(args); - this.updateDeptSubCnt(oldPid); - this.updateDeptSubCnt(newPid); - } - - /** - * 根据部门id获取部门信息 -> TestPassed - * - * @param id 部门id - * @return / - */ - private SystemDeptTb getDeptById(Long id) { - return systemDeptMapper.selectById(id); - } - - /** - * 删除 - * - * @param ids / - */ - @Transactional(rollbackFor = Exception.class) - public void deleteDeptByIds(Set ids) { - // 获取部门, 和其所有子部门 - Set depts = this.traverseDeptByIdWithPids(ids); - // 验证是否被角色或用户关联 - this.verifyBindRelationByIds(depts); - for (SystemDeptVo dept : depts) { - systemDeptMapper.deleteById(dept.getId()); - this.updateDeptSubCnt(dept.getPid()); + if (ObjectUtil.isNotNull(val)) { + args.setPidIsNull(null); + break; } + } } + // 数据权限 + args.setIds(KitSecurityHelper.getCurrentUserDataScope()); + List list = this.queryDeptByArgs(args); + // 如果为空, 就代表为自定义权限或者本级权限, 就需要去重, 不理解可以注释掉,看查询结果 + if (StrUtil.isBlank(dataScopeType)) { + return this.deduplication(list); + } + return list; + } - /** - * 更新父节点中子节点数目 -> TestPassed - * - * @param deptId / - */ - @Transactional(rollbackFor = Exception.class) - public void updateDeptSubCnt(Long deptId) { - if (deptId != null) { - long count = this.countDeptByPid(deptId); - systemDeptMapper.updateDeptSubCountById(count, deptId); + /** + * 根据ID查询 + * + * @param id / + * @return / + */ + public SystemDeptVo getDeptVoById(Long id) { + return KitBeanUtil.copyToClass(systemDeptMapper.selectById(id), SystemDeptVo.class); + } + + /** + * 查询部门下所有关联的部门 + * + * @param deptTbList / + * @param depts / + */ + private void queryRelationDeptByArgs(List deptTbList, Set depts) { + for (SystemDeptVo dept : deptTbList) { + depts.add(dept); + List deptList = this.listDeptVoByPid(dept.getId()); + if (CollUtil.isNotEmpty(deptList)) { + queryRelationDeptByArgs(deptList, depts); + } + } + } + + private List listDeptVoByPid(Long pid) { + return KitBeanUtil.copyToList(this.listDeptByPid(pid), SystemDeptVo.class); + } + + public List queryChildDeptIdByDeptIds(List deptList, Map> deptPidMap) { + List list = new ArrayList<>(); + for (SystemDeptTb systemDeptTb : deptList) { + if (systemDeptTb != null && systemDeptTb.getEnabled()) { + List deptList1 = deptPidMap.getOrDefault(systemDeptTb.getId(), null); + if (CollUtil.isNotEmpty(deptList1)) { + list.addAll(this.queryChildDeptIdByDeptIds(deptList1, deptPidMap)); } + list.add(systemDeptTb.getId()); + } } + return list; + } - private long countDeptByPid(Long pid) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemDeptTb::getPid, pid); - return systemDeptMapper.selectCount(wrapper); + /** + * 根据ID查询同级与上级数据 + * + * @param dept / + * @param deptList / + * @return / + */ + private List querySuperiorDeptByPid(SystemDeptVo dept, List deptList) { + if (dept.getPid() == null) { + deptList.addAll(this.listRootDept()); + return deptList; } + deptList.addAll(this.listDeptVoByPid(dept.getPid())); + return querySuperiorDeptByPid(this.getDeptVoById(dept.getPid()), deptList); + } - /** - * 筛选出 list 中没有父部门(即 pid 不在其他部门 id 列表中的部门)的部门列表 - */ - private List deduplication(List list) { - List deptList = new ArrayList<>(); - // 使用 Set 存储所有部门的 id - Set idSet = list.stream().map(SystemDeptTb::getId).collect(Collectors.toSet()); - // 遍历部门列表, 筛选出没有父部门的部门 - for (SystemDeptTb dept : list) { - if (!idSet.contains(dept.getPid())) { - deptList.add(dept); - } + private List listRootDept() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.isNull(SystemDeptTb::getPid); + return KitBeanUtil.copyToList(systemDeptMapper.selectList(wrapper), SystemDeptVo.class); + } + + /** + * 构建树形数据 + * + * @return / + */ + public KitPageResult searchDeptTree(List ids, Boolean exclude) { + Set deptSet1 = new LinkedHashSet<>(); + for (Long id : ids) { + // 同级数据 + SystemDeptVo dept = this.getDeptVoById(id); + // 上级数据 + List depts = this.querySuperiorDeptByPid(dept, new ArrayList<>()); + if (exclude) { + for (SystemDeptVo data : depts) { + if (data.getId().equals(dept.getPid())) { + data.setSubCount(data.getSubCount() - 1); + } } - return deptList; + // 编辑部门时不显示自己以及自己下级的数据, 避免出现PID数据环形问题 + depts = depts.stream().filter(i -> !ids.contains(i.getId())).collect(Collectors.toList()); + } + deptSet1.addAll(depts); } - - private List queryDeptByArgs(SystemQueryDeptArgs args) { - KitValidUtil.notNull(args); - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(CollUtil.isNotEmpty(args.getIds()), SystemDeptTb::getId, args.getIds()); - wrapper.like(StrUtil.isNotBlank(args.getName()), SystemDeptTb::getName, args.getName()); - wrapper.eq(args.getEnabled() != null, SystemDeptTb::getEnabled, args.getEnabled()); - wrapper.eq(args.getPid() != null, SystemDeptTb::getPid, args.getPid()); - wrapper.isNull(args.getPidIsNull() != null, SystemDeptTb::getPid); - if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { - wrapper.between(SystemDeptTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); + List deptList = new ArrayList<>(deptSet1); + // 构建部门树 + Set trees = new LinkedHashSet<>(); + Set deptSet = new LinkedHashSet<>(); + List deptNames = deptList.stream().map(SystemDeptVo::getName).collect(Collectors.toList()); + boolean isChild; + for (SystemDeptVo dept : deptList) { + isChild = false; + if (dept.getPid() == null) { + trees.add(dept); + } + for (SystemDeptVo it : deptList) { + if (it.getPid() != null && dept.getId().equals(it.getPid())) { + isChild = true; + if (dept.getChildren() == null) { + dept.setChildren(new ArrayList<>()); + } + dept.getChildren().add(it); } - wrapper.orderByAsc(SystemDeptTb::getDeptSort); - return systemDeptMapper.selectList(wrapper); + } + if (isChild) { + deptSet.add(dept); + } else if (dept.getPid() != null && !deptNames.contains(this.getDeptVoById(dept.getPid()).getName())) { + deptSet.add(dept); + } } + if (CollUtil.isEmpty(trees)) { + trees = deptSet; + } + KitPageResult baseResult = new KitPageResult<>(); + baseResult.setContent(CollUtil.isEmpty(trees) ? new ArrayList<>(deptSet) : new ArrayList<>(trees)); + baseResult.setTotalElements(deptSet.size()); + return baseResult; + } - /** - * 查询所有数据 - * - * @param args 条件 - * @param isQuery / - * @return / - * @throws Exception / - */ - public List queryAllDeptByArgs(SystemQueryDeptArgs args, Boolean isQuery) throws Exception { - String dataScopeType = KitSecurityHelper.getDataScopeType(); - if (isQuery) { - if (dataScopeType.equals(SystemDataScopeEnum.ALL.getValue())) { - args.setPidIsNull(true); - } - List fields = KitClassUtil.getAllFields(args.getClass(), new ArrayList<>()); - List fieldNames = new ArrayList<>() {{ - add("pidIsNull"); - add("enabled"); - }}; - for (Field field : fields) { - // 设置对象的访问权限, 保证对private的属性的访问 - field.setAccessible(true); - Object val = field.get(args); - if (fieldNames.contains(field.getName())) { - continue; - } - if (ObjectUtil.isNotNull(val)) { - args.setPidIsNull(null); - break; - } - } - } - // 数据权限 - args.setIds(KitSecurityHelper.getCurrentUserDataScope()); - List list = this.queryDeptByArgs(args); - // 如果为空, 就代表为自定义权限或者本级权限, 就需要去重, 不理解可以注释掉,看查询结果 - if (StrUtil.isBlank(dataScopeType)) { - return this.deduplication(list); - } - return list; + /** + * 验证是否被角色或用户关联 + * + * @param deptSet / + */ + public void verifyBindRelationByIds(Set deptSet) { + Set deptIds = deptSet.stream().map(SystemDeptVo::getId).collect(Collectors.toSet()); + if (systemUserDeptService.countUserByDeptIds(deptIds) > 0) { + throw new BadRequestException("所选部门存在用户关联,请解除后再试!"); } + if (systemRoleDeptService.countRoleByDeptIds(deptIds) > 0) { + throw new BadRequestException("所选部门存在角色关联,请解除后再试!"); + } + } - /** - * 根据ID查询 - * - * @param id / - * @return / - */ - public SystemDeptVo getDeptVoById(Long id) { - return KitBeanUtil.copyToClass(systemDeptMapper.selectById(id), SystemDeptVo.class); - } + private List listEnabledDepts() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemDeptTb::getEnabled, 1); + return systemDeptMapper.selectList(wrapper); + } - /** - * 获取部门下所有关联的部门 - * - * @param deptTbList / - * @param depts / - */ - private void queryRelationDeptByArgs(List deptTbList, Set depts) { - for (SystemDeptVo dept : deptTbList) { - depts.add(dept); - List deptList = this.listDeptVoByPid(dept.getId()); - if (CollUtil.isNotEmpty(deptList)) { - queryRelationDeptByArgs(deptList, depts); - } - } + /** + * 遍历所有部门和子部门 + * + * @param ids / + */ + public Set traverseDeptByIdWithPids(Set ids) { + Set depts = new HashSet<>(); + for (Long id : ids) { + // 根部门 + depts.add(this.getDeptVoById(id)); + // 子部门 + List deptList = this.listDeptVoByPid(id); + if (CollUtil.isNotEmpty(deptList)) { + queryRelationDeptByArgs(deptList, depts); + } } + return depts; + } - private List listDeptVoByPid(Long pid) { - return KitBeanUtil.copyToList(this.listDeptByPid(pid), SystemDeptVo.class); - } + public List listDeptSelectDataSource() { + List depts = this.listEnabledDepts(); + return buildDeptSelectOptions(depts); + } - public List queryChildDeptIdByDeptIds(List deptList, Map> deptPidMap) { - List list = new ArrayList<>(); - for (SystemDeptTb systemDeptTb : deptList) { - if (systemDeptTb != null && systemDeptTb.getEnabled()) { - List deptList1 = deptPidMap.getOrDefault(systemDeptTb.getId(), null); - if (CollUtil.isNotEmpty(deptList1)) { - list.addAll(this.queryChildDeptIdByDeptIds(deptList1, deptPidMap)); - } - list.add(systemDeptTb.getId()); - } - } - return list; + private List buildDeptSelectOptions(List depts) { + // 查询所有部门并按父子关系组织 + Map deptMap = + depts.stream().collect(Collectors.toMap(SystemDeptTb::getId, Function.identity())); + List options = new ArrayList<>(); + for (SystemDeptTb dept : depts) { + // 构建部门ID路径 + List pathIds = new ArrayList<>(); + buildDeptIdPath(dept, deptMap, pathIds); + // 反转路径,从顶级部门到当前部门 + Collections.reverse(pathIds); + SystemProductLineVo dto = new SystemProductLineVo(); + dto.setValue(dept.getId()); + dto.setIdPath(pathIds.stream().map(String::valueOf).collect(Collectors.joining("-"))); + // 保留名称路径用于显示 + dto.setLabel(buildNamePath(dept, deptMap)); + options.add(dto); } + // 按部门名称路径排序 + options.sort(Comparator.comparing(SystemProductLineVo::getLabel)); + return options; + } - /** - * 根据ID获取同级与上级数据 - * - * @param dept / - * @param deptList / - * @return / - */ - private List querySuperiorDeptByPid(SystemDeptVo dept, List deptList) { - if (dept.getPid() == null) { - deptList.addAll(this.listRootDept()); - return deptList; - } - deptList.addAll(this.listDeptVoByPid(dept.getPid())); - return querySuperiorDeptByPid(this.getDeptVoById(dept.getPid()), deptList); + private void buildDeptIdPath(SystemDeptTb dept, Map deptMap, List pathIds) { + pathIds.add(dept.getId()); + if (dept.getPid() != null && dept.getPid() != 0 && deptMap.containsKey(dept.getPid())) { + buildDeptIdPath(deptMap.get(dept.getPid()), deptMap, pathIds); } + } - private List listRootDept() { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.isNull(SystemDeptTb::getPid); - return KitBeanUtil.copyToList(systemDeptMapper.selectList(wrapper), SystemDeptVo.class); - } + private String buildNamePath(SystemDeptTb dept, Map deptMap) { + List pathNames = new ArrayList<>(); + buildDeptNamePath(dept, deptMap, pathNames); + Collections.reverse(pathNames); + return String.join(" / ", pathNames); + } - /** - * 构建树形数据 - * - * @return / - */ - public KitPageResult searchDeptTree(List ids, Boolean exclude) { - Set deptSet1 = new LinkedHashSet<>(); - for (Long id : ids) { - // 同级数据 - SystemDeptVo dept = this.getDeptVoById(id); - // 上级数据 - List depts = this.querySuperiorDeptByPid(dept, new ArrayList<>()); - if (exclude) { - for (SystemDeptVo data : depts) { - if (data.getId().equals(dept.getPid())) { - data.setSubCount(data.getSubCount() - 1); - } - } - // 编辑部门时不显示自己以及自己下级的数据, 避免出现PID数据环形问题 - depts = depts.stream().filter(i -> !ids.contains(i.getId())).collect(Collectors.toList()); - } - deptSet1.addAll(depts); - } - List deptList = new ArrayList<>(deptSet1); - // 构建部门树 - Set trees = new LinkedHashSet<>(); - Set deptSet = new LinkedHashSet<>(); - List deptNames = deptList.stream().map(SystemDeptVo::getName).collect(Collectors.toList()); - boolean isChild; - for (SystemDeptVo dept : deptList) { - isChild = false; - if (dept.getPid() == null) { - trees.add(dept); - } - for (SystemDeptVo it : deptList) { - if (it.getPid() != null && dept.getId().equals(it.getPid())) { - isChild = true; - if (dept.getChildren() == null) { - dept.setChildren(new ArrayList<>()); - } - dept.getChildren().add(it); - } - } - if (isChild) { - deptSet.add(dept); - } else if (dept.getPid() != null && !deptNames.contains(this.getDeptVoById(dept.getPid()).getName())) { - deptSet.add(dept); - } - } - if (CollUtil.isEmpty(trees)) { - trees = deptSet; - } - KitPageResult baseResult = new KitPageResult<>(); - baseResult.setContent(CollUtil.isEmpty(trees) ? new ArrayList<>(deptSet) : new ArrayList<>(trees)); - baseResult.setTotalElements(deptSet.size()); - return baseResult; + private void buildDeptNamePath(SystemDeptTb dept, Map deptMap, List pathNames) { + pathNames.add(dept.getName()); + if (dept.getPid() != null && dept.getPid() != 0 && deptMap.containsKey(dept.getPid())) { + buildDeptNamePath(deptMap.get(dept.getPid()), deptMap, pathNames); } + } - /** - * 验证是否被角色或用户关联 - * - * @param deptSet / - */ - public void verifyBindRelationByIds(Set deptSet) { - Set deptIds = deptSet.stream().map(SystemDeptVo::getId).collect(Collectors.toSet()); - if (systemUserDeptService.countUserByDeptIds(deptIds) > 0) { - throw new BadRequestException("所选部门存在用户关联,请解除后再试!"); - } - if (systemRoleDeptService.countRoleByDeptIds(deptIds) > 0) { - throw new BadRequestException("所选部门存在角色关联,请解除后再试!"); - } + public List listDeptSelectProDataSource() { + List depts = this.listEnabledDepts(); + // 查询所有部门并按父子关系组织 + Map deptMap = + depts.stream().collect(Collectors.toMap(SystemDeptTb::getId, Function.identity())); + List options = new ArrayList<>(); + // 构建树形结构 + for (SystemDeptTb dept : depts) { + // 只处理顶级部门(pid为null或0的部门) + if (dept.getPid() == null || dept.getPid() == 0) { + SystemProductLineTreeVo vo = buildDeptTreePro(dept, deptMap); + options.add(vo); + } } + // 按排序字段排序 + options.sort(Comparator.comparingInt(o -> { + Long id = Long.valueOf(o.getValue()); + return deptMap.get(id) != null ? deptMap.get(id).getDeptSort() : 0; + })); + return options; + } - private List listEnabledDepts() { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemDeptTb::getEnabled, 1); - return systemDeptMapper.selectList(wrapper); + /** + * 递归构建部门树 + * + * @param dept 当前部门 + * @param deptMap 部门映射 + * @return SystemProductLineTreeVo 树节点 + */ + private SystemProductLineTreeVo buildDeptTreePro(SystemDeptTb dept, Map deptMap) { + SystemProductLineTreeVo vo = new SystemProductLineTreeVo(); + vo.setValue(String.valueOf(dept.getId())); + vo.setLabel(dept.getName()); + // 查找子部门 + List children = new ArrayList<>(); + for (SystemDeptTb childDept : deptMap.values()) { + if (dept.getId().equals(childDept.getPid())) { + children.add(buildDeptTreePro(childDept, deptMap)); + } } + // 子部门按排序字段排序 + children.sort(Comparator.comparingInt(o -> { + Long id = Long.valueOf(o.getValue()); + return deptMap.get(id) != null ? deptMap.get(id).getDeptSort() : 0; + })); + vo.setChildren(children); + return vo; + } - /** - * 遍历所有部门和子部门 - * - * @param ids / - */ - public Set traverseDeptByIdWithPids(Set ids) { - Set depts = new HashSet<>(); - for (Long id : ids) { - // 根部门 - depts.add(this.getDeptVoById(id)); - // 子部门 - List deptList = this.listDeptVoByPid(id); - if (CollUtil.isNotEmpty(deptList)) { - queryRelationDeptByArgs(deptList, depts); - } - } - return depts; - } + public List listDeptByPid(long pid) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemDeptTb::getPid, pid); + return systemDeptMapper.selectList(wrapper); + } - public List listDeptSelectDataSource() { - List depts = this.listEnabledDepts(); - return buildDeptSelectOptions(depts); + public void exportDeptXlsx(HttpServletResponse response, SystemQueryDeptArgs args) throws Exception { + List systemDeptTbs = this.queryAllDeptByArgs(args, false); + List rowVos = new ArrayList<>(); + for (SystemDeptTb dataObject : systemDeptTbs) { + SystemDeptExportRowVo rowVo = new SystemDeptExportRowVo(); + rowVo.setName(dataObject.getName()); + rowVo.setEnabled(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR); + rowVo.setCreateTime(dataObject.getCreateTime()); + rowVos.add(rowVo); } + KitExcelExporter.exportSimple(response, "部门数据", SystemDeptExportRowVo.class, rowVos); + } - private List buildDeptSelectOptions(List depts) { - // 获取所有部门并按父子关系组织 - Map deptMap = - depts.stream().collect(Collectors.toMap(SystemDeptTb::getId, Function.identity())); - List options = new ArrayList<>(); - for (SystemDeptTb dept : depts) { - // 构建部门ID路径 - List pathIds = new ArrayList<>(); - buildDeptIdPath(dept, deptMap, pathIds); - // 反转路径,从顶级部门到当前部门 - Collections.reverse(pathIds); - SystemProductLineVo dto = new SystemProductLineVo(); - dto.setValue(dept.getId()); - dto.setIdPath(pathIds.stream().map(String::valueOf).collect(Collectors.joining("-"))); - // 保留名称路径用于显示 - dto.setLabel(buildNamePath(dept, deptMap)); - options.add(dto); - } - // 按部门名称路径排序 - options.sort(Comparator.comparing(SystemProductLineVo::getLabel)); - return options; - } - - private void buildDeptIdPath(SystemDeptTb dept, Map deptMap, List pathIds) { - pathIds.add(dept.getId()); - if (dept.getPid() != null && dept.getPid() != 0 && deptMap.containsKey(dept.getPid())) { - buildDeptIdPath(deptMap.get(dept.getPid()), deptMap, pathIds); - } - } - - private String buildNamePath(SystemDeptTb dept, Map deptMap) { - List pathNames = new ArrayList<>(); - buildDeptNamePath(dept, deptMap, pathNames); - Collections.reverse(pathNames); - return String.join(" / ", pathNames); - } - - private void buildDeptNamePath(SystemDeptTb dept, Map deptMap, List pathNames) { - pathNames.add(dept.getName()); - if (dept.getPid() != null && dept.getPid() != 0 && deptMap.containsKey(dept.getPid())) { - buildDeptNamePath(deptMap.get(dept.getPid()), deptMap, pathNames); - } - } - - public List listDeptSelectProDataSource() { - List depts = this.listEnabledDepts(); - // 获取所有部门并按父子关系组织 - Map deptMap = - depts.stream().collect(Collectors.toMap(SystemDeptTb::getId, Function.identity())); - List options = new ArrayList<>(); - // 构建树形结构 - for (SystemDeptTb dept : depts) { - // 只处理顶级部门(pid为null或0的部门) - if (dept.getPid() == null || dept.getPid() == 0) { - SystemProductLineTreeVo vo = buildDeptTreePro(dept, deptMap); - options.add(vo); - } - } - // 按排序字段排序 - options.sort(Comparator.comparingInt(o -> { - Long id = Long.valueOf(o.getValue()); - return deptMap.get(id) != null ? deptMap.get(id).getDeptSort() : 0; - })); - return options; - } - - /** - * 递归构建部门树 - * - * @param dept 当前部门 - * @param deptMap 部门映射 - * @return SystemProductLineTreeVo 树节点 - */ - private SystemProductLineTreeVo buildDeptTreePro(SystemDeptTb dept, Map deptMap) { - SystemProductLineTreeVo vo = new SystemProductLineTreeVo(); - vo.setValue(String.valueOf(dept.getId())); - vo.setLabel(dept.getName()); - // 查找子部门 - List children = new ArrayList<>(); - for (SystemDeptTb childDept : deptMap.values()) { - if (dept.getId().equals(childDept.getPid())) { - children.add(buildDeptTreePro(childDept, deptMap)); - } - } - // 子部门按排序字段排序 - children.sort(Comparator.comparingInt(o -> { - Long id = Long.valueOf(o.getValue()); - return deptMap.get(id) != null ? deptMap.get(id).getDeptSort() : 0; - })); - vo.setChildren(children); - return vo; - } - - public List listDeptByPid(long pid) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemDeptTb::getPid, pid); - return systemDeptMapper.selectList(wrapper); - } - - public void exportDeptXlsx(HttpServletResponse response, SystemQueryDeptArgs args) throws Exception { - List systemDeptTbs = this.queryAllDeptByArgs(args, false); - List rowVos = new ArrayList<>(); - for (SystemDeptTb dataObject : systemDeptTbs) { - SystemDeptExportRowVo rowVo = new SystemDeptExportRowVo(); - rowVo.setName(dataObject.getName()); - rowVo.setEnabled(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR); - rowVo.setCreateTime(dataObject.getCreateTime()); - rowVos.add(rowVo); - } - KitExcelExporter.exportSimple(response, "部门数据", SystemDeptExportRowVo.class, rowVos); - } - - public List listPidNonNull() { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemDeptTb::getEnabled, 1); - wrapper.isNotNull(SystemDeptTb::getPid); - return systemDeptMapper.selectList(wrapper); - } + public List listPidNonNull() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemDeptTb::getEnabled, 1); + wrapper.isNotNull(SystemDeptTb::getPid); + return systemDeptMapper.selectList(wrapper); + } } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDictDetailService.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDictDetailService.java index eb12357e..691e3b6e 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDictDetailService.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDictDetailService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; @@ -44,109 +43,100 @@ import java.util.stream.Collectors; @Service public class SystemDictDetailService { - @Autowired - private SystemDictDetailMapper systemDictDetailMapper; - @Autowired - private SystemDictMapper systemDictMapper; + @Autowired + private SystemDictDetailMapper systemDictDetailMapper; + @Autowired + private SystemDictMapper systemDictMapper; - /** - * 创建 -> TestPassed - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void saveDictDetail(SystemCreateDictDetailArgs args) { - KitValidUtil.notNull(args); - KitValidUtil.notNull(args.getDict()); - SystemDictDetailTb dictDetail = KitBeanUtil.copyToClass(args, SystemDictDetailTb.class); - dictDetail.setDictId(args.getDict().getId()); - systemDictDetailMapper.insert(dictDetail); + /** + * 创建 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void saveDictDetail(SystemCreateDictDetailArgs args) { + KitValidUtil.notNull(args); + KitValidUtil.notNull(args.getDict()); + SystemDictDetailTb dictDetail = KitBeanUtil.copyToClass(args, SystemDictDetailTb.class); + dictDetail.setDictId(args.getDict().getId()); + systemDictDetailMapper.insert(dictDetail); + } + + /** + * 编辑 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void updateDictDetailById(SystemDictDetailTb args) { + SystemDictDetailTb dictDetail = systemDictDetailMapper.selectById(args.getId()); + args.setId(dictDetail.getId()); + systemDictDetailMapper.insertOrUpdate(args); + } + + /** + * 删除 -> TestPassed + * + * @param id / + */ + @Transactional(rollbackFor = Exception.class) + public void deleteDictDetailById(Long id) { + systemDictDetailMapper.deleteById(id); + } + + @Transactional(rollbackFor = Exception.class) + public void deleteDictDetailByDictIds(Set ids) { + if (CollUtil.isNotEmpty(ids)) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(SystemDictDetailTb::getDictId, ids); + systemDictDetailMapper.delete(wrapper); } + } - /** - * 编辑 -> TestPassed - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void updateDictDetailById(SystemDictDetailTb args) { - SystemDictDetailTb dictDetail = systemDictDetailMapper.selectById(args.getId()); - args.setId(dictDetail.getId()); - systemDictDetailMapper.insertOrUpdate(args); + /** + * 分页查询 -> TestPassed + * + * @param args 条件 + * @param page 分页参数 + * @return / + */ + public KitPageResult searchDictDetail(SystemQueryDictDetailArgs args, + Page page) { + IPage iPage = systemDictDetailMapper.selectPageByArgs(page, args); + List dictIds = + iPage.getRecords().stream().map(SystemDictDetailVo::getDictId).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(dictIds)) { + Map id2ItemMap = + systemDictMapper.selectByIds(dictIds).stream().collect(Collectors.toMap(SystemDictTb::getId, i -> i)); + for (SystemDictDetailVo record : iPage.getRecords()) { + record.setDict(id2ItemMap.get(record.getDictId())); + } } + return KitPageUtil.toPage(iPage); + } - /** - * 删除 -> TestPassed - * - * @param id / - */ - @Transactional(rollbackFor = Exception.class) - public void deleteDictDetailById(Long id) { - systemDictDetailMapper.deleteById(id); + /** + * 根据字典名称查询字典详情 -> TestPassed + * + * @param name 字典名称 + * @return / + */ + public List listDictDetailByName(String name) { + if (StrUtil.isBlank(name)) { + return new ArrayList<>(); } - - @Transactional(rollbackFor = Exception.class) - public void deleteDictDetailByDictIds(Set ids) { - if (CollUtil.isNotEmpty(ids)) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(SystemDictDetailTb::getDictId, ids); - systemDictDetailMapper.delete(wrapper); + List detailVos = systemDictDetailMapper.listDictDetailByName(name); + if (CollUtil.isNotEmpty(detailVos)) { + SystemDictDetailVo systemDictDetailVo = detailVos.stream().findFirst().orElse(null); + if (systemDictDetailVo != null) { + SystemDictTb systemDictTb = systemDictMapper.selectById(systemDictDetailVo.getDictId()); + if (systemDictTb != null) { + for (SystemDictDetailVo detailVo : detailVos) { + detailVo.setDict(systemDictTb); + } } + } } - - /** - * 分页查询 -> TestPassed - * - * @param args 条件 - * @param page 分页参数 - * @return / - */ - public KitPageResult searchDictDetail(SystemQueryDictDetailArgs args, - Page page) { - IPage iPage = systemDictDetailMapper.selectPageByArgs(page, args); - List dictIds = - iPage.getRecords().stream().map(SystemDictDetailVo::getDictId).collect(Collectors.toList()); - if (CollUtil.isNotEmpty(dictIds)) { - Map id2ItemMap = - systemDictMapper.selectByIds(dictIds).stream().collect(Collectors.toMap(SystemDictTb::getId, i -> i)); - for (SystemDictDetailVo record : iPage.getRecords()) { - record.setDict(id2ItemMap.get(record.getDictId())); - } - } - return KitPageUtil.toPage(iPage); - } - - /** - * 根据字典名称获取字典详情 -> TestPassed - * - * @param name 字典名称 - * @return / - */ - public List listDictDetailByName(String name) { - if (StrUtil.isBlank(name)) { - return new ArrayList<>(); - } - List detailVos = systemDictDetailMapper.listDictDetailByName(name); - if (CollUtil.isNotEmpty(detailVos)) { - SystemDictDetailVo systemDictDetailVo = detailVos.stream().findFirst().orElse(null); - if (systemDictDetailVo != null) { - SystemDictTb systemDictTb = systemDictMapper.selectById(systemDictDetailVo.getDictId()); - if (systemDictTb != null) { - for (SystemDictDetailVo detailVo : detailVos) { - detailVo.setDict(systemDictTb); - } - } - } - } - return detailVos; - } - - public Map> getDictDetailMap(String dictName) { - String[] names = dictName.split("[,, ]"); - Map> dictMap = new HashMap<>(16); - for (String name : names) { - dictMap.put(name, this.listDictDetailByName(name)); - } - return dictMap; - } + return detailVos; + } } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDictService.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDictService.java index 698c24a1..e01bfb06 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDictService.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDictService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,100 +40,100 @@ import java.util.Set; @Service public class SystemDictService { - @Autowired - private SystemDictMapper systemDictMapper; - @Autowired - private SystemDictDetailService systemDictDetailService; + @Autowired + private SystemDictMapper systemDictMapper; + @Autowired + private SystemDictDetailService systemDictDetailService; - /** - * 创建 -> TestPassed - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void saveDict(SystemCreateDictArgs args) { - SystemDictTb dictTb = KitBeanUtil.copyToClass(args, SystemDictTb.class); - systemDictMapper.insert(dictTb); - } + /** + * 创建 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void saveDict(SystemCreateDictArgs args) { + SystemDictTb dictTb = KitBeanUtil.copyToClass(args, SystemDictTb.class); + systemDictMapper.insert(dictTb); + } - /** - * 编辑 -> TestPassed - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void updateDictById(SystemDictTb args) { - SystemDictTb dict = systemDictMapper.selectById(args.getId()); - dict.setName(args.getName()); - dict.setDescription(args.getDescription()); - systemDictMapper.insertOrUpdate(dict); - } + /** + * 编辑 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void updateDictById(SystemDictTb args) { + SystemDictTb dict = systemDictMapper.selectById(args.getId()); + dict.setName(args.getName()); + dict.setDescription(args.getDescription()); + systemDictMapper.insertOrUpdate(dict); + } - /** - * 删除 -> TestPassed - * - * @param ids / - */ - @Transactional(rollbackFor = Exception.class) - public void deleteDictByIds(Set ids) { - // 删除字典 - systemDictMapper.deleteByIds(ids); - // 删除字典详情 - systemDictDetailService.deleteDictDetailByDictIds(ids); - } + /** + * 删除 -> TestPassed + * + * @param ids / + */ + @Transactional(rollbackFor = Exception.class) + public void deleteDictByIds(Set ids) { + // 删除字典 + systemDictMapper.deleteByIds(ids); + // 删除字典详情 + systemDictDetailService.deleteDictDetailByDictIds(ids); + } - /** - * 分页查询 -> TestPassed - * - * @param args 条件 - * @param page 分页参数 - * @return / - */ - public KitPageResult searchDict(SystemQueryDictArgs args, Page page) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - this.injectQueryParams(args, wrapper); - Page selectPage = systemDictMapper.selectPage(page, wrapper); - return KitPageUtil.toPage(selectPage); - } + /** + * 分页查询 -> TestPassed + * + * @param args 条件 + * @param page 分页参数 + * @return / + */ + public KitPageResult searchDict(SystemQueryDictArgs args, Page page) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + this.injectQueryParams(args, wrapper); + Page selectPage = systemDictMapper.selectPage(page, wrapper); + return KitPageUtil.toPage(selectPage); + } - private void injectQueryParams(SystemQueryDictArgs args, LambdaQueryWrapper wrapper) { - if (args != null) { - wrapper.and(StrUtil.isNotBlank(args.getBlurry()), c -> c.like(SystemDictTb::getName, args.getBlurry()).or() - .like(SystemDictTb::getDescription, args.getBlurry())); - } + private void injectQueryParams(SystemQueryDictArgs args, LambdaQueryWrapper wrapper) { + if (args != null) { + wrapper.and(StrUtil.isNotBlank(args.getBlurry()), c -> c.like(SystemDictTb::getName, args.getBlurry()).or() + .like(SystemDictTb::getDescription, args.getBlurry())); } + } - public List queryDictByArgs(SystemQueryDictArgs args) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - this.injectQueryParams(args, wrapper); - return systemDictMapper.selectList(wrapper); - } + public List queryDictByArgs(SystemQueryDictArgs args) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + this.injectQueryParams(args, wrapper); + return systemDictMapper.selectList(wrapper); + } - public void exportDictXlsx(HttpServletResponse response, SystemQueryDictArgs args) { - List systemDictTbs = this.queryDictByArgs(args); - List rowVos = new ArrayList<>(); - for (SystemDictTb dataObject : systemDictTbs) { - List dictDetails = systemDictDetailService.listDictDetailByName(dataObject.getName()); - if (CollUtil.isEmpty(dictDetails)) { - SystemDictExportRowVo rowVo = new SystemDictExportRowVo(); - rowVo.setName(dataObject.getName()); - rowVo.setDescription(dataObject.getDescription()); - rowVo.setCreateTime(dataObject.getCreateTime()); - rowVo.setLabel(""); - rowVo.setValue(""); - rowVos.add(rowVo); - continue; - } - for (SystemDictDetailVo dictDetail : dictDetails) { - SystemDictExportRowVo rowVo = new SystemDictExportRowVo(); - rowVo.setName(dataObject.getName()); - rowVo.setDescription(dataObject.getDescription()); - rowVo.setCreateTime(dataObject.getCreateTime()); - rowVo.setLabel(dictDetail.getLabel()); - rowVo.setValue(dictDetail.getValue()); - rowVos.add(rowVo); - } - } - KitExcelExporter.exportSimple(response, "字典数据", SystemDictExportRowVo.class, rowVos); + public void exportDictXlsx(HttpServletResponse response, SystemQueryDictArgs args) { + List systemDictTbs = this.queryDictByArgs(args); + List rowVos = new ArrayList<>(); + for (SystemDictTb dataObject : systemDictTbs) { + List dictDetails = systemDictDetailService.listDictDetailByName(dataObject.getName()); + if (CollUtil.isEmpty(dictDetails)) { + SystemDictExportRowVo rowVo = new SystemDictExportRowVo(); + rowVo.setName(dataObject.getName()); + rowVo.setDescription(dataObject.getDescription()); + rowVo.setCreateTime(dataObject.getCreateTime()); + rowVo.setLabel(""); + rowVo.setValue(""); + rowVos.add(rowVo); + continue; + } + for (SystemDictDetailVo dictDetail : dictDetails) { + SystemDictExportRowVo rowVo = new SystemDictExportRowVo(); + rowVo.setName(dataObject.getName()); + rowVo.setDescription(dataObject.getDescription()); + rowVo.setCreateTime(dataObject.getCreateTime()); + rowVo.setLabel(dictDetail.getLabel()); + rowVo.setValue(dictDetail.getValue()); + rowVos.add(rowVo); + } } + KitExcelExporter.exportSimple(response, "字典数据", SystemDictExportRowVo.class, rowVos); + } } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemEmailService.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemEmailService.java index 8fb0cca6..de0c69ad 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemEmailService.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemEmailService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,124 +40,124 @@ import java.util.Collections; @Service public class SystemEmailService { - @Autowired - private SystemEmailConfigMapper systemEmailConfigMapper; - @Autowired - private KitRedisHelper redisHelper; - @Autowired - private AppProperties properties; + @Autowired + private SystemEmailConfigMapper systemEmailConfigMapper; + @Autowired + private KitRedisHelper redisHelper; + @Autowired + private AppProperties properties; - /** - * 更新邮件配置 -> TestPassed - * - * @param emailConfig 邮箱配置 - */ - @Transactional(rollbackFor = Exception.class) - public void updateEmailConfigById(SystemEmailConfigTb emailConfig) throws Exception { - SystemEmailConfigTb systemEmailConfigTb = getLastEmailConfig(); - if (!emailConfig.getPassword().equals(systemEmailConfigTb.getPassword())) { - // 对称加密 - systemEmailConfigTb.setPassword(KitDesEncryptUtil.desEncrypt(emailConfig.getPassword())); - } - systemEmailConfigTb.setId(1L); - systemEmailConfigMapper.insertOrUpdate(systemEmailConfigTb); + /** + * 更新邮件配置 -> TestPassed + * + * @param emailConfig 邮箱配置 + */ + @Transactional(rollbackFor = Exception.class) + public void updateEmailConfigById(SystemEmailConfigTb emailConfig) throws Exception { + SystemEmailConfigTb systemEmailConfigTb = getLastEmailConfig(); + if (!emailConfig.getPassword().equals(systemEmailConfigTb.getPassword())) { + // 对称加密 + systemEmailConfigTb.setPassword(KitDesEncryptUtil.desEncrypt(emailConfig.getPassword())); } + systemEmailConfigTb.setId(1L); + systemEmailConfigMapper.insertOrUpdate(systemEmailConfigTb); + } - /** - * 发送邮件 -> TestPassed - * - * @param sendEmailRequest 邮件发送的内容 - */ - public void sendEmail(SystemSendEmailArgs sendEmailRequest) { - SystemEmailConfigTb systemEmailConfigTb = getLastEmailConfig(); - if (systemEmailConfigTb.getId() == null) { - throw new BadRequestException("请先配置, 再操作"); - } - // 封装 - MailAccount account = new MailAccount(); - // 设置用户 - String user = systemEmailConfigTb.getFromUser().split("@")[0]; - account.setUser(user); - account.setHost(systemEmailConfigTb.getHost()); - account.setPort(Integer.parseInt(systemEmailConfigTb.getPort())); - account.setAuth(true); - try { - // 对称解密 - account.setPass(KitDesEncryptUtil.desDecrypt(systemEmailConfigTb.getPassword())); - } catch (Exception e) { - throw new BadRequestException(e.getMessage()); - } - account.setFrom(systemEmailConfigTb.getUser() + "<" + systemEmailConfigTb.getFromUser() + ">"); - // ssl方式发送 - account.setSslEnable(true); - // 使用STARTTLS安全连接 - account.setStarttlsEnable(true); - // 解决jdk8之后默认禁用部分tls协议, 导致邮件发送失败的问题 - account.setSslProtocols("TLSv1 TLSv1.1 TLSv1.2"); - String content = sendEmailRequest.getContent(); - // 发送 - try { - int size = sendEmailRequest.getTos().size(); - Mail.create(account).setTos(sendEmailRequest.getTos().toArray(new String[size])) - .setTitle(sendEmailRequest.getSubject()).setContent(content).setHtml(true) - // 关闭session - .setUseGlobalSession(false).send(); - } catch (Exception e) { - log.error("邮件发送失败", e); - throw new BadRequestException("邮件发送失败"); - } + /** + * 发送邮件 -> TestPassed + * + * @param sendEmailRequest 邮件发送的内容 + */ + public void sendEmail(SystemSendEmailArgs sendEmailRequest) { + SystemEmailConfigTb systemEmailConfigTb = getLastEmailConfig(); + if (systemEmailConfigTb.getId() == null) { + throw new BadRequestException("请先配置, 再操作"); } + // 封装 + MailAccount account = new MailAccount(); + // 设置用户 + String user = systemEmailConfigTb.getFromUser().split("@")[0]; + account.setUser(user); + account.setHost(systemEmailConfigTb.getHost()); + account.setPort(Integer.parseInt(systemEmailConfigTb.getPort())); + account.setAuth(true); + try { + // 对称解密 + account.setPass(KitDesEncryptUtil.desDecrypt(systemEmailConfigTb.getPassword())); + } catch (Exception e) { + throw new BadRequestException(e.getMessage()); + } + account.setFrom(systemEmailConfigTb.getUser() + "<" + systemEmailConfigTb.getFromUser() + ">"); + // ssl方式发送 + account.setSslEnable(true); + // 使用STARTTLS安全连接 + account.setStarttlsEnable(true); + // 解决jdk8之后默认禁用部分tls协议, 导致邮件发送失败的问题 + account.setSslProtocols("TLSv1 TLSv1.1 TLSv1.2"); + String content = sendEmailRequest.getContent(); + // 发送 + try { + int size = sendEmailRequest.getTos().size(); + Mail.create(account).setTos(sendEmailRequest.getTos().toArray(new String[size])) + .setTitle(sendEmailRequest.getSubject()).setContent(content).setHtml(true) + // 关闭session + .setUseGlobalSession(false).send(); + } catch (Exception e) { + log.error("邮件发送失败", e); + throw new BadRequestException("邮件发送失败"); + } + } - /** - * 校验邮箱验证码 -> TestPassed - */ - public void checkEmailCaptchaV1(SystemCaptchaBizEnum biEnum, String email, String code) { - String redisKey = biEnum.getRedisKey() + email; - String value = redisHelper.get(redisKey, String.class); - if (value == null || !value.equals(code)) { - throw new BadRequestException("无效验证码"); - } else { - redisHelper.del(redisKey); - } + /** + * 校验邮箱验证码 -> TestPassed + */ + public void checkEmailCaptchaV1(SystemCaptchaBizEnum biEnum, String email, String code) { + String redisKey = biEnum.getRedisKey() + email; + String value = redisHelper.get(redisKey, String.class); + if (value == null || !value.equals(code)) { + throw new BadRequestException("无效验证码"); + } else { + redisHelper.del(redisKey); } + } - /** - * 发送给邮箱验证码 - */ - public void sendCaptcha(SystemCaptchaBizEnum biEnum, String email) { - if (biEnum == null) { - throw new BadRequestException("biEnum必填"); - } - String content; - String redisKey = biEnum.getRedisKey() + email; - String oldCode = redisHelper.get(redisKey, String.class); - if (oldCode == null) { - String code = RandomUtil.randomNumbers(6); - // 存入缓存 - if (!redisHelper.set(redisKey, code, properties.getCaptcha().getExpireTime())) { - throw new BadRequestException("服务异常, 请联系网站负责人"); - } - // 存在就再次发送原来的验证码 - content = KitResourceTemplateUtil.render(null, biEnum.getTemplateName(), Dict.create().set("code", code)); - } else { - content = - KitResourceTemplateUtil.render(null, biEnum.getTemplateName(), Dict.create().set("code", oldCode)); - } - SystemSendEmailArgs sendEmailRequest = - new SystemSendEmailArgs(Collections.singletonList(email), SystemConst.CURRENT_APP_TITLE, content); - sendEmail(sendEmailRequest); + /** + * 发送给邮箱验证码 + */ + public void sendCaptcha(SystemCaptchaBizEnum biEnum, String email) { + if (biEnum == null) { + throw new BadRequestException("biEnum必填"); } + String content; + String redisKey = biEnum.getRedisKey() + email; + String oldCode = redisHelper.get(redisKey, String.class); + if (oldCode == null) { + String code = RandomUtil.randomNumbers(6); + // 存入缓存 + if (!redisHelper.set(redisKey, code, properties.getCaptcha().getExpireTime())) { + throw new BadRequestException("服务异常, 请联系网站负责人"); + } + // 存在就再次发送原来的验证码 + content = KitResourceTemplateUtil.render(null, biEnum.getTemplateName(), Dict.create().set("code", code)); + } else { + content = + KitResourceTemplateUtil.render(null, biEnum.getTemplateName(), Dict.create().set("code", oldCode)); + } + SystemSendEmailArgs sendEmailRequest = + new SystemSendEmailArgs(Collections.singletonList(email), SystemConst.CURRENT_APP_TITLE, content); + sendEmail(sendEmailRequest); + } - public SystemEmailConfigTb getLastEmailConfig() { - SystemEmailConfigTb systemEmailConfigTb = systemEmailConfigMapper.selectById(1L); - return systemEmailConfigTb == null ? new SystemEmailConfigTb() : systemEmailConfigTb; - } + public SystemEmailConfigTb getLastEmailConfig() { + SystemEmailConfigTb systemEmailConfigTb = systemEmailConfigMapper.selectById(1L); + return systemEmailConfigTb == null ? new SystemEmailConfigTb() : systemEmailConfigTb; + } - public void checkEmailCaptcha(SystemCheckEmailCaptchaArgs args) { - SystemCaptchaBizEnum biEnum = SystemCaptchaBizEnum.getByBizCode(args.getBizCode()); - if (biEnum == null) { - throw new BadRequestException("不支持的业务"); - } - this.checkEmailCaptchaV1(biEnum, args.getEmail(), args.getCode()); + public void checkEmailCaptcha(SystemCheckEmailCaptchaArgs args) { + SystemCaptchaBizEnum biEnum = SystemCaptchaBizEnum.getByBizCode(args.getBizCode()); + if (biEnum == null) { + throw new BadRequestException("不支持的业务"); } + this.checkEmailCaptchaV1(biEnum, args.getEmail(), args.getCode()); + } } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemJobService.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemJobService.java index 5a152bf2..aef9d605 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemJobService.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemJobService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,118 +40,128 @@ import java.util.Set; @Service public class SystemJobService { - @Autowired - private SystemJobMapper systemJobMapper; - @Autowired - private SystemUserJobService systemUserJobService; + @Autowired + private SystemJobMapper systemJobMapper; + @Autowired + private SystemUserJobService systemUserJobService; - /** - * 创建 -> TestPassed - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void saveJob(SystemCreateJobArgs args) { - SystemJobTb job = this.getJobByName(args.getName()); - if (job != null) { - throw new BadRequestException("职位名称已存在"); - } - SystemJobTb systemJobTb = KitBeanUtil.copyToClass(args, SystemJobTb.class); - systemJobMapper.insert(systemJobTb); + /** + * 创建 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void saveJob(SystemCreateJobArgs args) { + if (this.existJobWithName(args.getName())) { + throw new BadRequestException("职位名称已存在"); } + SystemJobTb systemJobTb = KitBeanUtil.copyToClass(args, SystemJobTb.class); + systemJobMapper.insert(systemJobTb); + } - /** - * 编辑 -> TestPassed - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void updateJobById(SystemJobTb args) { - SystemJobTb job = systemJobMapper.selectById(args.getId()); - SystemJobTb old = this.getJobByName(args.getName()); - if (old != null && !old.getId().equals(args.getId())) { - throw new BadRequestException("职位名称已存在"); - } - args.setId(job.getId()); - systemJobMapper.updateById(args); + /** + * 编辑 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void updateJobById(SystemJobTb args) { + SystemJobTb job = systemJobMapper.selectById(args.getId()); + if (this.existJobWithNameNeSelf(args.getName(), job.getId())) { + throw new BadRequestException("职位名称已存在"); } + args.setId(job.getId()); + systemJobMapper.updateById(args); + } - /** - * 删除 -> TestPassed - * - * @param ids / - */ - @Transactional(rollbackFor = Exception.class) - public void deleteJobByIds(Set ids) { - // 验证是否被用户关联 - this.verifyBindRelationByIds(ids); - systemJobMapper.deleteByIds(ids); - } + /** + * 删除 -> TestPassed + * + * @param ids / + */ + @Transactional(rollbackFor = Exception.class) + public void deleteJobByIds(Set ids) { + // 验证是否被用户关联 + this.verifyBindRelationByIds(ids); + systemJobMapper.deleteByIds(ids); + } - /** - * 分页查询 -> TestPassed - * - * @param args 条件 - * @param page 分页参数 - */ - public KitPageResult searchJobByArgs(SystemQueryJobArgs args, Page page) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - this.injectQueryParams(args, wrapper); - Page selectPage = systemJobMapper.selectPage(page, wrapper); - return KitPageUtil.toPage(selectPage); - } + /** + * 分页查询 -> TestPassed + * + * @param args 条件 + * @param page 分页参数 + */ + public KitPageResult searchJobByArgs(SystemQueryJobArgs args, Page page) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + this.injectQueryParams(args, wrapper); + Page selectPage = systemJobMapper.selectPage(page, wrapper); + return KitPageUtil.toPage(selectPage); + } - /** - * 查询全部数据 -> TestPassed - */ - public List queryJobByArgs(SystemQueryJobArgs args) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - this.injectQueryParams(args, wrapper); - return systemJobMapper.selectList(wrapper); - } + /** + * 查询全部数据 -> TestPassed + */ + public List queryJobByArgs(SystemQueryJobArgs args) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + this.injectQueryParams(args, wrapper); + return systemJobMapper.selectList(wrapper); + } - /** - * 验证是否被用户关联 -> TestPassed - * - * @param ids / - */ - public void verifyBindRelationByIds(Set ids) { - if (systemUserJobService.countUserByJobIds(ids) > 0) { - throw new BadRequestException("所选的岗位中存在用户关联, 请解除关联再试!"); - } + /** + * 验证是否被用户关联 -> TestPassed + * + * @param ids / + */ + public void verifyBindRelationByIds(Set ids) { + if (systemUserJobService.countUserByJobIds(ids) > 0) { + throw new BadRequestException("所选的岗位中存在用户关联, 请解除关联再试!"); } + } - public SystemJobTb getJobByName(String name) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemJobTb::getName, name); - return systemJobMapper.selectOne(wrapper); - } + /** + * 根据岗位名称查询岗位是否存在 -> TestPassed + */ + private boolean existJobWithName(String name) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemJobTb::getName, name); + return systemJobMapper.exists(wrapper); + } - public void injectQueryParams(SystemQueryJobArgs args, LambdaQueryWrapper wrapper) { - if (args != null) { - wrapper.like(StrUtil.isNotBlank(args.getName()), SystemJobTb::getName, args.getName()); - wrapper.eq(args.getEnabled() != null, SystemJobTb::getEnabled, args.getEnabled()); - if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { - wrapper.between(SystemJobTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); - } - } - wrapper.orderByDesc(SystemJobTb::getJobSort, SystemJobTb::getId); - } + /** + * 根据岗位名称和岗位id查询岗位是否存在 -> TestPassed + */ + private boolean existJobWithNameNeSelf(String name, Long currentJobId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemJobTb::getName, name); + wrapper.ne(SystemJobTb::getId, currentJobId); + return systemJobMapper.exists(wrapper); + } - public void exportJobXlsx(HttpServletResponse response, SystemQueryJobArgs args) { - List systemJobTbs = this.queryJobByArgs(args); - List rowVos = new ArrayList<>(); - for (SystemJobTb dataObject : systemJobTbs) { - SystemJobExportRowVo rowVo = new SystemJobExportRowVo(); - rowVo.setName(dataObject.getName()); - rowVo.setEnabled(dataObject.getEnabled() ? "启用" : "停用"); - rowVo.setCreateTime(dataObject.getCreateTime()); - rowVos.add(rowVo); - } - KitExcelExporter.exportSimple(response, "岗位数据", SystemJobExportRowVo.class, rowVos); + private void injectQueryParams(SystemQueryJobArgs args, LambdaQueryWrapper wrapper) { + if (args != null) { + wrapper.like(StrUtil.isNotBlank(args.getName()), SystemJobTb::getName, args.getName()); + wrapper.eq(args.getEnabled() != null, SystemJobTb::getEnabled, args.getEnabled()); + if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { + wrapper.between(SystemJobTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); + } } + wrapper.orderByDesc(SystemJobTb::getJobSort, SystemJobTb::getId); + } - public List listByIds(Set jobIds) { - return systemJobMapper.selectByIds(jobIds); + /** + * 导出岗位数据 -> TestPassed + */ + public void exportJobXlsx(HttpServletResponse response, SystemQueryJobArgs args) { + List systemJobTbs = this.queryJobByArgs(args); + List rowVos = new ArrayList<>(); + for (SystemJobTb dataObject : systemJobTbs) { + SystemJobExportRowVo rowVo = new SystemJobExportRowVo(); + rowVo.setName(dataObject.getName()); + rowVo.setEnabled(dataObject.getEnabled() ? "启用" : "停用"); + rowVo.setCreateTime(dataObject.getCreateTime()); + rowVos.add(rowVo); } + KitExcelExporter.exportSimple(response, "岗位数据", SystemJobExportRowVo.class, rowVos); + } } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemLocalStorageService.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemLocalStorageService.java index 2db33d35..5db8f625 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemLocalStorageService.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemLocalStorageService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,6 @@ import cn.hutool.core.io.IORuntimeException; import cn.hutool.core.util.StrUtil; import cn.odboy.base.KitPageResult; import cn.odboy.constant.FileTypeEnum; -import cn.odboy.framework.context.KitSpringBeanHolder; import cn.odboy.framework.exception.BadRequestException; import cn.odboy.framework.properties.AppProperties; import cn.odboy.framework.server.core.KitFileLocalUploadHelper; @@ -36,7 +35,9 @@ import cn.odboy.util.KitPageUtil; import cn.odboy.util.xlsx.KitExcelExporter; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; @@ -45,133 +46,144 @@ import java.io.File; import java.util.Date; import java.util.List; +@Slf4j @Service public class SystemLocalStorageService { - @Autowired - private SystemLocalStorageMapper systemLocalStorageMapper; - @Autowired - private KitFileLocalUploadHelper fileUploadPathHelper; - @Autowired - private AppProperties properties; + @Autowired + private SystemLocalStorageMapper systemLocalStorageMapper; + @Autowired + private KitFileLocalUploadHelper fileUploadPathHelper; + @Autowired + private AppProperties properties; + @Lazy + @Autowired + private SystemLocalStorageService localStorageService; - /** - * 上传 -> TestPassed - * - * @param name 文件名称 - * @param multipartFile 文件 - * @return / - */ - @Transactional(rollbackFor = Exception.class) - public SystemLocalStorageTb uploadFile(String name, MultipartFile multipartFile) { - long size = multipartFile.getSize(); - KitFileUtil.checkSize(properties.getOss().getMaxSize(), size); - String suffix = KitFileUtil.getSuffix(multipartFile.getOriginalFilename()); - String type = KitFileUtil.getFileType(suffix); - String uploadDateStr = DateUtil.format(new Date(), DatePattern.PURE_DATE_FORMAT); - File file = KitFileUtil.upload(multipartFile, fileUploadPathHelper.getPath() + uploadDateStr + File.separator); - if (file == null) { - throw new BadRequestException("上传失败"); - } - try { - String formatSize = KitFileUtil.getSize(size); - String prefixName = - StrUtil.isBlank(name) ? KitFileUtil.getPrefix(multipartFile.getOriginalFilename()) : name; - SystemLocalStorageTb localStorage = new SystemLocalStorageTb(); - localStorage.setRealName(file.getName()); - localStorage.setName(prefixName); - localStorage.setSuffix(suffix); - localStorage.setPath(file.getPath()); - localStorage.setType(type); - localStorage.setSize(formatSize); - localStorage.setDateGroup(uploadDateStr); - systemLocalStorageMapper.insert(localStorage); - return localStorage; - } catch (Exception e) { - KitFileUtil.del(file); - throw e; - } + /** + * 上传 -> TestPassed + * + * @param name 文件名称 + * @param multipartFile 文件 + * @return / + */ + @Transactional(rollbackFor = Exception.class) + public SystemLocalStorageTb uploadFile(String name, MultipartFile multipartFile) { + long size = multipartFile.getSize(); + KitFileUtil.checkSize(properties.getOss().getMaxSize(), size); + String suffix = KitFileUtil.getSuffix(multipartFile.getOriginalFilename()); + String type = KitFileUtil.getFileType(suffix); + String uploadDateStr = DateUtil.format(new Date(), DatePattern.PURE_DATE_FORMAT); + File file = KitFileUtil.upload(multipartFile, fileUploadPathHelper.getPath() + uploadDateStr + File.separator); + if (file == null) { + throw new BadRequestException("上传失败"); } + try { + String formatSize = KitFileUtil.getSize(size); + String prefixName = KitFileUtil.getPrefix(multipartFile.getOriginalFilename(), name); + SystemLocalStorageTb localStorage = new SystemLocalStorageTb(); + localStorage.setRealName(file.getName()); + localStorage.setName(prefixName); + localStorage.setSuffix(suffix); + localStorage.setPath(file.getPath()); + localStorage.setType(type); + localStorage.setSize(formatSize); + localStorage.setDateGroup(uploadDateStr); + systemLocalStorageMapper.insert(localStorage); + return localStorage; + } catch (Exception e) { + log.error("上传文件失败", e); + KitFileUtil.del(file); + throw e; + } + } - /** - * 编辑 -> TestPassed - * - * @param args 文件信息 - */ - @Transactional(rollbackFor = Exception.class) - public void updateLocalStorageById(SystemLocalStorageTb args) { - SystemLocalStorageTb localStorage = systemLocalStorageMapper.selectById(args.getId()); - localStorage.copy(args); - systemLocalStorageMapper.insertOrUpdate(localStorage); - } + /** + * 编辑 -> TestPassed + * + * @param args 文件信息 + */ + @Transactional(rollbackFor = Exception.class) + public void updateLocalStorageById(SystemLocalStorageTb args) { + systemLocalStorageMapper.updateById(args); + } - /** - * 多选删除 -> TestPassed - * - * @param ids / - */ - @Transactional(rollbackFor = Exception.class) - public void deleteFileByIds(Long[] ids) { - for (Long id : ids) { - SystemLocalStorageTb storage = systemLocalStorageMapper.selectById(id); - try { - KitFileUtil.del(storage.getPath()); - systemLocalStorageMapper.deleteById(storage); - } catch (IORuntimeException e) { - throw new BadRequestException("删除文件 " + storage.getName() + " 失败"); - } - } + /** + * 多选删除 -> TestPassed + * + * @param ids / + */ + @Transactional(rollbackFor = Exception.class) + public void deleteFileByIds(Long[] ids) { + for (Long id : ids) { + SystemLocalStorageTb storage = systemLocalStorageMapper.selectById(id); + try { + KitFileUtil.del(storage.getPath()); + systemLocalStorageMapper.deleteById(storage); + } catch (IORuntimeException e) { + throw new BadRequestException("删除文件 " + storage.getName() + " 失败"); + } } + } - /** - * 分页查询 -> TestPassed - * - * @param args 条件 - * @param page 分页参数 - * @return / - */ - public KitPageResult searchLocalStorage(SystemQueryStorageArgs args, - Page page) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - this.injectQueryParams(args, wrapper); - Page selectPage = systemLocalStorageMapper.selectPage(page, wrapper); - return KitPageUtil.toPage(selectPage); - } + /** + * 分页查询 -> TestPassed + * + * @param args 条件 + * @param page 分页参数 + * @return / + */ + public KitPageResult searchLocalStorage(SystemQueryStorageArgs args, + Page page) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + this.injectQueryParams(args, wrapper); + Page selectPage = systemLocalStorageMapper.selectPage(page, wrapper); + return KitPageUtil.toPage(selectPage); + } - private void injectQueryParams(SystemQueryStorageArgs args, LambdaQueryWrapper wrapper) { - if (args != null) { - wrapper.and(StrUtil.isNotBlank(args.getBlurry()), - c -> c.like(SystemLocalStorageTb::getName, args.getBlurry()).or() - .like(SystemLocalStorageTb::getSuffix, args.getBlurry()).or() - .like(SystemLocalStorageTb::getType, args.getBlurry()).or() - .like(SystemLocalStorageTb::getCreateBy, args.getBlurry())); - if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { - wrapper.between(SystemLocalStorageTb::getUpdateTime, args.getCreateTime().get(0), - args.getCreateTime().get(1)); - } - } - wrapper.orderByDesc(SystemLocalStorageTb::getId); + private void injectQueryParams(SystemQueryStorageArgs args, LambdaQueryWrapper wrapper) { + if (args != null) { + wrapper.and(StrUtil.isNotBlank(args.getBlurry()), + c -> c.like(SystemLocalStorageTb::getName, args.getBlurry()).or() + .like(SystemLocalStorageTb::getSuffix, args.getBlurry()).or() + .like(SystemLocalStorageTb::getType, args.getBlurry()).or() + .like(SystemLocalStorageTb::getCreateBy, args.getBlurry())); + if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { + wrapper.between(SystemLocalStorageTb::getUpdateTime, args.getCreateTime().get(0), + args.getCreateTime().get(1)); + } } + wrapper.orderByDesc(SystemLocalStorageTb::getId); + } - public List queryLocalStorageByArgs(SystemQueryStorageArgs args) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - this.injectQueryParams(args, wrapper); - return systemLocalStorageMapper.selectList(wrapper); - } + /** + * 查询文件上传记录 -> TestPassed + */ + public List queryLocalStorageByArgs(SystemQueryStorageArgs args) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + this.injectQueryParams(args, wrapper); + return systemLocalStorageMapper.selectList(wrapper); + } - public SystemLocalStorageTb uploadPictureV1(MultipartFile file) { - // 判断文件是否为图片 - String suffix = KitFileUtil.getSuffix(file.getOriginalFilename()); - if (!FileTypeEnum.IMAGE.getCode().equals(KitFileUtil.getFileType(suffix))) { - throw new BadRequestException("只能上传图片"); - } - return KitSpringBeanHolder.getBean(SystemLocalStorageService.class).uploadFile(null, file); + /** + * 上传图片 -> TestPassed + */ + @Transactional(rollbackFor = Exception.class) + public SystemLocalStorageTb uploadPicture(MultipartFile file) { + // 判断文件是否为图片 + String suffix = KitFileUtil.getSuffix(file.getOriginalFilename()); + if (!FileTypeEnum.IMAGE.getCode().equals(KitFileUtil.getFileType(suffix))) { + throw new BadRequestException("只能上传图片"); } + return localStorageService.uploadFile(null, file); + } - public void exportLocalStorageXlsx(HttpServletResponse response, SystemQueryStorageArgs args) { - List systemLocalStorageTbs = this.queryLocalStorageByArgs(args); - List rowVos = - KitBeanUtil.copyToList(systemLocalStorageTbs, SystemLocalStorageExportRowVo.class); - KitExcelExporter.exportSimple(response, "文件上传记录数据", SystemLocalStorageExportRowVo.class, rowVos); - } + /** + * 导出文件上传记录 -> TestPassed + */ + public void exportLocalStorageXlsx(HttpServletResponse response, SystemQueryStorageArgs args) { + List systemLocalStorageTbs = this.queryLocalStorageByArgs(args); + List rowVos = KitBeanUtil.copyToList(systemLocalStorageTbs, SystemLocalStorageExportRowVo.class); + KitExcelExporter.exportSimple(response, "文件上传记录数据", SystemLocalStorageExportRowVo.class, rowVos); + } } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemMenuService.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemMenuService.java index c47ae878..f3f88ec6 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemMenuService.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemMenuService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,6 @@ import cn.odboy.system.dal.model.request.SystemQueryMenuArgs; import cn.odboy.system.dal.model.response.SystemMenuMetaVo; import cn.odboy.system.dal.model.response.SystemMenuRouterVo; import cn.odboy.system.dal.model.response.SystemMenuVo; -import cn.odboy.system.dal.model.response.SystemRoleVo; import cn.odboy.system.dal.mysql.SystemMenuMapper; import cn.odboy.system.framework.permission.core.KitSecurityHelper; import cn.odboy.util.KitBeanUtil; @@ -37,6 +36,7 @@ import cn.odboy.util.xlsx.KitExcelExporter; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import jakarta.servlet.http.HttpServletResponse; @@ -46,431 +46,542 @@ import java.util.HashSet; import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; -import java.util.Objects; +import java.util.Map; import java.util.Set; import java.util.stream.Collectors; @Service public class SystemMenuService { - @Autowired - private SystemMenuMapper systemMenuMapper; - @Autowired - private SystemRoleMenuService systemRoleMenuService; - @Autowired - private SystemUserRoleService systemUserRoleService; + @Autowired + private SystemMenuMapper systemMenuMapper; + @Autowired + private SystemRoleMenuService systemRoleMenuService; + @Autowired + private SystemUserRoleService systemUserRoleService; + @Lazy + @Autowired + private SystemMenuService proxyService; - /** - * 创建 - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void saveMenu(SystemMenuTb args) { - if (this.getMenuByTitle(args.getTitle()) != null) { - throw new BadRequestException("菜单标题已存在"); - } - if (StrUtil.isNotBlank(args.getComponentName())) { - if (this.getMenuByComponentName(args.getComponentName()) != null) { - throw new BadRequestException("菜单组件名称已存在"); + /** + * 创建 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void saveMenu(SystemMenuTb args) { + if (this.existMenuWithTitle(args.getTitle())) { + throw new BadRequestException("菜单标题已存在"); + } + if (StrUtil.isNotBlank(args.getComponentName())) { + if (this.existMenuWithComponentName(args.getComponentName())) { + throw new BadRequestException("菜单组件名称已存在"); + } + } + if (Long.valueOf(0L).equals(args.getPid())) { + // 顶级目录 + args.setPid(null); + } + if (args.getIFrame()) { + if (!(args.getPath().toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTP) || args.getPath() + .toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTPS))) { + throw new BadRequestException(SystemTransferProtocolConst.PREFIX_HTTPS_BAD_REQUEST); + } + } + systemMenuMapper.insert(args); + // 计算子节点数目 + args.setSubCount(0); + // 更新父节点菜单数目 + this.updateMenuSubCnt(args.getPid()); + } + + /** + * 根据组件名称查询菜单是否存在 -> TestPassed + * + * @param componentName 组件名称 + * @return / + */ + private boolean existMenuWithComponentName(String componentName) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemMenuTb::getComponentName, componentName); + return systemMenuMapper.exists(wrapper); + } + + /** + * 根据组件名称查询菜单是否存在 -> TestPassed + * + * @param componentName 组件名称 + * @return / + */ + private boolean existMenuWithComponentNameNeSelf(String componentName, Long currentMenuId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemMenuTb::getComponentName, componentName); + wrapper.ne(SystemMenuTb::getId, currentMenuId); + return systemMenuMapper.exists(wrapper); + } + + /** + * 根据菜单标题查询菜单是否存在 -> TestPassed + * + * @param title 菜单标题 + * @return / + */ + private boolean existMenuWithTitle(String title) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemMenuTb::getTitle, title); + return systemMenuMapper.exists(wrapper); + } + + /** + * 根据菜单标题查询菜单是否存在 -> TestPassed + * + * @param title 菜单标题 + * @return / + */ + private boolean existMenuWithTitleNeSelf(String title, Long currentMenuId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemMenuTb::getTitle, title); + wrapper.ne(SystemMenuTb::getId, currentMenuId); + return systemMenuMapper.exists(wrapper); + } + + /** + * 编辑 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void updateMenuById(SystemMenuTb args) { + if (args.getId().equals(args.getPid())) { + throw new BadRequestException("上级不能为自己"); + } + SystemMenuTb menu = systemMenuMapper.selectById(args.getId()); + if (args.getIFrame()) { + if (!(args.getPath().toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTP) || args.getPath() + .toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTPS))) { + throw new BadRequestException(SystemTransferProtocolConst.PREFIX_HTTPS_BAD_REQUEST); + } + } + if (this.existMenuWithTitleNeSelf(args.getTitle(), menu.getId())) { + throw new BadRequestException("菜单标题已存在"); + } + if (args.getPid().equals(0L)) { + args.setPid(null); + } + // 记录的父节点ID + Long oldPid = menu.getPid(); + Long newPid = args.getPid(); + if (StrUtil.isNotBlank(args.getComponentName())) { + if (this.existMenuWithComponentNameNeSelf(args.getTitle(), menu.getId())) { + throw new BadRequestException("菜单组件名称已存在"); + } + } + menu.setTitle(args.getTitle()); + menu.setComponent(args.getComponent()); + menu.setPath(args.getPath()); + menu.setIcon(args.getIcon()); + menu.setIFrame(args.getIFrame()); + menu.setPid(args.getPid()); + menu.setMenuSort(args.getMenuSort()); + menu.setCache(args.getCache()); + menu.setHidden(args.getHidden()); + menu.setComponentName(args.getComponentName()); + menu.setPermission(args.getPermission()); + menu.setType(args.getType()); + // auto fill + menu.setUpdateBy(null); + menu.setUpdateTime(null); + systemMenuMapper.updateById(menu); + // 计算父级菜单节点数目 + this.updateMenuSubCnt(oldPid); + this.updateMenuSubCnt(newPid); + } + + /** + * 删除 -> TestPassed + */ + @Transactional(rollbackFor = Exception.class) + public void deleteMenuByIds(Set ids) { + // Set menuSet = new HashSet<>(); + // for (Long id : ids) { + // List menuList = this.listMenuByPid(id); + // menuSet.add(this.getMenuVoById(id)); + // menuSet = this.queryChildMenuByArgs(menuList, menuSet); + // } + // List menuIds = menuSet.stream().map(SystemMenuVo::getId).filter(Objects::nonNull).distinct().collect(Collectors.toList()); + // if (CollUtil.isNotEmpty(menuIds)) { + // systemRoleMenuService.deleteRoleMenuByMenuIds(menuIds); + // systemMenuMapper.deleteByIds(menuIds); + // } + // for (SystemMenuVo menu : menuSet) { + // this.updateMenuSubCnt(menu.getPid()); + // } + // ========= 优化 20260114 ========= + if (CollUtil.isEmpty(ids)) { + return; + } + // 查询所有菜单数据 + List allMenus = systemMenuMapper.listAll(); + // 根据ID集合获取当前菜单和其子菜单 + Set allMenuIds = this.getAllMenuIdsWithChildren(ids, allMenus); + if (CollUtil.isNotEmpty(allMenuIds)) { + // 删除角色菜单关联 + systemRoleMenuService.deleteRoleMenuByMenuIds(allMenuIds); + // 批量删除菜单 + systemMenuMapper.deleteByIds(allMenuIds); + // 更新父级菜单子节点数量 + this.updateParentMenuCounts(allMenuIds, allMenus); + } + } + + /** + * 从所有菜单中找出指定ID及其子菜单ID + * + * @param rootIds 要删除的根菜单ID集合 + * @param allMenus 所有菜单数据 + * @return 包含根菜单及其所有子菜单的ID集合 + */ + private Set getAllMenuIdsWithChildren(Set rootIds, List allMenus) { + Set result = new HashSet<>(rootIds); + Set currentLevelIds = new HashSet<>(rootIds); + // 构建父ID到子菜单的映射 + Map> parentToChildrenMap = allMenus.stream().filter(menu -> menu.getPid() != null) + .collect(Collectors.groupingBy(SystemMenuTb::getPid)); + while (!currentLevelIds.isEmpty()) { + Set nextLevelIds = new HashSet<>(); + // 对于当前层级的每个菜单ID,查找其子菜单 + for (Long parentId : currentLevelIds) { + List children = parentToChildrenMap.get(parentId); + if (children != null && !children.isEmpty()) { + for (SystemMenuTb child : children) { + if (result.add(child.getId())) { // 如果成功添加(之前不存在),则继续查找其子菜单 + nextLevelIds.add(child.getId()); } + } } - if (Long.valueOf(0L).equals(args.getPid())) { - args.setPid(null); - } - if (args.getIFrame()) { - if (!(args.getPath().toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTP) || args.getPath() - .toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTPS))) { - throw new BadRequestException(SystemTransferProtocolConst.PREFIX_HTTPS_BAD_REQUEST); - } - } - systemMenuMapper.insert(args); - // 计算子节点数目 - args.setSubCount(0); - // 更新父节点菜单数目 - this.updateMenuSubCnt(args.getPid()); + } + currentLevelIds = nextLevelIds; } + return result; + } - /** - * 编辑 - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void updateMenuById(SystemMenuTb args) { - if (args.getId().equals(args.getPid())) { - throw new BadRequestException("上级不能为自己"); - } - SystemMenuTb menu = systemMenuMapper.selectById(args.getId()); - if (args.getIFrame()) { - if (!(args.getPath().toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTP) || args.getPath() - .toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTPS))) { - throw new BadRequestException(SystemTransferProtocolConst.PREFIX_HTTPS_BAD_REQUEST); - } - } - SystemMenuTb menu1 = this.getMenuByTitle(args.getTitle()); - if (menu1 != null && !menu1.getId().equals(menu.getId())) { - throw new BadRequestException("菜单标题已存在"); - } - if (args.getPid().equals(0L)) { - args.setPid(null); - } - // 记录的父节点ID - Long oldPid = menu.getPid(); - Long newPid = args.getPid(); - if (StrUtil.isNotBlank(args.getComponentName())) { - menu1 = this.getMenuByComponentName(args.getComponentName()); - if (menu1 != null && !menu1.getId().equals(menu.getId())) { - throw new BadRequestException("菜单组件名称已存在"); - } - } - menu.setTitle(args.getTitle()); - menu.setComponent(args.getComponent()); - menu.setPath(args.getPath()); - menu.setIcon(args.getIcon()); - menu.setIFrame(args.getIFrame()); - menu.setPid(args.getPid()); - menu.setMenuSort(args.getMenuSort()); - menu.setCache(args.getCache()); - menu.setHidden(args.getHidden()); - menu.setComponentName(args.getComponentName()); - menu.setPermission(args.getPermission()); - menu.setType(args.getType()); - // auto fill - menu.setUpdateBy(null); - menu.setUpdateTime(null); - systemMenuMapper.insertOrUpdate(menu); - // 计算父级菜单节点数目 - this.updateMenuSubCnt(oldPid); - this.updateMenuSubCnt(newPid); + /** + * 更新被删除菜单的父菜单子节点计数 + */ + private void updateParentMenuCounts(Set deletedMenuIds, List allMenus) { + // 获取被删除菜单的父ID + Set parentIds = + allMenus.stream().filter(menu -> deletedMenuIds.contains(menu.getId()) && menu.getPid() != null) + .map(SystemMenuTb::getPid).collect(Collectors.toSet()); + // 更新每个父菜单的子节点计数 + for (Long parentId : parentIds) { + proxyService.updateMenuSubCnt(parentId); } + } - /** - * 删除 - */ - @Transactional(rollbackFor = Exception.class) - public void deleteMenuByIds(Set ids) { - Set menuSet = new HashSet<>(); - for (Long id : ids) { - List menuList = this.listMenuByPid(id); - menuSet.add(this.getMenuVoById(id)); - menuSet = this.queryChildMenuByArgs(menuList, menuSet); - } - List menuIds = - menuSet.stream().map(SystemMenuVo::getId).filter(Objects::nonNull).distinct().collect(Collectors.toList()); - if (CollUtil.isNotEmpty(menuIds)) { - systemRoleMenuService.deleteRoleMenuByMenuIds(menuIds); - systemMenuMapper.deleteByIds(menuIds); - } - for (SystemMenuVo menu : menuSet) { - this.updateMenuSubCnt(menu.getPid()); - } + /** + * 根据菜单id查询目录 -> TestPassed + * + * @param id 菜单id + */ + private SystemMenuTb getMenuById(Long id) { + return systemMenuMapper.selectById(id); + } + + @Transactional(rollbackFor = Exception.class) + public void updateMenuSubCnt(Long menuId) { + if (menuId != null) { + long count = this.countMenuByPid(menuId); + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); + wrapper.eq(SystemMenuTb::getId, menuId); + wrapper.set(SystemMenuTb::getSubCount, count); + systemMenuMapper.update(wrapper); } + } - private SystemMenuVo getMenuVoById(Long id) { - return KitBeanUtil.copyToClass(systemMenuMapper.selectById(id), SystemMenuVo.class); - } - - @Transactional(rollbackFor = Exception.class) - public void updateMenuSubCnt(Long menuId) { - if (menuId != null) { - long count = this.countMenuByPid(menuId); - LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); - wrapper.eq(SystemMenuTb::getId, menuId); - wrapper.set(SystemMenuTb::getSubCount, count); - systemMenuMapper.update(wrapper); + /** + * 查询全部数据 + * + * @param args 条件 + * @param isQuery / + * @return / + * @throws Exception / + */ + public List queryAllMenu(SystemQueryMenuArgs args, Boolean isQuery) throws Exception { + if (Boolean.TRUE.equals(isQuery)) { + args.setPidIsNull(true); + List fields = KitClassUtil.getAllFields(args.getClass(), new ArrayList<>()); + for (Field field : fields) { + //设置对象的访问权限, 保证对private的属性的访问 + field.setAccessible(true); + Object val = field.get(args); + if ("pidIsNull".equals(field.getName())) { + continue; } - } - - /** - * 查询全部数据 - * - * @param args 条件 - * @param isQuery / - * @return / - * @throws Exception / - */ - public List queryAllMenu(SystemQueryMenuArgs args, Boolean isQuery) throws Exception { - if (Boolean.TRUE.equals(isQuery)) { - args.setPidIsNull(true); - List fields = KitClassUtil.getAllFields(args.getClass(), new ArrayList<>()); - for (Field field : fields) { - //设置对象的访问权限, 保证对private的属性的访问 - field.setAccessible(true); - Object val = field.get(args); - if ("pidIsNull".equals(field.getName())) { - continue; - } - // 如果有查询条件, 则不指定pidIsNull - if (ObjectUtil.isNotNull(val)) { - args.setPidIsNull(null); - break; - } - } + // 如果有查询条件, 则不指定pidIsNull + if (ObjectUtil.isNotNull(val)) { + args.setPidIsNull(null); + break; } - return this.queryMenuByArgs(args); + } } + return this.queryMenuByArgs(args); + } - /** - * 根据当前用户获取菜单 - * - * @param currentUserId / - * @return / - */ - public List listMenuByUserId(Long currentUserId) { - List roles = systemUserRoleService.queryRoleVoByUsersId(currentUserId); - Set roleIds = roles.stream().map(SystemRoleVo::getId).collect(Collectors.toSet()); - return new ArrayList<>(systemRoleMenuService.queryMenuByRoleIds(roleIds)); + /** + * 根据当前用户查询菜单 + * + * @param currentUserId / + * @return / + */ + public List listMenuByUserId(Long currentUserId) { +// List roles = systemUserRoleService.listRoleVoByUsersId(currentUserId); +// Set roleIds = roles.stream().map(SystemRoleVo::getId).collect(Collectors.toSet()); + Set roleIds = systemUserRoleService.listUserRoleIdByUserId(currentUserId); + return systemRoleMenuService.listMenuByRoleIds(roleIds, false); + } + +// /** +// * 查询所有子节点, 包含自身ID +// * +// * @param menuList / +// * @param menuSet / +// * @return / +// */ +// public Set queryChildMenuByArgs(List menuList, Set menuSet) { +// for (SystemMenuTb menu : menuList) { +// menuSet.add(menu); +// List menus = this.listMenuByPid(menu.getId()); +// if (CollUtil.isNotEmpty(menus)) { +// queryChildMenuByArgs(menus, menuSet); +// } +// } +// return menuSet; +// } + + /** + * 懒加载菜单数据 + * + * @param pid / + * @return / + */ + public List listMenuByPid(Long pid) { + List menus; + if (pid != null && !pid.equals(0L)) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemMenuTb::getPid, pid); + wrapper.orderByAsc(SystemMenuTb::getMenuSort); + return systemMenuMapper.selectList(wrapper); + } else { + menus = this.listRootMenu(); } + return menus; + } - /** - * 获取所有子节点, 包含自身ID - * - * @param menuList / - * @param menuSet / - * @return / - */ - public Set queryChildMenuByArgs(List menuList, Set menuSet) { - for (SystemMenuVo menu : menuList) { - menuSet.add(menu); - List menus = this.listMenuByPid(menu.getId()); - if (CollUtil.isNotEmpty(menus)) { - queryChildMenuByArgs(menus, menuSet); - } + /** + * 根据ID查询同级与上级数据 -> TestPassed + * + * @param menu / + * @param menus / + * @return / + */ + public List querySuperiorMenuByArgs(SystemMenuTb menu, List menus) { + if (menu.getPid() == null) { + menus.addAll(this.listRootMenu()); + return menus; + } + menus.addAll(this.listMenuByPid(menu.getPid())); + return querySuperiorMenuByArgs(this.getMenuById(menu.getPid()), menus); + } + + /** + * 构建菜单树 + * + * @param menus 原始数据 + * @return / + */ + public List buildMenuTree(List menus) { + List systemMenuVos = KitBeanUtil.copyToList(menus, SystemMenuVo.class); + List trees = new ArrayList<>(); + Set ids = new HashSet<>(); + for (SystemMenuVo menu : systemMenuVos) { + if (menu.getPid() == null) { + trees.add(menu); + } + for (SystemMenuVo it : systemMenuVos) { + if (menu.getId().equals(it.getPid())) { + if (menu.getChildren() == null) { + menu.setChildren(new ArrayList<>()); + } + menu.getChildren().add(it); + ids.add(it.getId()); } - return menuSet; + } } - - /** - * 懒加载菜单数据 - * - * @param pid / - * @return / - */ - public List listMenuByPid(Long pid) { - List menus; - if (pid != null && !pid.equals(0L)) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemMenuTb::getPid, pid); - wrapper.orderByAsc(SystemMenuTb::getMenuSort); - return KitBeanUtil.copyToList(systemMenuMapper.selectList(wrapper), SystemMenuVo.class); - } else { - menus = this.listRootMenu(); - } - return menus; + if (CollUtil.isNotEmpty(trees)) { + trees = systemMenuVos.stream().filter(s -> !ids.contains(s.getId())).collect(Collectors.toList()); } + return trees; + } - /** - * 根据ID获取同级与上级数据 - * - * @param menu / - * @param menus / - * @return / - */ - public List querySuperiorMenuByArgs(SystemMenuVo menu, List menus) { - if (menu.getPid() == null) { - menus.addAll(this.listRootMenu()); - return menus; - } - menus.addAll(this.listMenuByPid(menu.getPid())); - return querySuperiorMenuByArgs(this.getMenuVoById(menu.getPid()), menus); - } - - /** - * 构建菜单树 - * - * @param menus 原始数据 - * @return / - */ - public List buildMenuTree(List menus) { - List trees = new ArrayList<>(); - Set ids = new HashSet<>(); - for (SystemMenuVo menu : menus) { - if (menu.getPid() == null) { - trees.add(menu); - } - for (SystemMenuVo it : menus) { - if (menu.getId().equals(it.getPid())) { - if (menu.getChildren() == null) { - menu.setChildren(new ArrayList<>()); - } - menu.getChildren().add(it); - ids.add(it.getId()); - } - } - } - if (CollUtil.isNotEmpty(trees)) { - trees = menus.stream().filter(s -> !ids.contains(s.getId())).collect(Collectors.toList()); - } - return trees; - } - - /** - * 构建菜单树 - * - * @param menus / - * @return / - */ - public List buildMenuVo(List menus) { - List list = new LinkedList<>(); - for (SystemMenuVo menu : menus) { - if (menu != null) { - List menuList = menu.getChildren(); - SystemMenuRouterVo menuVo = new SystemMenuRouterVo(); - menuVo.setName( - ObjectUtil.isNotEmpty(menu.getComponentName()) ? menu.getComponentName() : menu.getTitle()); - // 一级目录需要加斜杠, 不然会报警告 - menuVo.setPath(menu.getPid() == null ? "/" + menu.getPath() : menu.getPath()); - menuVo.setHidden(menu.getHidden()); - // 如果不是外链 - if (!menu.getIFrame()) { - if (menu.getPid() == null) { - menuVo.setComponent(StrUtil.isEmpty(menu.getComponent()) ? "Layout" : menu.getComponent()); - // 如果不是一级菜单,并且菜单类型为目录,则代表是多级菜单 - } else if (menu.getType() == 0) { - menuVo.setComponent(StrUtil.isEmpty(menu.getComponent()) ? "ParentView" : menu.getComponent()); - } else if (StrUtil.isNotBlank(menu.getComponent())) { - menuVo.setComponent(menu.getComponent()); - } - } - menuVo.setMeta(new SystemMenuMetaVo(menu.getTitle(), menu.getIcon(), !menu.getCache())); - if (CollUtil.isNotEmpty(menuList)) { - menuVo.setAlwaysShow(true); - menuVo.setRedirect("noredirect"); - menuVo.setChildren(buildMenuVo(menuList)); - // 处理是一级菜单并且没有子菜单的情况 - } else if (menu.getPid() == null) { - SystemMenuRouterVo menuVo1 = getMenuVo(menu, menuVo); - menuVo.setName(null); - menuVo.setMeta(null); - menuVo.setComponent("Layout"); - List list1 = new ArrayList<>(); - list1.add(menuVo1); - menuVo.setChildren(list1); - } - list.add(menuVo); - } - } - return list; - } - - /** - * 获取 MenuResponse - * - * @param menu / - * @param menuVo / - * @return / - */ - private SystemMenuRouterVo getMenuVo(SystemMenuVo menu, SystemMenuRouterVo menuVo) { - SystemMenuRouterVo menuVo1 = new SystemMenuRouterVo(); - menuVo1.setMeta(menuVo.getMeta()); - // 非外链 + /** + * 构建菜单树 + * + * @param menus / + * @return / + */ + public List buildMenuVo(List menus) { + List list = new LinkedList<>(); + for (SystemMenuVo menu : menus) { + if (menu != null) { + List menuList = menu.getChildren(); + SystemMenuRouterVo menuVo = new SystemMenuRouterVo(); + menuVo.setName( + ObjectUtil.isNotEmpty(menu.getComponentName()) ? menu.getComponentName() : menu.getTitle()); + // 一级目录需要加斜杠, 不然会报警告 + menuVo.setPath(menu.getPid() == null ? "/" + menu.getPath() : menu.getPath()); + menuVo.setHidden(menu.getHidden()); + // 如果不是外链 if (!menu.getIFrame()) { - menuVo1.setPath("index"); - menuVo1.setName(menuVo.getName()); - menuVo1.setComponent(menuVo.getComponent()); - } else { - menuVo1.setPath(menu.getPath()); + if (menu.getPid() == null) { + menuVo.setComponent(StrUtil.isEmpty(menu.getComponent()) ? "Layout" : menu.getComponent()); + // 如果不是一级菜单,并且菜单类型为目录,则代表是多级菜单 + } else if (menu.getType() == 0) { + menuVo.setComponent(StrUtil.isEmpty(menu.getComponent()) ? "ParentView" : menu.getComponent()); + } else if (StrUtil.isNotBlank(menu.getComponent())) { + menuVo.setComponent(menu.getComponent()); + } } - return menuVo1; - } - - public List listMenuByIds(List ids) { - return KitBeanUtil.copyToList(systemMenuMapper.selectByIds(ids), SystemMenuVo.class); - } - - private SystemMenuTb getMenuByComponentName(String componentName) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemMenuTb::getComponentName, componentName); - return systemMenuMapper.selectOne(wrapper); - } - - private SystemMenuTb getMenuByTitle(String title) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemMenuTb::getTitle, title); - return systemMenuMapper.selectOne(wrapper); - } - - private Long countMenuByPid(Long pid) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemMenuTb::getPid, pid); - return systemMenuMapper.selectCount(wrapper); - } - - private List queryMenuByArgs(SystemQueryMenuArgs args) { - KitValidUtil.notNull(args); - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.isNull(args.getPidIsNull() != null, SystemMenuTb::getPid); - wrapper.eq(args.getPid() != null, SystemMenuTb::getPid, args.getPid()); - wrapper.and(StrUtil.isNotBlank(args.getBlurry()), c -> c.like(SystemMenuTb::getTitle, args.getBlurry()).or() - .like(SystemMenuTb::getComponentName, args.getBlurry()).or() - .like(SystemMenuTb::getPermission, args.getBlurry())); - if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { - wrapper.between(SystemMenuTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); + menuVo.setMeta(new SystemMenuMetaVo(menu.getTitle(), menu.getIcon(), !menu.getCache())); + if (CollUtil.isNotEmpty(menuList)) { + menuVo.setAlwaysShow(true); + menuVo.setRedirect("noredirect"); + menuVo.setChildren(buildMenuVo(menuList)); + // 处理是一级菜单并且没有子菜单的情况 + } else if (menu.getPid() == null) { + SystemMenuRouterVo menuVo1 = getMenuVo(menu, menuVo); + menuVo.setName(null); + menuVo.setMeta(null); + menuVo.setComponent("Layout"); + List list1 = new ArrayList<>(); + list1.add(menuVo1); + menuVo.setChildren(list1); } - wrapper.orderByAsc(SystemMenuTb::getMenuSort); - return systemMenuMapper.selectList(wrapper); + list.add(menuVo); + } } + return list; + } - private List listRootMenu() { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.isNull(SystemMenuTb::getPid); - wrapper.orderByAsc(SystemMenuTb::getMenuSort); - return KitBeanUtil.copyToList(systemMenuMapper.selectList(wrapper), SystemMenuVo.class); + /** + * 查询 MenuResponse + * + * @param menu / + * @param menuVo / + * @return / + */ + private SystemMenuRouterVo getMenuVo(SystemMenuVo menu, SystemMenuRouterVo menuVo) { + SystemMenuRouterVo menuVo1 = new SystemMenuRouterVo(); + menuVo1.setMeta(menuVo.getMeta()); + // 非外链 + if (!menu.getIFrame()) { + menuVo1.setPath("index"); + menuVo1.setName(menuVo.getName()); + menuVo1.setComponent(menuVo.getComponent()); + } else { + menuVo1.setPath(menu.getPath()); } + return menuVo1; + } - public List buildFrontMenus() { - List originMenus = this.listMenuByUserId(KitSecurityHelper.getCurrentUserId()); - List targetMenus = this.buildMenuTree(originMenus); - return this.buildMenuVo(targetMenus); + public List listMenuByIds(List ids) { + return systemMenuMapper.selectByIds(ids); + } + + private Long countMenuByPid(Long pid) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemMenuTb::getPid, pid); + return systemMenuMapper.selectCount(wrapper); + } + + private List queryMenuByArgs(SystemQueryMenuArgs args) { + KitValidUtil.notNull(args); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.isNull(args.getPidIsNull() != null, SystemMenuTb::getPid); + wrapper.eq(args.getPid() != null, SystemMenuTb::getPid, args.getPid()); + wrapper.and(StrUtil.isNotBlank(args.getBlurry()), c -> c.like(SystemMenuTb::getTitle, args.getBlurry()).or() + .like(SystemMenuTb::getComponentName, args.getBlurry()).or() + .like(SystemMenuTb::getPermission, args.getBlurry())); + if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { + wrapper.between(SystemMenuTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); } + wrapper.orderByAsc(SystemMenuTb::getMenuSort); + return systemMenuMapper.selectList(wrapper); + } - public Set listChildMenuSetByMenuId(Long id) { - Set menuSet = new HashSet<>(); - List menuList = this.listMenuByPid(id); - menuSet.add(this.getMenuVoById(id)); - menuSet = this.queryChildMenuByArgs(menuList, menuSet); - return menuSet.stream().map(SystemMenuVo::getId).collect(Collectors.toSet()); - } + /** + * 查询根目录 -> TestPassed + */ + private List listRootMenu() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.isNull(SystemMenuTb::getPid); + wrapper.orderByAsc(SystemMenuTb::getMenuSort); + return systemMenuMapper.selectList(wrapper); + } - public List listMenuSuperior(List ids) { - Set menus; - List systemMenuTbs; - if (CollUtil.isNotEmpty(ids)) { - menus = new LinkedHashSet<>(this.listMenuByIds(ids)); - for (SystemMenuVo menu : menus) { - List menuList = this.querySuperiorMenuByArgs(menu, new ArrayList<>()); - for (SystemMenuVo data : menuList) { - if (data.getId().equals(menu.getPid())) { - data.setSubCount(data.getSubCount() - 1); - } - } - menus.addAll(menuList); - } - // 编辑菜单时不显示自己以及自己下级的数据, 避免出现PID数据环形问题 - menus = menus.stream().filter(i -> !ids.contains(i.getId())).collect(Collectors.toSet()); - List newMenuList = new ArrayList<>(menus); - systemMenuTbs = this.buildMenuTree(newMenuList); - } else { - systemMenuTbs = this.listMenuByPid(null); + public List buildFrontMenus() { + List originMenus = this.listMenuByUserId(KitSecurityHelper.getCurrentUserId()); + List targetMenus = this.buildMenuTree(originMenus); + return this.buildMenuVo(targetMenus); + } + + public Set listChildMenuSetByMenuId(Long id) { +// Set menuSet = new HashSet<>(); +// List menuList = this.listMenuByPid(id); +// menuSet.add(this.getMenuById(id)); +// menuSet = this.queryChildMenuByArgs(menuList, menuSet); +// return menuSet.stream().map(SystemMenuTb::getId).collect(Collectors.toSet()); + List allMenus = systemMenuMapper.listAll(); + return this.getAllMenuIdsWithChildren(CollUtil.newHashSet(id), allMenus); + } + + public List listMenuSuperior(List ids) { + Set menus; + if (CollUtil.isNotEmpty(ids)) { + menus = new LinkedHashSet<>(this.listMenuByIds(ids)); + for (SystemMenuTb menu : menus) { + List menuList = this.querySuperiorMenuByArgs(menu, new ArrayList<>()); + for (SystemMenuTb data : menuList) { + if (data.getId().equals(menu.getPid())) { + data.setSubCount(data.getSubCount() - 1); + } } - return systemMenuTbs; + menus.addAll(menuList); + } + // 编辑菜单时不显示自己以及自己下级的数据, 避免出现PID数据环形问题 + menus = menus.stream().filter(i -> !ids.contains(i.getId())).collect(Collectors.toSet()); + List newMenuList = new ArrayList<>(menus); + return this.buildMenuTree(newMenuList); + } else { + List records = this.listMenuByPid(null); + return KitBeanUtil.copyToList(records, SystemMenuVo.class); } + } - public void exportMenuXlsx(HttpServletResponse response, SystemQueryMenuArgs args) throws Exception { - List systemMenuTbs = this.queryAllMenu(args, false); - List rowVos = new ArrayList<>(); - for (SystemMenuTb dataObject : systemMenuTbs) { - SystemMenuExportRowVo rowVo = new SystemMenuExportRowVo(); - rowVo.setTitle(dataObject.getTitle()); - rowVo.setType(dataObject.getType() == null ? "目录" : dataObject.getType() == 1 ? "菜单" : "按钮"); - rowVo.setPermission(dataObject.getPermission()); - rowVo.setIFrame(dataObject.getIFrame() ? SystemYesOrNoChConst.YES_STR : SystemYesOrNoChConst.NO_STR); - rowVo.setHidden(dataObject.getHidden() ? SystemYesOrNoChConst.NO_STR : SystemYesOrNoChConst.YES_STR); - rowVo.setCache(dataObject.getCache() ? SystemYesOrNoChConst.YES_STR : SystemYesOrNoChConst.NO_STR); - rowVo.setCreateTime(dataObject.getCreateTime()); - rowVos.add(rowVo); - } - KitExcelExporter.exportSimple(response, "菜单数据", SystemMenuExportRowVo.class, rowVos); + public void exportMenuXlsx(HttpServletResponse response, SystemQueryMenuArgs args) throws Exception { + List systemMenuTbs = this.queryAllMenu(args, false); + List rowVos = new ArrayList<>(); + for (SystemMenuTb dataObject : systemMenuTbs) { + SystemMenuExportRowVo rowVo = new SystemMenuExportRowVo(); + rowVo.setTitle(dataObject.getTitle()); + rowVo.setType(dataObject.getType() == null ? "目录" : dataObject.getType() == 1 ? "菜单" : "按钮"); + rowVo.setPermission(dataObject.getPermission()); + rowVo.setIFrame(dataObject.getIFrame() ? SystemYesOrNoChConst.YES_STR : SystemYesOrNoChConst.NO_STR); + rowVo.setHidden(dataObject.getHidden() ? SystemYesOrNoChConst.NO_STR : SystemYesOrNoChConst.YES_STR); + rowVo.setCache(dataObject.getCache() ? SystemYesOrNoChConst.YES_STR : SystemYesOrNoChConst.NO_STR); + rowVo.setCreateTime(dataObject.getCreateTime()); + rowVos.add(rowVo); } + KitExcelExporter.exportSimple(response, "菜单数据", SystemMenuExportRowVo.class, rowVos); + } } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemMonitorService.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemMonitorService.java index 9dd6fc74..50da4422 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemMonitorService.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemMonitorService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,172 +44,172 @@ import java.util.Map; @Service public class SystemMonitorService { - private final DecimalFormat df = new DecimalFormat("0.00"); + private final DecimalFormat df = new DecimalFormat("0.00"); - /** - * 查询服务器监控信息 -> TestPassed - * - * @return Map - */ - public Map getServerMonitorInfo() { - Map resultMap = new LinkedHashMap<>(8); - try { - SystemInfo si = new SystemInfo(); - OperatingSystem os = si.getOperatingSystem(); - HardwareAbstractionLayer hal = si.getHardware(); - // 系统信息 - resultMap.put("sys", getSystemInfo(os)); - // cpu 信息 - resultMap.put("cpu", getCpuInfo(hal.getProcessor())); - // 内存信息 - resultMap.put("memory", getMemoryInfo(hal.getMemory())); - // 交换区信息 - resultMap.put("swap", getSwapInfo(hal.getMemory())); - // 磁盘 - resultMap.put("disk", getDiskInfo(os)); - resultMap.put("time", DateUtil.format(new Date(), "HH:mm:ss")); - } catch (Exception e) { - log.error(e.getMessage(), e); - } - return resultMap; + /** + * 查询服务器监控信息 -> TestPassed + * + * @return Map + */ + public Map getServerMonitorInfo() { + Map resultMap = new LinkedHashMap<>(8); + try { + SystemInfo si = new SystemInfo(); + OperatingSystem os = si.getOperatingSystem(); + HardwareAbstractionLayer hal = si.getHardware(); + // 系统信息 + resultMap.put("sys", getSystemInfo(os)); + // cpu 信息 + resultMap.put("cpu", getCpuInfo(hal.getProcessor())); + // 内存信息 + resultMap.put("memory", getMemoryInfo(hal.getMemory())); + // 交换区信息 + resultMap.put("swap", getSwapInfo(hal.getMemory())); + // 磁盘 + resultMap.put("disk", getDiskInfo(os)); + resultMap.put("time", DateUtil.format(new Date(), "HH:mm:ss")); + } catch (Exception e) { + log.error(e.getMessage(), e); } + return resultMap; + } - /** - * 获取磁盘信息 - * - * @return / - */ - private Map getDiskInfo(OperatingSystem os) { - Map diskInfo = new LinkedHashMap<>(); - FileSystem fileSystem = os.getFileSystem(); - List fsArray = fileSystem.getFileStores(); - String osName = System.getProperty("os.name"); - long available = 0, total = 0; - for (OSFileStore fs : fsArray) { - // windows 需要将所有磁盘分区累加, linux 和 mac 直接累加会出现磁盘重复的问题, 待修复 - if (osName.toLowerCase().startsWith(SystemConst.WIN)) { - available += fs.getUsableSpace(); - total += fs.getTotalSpace(); - } else { - available = fs.getUsableSpace(); - total = fs.getTotalSpace(); - break; - } - } - long used = total - available; - diskInfo.put("total", total > 0 ? KitFileUtil.getSize(total) : "?"); - diskInfo.put("available", KitFileUtil.getSize(available)); - diskInfo.put("used", KitFileUtil.getSize(used)); - if (total != 0) { - diskInfo.put("usageRate", df.format(used / (double)total * 100)); - } else { - diskInfo.put("usageRate", 0); - } - return diskInfo; + /** + * 查询磁盘信息 -> TestPassed + * + * @return / + */ + private Map getDiskInfo(OperatingSystem os) { + Map diskInfo = new LinkedHashMap<>(); + FileSystem fileSystem = os.getFileSystem(); + List fsArray = fileSystem.getFileStores(); + String osName = System.getProperty("os.name"); + long available = 0, total = 0; + for (OSFileStore fs : fsArray) { + // windows 需要将所有磁盘分区累加, linux 和 mac 直接累加会出现磁盘重复的问题, 待修复 + if (osName.toLowerCase().startsWith(SystemConst.WIN)) { + available += fs.getUsableSpace(); + total += fs.getTotalSpace(); + } else { + available = fs.getUsableSpace(); + total = fs.getTotalSpace(); + break; + } } + long used = total - available; + diskInfo.put("total", total > 0 ? KitFileUtil.getSize(total) : "?"); + diskInfo.put("available", KitFileUtil.getSize(available)); + diskInfo.put("used", KitFileUtil.getSize(used)); + if (total != 0) { + diskInfo.put("usageRate", df.format(used / (double) total * 100)); + } else { + diskInfo.put("usageRate", 0); + } + return diskInfo; + } - /** - * 获取交换区信息 - * - * @param memory / - * @return / - */ - private Map getSwapInfo(GlobalMemory memory) { - Map swapInfo = new LinkedHashMap<>(); - VirtualMemory virtualMemory = memory.getVirtualMemory(); - long total = virtualMemory.getSwapTotal(); - long used = virtualMemory.getSwapUsed(); - swapInfo.put("total", FormatUtil.formatBytes(total)); - swapInfo.put("used", FormatUtil.formatBytes(used)); - swapInfo.put("available", FormatUtil.formatBytes(total - used)); - if (used == 0) { - swapInfo.put("usageRate", 0); - } else { - swapInfo.put("usageRate", df.format(used / (double)total * 100)); - } - return swapInfo; + /** + * 查询交换区信息 -> TestPassed + * + * @param memory / + * @return / + */ + private Map getSwapInfo(GlobalMemory memory) { + Map swapInfo = new LinkedHashMap<>(); + VirtualMemory virtualMemory = memory.getVirtualMemory(); + long total = virtualMemory.getSwapTotal(); + long used = virtualMemory.getSwapUsed(); + swapInfo.put("total", FormatUtil.formatBytes(total)); + swapInfo.put("used", FormatUtil.formatBytes(used)); + swapInfo.put("available", FormatUtil.formatBytes(total - used)); + if (used == 0) { + swapInfo.put("usageRate", 0); + } else { + swapInfo.put("usageRate", df.format(used / (double) total * 100)); } + return swapInfo; + } - /** - * 获取内存信息 - * - * @param memory / - * @return / - */ - private Map getMemoryInfo(GlobalMemory memory) { - Map memoryInfo = new LinkedHashMap<>(); - memoryInfo.put("total", FormatUtil.formatBytes(memory.getTotal())); - memoryInfo.put("available", FormatUtil.formatBytes(memory.getAvailable())); - memoryInfo.put("used", FormatUtil.formatBytes(memory.getTotal() - memory.getAvailable())); - memoryInfo.put("usageRate", - df.format((memory.getTotal() - memory.getAvailable()) / (double)memory.getTotal() * 100)); - return memoryInfo; - } + /** + * 查询内存信息 -> TestPassed + * + * @param memory / + * @return / + */ + private Map getMemoryInfo(GlobalMemory memory) { + Map memoryInfo = new LinkedHashMap<>(); + memoryInfo.put("total", FormatUtil.formatBytes(memory.getTotal())); + memoryInfo.put("available", FormatUtil.formatBytes(memory.getAvailable())); + memoryInfo.put("used", FormatUtil.formatBytes(memory.getTotal() - memory.getAvailable())); + memoryInfo.put("usageRate", + df.format((memory.getTotal() - memory.getAvailable()) / (double) memory.getTotal() * 100)); + return memoryInfo; + } - /** - * 获取Cpu相关信息 - * - * @param processor / - * @return / - */ - private Map getCpuInfo(CentralProcessor processor) { - Map cpuInfo = new LinkedHashMap<>(); - cpuInfo.put("name", processor.getProcessorIdentifier().getName()); - cpuInfo.put("package", processor.getPhysicalPackageCount() + "个物理CPU"); - cpuInfo.put("core", processor.getPhysicalProcessorCount() + "个物理核心"); - cpuInfo.put("coreNumber", processor.getPhysicalProcessorCount()); - cpuInfo.put("logic", processor.getLogicalProcessorCount() + "个逻辑CPU"); - // CPU信息 - long[] prevTicks = processor.getSystemCpuLoadTicks(); - // 默认等待300毫秒... - long time = 300; - Util.sleep(time); - long[] ticks = processor.getSystemCpuLoadTicks(); - long minCpuLoadTick = 1000; - while (Arrays.toString(prevTicks).equals(Arrays.toString(ticks)) && time < minCpuLoadTick) { - time += 25; - Util.sleep(25); - ticks = processor.getSystemCpuLoadTicks(); - } - long user = - ticks[CentralProcessor.TickType.USER.getIndex()] - prevTicks[CentralProcessor.TickType.USER.getIndex()]; - long nice = - ticks[CentralProcessor.TickType.NICE.getIndex()] - prevTicks[CentralProcessor.TickType.NICE.getIndex()]; - long sys = - ticks[CentralProcessor.TickType.SYSTEM.getIndex()] - prevTicks[CentralProcessor.TickType.SYSTEM.getIndex()]; - long idle = - ticks[CentralProcessor.TickType.IDLE.getIndex()] - prevTicks[CentralProcessor.TickType.IDLE.getIndex()]; - long ioWait = - ticks[CentralProcessor.TickType.IOWAIT.getIndex()] - prevTicks[CentralProcessor.TickType.IOWAIT.getIndex()]; - long irq = - ticks[CentralProcessor.TickType.IRQ.getIndex()] - prevTicks[CentralProcessor.TickType.IRQ.getIndex()]; - long softIrq = - ticks[CentralProcessor.TickType.SOFTIRQ.getIndex()] - prevTicks[CentralProcessor.TickType.SOFTIRQ.getIndex()]; - long steal = - ticks[CentralProcessor.TickType.STEAL.getIndex()] - prevTicks[CentralProcessor.TickType.STEAL.getIndex()]; - long totalCpu = user + nice + sys + idle + ioWait + irq + softIrq + steal; - cpuInfo.put("used", df.format(100d * user / totalCpu + 100d * sys / totalCpu)); - cpuInfo.put("idle", df.format(100d * idle / totalCpu)); - return cpuInfo; + /** + * 查询Cpu相关信息 -> TestPassed + * + * @param processor / + * @return / + */ + private Map getCpuInfo(CentralProcessor processor) { + Map cpuInfo = new LinkedHashMap<>(); + cpuInfo.put("name", processor.getProcessorIdentifier().getName()); + cpuInfo.put("package", processor.getPhysicalPackageCount() + "个物理CPU"); + cpuInfo.put("core", processor.getPhysicalProcessorCount() + "个物理核心"); + cpuInfo.put("coreNumber", processor.getPhysicalProcessorCount()); + cpuInfo.put("logic", processor.getLogicalProcessorCount() + "个逻辑CPU"); + // CPU信息 + long[] prevTicks = processor.getSystemCpuLoadTicks(); + // 默认等待300毫秒... + long time = 300; + Util.sleep(time); + long[] ticks = processor.getSystemCpuLoadTicks(); + long minCpuLoadTick = 1000; + while (Arrays.toString(prevTicks).equals(Arrays.toString(ticks)) && time < minCpuLoadTick) { + time += 25; + Util.sleep(25); + ticks = processor.getSystemCpuLoadTicks(); } + long user = + ticks[CentralProcessor.TickType.USER.getIndex()] - prevTicks[CentralProcessor.TickType.USER.getIndex()]; + long nice = + ticks[CentralProcessor.TickType.NICE.getIndex()] - prevTicks[CentralProcessor.TickType.NICE.getIndex()]; + long sys = + ticks[CentralProcessor.TickType.SYSTEM.getIndex()] - prevTicks[CentralProcessor.TickType.SYSTEM.getIndex()]; + long idle = + ticks[CentralProcessor.TickType.IDLE.getIndex()] - prevTicks[CentralProcessor.TickType.IDLE.getIndex()]; + long ioWait = + ticks[CentralProcessor.TickType.IOWAIT.getIndex()] - prevTicks[CentralProcessor.TickType.IOWAIT.getIndex()]; + long irq = + ticks[CentralProcessor.TickType.IRQ.getIndex()] - prevTicks[CentralProcessor.TickType.IRQ.getIndex()]; + long softIrq = + ticks[CentralProcessor.TickType.SOFTIRQ.getIndex()] - prevTicks[CentralProcessor.TickType.SOFTIRQ.getIndex()]; + long steal = + ticks[CentralProcessor.TickType.STEAL.getIndex()] - prevTicks[CentralProcessor.TickType.STEAL.getIndex()]; + long totalCpu = user + nice + sys + idle + ioWait + irq + softIrq + steal; + cpuInfo.put("used", df.format(100d * user / totalCpu + 100d * sys / totalCpu)); + cpuInfo.put("idle", df.format(100d * idle / totalCpu)); + return cpuInfo; + } - /** - * 获取系统相关信息,系统、运行天数、系统IP - * - * @param os / - * @return / - */ - private Map getSystemInfo(OperatingSystem os) { - Map systemInfo = new LinkedHashMap<>(); - // jvm 运行时间 - long time = ManagementFactory.getRuntimeMXBean().getStartTime(); - Date date = new Date(time); - // 计算项目运行时间 - String formatBetween = DateUtil.formatBetween(date, new Date(), Level.HOUR); - // 系统信息 - systemInfo.put("os", os.toString()); - systemInfo.put("day", formatBetween); - systemInfo.put("ip", KitIPUtil.getLocalIp()); - return systemInfo; - } + /** + * 查询系统相关信息,系统、运行天数、系统IP -> TestPassed + * + * @param os / + * @return / + */ + private Map getSystemInfo(OperatingSystem os) { + Map systemInfo = new LinkedHashMap<>(); + // jvm 运行时间 + long time = ManagementFactory.getRuntimeMXBean().getStartTime(); + Date date = new Date(time); + // 计算项目运行时间 + String formatBetween = DateUtil.formatBetween(date, new Date(), Level.HOUR); + // 系统信息 + systemInfo.put("os", os.toString()); + systemInfo.put("day", formatBetween); + systemInfo.put("ip", KitIPUtil.getLocalIp()); + return systemInfo; + } } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemOperationLogService.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemOperationLogService.java index 337cdf16..a76e9cf9 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemOperationLogService.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemOperationLogService.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.service; import cn.odboy.base.KitPageArgs; @@ -14,16 +29,16 @@ import org.springframework.stereotype.Service; @Service public class SystemOperationLogService { - @Autowired - private SystemOperationLogMapper systemOperationLogMapper; + @Autowired + private SystemOperationLogMapper systemOperationLogMapper; - /** - * 查询用户操作日志 - */ - public IPage searchUserLog(KitPageArgs pageArgs) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemOperationLogTb::getUsername, KitSecurityHelper.getCurrentUsername()); - Page page = new Page<>(pageArgs.getPage(), pageArgs.getSize()); - return systemOperationLogMapper.selectPage(page, wrapper); - } + /** + * 查询用户操作日志 -> TestPassed + */ + public IPage searchUserLog(KitPageArgs pageArgs) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemOperationLogTb::getUsername, KitSecurityHelper.getCurrentUsername()); + Page page = new Page<>(pageArgs.getPage(), pageArgs.getSize()); + return systemOperationLogMapper.selectPage(page, wrapper); + } } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemOssStorageService.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemOssStorageService.java index 4d60ac4c..de41a08e 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemOssStorageService.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemOssStorageService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,13 +35,13 @@ import java.util.List; */ public interface SystemOssStorageService extends IService { - KitPageResult searchOssStorage(SystemQueryStorageArgs args, Page page); + KitPageResult searchOssStorage(SystemQueryStorageArgs args, Page page); - List queryOssStorage(SystemQueryStorageArgs args); + List queryOssStorage(SystemQueryStorageArgs args); - String uploadFile(MultipartFile file); + String uploadFile(MultipartFile file); - void deleteFileByIds(Long[] ids); + void deleteFileByIds(Long[] ids); - void exportOssStorageXlsx(HttpServletResponse response, SystemQueryStorageArgs args); + void exportOssStorageXlsx(HttpServletResponse response, SystemQueryStorageArgs args); } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemQuartzJobService.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemQuartzJobService.java index 241407d9..76525590 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemQuartzJobService.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemQuartzJobService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,6 @@ import cn.odboy.system.dal.mysql.SystemQuartzLogMapper; import cn.odboy.system.framework.quartz.QuartzManage; import cn.odboy.util.KitBeanUtil; import cn.odboy.util.KitPageUtil; -import cn.odboy.util.KitValidUtil; import cn.odboy.util.xlsx.KitExcelExporter; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -51,270 +50,278 @@ import java.util.Set; @Service public class SystemQuartzJobService { - @Autowired - private SystemQuartzJobMapper systemQuartzJobMapper; - @Autowired - private SystemQuartzLogMapper systemQuartzLogMapper; - @Autowired - private QuartzManage quartzManage; - @Autowired - private KitRedisHelper redisHelper; + @Autowired + private SystemQuartzJobMapper systemQuartzJobMapper; + @Autowired + private SystemQuartzLogMapper systemQuartzLogMapper; + @Autowired + private QuartzManage quartzManage; + @Autowired + private KitRedisHelper redisHelper; - /** - * 验证Bean是不是合法的, 合法的定时任务 Bean 需要用 @Service 定义 - * - * @param beanName Bean名称 - */ - private void checkBean(String beanName) { - // 避免调用攻击者可以从SpringContextHolder获得控制jdbcTemplate类 - // 并使用getDeclaredMethod调用jdbcTemplate的queryForMap函数,执行任意sql命令。 - if (!KitSpringBeanHolder.getAllServiceBeanName().contains(beanName)) { - throw new BadRequestException("非法的 Bean,请重新输入!"); - } + /** + * 验证Bean是不是合法的, 合法的定时任务 Bean 需要用 @Service 定义 + * + * @param beanName Bean名称 + */ + private void checkBean(String beanName) { + // 避免调用攻击者可以从SpringContextHolder获得控制jdbcTemplate类 + // 并使用getDeclaredMethod调用jdbcTemplate的queryForMap函数,执行任意sql命令。 + if (!KitSpringBeanHolder.getAllServiceBeanName().contains(beanName)) { + throw new BadRequestException("非法的 Bean,请重新输入!"); } + } - /** - * 创建 - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void createJob(SystemQuartzJobVo args) { - if (args.getId() != null) { - throw new BadRequestException("无效参数id"); - } - // 验证Bean是不是合法的, 合法的定时任务 Bean 需要用 @Service 定义 - checkBean(args.getBeanName()); - if (!CronExpression.isValidExpression(args.getCronExpression())) { - throw new BadRequestException("cron表达式格式错误"); - } - SystemQuartzJobTb record = KitBeanUtil.copyToClass(args, SystemQuartzJobTb.class); - systemQuartzJobMapper.insert(record); - quartzManage.addJob(args); + /** + * 创建 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void createJob(SystemQuartzJobTb args) { + if (args.getId() != null) { + throw new BadRequestException("无效参数id"); } + // 验证Bean是不是合法的, 合法的定时任务 Bean 需要用 @Service 定义 + checkBean(args.getBeanName()); + if (!CronExpression.isValidExpression(args.getCronExpression())) { + throw new BadRequestException("cron表达式格式错误"); + } + systemQuartzJobMapper.insert(args); + SystemQuartzJobVo quartzJobVo = KitBeanUtil.copyToClass(args, SystemQuartzJobVo.class); + quartzManage.addJob(quartzJobVo); + } - /** - * 修改任务并重新调度 - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void updateQuartzJobResumeCron(SystemUpdateQuartzJobArgs args) { - // 验证Bean是不是合法的, 合法的定时任务 Bean 需要用 @Service 定义 - checkBean(args.getBeanName()); - if (!CronExpression.isValidExpression(args.getCronExpression())) { - throw new BadRequestException("cron表达式格式错误"); - } - if (StrUtil.isNotBlank(args.getSubTask())) { - List tasks = Arrays.asList(args.getSubTask().split("[,,]")); - if (tasks.contains(args.getId().toString())) { - throw new BadRequestException("子任务中不能添加当前任务ID"); - } - } - SystemQuartzJobTb jobTb = KitBeanUtil.copyToClass(args, SystemQuartzJobTb.class); - systemQuartzJobMapper.insertOrUpdate(jobTb); - SystemQuartzJobVo jobVo = KitBeanUtil.copyToClass(args, SystemQuartzJobVo.class); - quartzManage.updateJobCron(jobVo); + /** + * 修改任务并重新调度 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void updateQuartzJobResumeCron(SystemUpdateQuartzJobArgs args) { + // 验证Bean是不是合法的, 合法的定时任务 Bean 需要用 @Service 定义 + checkBean(args.getBeanName()); + if (!CronExpression.isValidExpression(args.getCronExpression())) { + throw new BadRequestException("cron表达式格式错误"); } + if (StrUtil.isNotBlank(args.getSubTask())) { + List tasks = Arrays.asList(args.getSubTask().split("[,,]")); + if (tasks.contains(args.getId().toString())) { + throw new BadRequestException("子任务中不能添加当前任务ID"); + } + } + SystemQuartzJobTb jobTb = KitBeanUtil.copyToClass(args, SystemQuartzJobTb.class); + systemQuartzJobMapper.updateById(jobTb); + quartzManage.updateJobCron(jobTb); + } - /** - * 更改定时任务状态 - * - * @param quartzJob / - */ - @Transactional(rollbackFor = Exception.class) - public void switchQuartzJobStatus(SystemQuartzJobVo quartzJob) { - // 置换暂停状态 - if (quartzJob.getIsPause()) { - quartzManage.resumeJob(quartzJob); - quartzJob.setIsPause(false); - } else { - quartzManage.pauseJob(quartzJob); - quartzJob.setIsPause(true); - } - SystemQuartzJobTb quartzJobTb = KitBeanUtil.copyToClass(quartzJob, SystemQuartzJobTb.class); - systemQuartzJobMapper.insertOrUpdate(quartzJobTb); + /** + * 更改定时任务状态 -> TestPassed + * + * @param quartzJobVo / + */ + @Transactional(rollbackFor = Exception.class) + public void switchQuartzJobStatus(SystemQuartzJobVo quartzJobVo) { + // 置换暂停状态 + if (quartzJobVo.getIsPause()) { + quartzManage.resumeJob(quartzJobVo); + quartzJobVo.setIsPause(false); + } else { + quartzManage.pauseJob(quartzJobVo); + quartzJobVo.setIsPause(true); } + SystemQuartzJobTb record = KitBeanUtil.copyToClass(quartzJobVo, SystemQuartzJobTb.class); + systemQuartzJobMapper.updateById(record); + } - /** - * 立即执行定时任务 - * - * @param quartzJob / - */ - public void startQuartzJob(SystemQuartzJobVo quartzJob) { - quartzManage.runJobNow(quartzJob); - } + /** + * 立即执行定时任务 -> TestPassed + * + * @param quartzJob / + */ + public void startQuartzJob(SystemQuartzJobVo quartzJob) { + quartzManage.runJobNow(quartzJob); + } - /** - * 删除任务 - * - * @param ids / - */ - @Transactional(rollbackFor = Exception.class) - public void deleteJobByIds(Set ids) { - for (Long id : ids) { - SystemQuartzJobTb quartzJob = systemQuartzJobMapper.selectById(id); - quartzManage.deleteJob(quartzJob); - systemQuartzJobMapper.deleteById(quartzJob); - } + /** + * 删除任务 -> TestPassed + * + * @param ids / + */ + @Transactional(rollbackFor = Exception.class) + public void deleteJobByIds(Set ids) { + for (Long id : ids) { + SystemQuartzJobTb quartzJob = systemQuartzJobMapper.selectById(id); + quartzManage.deleteJob(quartzJob); + systemQuartzJobMapper.deleteById(quartzJob); } + } - /** - * 执行子任务 - * - * @param tasks / - * @throws InterruptedException / - */ - @Transactional(rollbackFor = Exception.class) - public void startSubQuartJob(String[] tasks) throws InterruptedException { - for (String id : tasks) { - if (StrUtil.isBlank(id)) { - // 如果是手动清除子任务id, 会出现id为空字符串的问题 - continue; - } - SystemQuartzJobVo quartzJob = systemQuartzJobMapper.selectVoById(id); - if (quartzJob == null) { - // 防止子任务不存在 - continue; - } - // 执行任务 - String uuid = IdUtil.simpleUUID(); - quartzJob.setUuid(uuid); - // 执行任务 - startQuartzJob(quartzJob); - // 获取执行状态, 如果执行失败则停止后面的子任务执行 - Boolean result = redisHelper.get(uuid, Boolean.class); - while (result == null) { - // 休眠5秒, 再次获取子任务执行情况 - Thread.sleep(5000); - result = redisHelper.get(uuid, Boolean.class); - } - if (!result) { - redisHelper.del(uuid); - break; - } - } + /** + * 执行子任务 -> TestPassed + * + * @param tasks / + * @throws InterruptedException / + */ + @Transactional(rollbackFor = Exception.class) + public void startSubQuartJob(String[] tasks) throws InterruptedException { + for (String id : tasks) { + if (StrUtil.isBlank(id)) { + // 如果是手动清除子任务id, 会出现id为空字符串的问题 + continue; + } + SystemQuartzJobTb quartzJobTb = systemQuartzJobMapper.selectById(id); + if (quartzJobTb == null) { + // 防止子任务不存在 + continue; + } + SystemQuartzJobVo quartzJobVo = KitBeanUtil.copyToClass(quartzJobTb, SystemQuartzJobVo.class); + // 执行任务 + String uuid = IdUtil.simpleUUID(); + quartzJobVo.setUuid(uuid); + startQuartzJob(quartzJobVo); + // 查询执行状态, 如果执行失败则停止后面的子任务执行 + Boolean result = redisHelper.get(uuid, Boolean.class); + while (result == null) { + // 休眠5秒, 再次查询子任务执行情况 + Thread.sleep(5000); + result = redisHelper.get(uuid, Boolean.class); + } + if (!result) { + redisHelper.del(uuid); + break; + } } + } - /** - * 分页查询 - * - * @param args 条件 - * @param page 分页参数 - * @return / - */ - public KitPageResult searchQuartzJobByArgs(SystemQueryQuartzJobArgs args, - Page page) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - this.injectQuartzJobQueryParams(args, wrapper); - return KitPageUtil.toPage(systemQuartzJobMapper.selectPage(page, wrapper)); - } + /** + * 分页查询 -> TestPassed + * + * @param args 条件 + * @param page 分页参数 + * @return / + */ + public KitPageResult searchQuartzJobByArgs(SystemQueryQuartzJobArgs args, Page page) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + this.injectQuartzJobQueryParams(args, wrapper); + return KitPageUtil.toPage(systemQuartzJobMapper.selectPage(page, wrapper)); + } - private void injectQuartzJobQueryParams(SystemQueryQuartzJobArgs args, - LambdaQueryWrapper wrapper) { - KitValidUtil.notNull(args); - wrapper.like(StrUtil.isNotBlank(args.getJobName()), SystemQuartzJobTb::getJobName, args.getJobName()); - if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { - wrapper.between(SystemQuartzJobTb::getUpdateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); - } - wrapper.orderByDesc(SystemQuartzJobTb::getId); + private void injectQuartzJobQueryParams(SystemQueryQuartzJobArgs args, LambdaQueryWrapper wrapper) { + if (args != null) { + wrapper.like(StrUtil.isNotBlank(args.getJobName()), SystemQuartzJobTb::getJobName, args.getJobName()); + if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { + wrapper.between(SystemQuartzJobTb::getUpdateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); + } } + wrapper.orderByDesc(SystemQuartzJobTb::getId); + } - private void injectQuartzLogQueryParams(SystemQueryQuartzJobArgs args, - LambdaQueryWrapper wrapper) { - if (args != null) { - wrapper.like(StrUtil.isNotBlank(args.getJobName()), SystemQuartzLogTb::getJobName, args.getJobName()); - wrapper.eq(args.getIsSuccess() != null, SystemQuartzLogTb::getIsSuccess, args.getIsSuccess()); - if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { - wrapper.between(SystemQuartzLogTb::getCreateTime, args.getCreateTime().get(0), - args.getCreateTime().get(1)); - } - } - wrapper.orderByDesc(SystemQuartzLogTb::getId); + private void injectQuartzLogQueryParams(SystemQueryQuartzJobArgs args, LambdaQueryWrapper wrapper) { + if (args != null) { + wrapper.like(StrUtil.isNotBlank(args.getJobName()), SystemQuartzLogTb::getJobName, args.getJobName()); + wrapper.eq(args.getIsSuccess() != null, SystemQuartzLogTb::getIsSuccess, args.getIsSuccess()); + if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { + wrapper.between(SystemQuartzLogTb::getCreateTime, args.getCreateTime().get(0), + args.getCreateTime().get(1)); + } } + wrapper.orderByDesc(SystemQuartzLogTb::getId); + } - /** - * 分页查询日志 - * - * @param args 条件 - * @param page 分页参数 - * @return / - */ - public KitPageResult searchQuartzLogByArgs(SystemQueryQuartzJobArgs args, - Page page) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - this.injectQuartzLogQueryParams(args, wrapper); - return KitPageUtil.toPage(systemQuartzLogMapper.selectPage(page, wrapper)); - } + /** + * 分页查询日志 -> TestPassed + * + * @param args 条件 + * @param page 分页参数 + * @return / + */ + public KitPageResult searchQuartzLogByArgs(SystemQueryQuartzJobArgs args, Page page) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + this.injectQuartzLogQueryParams(args, wrapper); + return KitPageUtil.toPage(systemQuartzLogMapper.selectPage(page, wrapper)); + } - /** - * 查询全部 - * - * @param args 条件 - * @return / - */ - public List queryQuartzJobByArgs(SystemQueryQuartzJobArgs args) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - this.injectQuartzJobQueryParams(args, wrapper); - return systemQuartzJobMapper.selectList(wrapper); - } + /** + * 查询全部 -> TestPassed + * + * @param args 条件 + * @return / + */ + public List queryQuartzJobByArgs(SystemQueryQuartzJobArgs args) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + this.injectQuartzJobQueryParams(args, wrapper); + return systemQuartzJobMapper.selectList(wrapper); + } - /** - * 查询全部 - * - * @param args 条件 - * @return / - */ - public List queryQuartzLogByArgs(SystemQueryQuartzJobArgs args) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - this.injectQuartzLogQueryParams(args, wrapper); - return systemQuartzLogMapper.selectList(wrapper); - } + /** + * 查询全部 -> TestPassed + * + * @param args 条件 + * @return / + */ + public List queryQuartzLogByArgs(SystemQueryQuartzJobArgs args) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + this.injectQuartzLogQueryParams(args, wrapper); + return systemQuartzLogMapper.selectList(wrapper); + } - public SystemQuartzJobVo getQuartzJobById(Long id) { - return KitBeanUtil.copyToClass(systemQuartzJobMapper.selectById(id), SystemQuartzJobVo.class); - } + /** + * 查询启用的定时任务 -> TestPassed + */ + public List listEnableQuartzJob() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemQuartzJobTb::getIsPause, 0); + return systemQuartzJobMapper.selectList(wrapper); + } - public List listEnableQuartzJob() { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemQuartzJobTb::getIsPause, 0); - return KitBeanUtil.copyToList(systemQuartzJobMapper.selectList(wrapper), SystemQuartzJobVo.class); + /** + * 导出定时任务数据 -> TestPassed + */ + public void exportQuartzJobXlsx(HttpServletResponse response, SystemQueryQuartzJobArgs args) { + List systemQuartzJobTbs = this.queryQuartzJobByArgs(args); + List rowVos = new ArrayList<>(); + for (SystemQuartzJobTb dataObject : systemQuartzJobTbs) { + SystemQuartzJobExportRowVo rowVo = new SystemQuartzJobExportRowVo(); + rowVo.setJobName(dataObject.getJobName()); + rowVo.setBeanName(dataObject.getBeanName()); + rowVo.setMethodName(dataObject.getMethodName()); + rowVo.setParams(dataObject.getParams()); + rowVo.setCronExpression(dataObject.getCronExpression()); + rowVo.setIsPause(dataObject.getIsPause() ? "暂停中" : "运行中"); + rowVo.setDescription(dataObject.getDescription()); + rowVo.setCreateTime(dataObject.getCreateTime()); + rowVos.add(rowVo); } + KitExcelExporter.exportSimple(response, "定时任务数据", SystemQuartzJobExportRowVo.class, rowVos); + } - public void exportQuartzJobXlsx(HttpServletResponse response, SystemQueryQuartzJobArgs args) { - List systemQuartzJobTbs = this.queryQuartzJobByArgs(args); - List rowVos = new ArrayList<>(); - for (SystemQuartzJobTb dataObject : systemQuartzJobTbs) { - SystemQuartzJobExportRowVo rowVo = new SystemQuartzJobExportRowVo(); - rowVo.setJobName(dataObject.getJobName()); - rowVo.setBeanName(dataObject.getBeanName()); - rowVo.setMethodName(dataObject.getMethodName()); - rowVo.setParams(dataObject.getParams()); - rowVo.setCronExpression(dataObject.getCronExpression()); - rowVo.setIsPause(dataObject.getIsPause() ? "暂停中" : "运行中"); - rowVo.setDescription(dataObject.getDescription()); - rowVo.setCreateTime(dataObject.getCreateTime()); - rowVos.add(rowVo); - } - KitExcelExporter.exportSimple(response, "定时任务数据", SystemQuartzJobExportRowVo.class, rowVos); + /** + * 导出定时任务日志数据 -> TestPassed + */ + public void exportQuartzLogXlsx(HttpServletResponse response, SystemQueryQuartzJobArgs args) { + List systemQuartzLogTbs = this.queryQuartzLogByArgs(args); + List rowVos = new ArrayList<>(); + for (SystemQuartzLogTb dataObject : systemQuartzLogTbs) { + SystemQuartzLogExportRowVo rowVo = new SystemQuartzLogExportRowVo(); + rowVo.setJobName(dataObject.getJobName()); + rowVo.setBeanName(dataObject.getBeanName()); + rowVo.setMethodName(dataObject.getMethodName()); + rowVo.setParams(dataObject.getParams()); + rowVo.setCronExpression(dataObject.getCronExpression()); + rowVo.setExceptionDetail(dataObject.getExceptionDetail()); + rowVo.setTime(dataObject.getTime()); + rowVo.setStatus(dataObject.getIsSuccess() ? "成功" : "失败"); + rowVo.setCreateTime(dataObject.getCreateTime()); + rowVos.add(rowVo); } + KitExcelExporter.exportSimple(response, "定时任务日志数据", SystemQuartzLogExportRowVo.class, rowVos); + } - public void exportQuartzLogXlsx(HttpServletResponse response, SystemQueryQuartzJobArgs args) { - List systemQuartzLogTbs = this.queryQuartzLogByArgs(args); - List rowVos = new ArrayList<>(); - for (SystemQuartzLogTb dataObject : systemQuartzLogTbs) { - SystemQuartzLogExportRowVo rowVo = new SystemQuartzLogExportRowVo(); - rowVo.setJobName(dataObject.getJobName()); - rowVo.setBeanName(dataObject.getBeanName()); - rowVo.setMethodName(dataObject.getMethodName()); - rowVo.setParams(dataObject.getParams()); - rowVo.setCronExpression(dataObject.getCronExpression()); - rowVo.setExceptionDetail(dataObject.getExceptionDetail()); - rowVo.setTime(dataObject.getTime()); - rowVo.setStatus(dataObject.getIsSuccess() ? "成功" : "失败"); - rowVo.setCreateTime(dataObject.getCreateTime()); - rowVos.add(rowVo); - } - KitExcelExporter.exportSimple(response, "定时任务日志数据", SystemQuartzLogExportRowVo.class, rowVos); - } + /** + * 根据任务id查询定时任务 -> TestPassed + */ + public SystemQuartzJobTb getQuartzJobById(Long id) { + return systemQuartzJobMapper.selectById(id); + } } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemRoleDeptService.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemRoleDeptService.java index 7285175e..c2232ffa 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemRoleDeptService.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemRoleDeptService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ package cn.odboy.system.service; import cn.hutool.core.collection.CollUtil; import cn.odboy.system.dal.dataobject.SystemDeptTb; import cn.odboy.system.dal.dataobject.SystemRoleDeptTb; -import cn.odboy.system.dal.mysql.SystemDeptMapper; import cn.odboy.system.dal.mysql.SystemRoleDeptMapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.springframework.beans.factory.annotation.Autowired; @@ -31,57 +30,65 @@ import java.util.Set; @Service public class SystemRoleDeptService { - @Autowired - private SystemRoleDeptMapper systemRoleDeptMapper; - @Autowired - private SystemDeptMapper systemDeptMapper; + @Autowired + private SystemRoleDeptMapper systemRoleDeptMapper; - @Transactional(rollbackFor = Exception.class) - public void batchDeleteRoleDept(Set roleIds) { - if (CollUtil.isNotEmpty(roleIds)) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(SystemRoleDeptTb::getRoleId, roleIds); - systemRoleDeptMapper.delete(wrapper); - } + /** + * 批量删除角色部门关联 -> TestPassed + * + * @param roleIds 角色id集合 + */ + @Transactional(rollbackFor = Exception.class) + public void batchDeleteRoleDept(Set roleIds) { + if (CollUtil.isNotEmpty(roleIds)) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(SystemRoleDeptTb::getRoleId, roleIds); + systemRoleDeptMapper.delete(wrapper); } + } - @Transactional(rollbackFor = Exception.class) - public void batchInsertRoleDept(Set depts, Long id) { - if (CollUtil.isNotEmpty(depts)) { - List records = new ArrayList<>(); - for (SystemDeptTb dept : depts) { - SystemRoleDeptTb record = new SystemRoleDeptTb(); - record.setRoleId(id); - record.setDeptId(dept.getId()); - records.add(record); - } - systemRoleDeptMapper.insert(records); - } + /** + * 批量绑定角色部门关联 -> TestPassed + * + * @param depts 部门集合 + * @param roleId 角色id + */ + @Transactional(rollbackFor = Exception.class) + public void batchInsertRoleDept(Set depts, Long roleId) { + if (CollUtil.isNotEmpty(depts)) { + List records = new ArrayList<>(); + for (SystemDeptTb dept : depts) { + SystemRoleDeptTb record = new SystemRoleDeptTb(); + record.setRoleId(roleId); + record.setDeptId(dept.getId()); + records.add(record); + } + systemRoleDeptMapper.insert(records); } + } - /** - * 根据部门ID统计角色数量 - * - * @param deptIds 部门ID集合 - * @return / - */ - public Long countRoleByDeptIds(Set deptIds) { - if (CollUtil.isEmpty(deptIds)) { - return 0L; - } - - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(SystemRoleDeptTb::getDeptId, deptIds); - return systemRoleDeptMapper.selectCount(wrapper); + /** + * 根据部门ID统计角色数量 -> TestPassed + * + * @param deptIds 部门id集合 + * @return / + */ + public Long countRoleByDeptIds(Set deptIds) { + if (CollUtil.isEmpty(deptIds)) { + return 0L; } + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(SystemRoleDeptTb::getDeptId, deptIds); + return systemRoleDeptMapper.selectCount(wrapper); + } - /** - * 根据角色id查询部门信息 - * - * @param roleId 角色id - * @return / - */ - public Set listUserDeptByRoleId(Long roleId) { - return systemRoleDeptMapper.listUserDeptByRoleId(roleId); - } + /** + * 根据角色id查询部门信息 -> TestPassed + * + * @param roleId 角色id + * @return / + */ + public Set listUserDeptByRoleId(Long roleId) { + return systemRoleDeptMapper.listUserDeptByRoleId(roleId); + } } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemRoleMenuService.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemRoleMenuService.java index c86ef87b..c5624ca7 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemRoleMenuService.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemRoleMenuService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,18 +16,15 @@ package cn.odboy.system.service; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; import cn.odboy.system.dal.dataobject.SystemMenuTb; import cn.odboy.system.dal.dataobject.SystemRoleMenuTb; -import cn.odboy.system.dal.model.response.SystemMenuVo; -import cn.odboy.system.dal.mysql.SystemMenuMapper; import cn.odboy.system.dal.mysql.SystemRoleMenuMapper; -import cn.odboy.util.KitBeanUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; -import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import java.util.stream.Collectors; @@ -35,70 +32,105 @@ import java.util.stream.Collectors; @Service public class SystemRoleMenuService { - @Autowired - private SystemRoleMenuMapper systemRoleMenuMapper; - @Autowired - private SystemMenuMapper systemMenuMapper; + @Autowired + private SystemRoleMenuMapper systemRoleMenuMapper; - @Transactional(rollbackFor = Exception.class) - public void deleteRoleMenuByRoleId(Long roleId) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemRoleMenuTb::getRoleId, roleId); - systemRoleMenuMapper.delete(wrapper); + /** + * 删除角色菜单关联 -> TestPassed + * + * @param roleId 角色id + */ + @Transactional(rollbackFor = Exception.class) + public void deleteRoleMenuByRoleId(Long roleId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemRoleMenuTb::getRoleId, roleId); + systemRoleMenuMapper.delete(wrapper); + } + + /** + * 批量绑定角色菜单关联 -> TestPassed + * + * @param menus 菜单集合 + * @param roleId 角色id + */ + @Transactional(rollbackFor = Exception.class) + public void batchInsertRoleMenu(Set menus, Long roleId) { + if (CollUtil.isNotEmpty(menus)) { + List records = new ArrayList<>(); + for (SystemMenuTb menu : menus) { + SystemRoleMenuTb record = new SystemRoleMenuTb(); + record.setMenuId(menu.getId()); + record.setRoleId(roleId); + records.add(record); + } + systemRoleMenuMapper.insert(records); } + } - @Transactional(rollbackFor = Exception.class) - public void batchInsertRoleMenu(Set menus, Long roleId) { - if (CollUtil.isNotEmpty(menus)) { - List records = new ArrayList<>(); - for (SystemMenuVo menu : menus) { - SystemRoleMenuTb record = new SystemRoleMenuTb(); - record.setMenuId(menu.getId()); - record.setRoleId(roleId); - records.add(record); - } - systemRoleMenuMapper.insert(records); - } + /** + * 批量删除角色菜单关联 -> TestPassed + * + * @param roleIds 角色id集合 + */ + @Transactional(rollbackFor = Exception.class) + public void batchDeleteRoleMenu(Set roleIds) { + if (CollUtil.isNotEmpty(roleIds)) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(SystemRoleMenuTb::getRoleId, roleIds); + systemRoleMenuMapper.delete(wrapper); } + } - @Transactional(rollbackFor = Exception.class) - public void batchDeleteRoleMenu(Set roleIds) { - if (CollUtil.isNotEmpty(roleIds)) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(SystemRoleMenuTb::getRoleId, roleIds); - systemRoleMenuMapper.delete(wrapper); - } + /** + * @param roleIds 角色id集合 -> TestPassed + * @return / + */ + public List listMenuByRoleIds(Set roleIds, boolean hasButton) { + if (CollUtil.isEmpty(roleIds)) { + return new ArrayList<>(); } - - public LinkedHashSet queryMenuByRoleIds(Set roleIds) { - if (CollUtil.isEmpty(roleIds)) { - return new LinkedHashSet<>(); - } - LambdaQueryWrapper roleMenuWrapper = new LambdaQueryWrapper<>(); - roleMenuWrapper.in(SystemRoleMenuTb::getRoleId, roleIds); - List menuIds = systemRoleMenuMapper.selectList(roleMenuWrapper).stream().map(SystemRoleMenuTb::getMenuId) - .collect(Collectors.toList()); - if (CollUtil.isEmpty(menuIds)) { - return new LinkedHashSet<>(); - } - LambdaQueryWrapper menuWrapper = new LambdaQueryWrapper<>(); - menuWrapper.in(SystemMenuTb::getId, menuIds); - // 排除"按钮" - menuWrapper.ne(SystemMenuTb::getType, 2); - menuWrapper.orderByAsc(SystemMenuTb::getMenuSort); - - List systemMenuTbs = systemMenuMapper.selectList(menuWrapper); - List systemMenuVos = KitBeanUtil.copyToList(systemMenuTbs, SystemMenuVo.class); - return new LinkedHashSet<>(systemMenuVos); +// LambdaQueryWrapper roleMenuWrapper = new LambdaQueryWrapper<>(); +// roleMenuWrapper.in(SystemRoleMenuTb::getRoleId, roleIds); +// List menuIds = systemRoleMenuMapper.selectList(roleMenuWrapper).stream().map(SystemRoleMenuTb::getMenuId) +// .collect(Collectors.toList()); +// if (CollUtil.isEmpty(menuIds)) { +// return new ArrayList<>(); +// } +// LambdaQueryWrapper menuWrapper = new LambdaQueryWrapper<>(); +// menuWrapper.in(SystemMenuTb::getId, menuIds); +// // 排除"按钮" +// menuWrapper.ne(SystemMenuTb::getType, 2); +// menuWrapper.orderByAsc(SystemMenuTb::getMenuSort); +// return systemMenuMapper.selectList(menuWrapper); + if (hasButton){ + return systemRoleMenuMapper.listMenuWithRoleIds(roleIds); } + return systemRoleMenuMapper.listMenuWithRoleIdsNeButton(roleIds); + } - @Transactional(rollbackFor = Exception.class) - public void deleteRoleMenuByMenuIds(List menuIds) { - if (CollUtil.isEmpty(menuIds)) { - return; - } - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(SystemRoleMenuTb::getMenuId, menuIds); - systemRoleMenuMapper.delete(wrapper); + /** + * 批量删除菜单角色关联 -> TestPassed + * + * @param menuIds 菜单id集合 + */ + @Transactional(rollbackFor = Exception.class) + public void deleteRoleMenuByMenuIds(Set menuIds) { + if (CollUtil.isEmpty(menuIds)) { + return; } + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(SystemRoleMenuTb::getMenuId, menuIds); + systemRoleMenuMapper.delete(wrapper); + } + + /** + * 根据角色id集合查询菜单权限 -> TestPassed + * + * @param roleIds 角色id集合 + * @return / + */ + public List listMenuPermissionByRoleIds(Set roleIds) { + Set permissions = systemRoleMenuMapper.listMenuPermissionByRoleIds(roleIds); + return permissions.stream().filter(StrUtil::isNotBlank).collect(Collectors.toList()); + } } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemRoleService.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemRoleService.java index c9d52fcd..87fe39f5 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemRoleService.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemRoleService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,11 +20,11 @@ import cn.hutool.core.lang.Dict; import cn.hutool.core.util.StrUtil; import cn.odboy.base.KitPageResult; import cn.odboy.framework.exception.BadRequestException; +import cn.odboy.system.dal.dataobject.SystemMenuTb; import cn.odboy.system.dal.dataobject.SystemRoleTb; import cn.odboy.system.dal.model.export.SystemRoleExportRowVo; import cn.odboy.system.dal.model.request.SystemCreateRoleArgs; import cn.odboy.system.dal.model.request.SystemQueryRoleArgs; -import cn.odboy.system.dal.model.response.SystemMenuVo; import cn.odboy.system.dal.model.response.SystemRoleCodeVo; import cn.odboy.system.dal.model.response.SystemRoleVo; import cn.odboy.system.dal.model.response.SystemUserVo; @@ -32,9 +32,9 @@ import cn.odboy.system.dal.mysql.SystemRoleMapper; import cn.odboy.system.framework.permission.core.KitSecurityHelper; import cn.odboy.util.KitBeanUtil; import cn.odboy.util.KitPageUtil; -import cn.odboy.util.KitValidUtil; import cn.odboy.util.xlsx.KitExcelExporter; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -50,250 +50,234 @@ import java.util.stream.Collectors; @Service public class SystemRoleService { - @Autowired - private SystemRoleMapper systemRoleMapper; - @Autowired - private SystemRoleMenuService systemRoleMenuService; - @Autowired - private SystemRoleDeptService systemRoleDeptService; - @Autowired - private SystemUserRoleService systemUserRoleService; + @Autowired + private SystemRoleMapper systemRoleMapper; + @Autowired + private SystemRoleMenuService systemRoleMenuService; + @Autowired + private SystemRoleDeptService systemRoleDeptService; + @Autowired + private SystemUserRoleService systemUserRoleService; - /** - * 创建 - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void saveRole(SystemCreateRoleArgs args) { - checkRoleLevels(args.getLevel()); - if (this.countRoleByName(args.getName()) > 0) { - throw new BadRequestException("角色名称已存在"); - } - SystemRoleTb roleTb = KitBeanUtil.copyToClass(args, SystemRoleTb.class); - systemRoleMapper.insert(roleTb); - // 判断是否有部门数据, 若有, 则需创建关联 - if (CollUtil.isNotEmpty(args.getDepts())) { - systemRoleDeptService.batchInsertRoleDept(args.getDepts(), roleTb.getId()); - } + /** + * 创建 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void saveRole(SystemCreateRoleArgs args) { + checkRoleLevels(args.getLevel()); + if (this.existRoleWithName(args.getName())) { + throw new BadRequestException("角色名称已存在"); } + SystemRoleTb roleTb = KitBeanUtil.copyToClass(args, SystemRoleTb.class); + systemRoleMapper.insert(roleTb); + // 判断是否有部门数据, 若有, 则需创建关联 + if (CollUtil.isNotEmpty(args.getDepts())) { + systemRoleDeptService.batchInsertRoleDept(args.getDepts(), roleTb.getId()); + } + } - private SystemRoleTb getRoleByName(String name) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemRoleTb::getName, name); - return systemRoleMapper.selectOne(wrapper); - } + private boolean existRoleWithName(String name) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemRoleTb::getName, name); + return systemRoleMapper.exists(wrapper); + } - private long countRoleByName(String name) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemRoleTb::getName, name); - return systemRoleMapper.selectCount(wrapper); - } + private boolean existRoleWithNameNeSelf(String name, Long roleId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemRoleTb::getName, name); + wrapper.eq(SystemRoleTb::getId, roleId); + return systemRoleMapper.exists(wrapper); + } - /** - * 修改 - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void updateRoleById(SystemRoleVo args) { - checkRoleLevels(args.getLevel()); - SystemRoleTb role = this.getRoleTbById(args.getId()); - SystemRoleTb role1 = this.getRoleByName(args.getName()); - if (role1 != null && !role1.getId().equals(role.getId())) { - throw new BadRequestException("角色名称已存在"); - } - role.setName(args.getName()); - role.setDescription(args.getDescription()); - role.setDataScope(args.getDataScope()); - role.setLevel(args.getLevel()); - // 更新 - systemRoleMapper.insertOrUpdate(role); - // 删除关联部门数据 - systemRoleDeptService.batchDeleteRoleDept(Collections.singleton(args.getId())); - // 判断是否有部门数据, 若有, 则需更新关联 - if (CollUtil.isNotEmpty(args.getDepts())) { - systemRoleDeptService.batchInsertRoleDept(args.getDepts(), args.getId()); - } + /** + * 修改 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void updateRoleById(SystemRoleVo args) { + checkRoleLevels(args.getLevel()); + SystemRoleTb role = systemRoleMapper.selectById(args.getId()); + if (this.existRoleWithNameNeSelf(args.getName(), role.getId())) { + throw new BadRequestException("角色名称已存在"); } + role.setName(args.getName()); + role.setDescription(args.getDescription()); + role.setDataScope(args.getDataScope()); + role.setLevel(args.getLevel()); + // 更新 + systemRoleMapper.updateById(role); + // 删除关联部门数据 + systemRoleDeptService.batchDeleteRoleDept(Collections.singleton(args.getId())); + // 判断是否有部门数据, 若有, 则需更新关联 + if (CollUtil.isNotEmpty(args.getDepts())) { + systemRoleDeptService.batchInsertRoleDept(args.getDepts(), args.getId()); + } + } - private SystemRoleTb getRoleTbById(Long id) { - return systemRoleMapper.selectById(id); + /** + * 修改绑定的菜单 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void updateBindMenuById(SystemRoleVo args) { + SystemRoleTb role = systemRoleMapper.selectById(args.getId()); + checkRoleLevels(role.getLevel()); + // 更新菜单 + systemRoleMenuService.deleteRoleMenuByRoleId(role.getId()); + Set menus = args.getMenus(); + if (CollUtil.isNotEmpty(menus)) { + systemRoleMenuService.batchInsertRoleMenu(menus, role.getId()); } + } - /** - * 修改绑定的菜单 - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void updateBindMenuById(SystemRoleVo args) { - SystemRoleTb role = systemRoleMapper.selectById(args.getId()); - checkRoleLevels(role.getLevel()); - // 更新菜单 - systemRoleMenuService.deleteRoleMenuByRoleId(role.getId()); - // 判断是否为空 - Set menus = args.getMenus(); - if (CollUtil.isNotEmpty(menus)) { - systemRoleMenuService.batchInsertRoleMenu(menus, role.getId()); - } + /** + * 删除 -> TestPassed + * + * @param ids / + */ + @Transactional(rollbackFor = Exception.class) + public void deleteRoleByIds(Set ids) { + List roleLevels = systemRoleMapper.listRoleLevelByRoleIds(new ArrayList<>(ids)); + for (Integer roleLevel : roleLevels) { + checkRoleLevels(roleLevel); } + // 验证是否被用户关联 + this.verifyBindRelationByIds(ids); + // 删除角色 + systemRoleMapper.deleteByIds(ids); + // 删除角色部门关联数据、角色菜单关联数据 + systemRoleDeptService.batchDeleteRoleDept(ids); + systemRoleMenuService.batchDeleteRoleMenu(ids); + } - /** - * 删除 - * - * @param ids / - */ - @Transactional(rollbackFor = Exception.class) - public void deleteRoleByIds(Set ids) { - List roleLevels = systemRoleMapper.selectByIds(ids).stream().map(SystemRoleTb::getLevel).distinct() - .collect(Collectors.toList()); - for (Integer roleLevel : roleLevels) { - checkRoleLevels(roleLevel); - } - // 验证是否被用户关联 - this.verifyBindRelationByIds(ids); - // 删除角色 - systemRoleMapper.deleteByIds(ids); - // 删除角色部门关联数据、角色菜单关联数据 - systemRoleDeptService.batchDeleteRoleDept(ids); - systemRoleMenuService.batchDeleteRoleMenu(ids); - } + /** + * 查询全部角色 -> TestPassed + */ + public List listAllRole() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.orderByDesc(SystemRoleTb::getCreateTime); + return systemRoleMapper.selectList(wrapper); + } - /** - * 查询全部角色 - */ - public List listAllRole() { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.orderByAsc(SystemRoleTb::getLevel); - return systemRoleMapper.selectList(wrapper); - } + /** + * 根据条件查询全部角色 -> TestPassed + * + * @param args 条件 + * @param rolePage 分页参数 + * @return / + */ + public List queryRoleByArgs(SystemQueryRoleArgs args, Page rolePage) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + this.injectQueryParams(args, wrapper); + return systemRoleMapper.selectList(wrapper); + } - /** - * 根据条件查询全部角色 - * - * @param args 条件 - * @param rolePage 分页参数 - * @return / - */ - public List queryRoleByArgs(SystemQueryRoleArgs args, Page rolePage) { - KitValidUtil.notNull(args); - // 查询角色基本信息 - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.and(StrUtil.isNotBlank(args.getBlurry()), c -> c.like(SystemRoleTb::getName, args.getBlurry()).or() - .like(SystemRoleTb::getDescription, args.getBlurry())); - if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { - wrapper.between(SystemRoleTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); - } - wrapper.orderByAsc(SystemRoleTb::getLevel); - List roles; - if (rolePage == null) { - roles = systemRoleMapper.selectList(wrapper); - } else { - Page page = systemRoleMapper.selectPage(rolePage, wrapper); - roles = page.getRecords(); - } - return roles.stream().map(systemUserRoleService::convertToRoleVo).collect(Collectors.toList()); + private void injectQueryParams(SystemQueryRoleArgs args, LambdaQueryWrapper wrapper) { + if (args != null) { + wrapper.and(StrUtil.isNotBlank(args.getBlurry()), c -> c.like(SystemRoleTb::getName, args.getBlurry()).or() + .like(SystemRoleTb::getDescription, args.getBlurry())); + if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { + wrapper.between(SystemRoleTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); + } } + wrapper.orderByAsc(SystemRoleTb::getLevel); + } - /** - * 分页查询角色 - * - * @param args 条件 - * @param page 分页条件 - * @return / - */ - public KitPageResult searchRoleByArgs(SystemQueryRoleArgs args, Page page) { - List roles = this.queryRoleByArgs(args, page); - Long total = this.countRoleByArgs(args); - return KitPageUtil.toPage(roles, total); - } + /** + * 分页查询角色 -> TestPassed + * + * @param args 条件 + * @param page 分页条件 + * @return / + */ + public KitPageResult searchRoleByArgs(SystemQueryRoleArgs args, Page page) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + this.injectQueryParams(args, wrapper); + IPage data = systemRoleMapper.selectPage(page, wrapper).convert(systemUserRoleService::convertToRoleVo); + return KitPageUtil.toPage(data); + } - /** - * 获取用户权限信息 - * - * @param user 用户信息 - * @return 权限信息 - */ - public List buildUserRolePermissions(SystemUserVo user) { - Set permissions = new HashSet<>(); - // 如果是管理员直接返回 - if (user.getIsAdmin()) { - permissions.add("admin"); - return permissions.stream().map(SystemRoleCodeVo::new).collect(Collectors.toList()); - } - List roles = systemUserRoleService.queryRoleVoByUsersId(user.getId()); - permissions = roles.stream().flatMap(role -> role.getMenus().stream()).map(SystemMenuVo::getPermission) - .filter(StrUtil::isNotBlank).collect(Collectors.toSet()); - return permissions.stream().map(SystemRoleCodeVo::new).collect(Collectors.toList()); + /** + * 查询用户权限信息 -> TestPassed? + * + * @param user 用户信息 + * @return 权限信息 + */ + public List buildUserRolePermissions(SystemUserVo user) { + Set permissions = new HashSet<>(); + // 如果是管理员直接返回 + if (user.getIsAdmin()) { + permissions.add("admin"); + return permissions.stream().map(SystemRoleCodeVo::new).collect(Collectors.toList()); } +// List roles = systemUserRoleService.listRoleVoByUsersId(user.getId()); +// permissions = roles.stream().flatMap(role -> role.getMenus().stream()).map(SystemMenuVo::getPermission) +// .filter(StrUtil::isNotBlank).collect(Collectors.toSet()); +// return permissions.stream().map(SystemRoleCodeVo::new).collect(Collectors.toList()); + Set roleIds = systemUserRoleService.listUserRoleIdByUserId(user.getId()); + // 查询角色权限 + if (CollUtil.isNotEmpty(roleIds)) { + return systemRoleMenuService.listMenuPermissionByRoleIds(roleIds).stream().map(SystemRoleCodeVo::new).collect(Collectors.toList()); + } + // 没有包含任何角色,赋予默认权限 + permissions.add("IsAJoker"); + return permissions.stream().map(SystemRoleCodeVo::new).collect(Collectors.toList()); + } - /** - * 验证是否被用户关联 - * - * @param ids / - */ - public void verifyBindRelationByIds(Set ids) { - if (systemUserRoleService.countUserByRoleIds(ids) > 0) { - throw new BadRequestException("所选角色存在用户关联, 请解除关联再试!"); - } + /** + * 验证是否被用户关联 -> TestPassed + * + * @param ids / + */ + public void verifyBindRelationByIds(Set ids) { + if (systemUserRoleService.existUserWithRoleIds(ids)) { + throw new BadRequestException("所选角色存在用户关联, 请解除关联再试!"); } + } - public Long countRoleByArgs(SystemQueryRoleArgs args) { - KitValidUtil.notNull(args); - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.and(StrUtil.isNotBlank(args.getBlurry()), c -> c.like(SystemRoleTb::getName, args.getBlurry()).or() - .like(SystemRoleTb::getDescription, args.getBlurry())); - if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { - wrapper.between(SystemRoleTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); - } - return systemRoleMapper.selectCount(wrapper); + public SystemRoleVo getRoleVoById(Long id) { + SystemRoleTb roleTb = systemRoleMapper.selectById(id); + if (roleTb == null) { + return null; } + return systemUserRoleService.convertToRoleVo(roleTb); + } - public SystemRoleVo getRoleById(Long id) { - SystemRoleTb roleTb = systemRoleMapper.selectById(id); - if (roleTb == null) { - return null; - } - return systemUserRoleService.convertToRoleVo(roleTb); - } + public Dict getCurrentUserRoleLevel() { + return Dict.create().set("level", checkRoleLevels(null)); + } - public Dict getCurrentUserRoleLevel() { - return Dict.create().set("level", checkRoleLevels(null)); + /** + * 检查用户的角色级别 -> TestPassed + * + * @return / + */ + private int checkRoleLevels(Integer level) { + Set levels = systemUserRoleService.listUserRoleLevelByUserId(KitSecurityHelper.getCurrentUserId()); + int min = Collections.min(levels); + if (level != null) { + if (level < min) { + throw new BadRequestException("权限不足, 你的角色级别:" + min + ", 低于操作的角色级别:" + level); + } } + return min; + } - /** - * 检查用户的角色级别 - * - * @return / - */ - private int checkRoleLevels(Integer level) { - List levels = systemUserRoleService.queryRoleVoByUsersId(KitSecurityHelper.getCurrentUserId()).stream() - .map(SystemRoleVo::getLevel).collect(Collectors.toList()); - int min = Collections.min(levels); - if (level != null) { - if (level < min) { - throw new BadRequestException("权限不足, 你的角色级别:" + min + ", 低于操作的角色级别:" + level); - } - } - return min; - } - - public void exportRoleXlsx(HttpServletResponse response, SystemQueryRoleArgs args) { - List systemRoleVos = this.queryRoleByArgs(args, null); - List rowVos = new ArrayList<>(); - for (SystemRoleVo dataObject : systemRoleVos) { - SystemRoleExportRowVo rowVo = new SystemRoleExportRowVo(); - rowVo.setName(dataObject.getName()); - rowVo.setLevel(dataObject.getLevel()); - rowVo.setDescription(dataObject.getDescription()); - rowVo.setCreateTime(dataObject.getCreateTime()); - rowVos.add(rowVo); - } - KitExcelExporter.exportSimple(response, "部门数据", SystemRoleExportRowVo.class, rowVos); - } - - public List listByIds(Set roleIds) { - return systemRoleMapper.selectByIds(roleIds); + public void exportRoleXlsx(HttpServletResponse response, SystemQueryRoleArgs args) { + List systemRoleVos = this.queryRoleByArgs(args, null); + List rowVos = new ArrayList<>(); + for (SystemRoleTb dataObject : systemRoleVos) { + SystemRoleExportRowVo rowVo = new SystemRoleExportRowVo(); + rowVo.setName(dataObject.getName()); + rowVo.setLevel(dataObject.getLevel()); + rowVo.setDescription(dataObject.getDescription()); + rowVo.setCreateTime(dataObject.getCreateTime()); + rowVos.add(rowVo); } + KitExcelExporter.exportSimple(response, "部门数据", SystemRoleExportRowVo.class, rowVos); + } } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserDeptService.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserDeptService.java index 986789d2..d5d7b468 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserDeptService.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserDeptService.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.service; import cn.odboy.system.dal.dataobject.SystemUserTb; @@ -10,12 +25,15 @@ import java.util.Set; @Service public class SystemUserDeptService { - @Autowired - private SystemUserMapper systemUserMapper; + @Autowired + private SystemUserMapper systemUserMapper; - public long countUserByDeptIds(Set deptIds) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(SystemUserTb::getDeptId, deptIds); - return systemUserMapper.selectCount(wrapper); - } + /** + * 根据部门id统计用户数量 -> TestPassed + */ + public long countUserByDeptIds(Set deptIds) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(SystemUserTb::getDeptId, deptIds); + return systemUserMapper.selectCount(wrapper); + } } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserJobService.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserJobService.java index c0b9057e..a994d5ee 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserJobService.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserJobService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,48 +30,60 @@ import java.util.Set; @Service public class SystemUserJobService { - @Autowired - private SystemUserJobMapper systemUserJobMapper; + @Autowired + private SystemUserJobMapper systemUserJobMapper; - @Transactional(rollbackFor = Exception.class) - public void batchInsertUserJob(Set jobs, Long userId) { - if (CollUtil.isNotEmpty(jobs)) { - List records = new ArrayList<>(); - for (SystemJobTb job : jobs) { - SystemUserJobTb record = new SystemUserJobTb(); - record.setUserId(userId); - record.setJobId(job.getId()); - records.add(record); - } - systemUserJobMapper.insert(records); - } + /** + * 批量绑定用户岗位 -> TestPassed + */ + @Transactional(rollbackFor = Exception.class) + public void batchInsertUserJob(Set jobs, Long userId) { + if (CollUtil.isNotEmpty(jobs)) { + List records = new ArrayList<>(); + for (SystemJobTb job : jobs) { + SystemUserJobTb record = new SystemUserJobTb(); + record.setUserId(userId); + record.setJobId(job.getId()); + records.add(record); + } + systemUserJobMapper.insert(records); } + } - @Transactional(rollbackFor = Exception.class) - public void batchDeleteUserJob(Set userIds) { - if (CollUtil.isNotEmpty(userIds)) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(SystemUserJobTb::getUserId, userIds); - systemUserJobMapper.delete(wrapper); - } + /** + * 批量解绑用户岗位 -> TestPassed + */ + @Transactional(rollbackFor = Exception.class) + public void batchDeleteUserJob(Set userIds) { + if (CollUtil.isNotEmpty(userIds)) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(SystemUserJobTb::getUserId, userIds); + systemUserJobMapper.delete(wrapper); } + } - /** - * 根据岗位ID统计用户数量 - * - * @param jobIds 岗位ID集合 - * @return / - */ - public Long countUserByJobIds(Set jobIds) { - if (CollUtil.isEmpty(jobIds)) { - return 0L; - } - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(SystemUserJobTb::getJobId, jobIds); - return systemUserJobMapper.selectCount(wrapper); + /** + * 根据岗位ID统计用户数量 -> TestPassed + * + * @param jobIds / + * @return / + */ + public Long countUserByJobIds(Set jobIds) { + if (CollUtil.isEmpty(jobIds)) { + return 0L; } + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(SystemUserJobTb::getJobId, jobIds); + return systemUserJobMapper.selectCount(wrapper); + } - public Set listUserJobByUserId(Long userId) { - return systemUserJobMapper.listUserJobByUserId(userId); - } + /** + * 根据用户id查询岗位 -> TestPassed + * + * @param userId / + * @return / + */ + public Set listUserJobByUserId(Long userId) { + return systemUserJobMapper.listUserJobByUserId(userId); + } } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserRoleService.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserRoleService.java index c53a4c7f..76d6e861 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserRoleService.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserRoleService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,9 @@ package cn.odboy.system.service; import cn.hutool.core.collection.CollUtil; import cn.odboy.framework.exception.BadRequestException; import cn.odboy.system.dal.dataobject.SystemDeptTb; +import cn.odboy.system.dal.dataobject.SystemMenuTb; import cn.odboy.system.dal.dataobject.SystemRoleTb; import cn.odboy.system.dal.dataobject.SystemUserRoleTb; -import cn.odboy.system.dal.model.response.SystemMenuVo; import cn.odboy.system.dal.model.response.SystemRoleVo; import cn.odboy.system.dal.model.response.SystemUserVo; import cn.odboy.system.dal.mysql.SystemRoleMapper; @@ -33,6 +33,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Collections; +import java.util.HashSet; import java.util.List; import java.util.Objects; import java.util.Set; @@ -41,122 +42,155 @@ import java.util.stream.Collectors; @Service public class SystemUserRoleService { - @Autowired - private SystemRoleMapper systemRoleMapper; - @Autowired - private SystemUserRoleMapper systemUserRoleMapper; - @Autowired - private SystemRoleMenuService systemRoleMenuService; - @Autowired - private SystemRoleDeptService systemRoleDeptService; + @Autowired + private SystemRoleMapper systemRoleMapper; + @Autowired + private SystemUserRoleMapper systemUserRoleMapper; + @Autowired + private SystemRoleMenuService systemRoleMenuService; + @Autowired + private SystemRoleDeptService systemRoleDeptService; - @Transactional(rollbackFor = Exception.class) - public void batchInsertUserRole(Set roles, Long userId) { - if (CollUtil.isNotEmpty(roles)) { - List records = new ArrayList<>(); - for (SystemRoleTb role : roles) { - SystemUserRoleTb record = new SystemUserRoleTb(); - record.setUserId(userId); - record.setRoleId(role.getId()); - records.add(record); - } - systemUserRoleMapper.insert(records); - } + /** + * 批量绑定用户角色 -> TestPassed + */ + @Transactional(rollbackFor = Exception.class) + public void batchInsertUserRole(Set roles, Long userId) { + if (CollUtil.isNotEmpty(roles)) { + List records = new ArrayList<>(); + for (SystemRoleTb role : roles) { + SystemUserRoleTb record = new SystemUserRoleTb(); + record.setUserId(userId); + record.setRoleId(role.getId()); + records.add(record); + } + systemUserRoleMapper.insert(records); } + } - @Transactional(rollbackFor = Exception.class) - public void batchDeleteUserRole(Set userIds) { - if (CollUtil.isNotEmpty(userIds)) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(SystemUserRoleTb::getUserId, userIds); - systemUserRoleMapper.delete(wrapper); - } + /** + * 批量解绑用户角色 -> TestPassed + */ + @Transactional(rollbackFor = Exception.class) + public void batchDeleteUserRole(Set userIds) { + if (CollUtil.isNotEmpty(userIds)) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(SystemUserRoleTb::getUserId, userIds); + systemUserRoleMapper.delete(wrapper); } + } - /** - * 转换为SystemRoleVo并关联查询菜单和部门信息 - * - * @param role 角色基本信息 - * @return 包含关联信息的SystemRoleVo - */ - public SystemRoleVo convertToRoleVo(SystemRoleTb role) { - if (role == null) { - return null; - } - SystemRoleVo roleVo = KitBeanUtil.copyToClass(role, SystemRoleVo.class); - // 查询关联的菜单信息 - Set menus = systemRoleMenuService.queryMenuByRoleIds(Collections.singleton(role.getId())); - roleVo.setMenus(menus); - // 查询关联的部门信息 - Set depts = systemRoleDeptService.listUserDeptByRoleId(role.getId()); - roleVo.setDepts(depts); - return roleVo; + /** + * 转换为SystemRoleVo并关联查询菜单和部门信息 + * + * @param role 角色基本信息 + * @return 包含关联信息的SystemRoleVo + */ + public SystemRoleVo convertToRoleVo(SystemRoleTb role) { + if (role == null) { + return null; } + SystemRoleVo roleVo = KitBeanUtil.copyToClass(role, SystemRoleVo.class); + // 查询关联的菜单信息 + List menus = systemRoleMenuService.listMenuByRoleIds(Collections.singleton(role.getId()), true); + roleVo.setMenus(new HashSet<>(menus)); + // 查询关联的部门信息 + Set depts = systemRoleDeptService.listUserDeptByRoleId(role.getId()); + roleVo.setDepts(depts); + return roleVo; + } - /** - * 根据用户ID查询 - * - * @param userId 用户ID - * @return / - */ - public List queryRoleVoByUsersId(Long userId) { - Set roles = this.listUserRoleByUserId(userId); - return roles.stream().map(this::convertToRoleVo).collect(Collectors.toList()); - } + /** + * 根据用户ID查询 -> TestPassed + * + * @param userId 用户ID + * @return / + */ + public List listRoleVoByUsersId(Long userId) { + Set roles = this.listUserRoleByUserId(userId); + return roles.stream().map(this::convertToRoleVo).collect(Collectors.toList()); + } - /** - * 根据角色查询角色级别 - * - * @param roles / - * @return / - */ - public Integer getDeptLevelByRoles(Set roles) { - if (CollUtil.isEmpty(roles)) { - // 最小权限 - return Integer.MAX_VALUE; - } - List roleIds = - roles.stream().map(SystemRoleTb::getId).filter(Objects::nonNull).distinct().collect(Collectors.toList()); - if (CollUtil.isEmpty(roleIds)) { - // 最小权限 - return Integer.MAX_VALUE; - } - List roleLevels = systemRoleMapper.selectList( - new LambdaQueryWrapper().select(SystemRoleTb::getLevel).isNotNull(SystemRoleTb::getLevel) - .in(SystemRoleTb::getId, roleIds)).stream().map(SystemRoleTb::getLevel).distinct() - .collect(Collectors.toList()); - if (CollUtil.isEmpty(roleLevels)) { - // 最小权限 - return Integer.MAX_VALUE; - } - return Collections.min(roleLevels); + /** + * 根据角色查询角色级别 -> TestPassed + * + * @param roles / + * @return / + */ + public Integer getDeptLevelByRoles(Set roles) { + if (CollUtil.isEmpty(roles)) { + // 最小权限 + return Integer.MAX_VALUE; } + List roleIds = roles.stream().map(SystemRoleTb::getId).filter(Objects::nonNull).distinct().collect(Collectors.toList()); + if (CollUtil.isEmpty(roleIds)) { + // 最小权限 + return Integer.MAX_VALUE; + } + List roleLevels = systemRoleMapper.listRoleLevelByRoleIds(roleIds); + if (CollUtil.isEmpty(roleLevels)) { + // 最小权限 + return Integer.MAX_VALUE; + } + return Collections.min(roleLevels); + } - /** - * 如果当前用户的角色级别低于创建用户的角色级别,则抛出权限不足的错误 - * - * @param args / - */ - public void checkLevel(SystemUserVo args) { - Integer currentLevel = Collections.min( - this.queryRoleVoByUsersId(KitSecurityHelper.getCurrentUserId()).stream().map(SystemRoleVo::getLevel) - .collect(Collectors.toList())); - Integer optLevel = this.getDeptLevelByRoles(args.getRoles()); - if (currentLevel > optLevel) { - throw new BadRequestException("角色权限不足"); - } + /** + * 如果当前用户的角色级别低于创建用户的角色级别,则抛出权限不足的错误 -> TestPassed + * + * @param args / + */ + public void checkLevel(SystemUserVo args) { + Set roleLevels = systemUserRoleMapper.listUserRoleLevelByUserId(KitSecurityHelper.getCurrentUserId()); + Integer currentLevel = Collections.min(roleLevels); + Integer optLevel = this.getDeptLevelByRoles(args.getRoles()); + if (currentLevel > optLevel) { + throw new BadRequestException("角色权限不足"); } + } - public long countUserByRoleIds(Set ids) { - if (CollUtil.isEmpty(ids)) { - return 0L; - } - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(SystemUserRoleTb::getRoleId, ids); - return systemUserRoleMapper.selectCount(wrapper); - } + /** + * 根据用户id查询角色 -> TestPassed + * + * @param userId / + * @return / + */ + public Set listUserRoleByUserId(Long userId) { + return systemUserRoleMapper.listUserRoleByUserId(userId); + } - public Set listUserRoleByUserId(Long userId) { - return systemUserRoleMapper.listUserRoleByUserId(userId); + /** + * 根据用户id查询角色级别集合 -> TestPassed + * + * @param userId / + * @return / + */ + public Set listUserRoleLevelByUserId(Long userId) { + return systemUserRoleMapper.listUserRoleLevelByUserId(userId); + } + + /** + * 根据用户id查询角色id集合 -> TestPassed + * + * @param userId / + * @return / + */ + public Set listUserRoleIdByUserId(Long userId) { + return systemUserRoleMapper.listUserRoleIdByUserId(userId); + } + + /** + * 根据角色id集合判断是否存在关联用户 -> TestPassed + * + * @param ids 角色id集合 + * @return / + */ + public boolean existUserWithRoleIds(Set ids) { + if (CollUtil.isEmpty(ids)) { + return false; } + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(SystemUserRoleTb::getRoleId, ids); + return systemUserRoleMapper.exists(wrapper); + } } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserService.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserService.java index 9cb16728..08b535cd 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserService.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,6 @@ import cn.odboy.system.dal.dataobject.SystemUserTb; import cn.odboy.system.dal.model.export.SystemUserExportRowVo; import cn.odboy.system.dal.model.request.SystemQueryUserArgs; import cn.odboy.system.dal.model.request.SystemUpdateUserPasswordArgs; -import cn.odboy.system.dal.model.response.SystemRoleVo; import cn.odboy.system.dal.model.response.SystemUserVo; import cn.odboy.system.dal.mysql.SystemUserMapper; import cn.odboy.system.dal.redis.SystemUserInfoDAO; @@ -42,7 +41,6 @@ import cn.odboy.util.KitBeanUtil; import cn.odboy.util.KitFileUtil; import cn.odboy.util.KitPageUtil; import cn.odboy.util.KitRsaEncryptUtil; -import cn.odboy.util.KitValidUtil; import cn.odboy.util.xlsx.KitExcelExporter; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -67,445 +65,459 @@ import java.util.stream.Collectors; @Service public class SystemUserService { - @Autowired - private SystemUserMapper systemUserMapper; - @Autowired - private SystemDeptService systemDeptService; - @Autowired - private SystemUserJobService systemUserJobService; - @Autowired - private SystemUserRoleService systemUserRoleService; - @Autowired - private SystemEmailService systemEmailService; - @Autowired - private SystemDataService systemDataService; - @Autowired - private SystemUserInfoDAO systemUserInfoDAO; - @Autowired - private SystemUserOnlineInfoDAO systemUserOnlineInfoDAO; - @Autowired - private KitFileLocalUploadHelper fileUploadPathHelper; - @Autowired - private AppProperties properties; - @Autowired - private PasswordEncoder passwordEncoder; + @Autowired + private SystemUserMapper systemUserMapper; + @Autowired + private SystemDeptService systemDeptService; + @Autowired + private SystemUserJobService systemUserJobService; + @Autowired + private SystemUserRoleService systemUserRoleService; + @Autowired + private SystemEmailService systemEmailService; + @Autowired + private SystemDataService systemDataService; + @Autowired + private SystemUserInfoDAO systemUserInfoDAO; + @Autowired + private SystemUserOnlineInfoDAO systemUserOnlineInfoDAO; + @Autowired + private KitFileLocalUploadHelper fileUploadPathHelper; + @Autowired + private AppProperties properties; + @Autowired + private PasswordEncoder passwordEncoder; - /** - * 新增用户 - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void saveUser(SystemUserVo args) { - systemUserRoleService.checkLevel(args); - SystemUserTb record = KitBeanUtil.copyToClass(args, SystemUserTb.class); - // 默认密码 123456 - record.setPassword(passwordEncoder.encode("123456")); - record.setDeptId(args.getDept().getId()); - if (this.getUserByUsername(record.getUsername()) != null) { - throw new BadRequestException("用户名已存在"); - } - if (this.getUserByEmail(record.getEmail()) != null) { - throw new BadRequestException("邮箱已存在"); - } - if (this.getUserByPhone(record.getPhone()) != null) { - throw new BadRequestException("手机号已存在"); - } - // 保存用户 - systemUserMapper.insert(record); - // 保存用户岗位 - systemUserJobService.batchInsertUserJob(args.getJobs(), record.getId()); - // 保存用户角色 - systemUserRoleService.batchInsertUserRole(args.getRoles(), record.getId()); + /** + * 新增用户 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void saveUser(SystemUserVo args) { + systemUserRoleService.checkLevel(args); + SystemUserTb record = KitBeanUtil.copyToClass(args, SystemUserTb.class); + // 默认密码 123456 + record.setPassword(passwordEncoder.encode("123456")); + record.setDeptId(args.getDept().getId()); + if (this.existUserWithUsername(record.getUsername())) { + throw new BadRequestException("用户名已存在"); } - - /** - * 编辑用户 - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void updateUserById(SystemUserVo args) { - systemUserRoleService.checkLevel(args); - SystemUserTb user = systemUserMapper.selectById(args.getId()); - SystemUserTb user1 = this.getUserByUsername(args.getUsername()); - SystemUserTb user2 = this.getUserByEmail(args.getEmail()); - SystemUserTb user3 = this.getUserByPhone(args.getPhone()); - if (user1 != null && !user.getId().equals(user1.getId())) { - throw new BadRequestException("用户名已存在"); - } - if (user2 != null && !user.getId().equals(user2.getId())) { - throw new BadRequestException("邮箱已存在"); - } - if (user3 != null && !user.getId().equals(user3.getId())) { - throw new BadRequestException("手机号已存在"); - } - // 如果用户被禁用, 则清除用户登录信息 - if (!args.getEnabled()) { - systemUserOnlineInfoDAO.kickOutByUsername(args.getUsername()); - } - user.setDeptId(args.getDept().getId()); - user.setUsername(args.getUsername()); - user.setEmail(args.getEmail()); - user.setEnabled(args.getEnabled()); - user.setPhone(args.getPhone()); - user.setNickName(args.getNickName()); - user.setGender(args.getGender()); - systemUserMapper.updateById(user); - // 清除用户登录缓存 - systemUserInfoDAO.deleteUserLoginInfoByUserName(user.getUsername()); - // 更新用户岗位 - systemUserJobService.batchDeleteUserJob(Collections.singleton(args.getId())); - systemUserJobService.batchInsertUserJob(args.getJobs(), args.getId()); - // 更新用户角色 - systemUserRoleService.batchDeleteUserRole(Collections.singleton(args.getId())); - systemUserRoleService.batchInsertUserRole(args.getRoles(), args.getId()); + if (this.existUserWithEmail(record.getEmail())) { + throw new BadRequestException("邮箱已存在"); } - - /** - * 用户自助修改资料 - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void updateUserCenterInfoById(SystemUserTb args) { - if (!args.getId().equals(KitSecurityHelper.getCurrentUserId())) { - throw new BadRequestException("不能修改他人资料"); - } - SystemUserTb user = systemUserMapper.selectById(args.getId()); - SystemUserTb user1 = this.getUserByPhone(args.getPhone()); - if (user1 != null && !user.getId().equals(user1.getId())) { - throw new BadRequestException("手机号已存在"); - } - user.setNickName(args.getNickName()); - user.setPhone(args.getPhone()); - user.setGender(args.getGender()); - systemUserMapper.insertOrUpdate(user); - systemUserInfoDAO.deleteUserLoginInfoByUserName(user.getUsername()); + if (this.existUserWithPhone(record.getPhone())) { + throw new BadRequestException("手机号已存在"); } + // 保存用户 + systemUserMapper.insert(record); + // 保存用户岗位 + systemUserJobService.batchInsertUserJob(args.getJobs(), record.getId()); + // 保存用户角色 + systemUserRoleService.batchInsertUserRole(args.getRoles(), record.getId()); + } - /** - * 删除用户 - * - * @param ids / - */ - @Transactional(rollbackFor = Exception.class) - public void deleteUserByIds(Set ids) { - Long currentUserId = KitSecurityHelper.getCurrentUserId(); - // 校验权限 - for (Long id : ids) { - Integer currentLevel = Collections.min( - systemUserRoleService.queryRoleVoByUsersId(currentUserId).stream().map(SystemRoleVo::getLevel) - .collect(Collectors.toList())); - Integer optLevel = Collections.min( - systemUserRoleService.queryRoleVoByUsersId(id).stream().map(SystemRoleVo::getLevel) - .collect(Collectors.toList())); - if (currentLevel > optLevel) { - throw new BadRequestException("角色权限不足, 不能删除:" + this.getUserById(id).getUsername()); - } - } - // 清理缓存 - List usernameList = systemUserMapper.selectByIds(ids).stream().map(SystemUserTb::getUsername).distinct() - .collect(Collectors.toList()); - for (String username : usernameList) { - systemUserInfoDAO.deleteUserLoginInfoByUserName(username); - } - // 删除用户 - systemUserMapper.deleteByIds(ids); - // 删除用户岗位 - systemUserJobService.batchDeleteUserJob(ids); - // 删除用户角色 - systemUserRoleService.batchDeleteUserRole(ids); + private boolean existUserWithPhone(String phone) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemUserTb::getPhone, phone); + wrapper.eq(SystemUserTb::getEnabled, 1); + return systemUserMapper.exists(wrapper); + } + + private boolean existUserWithEmail(String email) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemUserTb::getEmail, email); + wrapper.eq(SystemUserTb::getEnabled, 1); + return systemUserMapper.exists(wrapper); + } + + private boolean existUserWithUsername(String username) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemUserTb::getUsername, username); + wrapper.eq(SystemUserTb::getEnabled, 1); + return systemUserMapper.exists(wrapper); + } + + /** + * 编辑用户 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void updateUserById(SystemUserVo args) { + systemUserRoleService.checkLevel(args); + SystemUserTb user = systemUserMapper.selectById(args.getId()); + if (this.existUserWithUsernameNeSelf(args.getUsername(), user.getId())) { + throw new BadRequestException("用户名已存在"); } - - /** - * 修改密码 - * - * @param username 用户名 - * @param args 参数 - */ - @Transactional(rollbackFor = Exception.class) - public void updateUserPasswordByUsername(String username, SystemUpdateUserPasswordArgs args) throws Exception { - String oldPass = KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), args.getOldPass()); - String newPass = KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), args.getNewPass()); - SystemUserTb user = this.getUserByUsername(username); - if (!passwordEncoder.matches(oldPass, user.getPassword())) { - throw new BadRequestException("修改失败,旧密码错误"); - } - if (passwordEncoder.matches(newPass, user.getPassword())) { - throw new BadRequestException("新密码不能与旧密码相同"); - } - String encryptPassword = passwordEncoder.encode(newPass); - systemUserMapper.updateUserPasswordByUsername(username, encryptPassword); - systemUserInfoDAO.deleteUserLoginInfoByUserName(username); + if (this.existUserWithEmailNeSelf(args.getEmail(), user.getId())) { + throw new BadRequestException("邮箱已存在"); } - - /** - * 重置密码 - * - * @param ids 用户id - */ - @Transactional(rollbackFor = Exception.class) - public void resetUserPasswordByIds(Set ids) { - String defaultPwd = passwordEncoder.encode("123456"); - List users = systemUserMapper.selectByIds(ids); - // 清除缓存 - for (SystemUserTb user : users) { - // 清除缓存 - systemUserInfoDAO.deleteUserLoginInfoByUserName(user.getUsername()); - // 强制退出 - systemUserOnlineInfoDAO.kickOutByUsername(user.getUsername()); - } - // 重置密码 - systemUserMapper.updateUserPasswordByUserIds(defaultPwd, ids); + if (this.existUserWithPhoneNeSelf(args.getPhone(), user.getId())) { + throw new BadRequestException("手机号已存在"); } - - /** - * 修改头像 - * - * @param multipartFile 文件 - * @return / - */ - @Transactional(rollbackFor = Exception.class) - public Map updateUserAvatar(MultipartFile multipartFile) { - SystemUserTb user = this.getUserByUsername(KitSecurityHelper.getCurrentUsername()); - String username = user.getUsername(); - if (StrUtil.isBlank(username)) { - throw new BadRequestException("异常用户数据, 请联系管理员处理"); - } - // 文件大小验证 - KitFileUtil.checkSize(fileUploadPathHelper.getAvatarMaxSize(), multipartFile.getSize()); - // 验证文件上传的格式 - String image = "gif jpg png jpeg"; - String fileType = KitFileUtil.getSuffix(multipartFile.getOriginalFilename()); - if (fileType != null && !image.contains(fileType)) { - throw new BadRequestException("文件格式错误!, 仅支持 " + image + " 格式"); - } - String oldPath = user.getAvatarPath(); - File file = KitFileUtil.upload(multipartFile, fileUploadPathHelper.getPath()); - user.setAvatarPath(Objects.requireNonNull(file).getPath()); - user.setAvatarName(file.getName()); - systemUserMapper.insertOrUpdate(user); - if (StrUtil.isNotBlank(oldPath)) { - KitFileUtil.del(oldPath); - } - systemUserInfoDAO.deleteUserLoginInfoByUserName(username); - return new HashMap<>(1) {{ - put("avatar", file.getName()); - }}; + // 如果用户被禁用, 则清除用户登录信息 + if (!args.getEnabled()) { + systemUserOnlineInfoDAO.kickOutByUsername(args.getUsername()); } + user.setDeptId(args.getDept().getId()); + user.setUsername(args.getUsername()); + user.setEmail(args.getEmail()); + user.setEnabled(args.getEnabled()); + user.setPhone(args.getPhone()); + user.setNickName(args.getNickName()); + user.setGender(args.getGender()); + systemUserMapper.updateById(user); + // 清除用户登录缓存 + systemUserInfoDAO.deleteUserLoginInfoByUserName(user.getUsername()); + // 更新用户岗位 + systemUserJobService.batchDeleteUserJob(Collections.singleton(args.getId())); + systemUserJobService.batchInsertUserJob(args.getJobs(), args.getId()); + // 更新用户角色 + systemUserRoleService.batchDeleteUserRole(Collections.singleton(args.getId())); + systemUserRoleService.batchInsertUserRole(args.getRoles(), args.getId()); + } - /** - * 修改邮箱 - * - * @param username 用户名 - * @param args 参数 - * @param code 验证码 - */ - @Transactional(rollbackFor = Exception.class) - public void updateUserEmailByUsername(String username, SystemUserTb args, String code) throws Exception { - String password = - KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), args.getPassword()); - SystemUserTb user = this.getUserByUsername(username); - if (!passwordEncoder.matches(password, user.getPassword())) { - throw new BadRequestException("密码错误"); - } - systemEmailService.checkEmailCaptchaV1(SystemCaptchaBizEnum.EMAIL_RESET_EMAIL_CODE, args.getEmail(), code); - systemUserMapper.updateUserEmailByUsername(username, args.getEmail()); - systemUserInfoDAO.deleteUserLoginInfoByUserName(username); + private boolean existUserWithPhoneNeSelf(String phone, Long currentUserId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemUserTb::getPhone, phone); + wrapper.ne(SystemUserTb::getId, currentUserId); + return systemUserMapper.exists(wrapper); + } + + private boolean existUserWithEmailNeSelf(String email, Long currentUserId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemUserTb::getEmail, email); + wrapper.ne(SystemUserTb::getId, currentUserId); + return systemUserMapper.exists(wrapper); + } + + private boolean existUserWithUsernameNeSelf(String username, Long currentUserId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemUserTb::getUsername, username); + wrapper.ne(SystemUserTb::getId, currentUserId); + return systemUserMapper.exists(wrapper); + } + + /** + * 用户自助修改资料 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void updateUserCenterInfoById(SystemUserTb args) { + if (!args.getId().equals(KitSecurityHelper.getCurrentUserId())) { + throw new BadRequestException("不能修改他人资料"); } - - /** - * 查询全部 - * - * @param args 条件 - * @param page 分页参数 - * @return / - */ - public KitPageResult searchUserByArgs(SystemQueryUserArgs args, Page page) { - // 查询用户基本信息 - LambdaQueryWrapper wrapper = this.buildUserQueryWrapper(args); - IPage userPage = systemUserMapper.selectPage(page, wrapper); - List users = userPage.getRecords(); - // 转换为SystemUserVo并关联查询 - List userVos = - users.stream().map(m -> this.convertToUserVo(m, false)).collect(Collectors.toList()); - return KitPageUtil.toPage(userVos, userPage.getTotal()); + SystemUserTb user = systemUserMapper.selectById(args.getId()); + if (this.existUserWithPhoneNeSelf(args.getPhone(), user.getId())) { + throw new BadRequestException("手机号已存在"); } + user.setNickName(args.getNickName()); + user.setPhone(args.getPhone()); + user.setGender(args.getGender()); + systemUserMapper.updateById(user); + systemUserInfoDAO.deleteUserLoginInfoByUserName(user.getUsername()); + } - public long countUserByArgs(SystemQueryUserArgs args) { - LambdaQueryWrapper wrapper = this.buildUserQueryWrapper(args); - return systemUserMapper.selectCount(wrapper); + /** + * 删除用户 -> TestPassed + * + * @param ids / + */ + @Transactional(rollbackFor = Exception.class) + public void deleteUserByIds(Set ids) { + Long currentUserId = KitSecurityHelper.getCurrentUserId(); + // 校验权限 + for (Long id : ids) { + Integer currentLevel = Collections.min(systemUserRoleService.listUserRoleLevelByUserId(currentUserId)); + Integer optLevel = Collections.min(systemUserRoleService.listUserRoleLevelByUserId(id)); + if (currentLevel > optLevel) { + SystemUserTb systemUserTb = systemUserMapper.selectById(id); + throw new BadRequestException("角色权限不足, 不能删除:" + systemUserTb.getUsername()); + } } - - /** - * 根据ID查询 - * - * @param id ID - * @return / - */ - public SystemUserTb getUserById(long id) { - return systemUserMapper.selectById(id); + // 清理缓存 + List usernameList = systemUserMapper.listUsernameByIds(ids); + for (String username : usernameList) { + systemUserInfoDAO.deleteUserLoginInfoByUserName(username); } + // 删除用户 + systemUserMapper.deleteByIds(ids); + // 删除用户岗位 + systemUserJobService.batchDeleteUserJob(ids); + // 删除用户角色 + systemUserRoleService.batchDeleteUserRole(ids); + } - public List queryUserMetadataOptions(KitPageArgs pageArgs) { - SystemQueryUserArgs args = pageArgs.getArgs(); - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.select(SystemUserTb::getId, SystemUserTb::getDeptId, SystemUserTb::getEmail, SystemUserTb::getPhone); - wrapper.and(c -> { - c.eq(SystemUserTb::getPhone, args.getBlurry()); - c.or(); - c.eq(SystemUserTb::getEmail, args.getBlurry()); - c.or(); - c.like(SystemUserTb::getUsername, args.getBlurry()); - c.or(); - c.like(SystemUserTb::getNickName, args.getBlurry()); + /** + * 修改密码 -> TestPassed + * + * @param username 用户名 + * @param args 参数 + */ + @Transactional(rollbackFor = Exception.class) + public void updateUserPasswordByUsername(String username, SystemUpdateUserPasswordArgs args) throws Exception { + String oldPass = KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), args.getOldPass()); + String newPass = KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), args.getNewPass()); + SystemUserTb user = this.getUserByUsername(username); + if (!passwordEncoder.matches(oldPass, user.getPassword())) { + throw new BadRequestException("修改失败,旧密码错误"); + } + if (passwordEncoder.matches(newPass, user.getPassword())) { + throw new BadRequestException("新密码不能与旧密码相同"); + } + String encryptPassword = passwordEncoder.encode(newPass); + systemUserMapper.updateUserPasswordByUsername(username, encryptPassword); + systemUserInfoDAO.deleteUserLoginInfoByUserName(username); + } + + /** + * 重置密码 -> TestPassed + * + * @param ids 用户id + */ + @Transactional(rollbackFor = Exception.class) + public void resetUserPasswordByIds(Set ids) { + String defaultPwd = passwordEncoder.encode("123456"); + List users = systemUserMapper.listUsernameByIds(ids); + // 清除缓存 + for (String username : users) { + // 清除缓存 + systemUserInfoDAO.deleteUserLoginInfoByUserName(username); + // 强制退出 + systemUserOnlineInfoDAO.kickOutByUsername(username); + } + // 重置密码 + systemUserMapper.updateUserPasswordByUserIds(defaultPwd, ids); + } + + /** + * 修改头像 -> TestPassed + * + * @param multipartFile 文件 + * @return / + */ + @Transactional(rollbackFor = Exception.class) + public Map updateUserAvatar(MultipartFile multipartFile) { + SystemUserTb user = this.getUserByUsername(KitSecurityHelper.getCurrentUsername()); + String username = user.getUsername(); + if (StrUtil.isBlank(username)) { + throw new BadRequestException("异常用户数据, 请联系管理员处理!"); + } + // 文件大小验证 + KitFileUtil.checkSize(fileUploadPathHelper.getAvatarMaxSize(), multipartFile.getSize()); + // 验证文件上传的格式 + String image = "gif jpg png jpeg"; + String fileType = KitFileUtil.getSuffix(multipartFile.getOriginalFilename()); + if (fileType != null && !image.contains(fileType)) { + throw new BadRequestException("文件格式错误, 仅支持 " + image + " 格式!"); + } + String oldPath = user.getAvatarPath(); + File file = KitFileUtil.upload(multipartFile, fileUploadPathHelper.getPath()); + user.setAvatarPath(Objects.requireNonNull(file).getPath()); + user.setAvatarName(file.getName()); + systemUserMapper.updateById(user); + if (StrUtil.isNotBlank(oldPath)) { + KitFileUtil.del(oldPath); + } + systemUserInfoDAO.deleteUserLoginInfoByUserName(username); + return new HashMap<>(1) {{ + put("avatar", file.getName()); + }}; + } + + /** + * 修改邮箱 -> TestPassed + * + * @param username 用户名 + * @param args 参数 + * @param code 验证码 + */ + @Transactional(rollbackFor = Exception.class) + public void updateUserEmailByUsername(String username, SystemUserTb args, String code) throws Exception { + String password = KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), args.getPassword()); + SystemUserTb user = this.getUserByUsername(username); + if (!passwordEncoder.matches(password, user.getPassword())) { + throw new BadRequestException("密码错误"); + } + systemEmailService.checkEmailCaptchaV1(SystemCaptchaBizEnum.EMAIL_RESET_EMAIL_CODE, args.getEmail(), code); + systemUserMapper.updateUserEmailByUsername(username, args.getEmail()); + systemUserInfoDAO.deleteUserLoginInfoByUserName(username); + } + + /** + * 查询全部 -> TestPassed + * + * @param args 条件 + * @param page 分页参数 + * @return / + */ + public KitPageResult searchUserByArgs(SystemQueryUserArgs args, Page page) { + // 查询用户基本信息 + LambdaQueryWrapper wrapper = this.buildUserQueryWrapper(args); + IPage userPage = systemUserMapper.selectPage(page, wrapper); + List users = userPage.getRecords(); + // 转换为SystemUserVo并关联查询 + List userVos = users.stream().map(m -> this.convertToUserVo(m, false)).collect(Collectors.toList()); + return KitPageUtil.toPage(userVos, userPage.getTotal()); + } + + public long countUserByArgs(SystemQueryUserArgs args) { + LambdaQueryWrapper wrapper = this.buildUserQueryWrapper(args); + return systemUserMapper.selectCount(wrapper); + } + + public List queryUserMetadataOptions(KitPageArgs pageArgs) { + SystemQueryUserArgs args = pageArgs.getArgs(); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.select(SystemUserTb::getId, SystemUserTb::getDeptId, SystemUserTb::getEmail, SystemUserTb::getPhone); + wrapper.and(c -> { + c.eq(SystemUserTb::getPhone, args.getBlurry()); + c.or(); + c.eq(SystemUserTb::getEmail, args.getBlurry()); + c.or(); + c.like(SystemUserTb::getUsername, args.getBlurry()); + c.or(); + c.like(SystemUserTb::getNickName, args.getBlurry()); + }); + return systemUserMapper.selectPage(new Page<>(pageArgs.getPage(), 50), wrapper).getRecords().stream().map(m -> { + Map ext = new HashMap<>(1); + ext.put("id", m.getId()); + ext.put("deptId", m.getDeptId()); + ext.put("email", m.getEmail()); + ext.put("phone", m.getPhone()); + return KitSelectOptionVo.builder().label(m.getNickName()).value(String.valueOf(m.getId())).ext(ext).build(); + }).collect(Collectors.toList()); + } + + /** + * 构建用户查询条件 -> TestPassed + * + * @param args 查询条件 + * @return / + */ + private LambdaQueryWrapper buildUserQueryWrapper(SystemQueryUserArgs args) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + if (args != null) { + if (args.getId() != null) { + wrapper.eq(SystemUserTb::getId, args.getId()); + } + if (args.getEnabled() != null) { + wrapper.eq(SystemUserTb::getEnabled, args.getEnabled()); + } + if (CollUtil.isNotEmpty(args.getDeptIds())) { + wrapper.in(SystemUserTb::getDeptId, args.getDeptIds()); + } + if (StrUtil.isNotBlank(args.getBlurry())) { + wrapper.and(w -> w.like(SystemUserTb::getUsername, args.getBlurry()).or() + .like(SystemUserTb::getNickName, args.getBlurry()).or().like(SystemUserTb::getEmail, args.getBlurry())); + } + if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { + wrapper.between(SystemUserTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); + } + } + wrapper.orderByDesc(SystemUserTb::getCreateTime); + return wrapper; + } + + /** + * 转换为SystemUserVo并关联查询部门、角色、岗位信息 -> TestPassed + * + * @param user 用户基本信息 + * @param includePassword 是否包含用户密码 + * @return 包含关联信息的SystemUserVo + */ + private SystemUserVo convertToUserVo(SystemUserTb user, boolean includePassword) { + if (user == null) { + return null; + } + if (!includePassword) { + // 查询用户时,清空密码 + user.setPassword(null); + } + SystemUserVo userVo = KitBeanUtil.copyToClass(user, SystemUserVo.class); + // 查询关联的部门信息 + if (user.getDeptId() != null) { + userVo.setDept(systemDeptService.getDeptVoById(user.getDeptId())); + } + // 查询关联的岗位信息 + userVo.setJobs(systemUserJobService.listUserJobByUserId(user.getId())); + // 查询关联的角色信息 + userVo.setRoles(systemUserRoleService.listUserRoleByUserId(user.getId())); + return userVo; + } + + public SystemUserTb getUserByUsername(String username) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemUserTb::getUsername, username); + wrapper.eq(SystemUserTb::getEnabled, 1); + return systemUserMapper.selectOne(wrapper); + } + + public SystemUserVo getUserVoWithPasswordByUsername(String username) { + return this.convertToUserVo(this.getUserByUsername(username), true); + } + + public SystemUserVo getUserVoByUsername(String username) { + return this.convertToUserVo(this.getUserByUsername(username), false); + } + + /** + * 聚合查询 -> TestPassed + */ + public KitPageResult aggregationSearchUserByArgs(Page page, SystemQueryUserArgs args, + String currentUsername) { + if (!ObjectUtils.isEmpty(args.getDeptId())) { + args.getDeptIds().add(args.getDeptId()); + // 先查找是否存在子节点 + List data = systemDeptService.listDeptByPid(args.getDeptId()); + Map> deptPidMap = systemDeptService.listPidNonNull().stream().collect(Collectors.groupingBy(SystemDeptTb::getPid)); + // 然后把子节点的ID都加入到集合中 + args.getDeptIds().addAll(systemDeptService.queryChildDeptIdByDeptIds(data, deptPidMap)); + } + // 数据权限 + List dataScopes = systemDataService.queryDeptIdByArgs(this.getUserVoByUsername(currentUsername)); + // args.getDeptIds() 不为空并且数据权限不为空则取交集 + if (!CollUtil.isEmpty(args.getDeptIds()) && !CollUtil.isEmpty(dataScopes)) { + // 取交集 + args.getDeptIds().retainAll(dataScopes); + if (!CollUtil.isEmpty(args.getDeptIds())) { + return this.searchUserByArgs(args, page); + } + } else { + // 否则取并集 + args.getDeptIds().addAll(dataScopes); + return this.searchUserByArgs(args, page); + } + return KitPageUtil.emptyData(); + } + + /** + * 导出 -> TestPassed + */ + public void exportUserXlsx(HttpServletResponse response, SystemQueryUserArgs args) { + long totalCount = this.countUserByArgs(args); + KitExcelExporter.exportByPage(response, "用户数据", SystemUserExportRowVo.class, totalCount, + (long pageNum, long pageSize) -> { + KitPageResult pageResult = this.searchUserByArgs(args, new Page<>(pageNum, pageSize)); + List rowVos = new ArrayList<>(); + for (SystemUserVo dataObject : pageResult.getContent()) { + SystemUserExportRowVo rowVo = new SystemUserExportRowVo(); + rowVo.setUsername(dataObject.getUsername()); + rowVo.setRoles( + dataObject.getRoles().stream().map(SystemRoleTb::getName).collect(Collectors.joining(","))); + rowVo.setDept(dataObject.getDept().getName()); + rowVo.setJobs( + dataObject.getJobs().stream().map(SystemJobTb::getName).collect(Collectors.joining(","))); + rowVo.setEmail(dataObject.getEmail()); + rowVo.setStatus(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR); + rowVo.setMobile(dataObject.getPhone()); + rowVo.setUpdatePwdTime(dataObject.getPwdResetTime()); + rowVo.setCreateTime(dataObject.getCreateTime()); + rowVos.add(rowVo); + } + return rowVos; }); - return systemUserMapper.selectPage(new Page<>(pageArgs.getPage(), 50), wrapper).getRecords().stream().map(m -> { - Map ext = new HashMap<>(1); - ext.put("id", m.getId()); - ext.put("deptId", m.getDeptId()); - ext.put("email", m.getEmail()); - ext.put("phone", m.getPhone()); - return KitSelectOptionVo.builder().label(m.getNickName()).value(String.valueOf(m.getId())).ext(ext).build(); - }).collect(Collectors.toList()); - } - - /** - * 构建用户查询条件 - * - * @param args 查询条件 - * @return / - */ - private LambdaQueryWrapper buildUserQueryWrapper(SystemQueryUserArgs args) { - KitValidUtil.notNull(args); - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - if (args.getId() != null) { - wrapper.eq(SystemUserTb::getId, args.getId()); - } - if (args.getEnabled() != null) { - wrapper.eq(SystemUserTb::getEnabled, args.getEnabled()); - } - if (CollUtil.isNotEmpty(args.getDeptIds())) { - wrapper.in(SystemUserTb::getDeptId, args.getDeptIds()); - } - if (StrUtil.isNotBlank(args.getBlurry())) { - wrapper.and(w -> w.like(SystemUserTb::getUsername, args.getBlurry()).or() - .like(SystemUserTb::getNickName, args.getBlurry()).or().like(SystemUserTb::getEmail, args.getBlurry())); - } - if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { - wrapper.between(SystemUserTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); - } - wrapper.orderByDesc(SystemUserTb::getCreateTime); - return wrapper; - } - - /** - * 转换为SystemUserVo并关联查询部门、角色、岗位信息 - * - * @param user 用户基本信息 - * @param includePassword 是否包含用户密码 - * @return 包含关联信息的SystemUserVo - */ - private SystemUserVo convertToUserVo(SystemUserTb user, boolean includePassword) { - if (user == null) { - return null; - } - if (!includePassword) { - // 查询用户时,清空密码 - user.setPassword(null); - } - SystemUserVo userVo = KitBeanUtil.copyToClass(user, SystemUserVo.class); - // 查询关联的部门信息 - if (user.getDeptId() != null) { - userVo.setDept(systemDeptService.getDeptVoById(user.getDeptId())); - } - // 查询关联的岗位信息 - userVo.setJobs(systemUserJobService.listUserJobByUserId(user.getId())); - // 查询关联的角色信息 - userVo.setRoles(systemUserRoleService.listUserRoleByUserId(user.getId())); - return userVo; - } - - public SystemUserTb getUserByUsername(String username) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemUserTb::getUsername, username); - wrapper.eq(SystemUserTb::getEnabled, 1); - return systemUserMapper.selectOne(wrapper); - } - - public SystemUserVo getUserVoWithPasswordByUsername(String username) { - return this.convertToUserVo(this.getUserByUsername(username), true); - } - - public SystemUserVo getUserVoByUsername(String username) { - return this.convertToUserVo(this.getUserByUsername(username), false); - } - - public SystemUserTb getUserByEmail(String email) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemUserTb::getEmail, email); - wrapper.eq(SystemUserTb::getEnabled, 1); - return systemUserMapper.selectOne(wrapper); - } - - public SystemUserTb getUserByPhone(String phone) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemUserTb::getPhone, phone); - wrapper.eq(SystemUserTb::getEnabled, 1); - return systemUserMapper.selectOne(wrapper); - } - - public KitPageResult aggregationSearchUserByArgs(Page page, SystemQueryUserArgs args, - String currentUsername) { - if (!ObjectUtils.isEmpty(args.getDeptId())) { - args.getDeptIds().add(args.getDeptId()); - // 先查找是否存在子节点 - List data = systemDeptService.listDeptByPid(args.getDeptId()); - Map> deptPidMap = - systemDeptService.listPidNonNull().stream().collect(Collectors.groupingBy(SystemDeptTb::getPid)); - // 然后把子节点的ID都加入到集合中 - args.getDeptIds().addAll(systemDeptService.queryChildDeptIdByDeptIds(data, deptPidMap)); - } - // 数据权限 - List dataScopes = systemDataService.queryDeptIdByArgs(this.getUserVoByUsername(currentUsername)); - // args.getDeptIds() 不为空并且数据权限不为空则取交集 - if (!CollUtil.isEmpty(args.getDeptIds()) && !CollUtil.isEmpty(dataScopes)) { - // 取交集 - args.getDeptIds().retainAll(dataScopes); - if (!CollUtil.isEmpty(args.getDeptIds())) { - return this.searchUserByArgs(args, page); - } - } else { - // 否则取并集 - args.getDeptIds().addAll(dataScopes); - return this.searchUserByArgs(args, page); - } - return KitPageUtil.emptyData(); - } - - public void exportUserXlsx(HttpServletResponse response, SystemQueryUserArgs args) { - long totalCount = this.countUserByArgs(args); - KitExcelExporter.exportByPage(response, "用户数据", SystemUserExportRowVo.class, totalCount, - (long pageNum, long pageSize) -> { - KitPageResult pageResult = this.searchUserByArgs(args, new Page<>(pageNum, pageSize)); - List rowVos = new ArrayList<>(); - for (SystemUserVo dataObject : pageResult.getContent()) { - SystemUserExportRowVo rowVo = new SystemUserExportRowVo(); - rowVo.setUsername(dataObject.getUsername()); - rowVo.setRoles( - dataObject.getRoles().stream().map(SystemRoleTb::getName).collect(Collectors.joining(","))); - rowVo.setDept(dataObject.getDept().getName()); - rowVo.setJobs( - dataObject.getJobs().stream().map(SystemJobTb::getName).collect(Collectors.joining(","))); - rowVo.setEmail(dataObject.getEmail()); - rowVo.setStatus(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR); - rowVo.setMobile(dataObject.getPhone()); - rowVo.setUpdatePwdTime(dataObject.getPwdResetTime()); - rowVo.setCreateTime(dataObject.getCreateTime()); - rowVos.add(rowVo); - } - return rowVos; - }); - } + } } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/impl/SystemMinioStorageServiceImpl.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/impl/SystemMinioStorageServiceImpl.java index ded396f3..645b158d 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/impl/SystemMinioStorageServiceImpl.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/service/impl/SystemMinioStorageServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,110 +59,110 @@ import java.util.List; public class SystemMinioStorageServiceImpl extends ServiceImpl implements SystemOssStorageService { - @Autowired - private MinioRepository minioRepository; - @Autowired - private AppProperties properties; - @Autowired - private KitFileLocalUploadHelper fileLocalUploadHelper; - @Autowired - private SystemOssStorageMapper systemOssStorageMapper; + @Autowired + private MinioRepository minioRepository; + @Autowired + private AppProperties properties; + @Autowired + private KitFileLocalUploadHelper fileLocalUploadHelper; + @Autowired + private SystemOssStorageMapper systemOssStorageMapper; - @Override - public KitPageResult searchOssStorage(SystemQueryStorageArgs args, - Page page) { - IPage ossStorageTbs = this.selectOssStorageByArgs(args, page); - for (SystemOssStorageVo storageVo : ossStorageTbs.getRecords()) { - storageVo.setFileSizeDesc(KitFileUtil.getSize(storageVo.getFileSize())); - } - return KitPageUtil.toPage(ossStorageTbs); + @Override + public KitPageResult searchOssStorage(SystemQueryStorageArgs args, + Page page) { + IPage ossStorageTbs = this.selectOssStorageByArgs(args, page); + for (SystemOssStorageVo storageVo : ossStorageTbs.getRecords()) { + storageVo.setFileSizeDesc(KitFileUtil.getSize(storageVo.getFileSize())); } + return KitPageUtil.toPage(ossStorageTbs); + } - private IPage selectOssStorageByArgs(SystemQueryStorageArgs args, - Page page) { - KitValidUtil.notNull(args); - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.and(StrUtil.isNotBlank(args.getBlurry()), - c -> c.like(SystemOssStorageTb::getFileName, args.getBlurry()).or() - .like(SystemOssStorageTb::getFilePrefix, args.getBlurry()).or() - .like(SystemOssStorageTb::getFileMime, args.getBlurry()).or() - .like(SystemOssStorageTb::getFileMd5, args.getBlurry())); - if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { - wrapper.between(SystemOssStorageTb::getUpdateTime, args.getCreateTime().get(0), - args.getCreateTime().get(1)); - } - wrapper.orderByAsc(SystemOssStorageTb::getId); - return systemOssStorageMapper.selectPage(page, wrapper) - .convert(i -> KitBeanUtil.copyToClass(i, SystemOssStorageVo.class)); + private IPage selectOssStorageByArgs(SystemQueryStorageArgs args, + Page page) { + KitValidUtil.notNull(args); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.and(StrUtil.isNotBlank(args.getBlurry()), + c -> c.like(SystemOssStorageTb::getFileName, args.getBlurry()).or() + .like(SystemOssStorageTb::getFilePrefix, args.getBlurry()).or() + .like(SystemOssStorageTb::getFileMime, args.getBlurry()).or() + .like(SystemOssStorageTb::getFileMd5, args.getBlurry())); + if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { + wrapper.between(SystemOssStorageTb::getUpdateTime, args.getCreateTime().get(0), + args.getCreateTime().get(1)); } + wrapper.orderByAsc(SystemOssStorageTb::getId); + return systemOssStorageMapper.selectPage(page, wrapper) + .convert(i -> KitBeanUtil.copyToClass(i, SystemOssStorageVo.class)); + } - @Override - public List queryOssStorage(SystemQueryStorageArgs args) { - // 防止刷数据 - Page page = new Page<>(1, 500); - return searchOssStorage(args, page).getContent(); - } + @Override + public List queryOssStorage(SystemQueryStorageArgs args) { + // 防止刷数据 + Page page = new Page<>(1, 500); + return searchOssStorage(args, page).getContent(); + } - @Override - @Transactional(rollbackFor = Exception.class) - public String uploadFile(MultipartFile file) { - String originalFilename = file.getOriginalFilename(); - if (StrUtil.isBlank(originalFilename)) { - throw new BadRequestException("文件名不能为空"); - } - StorageOSSModel ossConfig = properties.getOss(); - long fileSize = file.getSize(); - String contentType = file.getContentType(); - KitFileUtil.checkSize(ossConfig.getMaxSize(), fileSize); - // 按天分组 - String nowDateStr = KitDateUtil.getNowDateStr(); - // 上传到本地临时目录 - File tempFile = KitFileUtil.upload(file, fileLocalUploadHelper.getPath() + nowDateStr + File.separator); - if (tempFile == null) { - throw new BadRequestException("上传失败"); - } - // 校验文件md5, 看是否已存在云端(不确定, 可能云端已经删除, 但是正常来说云端是不允许私自删除的, 所以这里忽略云端不存在的情况) - String md5 = KitFileUtil.getMd5(tempFile); - SystemOssStorageTb systemOssStorageTb = this.getOssStorageByMd5(md5); - if (systemOssStorageTb != null) { - // 重新生成7天链接 - return minioRepository.generatePreviewUrl(systemOssStorageTb.getObjectName()); - } - // 上传到OSS - SystemOssStorageTb storageTb = minioRepository.upload(tempFile, originalFilename, fileSize, contentType, md5); - if (storageTb == null) { - throw new BadRequestException("文件上传失败"); - } - save(storageTb); - return minioRepository.generatePreviewUrl(storageTb.getObjectName()); + @Override + @Transactional(rollbackFor = Exception.class) + public String uploadFile(MultipartFile file) { + String originalFilename = file.getOriginalFilename(); + if (StrUtil.isBlank(originalFilename)) { + throw new BadRequestException("文件名不能为空"); } + StorageOSSModel ossConfig = properties.getOss(); + long fileSize = file.getSize(); + String contentType = file.getContentType(); + KitFileUtil.checkSize(ossConfig.getMaxSize(), fileSize); + // 按天分组 + String nowDateStr = KitDateUtil.getNowDateStr(); + // 上传到本地临时目录 + File tempFile = KitFileUtil.upload(file, fileLocalUploadHelper.getPath() + nowDateStr + File.separator); + if (tempFile == null) { + throw new BadRequestException("上传失败"); + } + // 校验文件md5, 看是否已存在云端(不确定, 可能云端已经删除, 但是正常来说云端是不允许私自删除的, 所以这里忽略云端不存在的情况) + String md5 = KitFileUtil.getMd5(tempFile); + SystemOssStorageTb systemOssStorageTb = this.getOssStorageByMd5(md5); + if (systemOssStorageTb != null) { + // 重新生成7天链接 + return minioRepository.generatePreviewUrl(systemOssStorageTb.getObjectName()); + } + // 上传到OSS + SystemOssStorageTb storageTb = minioRepository.upload(tempFile, originalFilename, fileSize, contentType, md5); + if (storageTb == null) { + throw new BadRequestException("文件上传失败"); + } + save(storageTb); + return minioRepository.generatePreviewUrl(storageTb.getObjectName()); + } - /** - * 多选删除 - * - * @param ids / - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void deleteFileByIds(Long[] ids) { - for (Long id : ids) { - SystemOssStorageTb storage = getById(id); - minioRepository.removeBucketFile(storage.getObjectName()); - removeById(storage); - } + /** + * 多选删除 + * + * @param ids / + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteFileByIds(Long[] ids) { + for (Long id : ids) { + SystemOssStorageTb storage = getById(id); + minioRepository.removeBucketFile(storage.getObjectName()); + removeById(storage); } + } - @Override - public void exportOssStorageXlsx(HttpServletResponse response, SystemQueryStorageArgs args) { - List systemOssStorageVos = this.queryOssStorage(args); - // KitXlsxExportUtil.exportFile(response, "OSS文件上传记录数据", systemOssStorageVos, SystemOssStorageExportRowVo.class, - // (dataObject) -> CollUtil.newArrayList(KitBeanUtil.copyProperties(dataObject, SystemOssStorageExportRowVo.class))); - List rowVos = - KitBeanUtil.copyToList(systemOssStorageVos, SystemOssStorageExportRowVo.class); - KitExcelExporter.exportSimple(response, "OSS文件上传记录数据", SystemOssStorageExportRowVo.class, rowVos); - } + @Override + public void exportOssStorageXlsx(HttpServletResponse response, SystemQueryStorageArgs args) { + List systemOssStorageVos = this.queryOssStorage(args); + // KitXlsxExportUtil.exportFile(response, "OSS文件上传记录数据", systemOssStorageVos, SystemOssStorageExportRowVo.class, + // (dataObject) -> CollUtil.newArrayList(KitBeanUtil.copyProperties(dataObject, SystemOssStorageExportRowVo.class))); + List rowVos = + KitBeanUtil.copyToList(systemOssStorageVos, SystemOssStorageExportRowVo.class); + KitExcelExporter.exportSimple(response, "OSS文件上传记录数据", SystemOssStorageExportRowVo.class, rowVos); + } - private SystemOssStorageTb getOssStorageByMd5(String md5) { - return lambdaQuery().eq(SystemOssStorageTb::getFileMd5, md5).one(); - } + private SystemOssStorageTb getOssStorageByMd5(String md5) { + return lambdaQuery().eq(SystemOssStorageTb::getFileMd5, md5).one(); + } } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/util/KitSqlUtil.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/util/KitSqlUtil.java index 63d538b5..7ab4e498 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/util/KitSqlUtil.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/util/KitSqlUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-module-system/src/main/resources/mapper/SystemDictDetailMapper.xml b/cutejava-springboot3/cutejava-module-system/src/main/resources/mapper/SystemDictDetailMapper.xml index ad6e4642..c8985ddd 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/resources/mapper/SystemDictDetailMapper.xml +++ b/cutejava-springboot3/cutejava-module-system/src/main/resources/mapper/SystemDictDetailMapper.xml @@ -1,29 +1,29 @@ - - + + diff --git a/cutejava-springboot3/cutejava-module-system/src/main/resources/mapper/SystemRoleMapper.xml b/cutejava-springboot3/cutejava-module-system/src/main/resources/mapper/SystemRoleMapper.xml new file mode 100644 index 00000000..486a3730 --- /dev/null +++ b/cutejava-springboot3/cutejava-module-system/src/main/resources/mapper/SystemRoleMapper.xml @@ -0,0 +1,13 @@ + + + + + diff --git a/cutejava-springboot3/cutejava-module-system/src/main/resources/mapper/SystemRoleMenuMapper.xml b/cutejava-springboot3/cutejava-module-system/src/main/resources/mapper/SystemRoleMenuMapper.xml new file mode 100644 index 00000000..c19292ae --- /dev/null +++ b/cutejava-springboot3/cutejava-module-system/src/main/resources/mapper/SystemRoleMenuMapper.xml @@ -0,0 +1,40 @@ + + + + + + + diff --git a/cutejava-springboot3/cutejava-module-system/src/main/resources/mapper/SystemUserMapper.xml b/cutejava-springboot3/cutejava-module-system/src/main/resources/mapper/SystemUserMapper.xml new file mode 100644 index 00000000..87c7aad5 --- /dev/null +++ b/cutejava-springboot3/cutejava-module-system/src/main/resources/mapper/SystemUserMapper.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/cutejava-springboot3/cutejava-module-system/src/main/resources/mapper/SystemUserRoleMapper.xml b/cutejava-springboot3/cutejava-module-system/src/main/resources/mapper/SystemUserRoleMapper.xml index 177b248e..19b83a1f 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/resources/mapper/SystemUserRoleMapper.xml +++ b/cutejava-springboot3/cutejava-module-system/src/main/resources/mapper/SystemUserRoleMapper.xml @@ -7,4 +7,16 @@ LEFT JOIN system_users_roles t2 ON t1.role_id = t2.role_id WHERE t2.user_id = #{userId} + + diff --git a/cutejava-springboot3/cutejava-starter/src/main/java/cn/odboy/AppRun.java b/cutejava-springboot3/cutejava-starter/src/main/java/cn/odboy/AppRun.java index d450df18..17cfe0ef 100644 --- a/cutejava-springboot3/cutejava-starter/src/main/java/cn/odboy/AppRun.java +++ b/cutejava-springboot3/cutejava-starter/src/main/java/cn/odboy/AppRun.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-starter/src/main/java/cn/odboy/GenCode.java b/cutejava-springboot3/cutejava-starter/src/main/java/cn/odboy/GenCode.java index 053dc9b4..551aa6d9 100644 --- a/cutejava-springboot3/cutejava-starter/src/main/java/cn/odboy/GenCode.java +++ b/cutejava-springboot3/cutejava-starter/src/main/java/cn/odboy/GenCode.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-starter/src/main/java/cn/odboy/HealthCheckPointer.java b/cutejava-springboot3/cutejava-starter/src/main/java/cn/odboy/HealthCheckPointer.java index eaf005a5..99ef451d 100644 --- a/cutejava-springboot3/cutejava-starter/src/main/java/cn/odboy/HealthCheckPointer.java +++ b/cutejava-springboot3/cutejava-starter/src/main/java/cn/odboy/HealthCheckPointer.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-starter/src/main/resources/logback.xml b/cutejava-springboot3/cutejava-starter/src/main/resources/logback.xml index 6e9cdd7a..51c5437f 100644 --- a/cutejava-springboot3/cutejava-starter/src/main/resources/logback.xml +++ b/cutejava-springboot3/cutejava-starter/src/main/resources/logback.xml @@ -1,44 +1,40 @@ - CuteJava - - - - - - - - - - - - - - - - - ${log.pattern} - ${log.charset} - - - - - ${log.home}/${log.name}.log - - ${log.home}/${log.name}.log.%d{yyyy-MM-dd}.%i.log - 90 - 100MB - - - ${log.pattern} - - - - - - - - - + CuteJava + + + + + + + + + + + + + + + ${log.pattern} + ${log.charset} + + + + ${log.home}/${log.name}.log + + ${log.home}/${log.name}.log.%d{yyyy-MM-dd}.%i.log + 90 + 100MB + + + ${log.pattern} + + + + + + + + \ No newline at end of file diff --git a/cutejava-springboot3/cutejava-starter/src/test/java/cn/odboy/MyBatisMapperTests.java b/cutejava-springboot3/cutejava-starter/src/test/java/cn/odboy/MyBatisMapperTests.java index 913af24e..0fd9393b 100644 --- a/cutejava-springboot3/cutejava-starter/src/test/java/cn/odboy/MyBatisMapperTests.java +++ b/cutejava-springboot3/cutejava-starter/src/test/java/cn/odboy/MyBatisMapperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-starter/src/test/java/cn/odboy/SystemApplicationTests.java b/cutejava-springboot3/cutejava-starter/src/test/java/cn/odboy/SystemApplicationTests.java index c9e6daeb..a47057b1 100644 --- a/cutejava-springboot3/cutejava-starter/src/test/java/cn/odboy/SystemApplicationTests.java +++ b/cutejava-springboot3/cutejava-starter/src/test/java/cn/odboy/SystemApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-starter/src/test/java/cn/odboy/util/KitDesEncryptUtilTest.java b/cutejava-springboot3/cutejava-starter/src/test/java/cn/odboy/util/KitDesEncryptUtilTest.java index 955b1c4a..8dafe8c6 100644 --- a/cutejava-springboot3/cutejava-starter/src/test/java/cn/odboy/util/KitDesEncryptUtilTest.java +++ b/cutejava-springboot3/cutejava-starter/src/test/java/cn/odboy/util/KitDesEncryptUtilTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-starter/src/test/java/cn/odboy/util/KitFileUtilTest.java b/cutejava-springboot3/cutejava-starter/src/test/java/cn/odboy/util/KitFileUtilTest.java index cf256ca2..dfefcc96 100644 --- a/cutejava-springboot3/cutejava-starter/src/test/java/cn/odboy/util/KitFileUtilTest.java +++ b/cutejava-springboot3/cutejava-starter/src/test/java/cn/odboy/util/KitFileUtilTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-starter/src/test/java/cn/odboy/util/KitStringUtilTest.java b/cutejava-springboot3/cutejava-starter/src/test/java/cn/odboy/util/KitStringUtilTest.java index eb749543..0b48cd39 100644 --- a/cutejava-springboot3/cutejava-starter/src/test/java/cn/odboy/util/KitStringUtilTest.java +++ b/cutejava-springboot3/cutejava-starter/src/test/java/cn/odboy/util/KitStringUtilTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava-springboot3/cutejava-starter/src/test/java/cn/odboy/util/WorkTimeTests.java b/cutejava-springboot3/cutejava-starter/src/test/java/cn/odboy/util/WorkTimeTests.java index c7a8fe6a..06b0277a 100644 --- a/cutejava-springboot3/cutejava-starter/src/test/java/cn/odboy/util/WorkTimeTests.java +++ b/cutejava-springboot3/cutejava-starter/src/test/java/cn/odboy/util/WorkTimeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/annotation/AnonymousAccess.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/annotation/AnonymousAccess.java index 0180a757..11451583 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/annotation/AnonymousAccess.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/annotation/AnonymousAccess.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/annotation/AnonymousDeleteMapping.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/annotation/AnonymousDeleteMapping.java index a6807e02..d26d893e 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/annotation/AnonymousDeleteMapping.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/annotation/AnonymousDeleteMapping.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/annotation/AnonymousGetMapping.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/annotation/AnonymousGetMapping.java index bbec2c98..91be45dd 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/annotation/AnonymousGetMapping.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/annotation/AnonymousGetMapping.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/annotation/AnonymousPatchMapping.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/annotation/AnonymousPatchMapping.java index 3f356a16..165f539b 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/annotation/AnonymousPatchMapping.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/annotation/AnonymousPatchMapping.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/annotation/AnonymousPostMapping.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/annotation/AnonymousPostMapping.java index 8b399dde..f4603751 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/annotation/AnonymousPostMapping.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/annotation/AnonymousPostMapping.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/annotation/AnonymousPutMapping.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/annotation/AnonymousPutMapping.java index 6ee730b8..d54b2521 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/annotation/AnonymousPutMapping.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/annotation/AnonymousPutMapping.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitArgs.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitArgs.java index f517be72..f3d5d199 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitArgs.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitBaseCreateTimeTb.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitBaseCreateTimeTb.java index 8c755c88..e1a1bed9 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitBaseCreateTimeTb.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitBaseCreateTimeTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitBaseTimeTb.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitBaseTimeTb.java index 6593aab8..7d5d428d 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitBaseTimeTb.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitBaseTimeTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitBaseUpdateTimeTb.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitBaseUpdateTimeTb.java index ad290bff..0ba57fa1 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitBaseUpdateTimeTb.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitBaseUpdateTimeTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitBaseUserCreateTimeTb.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitBaseUserCreateTimeTb.java index 88430bfc..c03a1e33 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitBaseUserCreateTimeTb.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitBaseUserCreateTimeTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitBaseUserTimeLogicTb.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitBaseUserTimeLogicTb.java index 5029c76f..9d1c99de 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitBaseUserTimeLogicTb.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitBaseUserTimeLogicTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitBaseUserTimeTb.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitBaseUserTimeTb.java index 6a55d66a..96652bc3 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitBaseUserTimeTb.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitBaseUserTimeTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitObject.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitObject.java index ada1e818..615cf630 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitObject.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitObject.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitPageArgs.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitPageArgs.java index 29cb001e..51236a15 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitPageArgs.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitPageArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitPageResult.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitPageResult.java index 1f469a90..e40fda1c 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitPageResult.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitPageResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitSelectOptionVo.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitSelectOptionVo.java index bfa1eaf2..2b712e9a 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitSelectOptionVo.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/base/KitSelectOptionVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/constant/CaptchaCodeEnum.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/constant/CaptchaCodeEnum.java index 036ec0c3..014acd69 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/constant/CaptchaCodeEnum.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/constant/CaptchaCodeEnum.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/constant/FileTypeEnum.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/constant/FileTypeEnum.java index 0052eabc..ef82bca1 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/constant/FileTypeEnum.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/constant/FileTypeEnum.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/constant/RequestMethodEnum.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/constant/RequestMethodEnum.java index 17a0693b..16d52ac0 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/constant/RequestMethodEnum.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/constant/RequestMethodEnum.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/constant/SystemConst.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/constant/SystemConst.java index b9a25bf6..bb00a311 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/constant/SystemConst.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/constant/SystemConst.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/context/BeanLoadFinishListener.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/context/BeanLoadFinishListener.java index 634ebce9..2bf99e40 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/context/BeanLoadFinishListener.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/context/BeanLoadFinishListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,4 +34,4 @@ public class BeanLoadFinishListener implements ApplicationListener %s;", RED, now, RESET, GREEN, Thread.currentThread().getName(), BLUE, elapsed, RESET, sql); } -} \ No newline at end of file +} diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/config/MpInsertBatchSqlInjector.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/config/MpInsertBatchSqlInjector.java index 9abb4d34..ac1a632f 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/config/MpInsertBatchSqlInjector.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/config/MpInsertBatchSqlInjector.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,4 +41,4 @@ public class MpInsertBatchSqlInjector extends DefaultSqlInjector { methodList.add(new AlwaysUpdateSomeColumnById(i -> i.getFieldFill() != FieldFill.INSERT)); return methodList; } -} \ No newline at end of file +} diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/config/MybatisPlusConfig.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/config/MybatisPlusConfig.java index 1337e07f..09bfe6ad 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/config/MybatisPlusConfig.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/config/MybatisPlusConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/config/RemoveDruidAdConfig.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/config/RemoveDruidAdConfig.java index fd66c1f5..0b83d3c2 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/config/RemoveDruidAdConfig.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/config/RemoveDruidAdConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/KitMpAnyQUtil.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/KitMpAnyQUtil.java index efa02dd6..1c2cd08b 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/KitMpAnyQUtil.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/KitMpAnyQUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/KitMpCmdGenUtil.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/KitMpCmdGenUtil.java index c24f1b46..3e219e93 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/KitMpCmdGenUtil.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/KitMpCmdGenUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -210,4 +210,4 @@ public class KitMpCmdGenUtil { .serviceImpl("service.impl").controller("controller") .pathInfo(Collections.singletonMap(OutputFile.xml, mapperPath)); } -} \ No newline at end of file +} diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/KitMpQUtil.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/KitMpQUtil.java index a4bf25e0..862113fd 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/KitMpQUtil.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/KitMpQUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,6 +35,7 @@ import java.util.Optional; import java.util.stream.Collectors; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; +import lombok.Data; import lombok.extern.slf4j.Slf4j; /** @@ -198,7 +199,7 @@ public class KitMpQUtil { } public static void main(String[] args) { - QueryWrapper query = new QueryWrapper(); + QueryWrapper query = new QueryWrapper<>(); query.or(wrapper -> wrapper.eq("username", 1).or().eq("nickname", 2)); query.eq("id", 1); query.orderByDesc("id"); @@ -214,13 +215,13 @@ public class KitMpQUtil { System.err.println(query.getTargetSql()); } + @Data @TableName("test_domain") private static class TestDomain { @NotNull(groups = KitBaseUserTimeTb.Update.class) @TableId(value = "user_id", type = IdType.AUTO) - private Long - id; + private Long id; @TableField(value = "dept_id") private Long deptId; @NotBlank diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/interfaces/KitMpMapper.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/interfaces/KitMpMapper.java index 2bd4a2c9..ec61e36c 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/interfaces/KitMpMapper.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/interfaces/KitMpMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/interfaces/KitMpService.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/interfaces/KitMpService.java index 5610b2f5..b30ea30b 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/interfaces/KitMpService.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/interfaces/KitMpService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/interfaces/KitMpServiceImpl.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/interfaces/KitMpServiceImpl.java index 9be39c97..ac0e1f04 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/interfaces/KitMpServiceImpl.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/mybatisplus/core/interfaces/KitMpServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/AppProperties.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/AppProperties.java index 0b44e3ff..e5bfda0f 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/AppProperties.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/AppProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/CaptchaModel.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/CaptchaModel.java index 8597949b..fe660223 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/CaptchaModel.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/CaptchaModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/ContentRsaEncodeSettingModel.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/ContentRsaEncodeSettingModel.java index a16001ff..1c5b81ff 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/ContentRsaEncodeSettingModel.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/ContentRsaEncodeSettingModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/JwtAuthSettingModel.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/JwtAuthSettingModel.java index 679f9d4c..01be7a48 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/JwtAuthSettingModel.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/JwtAuthSettingModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/OSSConfigModel.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/OSSConfigModel.java index 25d775c9..df2e490e 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/OSSConfigModel.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/OSSConfigModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/StorageOSSModel.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/StorageOSSModel.java index 0d3d1da7..4e1e7779 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/StorageOSSModel.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/StorageOSSModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/SwaggerApiDocSettingModel.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/SwaggerApiDocSettingModel.java index fd5630b1..4a9373ac 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/SwaggerApiDocSettingModel.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/SwaggerApiDocSettingModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/ThreadPoolSettingModel.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/ThreadPoolSettingModel.java index e5d37ec3..f60d03e8 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/ThreadPoolSettingModel.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/ThreadPoolSettingModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/UserLoginCaptchaSettingModel.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/UserLoginCaptchaSettingModel.java index 93fd140a..113280b0 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/UserLoginCaptchaSettingModel.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/UserLoginCaptchaSettingModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/UserLoginSettingModel.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/UserLoginSettingModel.java index 2fecb694..0d4bf266 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/UserLoginSettingModel.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/properties/model/UserLoginSettingModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/quartz/config/QuartzConfig.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/quartz/config/QuartzConfig.java index 47f76dbd..fe29bbe4 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/quartz/config/QuartzConfig.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/quartz/config/QuartzConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/quartz/core/QuartzRunnable.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/quartz/core/QuartzRunnable.java index 109284ef..e4fedfeb 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/quartz/core/QuartzRunnable.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/quartz/core/QuartzRunnable.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,7 +49,7 @@ public class QuartzRunnable implements Callable { if (StringUtils.isNotBlank(params)) { return method.invoke(target, params); } else { - return method.invoke(target, ""); + return method.invoke(target, null); } } } diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/redis/KitRedisHelper.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/redis/KitRedisHelper.java index 8778c4ff..04c715c2 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/redis/KitRedisHelper.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/redis/KitRedisHelper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/redis/RedisConfiguration.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/redis/RedisConfiguration.java index e4c978ca..600a90b4 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/redis/RedisConfiguration.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/redis/RedisConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -198,4 +198,4 @@ public class RedisConfiguration extends CachingConfigurerSupport { return JSON.parseObject(str, clazz); } } -} \ No newline at end of file +} diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/server/config/AsyncTheadPoolConfig.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/server/config/AsyncTheadPoolConfig.java index a058ed55..ffd246a7 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/server/config/AsyncTheadPoolConfig.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/server/config/AsyncTheadPoolConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/server/converters/DateStringArraysToListDateConverter.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/server/converters/DateStringArraysToListDateConverter.java index 06b9e9bd..b2dfb686 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/server/converters/DateStringArraysToListDateConverter.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/server/converters/DateStringArraysToListDateConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/server/converters/DateStringToDateConverter.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/server/converters/DateStringToDateConverter.java index 26a02be4..899518b1 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/server/converters/DateStringToDateConverter.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/server/converters/DateStringToDateConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/server/core/ConfigurerAdapter.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/server/core/ConfigurerAdapter.java index 0839edd3..f784e907 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/server/core/ConfigurerAdapter.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/server/core/ConfigurerAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/server/core/KitFileLocalUploadHelper.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/server/core/KitFileLocalUploadHelper.java index 286cf46c..072b0c70 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/server/core/KitFileLocalUploadHelper.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/server/core/KitFileLocalUploadHelper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/websocket/config/UndertowWebSocketConfig.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/websocket/config/UndertowWebSocketConfig.java index b90e0165..0a9b18eb 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/websocket/config/UndertowWebSocketConfig.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/websocket/config/UndertowWebSocketConfig.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.framework.websocket.config; import io.undertow.server.DefaultByteBufferPool; @@ -40,4 +55,4 @@ public class UndertowWebSocketConfig implements WebServerFactoryCustomizer>> getDictDetailMaps(@RequestParam String dictName) { - Map> dictMap = systemDictDetailService.getDictDetailMap(dictName); - return ResponseEntity.ok(dictMap); - } - @OperationLog @ApiOperation("新增字典详情") @PostMapping(value = "/saveDictDetail") diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemEmailController.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemEmailController.java index df210692..90622c23 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemEmailController.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemEmailController.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemJobController.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemJobController.java index 97af85df..07e564a8 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemJobController.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemJobController.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemLocalStorageController.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemLocalStorageController.java index 4ebaa181..b6bcfc9e 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemLocalStorageController.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemLocalStorageController.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -74,7 +74,7 @@ public class SystemLocalStorageController { @ApiOperation("上传图片") @PostMapping("/uploadPicture") public ResponseEntity uploadPicture(@RequestParam MultipartFile file) { - SystemLocalStorageTb localStorage = localStorageService.uploadPictureV1(file); + SystemLocalStorageTb localStorage = localStorageService.uploadPicture(file); return ResponseEntity.ok(localStorage); } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemMenuController.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemMenuController.java index 99269a30..52ccb297 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemMenuController.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemMenuController.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,8 +67,8 @@ public class SystemMenuController { @ApiOperation("返回全部的菜单") @PostMapping(value = "/listMenuByPid") @PreAuthorize("@el.check('menu:list','roles:list')") - public ResponseEntity> listMenuByPid(@RequestParam Long pid) { - List systemMenuTbs = systemMenuService.listMenuByPid(pid); + public ResponseEntity> listMenuByPid(@RequestParam Long pid) { + List systemMenuTbs = systemMenuService.listMenuByPid(pid); return ResponseEntity.ok(systemMenuTbs); } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemMonitorController.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemMonitorController.java index de0fcf6a..ad200d5a 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemMonitorController.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemMonitorController.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemOnlineController.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemOnlineController.java index 7e9a512f..b272cb03 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemOnlineController.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemOnlineController.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemOperationLogController.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemOperationLogController.java index ac087351..aec892b9 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemOperationLogController.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemOperationLogController.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.controller; import cn.odboy.base.KitPageArgs; diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemOssStorageController.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemOssStorageController.java index 68124348..b2edf367 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemOssStorageController.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemOssStorageController.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemQuartzJobController.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemQuartzJobController.java index 3c513b29..22d3a28d 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemQuartzJobController.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemQuartzJobController.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ import cn.odboy.system.dal.model.request.SystemUpdateQuartzJobArgs; import cn.odboy.system.dal.model.response.SystemQuartzJobVo; import cn.odboy.system.framework.operalog.OperationLog; import cn.odboy.system.service.SystemQuartzJobService; +import cn.odboy.util.KitBeanUtil; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -86,7 +87,7 @@ public class SystemQuartzJobController { @ApiOperation("新增定时任务") @PostMapping(value = "/createQuartzJob") @PreAuthorize("@el.check('quartzJob:add')") - public ResponseEntity createQuartzJob(@Validated @RequestBody SystemQuartzJobVo args) { + public ResponseEntity createQuartzJob(@Validated @RequestBody SystemQuartzJobTb args) { systemQuartzJobService.createJob(args); return ResponseEntity.ok(null); } @@ -106,7 +107,9 @@ public class SystemQuartzJobController { @PostMapping(value = "/switchQuartzJobStatus/{id}") @PreAuthorize("@el.check('quartzJob:edit')") public ResponseEntity switchQuartzJobStatus(@PathVariable Long id) { - systemQuartzJobService.switchQuartzJobStatus(systemQuartzJobService.getQuartzJobById(id)); + SystemQuartzJobTb quartzJobTb = systemQuartzJobService.getQuartzJobById(id); + SystemQuartzJobVo quartzJobVo = KitBeanUtil.copyToClass(quartzJobTb, SystemQuartzJobVo.class); + systemQuartzJobService.switchQuartzJobStatus(quartzJobVo); return ResponseEntity.ok(null); } @@ -115,7 +118,9 @@ public class SystemQuartzJobController { @PostMapping(value = "/startQuartzJob/{id}") @PreAuthorize("@el.check('quartzJob:edit')") public ResponseEntity startQuartzJob(@PathVariable Long id) { - systemQuartzJobService.startQuartzJob(systemQuartzJobService.getQuartzJobById(id)); + SystemQuartzJobTb quartzJobTb = systemQuartzJobService.getQuartzJobById(id); + SystemQuartzJobVo quartzJobVo = KitBeanUtil.copyToClass(quartzJobTb, SystemQuartzJobVo.class); + systemQuartzJobService.startQuartzJob(quartzJobVo); return ResponseEntity.ok(null); } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemRoleController.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemRoleController.java index 0bf4cd07..d721636b 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemRoleController.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemRoleController.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,7 +52,7 @@ public class SystemRoleController { @PostMapping(value = "/getRoleById") @PreAuthorize("@el.check('roles:list')") public ResponseEntity getRoleById(@RequestBody SystemRoleTb args) { - return ResponseEntity.ok(systemRoleService.getRoleById(args.getId())); + return ResponseEntity.ok(systemRoleService.getRoleVoById(args.getId())); } @ApiOperation("导出角色数据") diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemUserController.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemUserController.java index 7b7e1041..7c90a81a 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemUserController.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/controller/SystemUserController.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemDeptTb.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemDeptTb.java index 50231e72..83e392e6 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemDeptTb.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemDeptTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -79,4 +79,4 @@ public class SystemDeptTb extends KitBaseUserTimeTb { public String getLabel() { return name; } -} \ No newline at end of file +} diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemDictDetailTb.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemDictDetailTb.java index 1d744684..534a0b42 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemDictDetailTb.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemDictDetailTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,4 +43,4 @@ public class SystemDictDetailTb extends KitBaseUserTimeTb { private String value; @ApiModelProperty(value = "排序") private Integer dictSort = 999; -} \ No newline at end of file +} diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemDictTb.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemDictTb.java index 47ca9fee..a9a6d029 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemDictTb.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemDictTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,4 +42,4 @@ public class SystemDictTb extends KitBaseUserTimeTb { @ApiModelProperty(value = "描述") @TableField(updateStrategy = FieldStrategy.ALWAYS) private String description; -} \ No newline at end of file +} diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemEmailConfigTb.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemEmailConfigTb.java index 2d456330..28c2c39d 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemEmailConfigTb.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemEmailConfigTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemJobTb.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemJobTb.java index 3763c998..e5080e00 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemJobTb.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemJobTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,4 +61,4 @@ public class SystemJobTb extends KitBaseUserTimeTb { public int hashCode() { return Objects.hash(id); } -} \ No newline at end of file +} diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemLocalStorageTb.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemLocalStorageTb.java index bded4f86..c095a17b 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemLocalStorageTb.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemLocalStorageTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ package cn.odboy.system.dal.dataobject; import cn.odboy.base.KitBaseUserTimeTb; -import cn.odboy.util.KitBeanUtil; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; @@ -46,8 +45,4 @@ public class SystemLocalStorageTb extends KitBaseUserTimeTb { private String size; @ApiModelProperty(value = "日期分组") private String dateGroup; - - public void copy(SystemLocalStorageTb source) { - KitBeanUtil.copyToTarget(source, this); - } -} \ No newline at end of file +} diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemMenuTb.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemMenuTb.java index ecc5dfc8..916c6ac8 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemMenuTb.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemMenuTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemOperationLogTb.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemOperationLogTb.java index 21d8aca9..24543629 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemOperationLogTb.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemOperationLogTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemOssStorageTb.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemOssStorageTb.java index 70ae5db9..91e27d92 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemOssStorageTb.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemOssStorageTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemQuartzJobTb.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemQuartzJobTb.java index 80d4d6ec..48b6597a 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemQuartzJobTb.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemQuartzJobTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,4 +63,4 @@ public class SystemQuartzJobTb extends KitBaseUserTimeTb { @ApiModelProperty(value = "备注") @TableField(updateStrategy = FieldStrategy.ALWAYS) private String description; -} \ No newline at end of file +} diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemQuartzLogTb.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemQuartzLogTb.java index 2eebf8f3..eb4b38fe 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemQuartzLogTb.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemQuartzLogTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemRoleDeptTb.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemRoleDeptTb.java index 92b7be14..0015432f 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemRoleDeptTb.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemRoleDeptTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,4 +30,4 @@ public class SystemRoleDeptTb extends KitObject { private Long roleId; @TableField(value = "dept_id") private Long deptId; -} \ No newline at end of file +} diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemRoleMenuTb.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemRoleMenuTb.java index ebfeb4b5..0f35f183 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemRoleMenuTb.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemRoleMenuTb.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.dataobject; import com.baomidou.mybatisplus.annotation.TableField; diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemRoleTb.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemRoleTb.java index d7e81ce4..90314b4d 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemRoleTb.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemRoleTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemUserJobTb.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemUserJobTb.java index 7c2c964f..68d9b3bd 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemUserJobTb.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemUserJobTb.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.dataobject; import com.baomidou.mybatisplus.annotation.TableField; diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemUserRoleTb.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemUserRoleTb.java index 6d7a137b..d07ce33e 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemUserRoleTb.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemUserRoleTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,4 +30,4 @@ public class SystemUserRoleTb extends KitObject { private Long userId; @TableField(value = "role_id") private Long roleId; -} \ No newline at end of file +} diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemUserTb.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemUserTb.java index 43925297..005c727c 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemUserTb.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/dataobject/SystemUserTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -86,4 +86,4 @@ public class SystemUserTb extends KitBaseUserTimeTb { public int hashCode() { return Objects.hash(id, username); } -} \ No newline at end of file +} diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemDeptExportRowVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemDeptExportRowVo.java index 02a9da71..a83c0cc0 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemDeptExportRowVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemDeptExportRowVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.export; import cn.idev.excel.annotation.ExcelProperty; diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemDictExportRowVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemDictExportRowVo.java index 0cd7ff7d..7f9595a1 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemDictExportRowVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemDictExportRowVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.export; import cn.idev.excel.annotation.ExcelProperty; diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemJobExportRowVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemJobExportRowVo.java index d4e6f2cd..94642e20 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemJobExportRowVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemJobExportRowVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.export; import cn.idev.excel.annotation.ExcelProperty; diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemLocalStorageExportRowVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemLocalStorageExportRowVo.java index 5148a50e..d175f1f1 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemLocalStorageExportRowVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemLocalStorageExportRowVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.export; import cn.idev.excel.annotation.ExcelProperty; diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemMenuExportRowVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemMenuExportRowVo.java index 21c2f4e2..f30f03bf 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemMenuExportRowVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemMenuExportRowVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.export; import cn.idev.excel.annotation.ExcelProperty; diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemOssStorageExportRowVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemOssStorageExportRowVo.java index da9d765d..2b399cdf 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemOssStorageExportRowVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemOssStorageExportRowVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.export; import cn.idev.excel.annotation.ExcelProperty; diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemQuartzJobExportRowVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemQuartzJobExportRowVo.java index 1f35df7e..1f93e1b2 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemQuartzJobExportRowVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemQuartzJobExportRowVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.export; import cn.idev.excel.annotation.ExcelProperty; diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemQuartzLogExportRowVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemQuartzLogExportRowVo.java index de272d53..5f4a3254 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemQuartzLogExportRowVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemQuartzLogExportRowVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.export; import cn.idev.excel.annotation.ExcelProperty; diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemRoleExportRowVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemRoleExportRowVo.java index 549ff2e8..eebd412c 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemRoleExportRowVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemRoleExportRowVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.export; import cn.idev.excel.annotation.ExcelProperty; diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemUserExportRowVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemUserExportRowVo.java index cb91d952..30ddcca6 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemUserExportRowVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemUserExportRowVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.export; import cn.idev.excel.annotation.ExcelProperty; diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemUserOnlineExportRowVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemUserOnlineExportRowVo.java index 15c386c0..330524f7 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemUserOnlineExportRowVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/export/SystemUserOnlineExportRowVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.export; import cn.idev.excel.annotation.ExcelProperty; @@ -21,4 +36,4 @@ public class SystemUserOnlineExportRowVo extends KitObject { private String browser; @ExcelProperty("登录日期") private String loginTime; -} \ No newline at end of file +} diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCheckEmailCaptchaArgs.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCheckEmailCaptchaArgs.java index f8673027..bd7fcc36 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCheckEmailCaptchaArgs.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCheckEmailCaptchaArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateDeptArgs.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateDeptArgs.java index bc1563d3..ad874a6d 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateDeptArgs.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateDeptArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateDictArgs.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateDictArgs.java index 71df4f79..b89e1c0f 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateDictArgs.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateDictArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateDictDetailArgs.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateDictDetailArgs.java index 70da6316..1c635b67 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateDictDetailArgs.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateDictDetailArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateJobArgs.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateJobArgs.java index 5bc0c6a2..e222744b 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateJobArgs.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateJobArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateRoleArgs.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateRoleArgs.java index 70faad66..54793674 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateRoleArgs.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemCreateRoleArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryDeptArgs.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryDeptArgs.java index 008cc29a..9bb6801d 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryDeptArgs.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryDeptArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryDictArgs.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryDictArgs.java index 95ca97d1..fc938a2a 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryDictArgs.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryDictArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryDictDetailArgs.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryDictDetailArgs.java index d05f55de..83d726b9 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryDictDetailArgs.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryDictDetailArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,4 +28,4 @@ public class SystemQueryDictDetailArgs extends KitObject { private String label; @ApiModelProperty(value = "字典名称") private String dictName; -} \ No newline at end of file +} diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryJobArgs.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryJobArgs.java index 299d1543..20b941ca 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryJobArgs.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryJobArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryMenuArgs.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryMenuArgs.java index f7a45ff9..a1c27634 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryMenuArgs.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryMenuArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryOperationLogArgs.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryOperationLogArgs.java index 2d26cc23..8825d4eb 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryOperationLogArgs.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryOperationLogArgs.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.request; import cn.odboy.base.KitObject; diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryQuartzJobArgs.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryQuartzJobArgs.java index 6aebbb30..28b26933 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryQuartzJobArgs.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryQuartzJobArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryRoleArgs.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryRoleArgs.java index b3771982..04bcf729 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryRoleArgs.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryRoleArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryStorageArgs.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryStorageArgs.java index 4e524e5d..87c7070c 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryStorageArgs.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryStorageArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryUserArgs.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryUserArgs.java index 42ad7160..0ae886f9 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryUserArgs.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemQueryUserArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemSendEmailArgs.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemSendEmailArgs.java index fa7f28ab..e95f9d69 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemSendEmailArgs.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemSendEmailArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemUpdateQuartzJobArgs.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemUpdateQuartzJobArgs.java index 7a368607..c47ea751 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemUpdateQuartzJobArgs.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemUpdateQuartzJobArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemUpdateUserPasswordArgs.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemUpdateUserPasswordArgs.java index d8284b75..c33aa8c3 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemUpdateUserPasswordArgs.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemUpdateUserPasswordArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemUserLoginArgs.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemUserLoginArgs.java index 88e42fa6..898db36e 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemUserLoginArgs.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/request/SystemUserLoginArgs.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemAuthVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemAuthVo.java index 9024d26e..24f6cb3a 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemAuthVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemAuthVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.response; import cn.odboy.base.KitObject; diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemCaptchaVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemCaptchaVo.java index 6f6dc84a..6bc528e8 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemCaptchaVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemCaptchaVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.response; import cn.odboy.base.KitObject; diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemDeptVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemDeptVo.java index ae6dba88..d94e8e17 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemDeptVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemDeptVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.response; import cn.odboy.base.KitBaseUserTimeTb; diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemDictDetailVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemDictDetailVo.java index 45fdb903..fa6e56a4 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemDictDetailVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemDictDetailVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,4 +40,4 @@ public class SystemDictDetailVo extends KitBaseUserTimeTb { */ @ApiModelProperty(value = "字典") private SystemDictTb dict; -} \ No newline at end of file +} diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemMenuMetaVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemMenuMetaVo.java index a49bd485..64078814 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemMenuMetaVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemMenuMetaVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemMenuRouterVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemMenuRouterVo.java index d98c65ff..a1ffaab5 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemMenuRouterVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemMenuRouterVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemMenuVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemMenuVo.java index 597a02af..58e83774 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemMenuVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemMenuVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.response; import cn.odboy.base.KitBaseUserTimeTb; diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemOssStorageVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemOssStorageVo.java index 503cfddf..910304c4 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemOssStorageVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemOssStorageVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemProductLineTreeVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemProductLineTreeVo.java index 91527bee..16d5cd68 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemProductLineTreeVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemProductLineTreeVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemProductLineVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemProductLineVo.java index e358907b..6b0291c2 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemProductLineVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemProductLineVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemQuartzJobVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemQuartzJobVo.java index caf2e513..19633561 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemQuartzJobVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemQuartzJobVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.response; import cn.odboy.base.KitBaseUserTimeTb; @@ -8,6 +23,7 @@ import lombok.Setter; @Getter @Setter public class SystemQuartzJobVo extends KitBaseUserTimeTb { + private Long id; @ApiModelProperty(value = "定时器名称") private String jobName; diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemRoleCodeVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemRoleCodeVo.java index 2fb55924..52710c8e 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemRoleCodeVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemRoleCodeVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemRoleVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemRoleVo.java index 88a34ce2..1c080406 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemRoleVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemRoleVo.java @@ -1,14 +1,31 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.response; import cn.odboy.base.KitBaseUserTimeTb; import cn.odboy.system.constant.SystemDataScopeEnum; import cn.odboy.system.dal.dataobject.SystemDeptTb; +import cn.odboy.system.dal.dataobject.SystemMenuTb; import cn.odboy.system.dal.dataobject.SystemUserTb; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; -import java.util.Set; import lombok.Getter; import lombok.Setter; +import java.util.List; +import java.util.Objects; +import java.util.Set; @Getter @Setter @@ -30,7 +47,7 @@ public class SystemRoleVo extends KitBaseUserTimeTb { @ApiModelProperty(value = "用户", hidden = true) private Set users; @ApiModelProperty(value = "菜单", hidden = true) - private Set menus; + private Set menus; @ApiModelProperty(value = "部门", hidden = true) private Set depts; @@ -51,5 +68,4 @@ public class SystemRoleVo extends KitBaseUserTimeTb { return Objects.hash(id); } - } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemSimpleUserVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemSimpleUserVo.java index fd60f0c1..6e67d147 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemSimpleUserVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemSimpleUserVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,4 +52,4 @@ public class SystemSimpleUserVo extends KitObject { private Boolean enabled; @ApiModelProperty(value = "是否为admin账号", hidden = true) private Boolean isAdmin = false; -} \ No newline at end of file +} diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserInfoVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserInfoVo.java index 1d435bc4..c85c3928 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserInfoVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserInfoVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserJwtVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserJwtVo.java index 9d47f2ef..0a3839e9 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserJwtVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserJwtVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserOnlineVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserOnlineVo.java index 90d0ad67..5416122e 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserOnlineVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserOnlineVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserVo.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserVo.java index 0495fc8f..971ca461 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserVo.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/model/response/SystemUserVo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.model.response; import cn.odboy.base.KitBaseUserTimeTb; diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemDeptMapper.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemDeptMapper.java index 6eda0e19..270490c0 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemDeptMapper.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemDeptMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemDictDetailMapper.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemDictDetailMapper.java index 98aa735c..26eaa936 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemDictDetailMapper.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemDictDetailMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,9 +21,9 @@ import cn.odboy.system.dal.model.response.SystemDictDetailVo; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import java.util.List; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; -import java.util.List; /** * 字典明细 Mapper @@ -33,7 +33,7 @@ import java.util.List; @Mapper public interface SystemDictDetailMapper extends BaseMapper { - IPage selectPageByArgs(Page page, @Param("args") SystemQueryDictDetailArgs args); + IPage selectPageByArgs(Page page, @Param("args") SystemQueryDictDetailArgs args); - List listDictDetailByName(@Param("name") String name); + List listDictDetailByName(@Param("name") String name); } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemDictMapper.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemDictMapper.java index dac2faa3..7f1474d3 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemDictMapper.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemDictMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemEmailConfigMapper.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemEmailConfigMapper.java index 5855b161..4510b68d 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemEmailConfigMapper.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemEmailConfigMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemJobMapper.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemJobMapper.java index 0f20d2d1..f16ad379 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemJobMapper.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemJobMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemLocalStorageMapper.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemLocalStorageMapper.java index c6ccce07..3c209bc6 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemLocalStorageMapper.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemLocalStorageMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemMenuMapper.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemMenuMapper.java index d8363107..fa16c6cf 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemMenuMapper.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemMenuMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package cn.odboy.system.dal.mysql; import cn.odboy.system.dal.dataobject.SystemMenuTb; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import java.util.List; import org.apache.ibatis.annotations.Mapper; /** @@ -27,4 +28,7 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface SystemMenuMapper extends BaseMapper { + default List listAll() { + return selectList(null); + } } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemOperationLogMapper.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemOperationLogMapper.java index 715d6d07..25f8ff9b 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemOperationLogMapper.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemOperationLogMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemOssStorageMapper.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemOssStorageMapper.java index 9d7af923..411bab26 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemOssStorageMapper.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemOssStorageMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemQuartzJobMapper.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemQuartzJobMapper.java index 0b1cfb82..3bfce3fa 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemQuartzJobMapper.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemQuartzJobMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package cn.odboy.system.dal.mysql; import cn.odboy.system.dal.dataobject.SystemQuartzJobTb; -import cn.odboy.system.dal.model.response.SystemQuartzJobVo; -import cn.odboy.util.KitBeanUtil; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; @@ -29,7 +27,4 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface SystemQuartzJobMapper extends BaseMapper { - default SystemQuartzJobVo selectVoById(String id) { - return KitBeanUtil.copyToClass(selectById(id), SystemQuartzJobVo.class); - } } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemQuartzLogMapper.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemQuartzLogMapper.java index 4435b853..0f289f83 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemQuartzLogMapper.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemQuartzLogMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemRoleDeptMapper.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemRoleDeptMapper.java index b5dafd08..fafdd336 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemRoleDeptMapper.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemRoleDeptMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ package cn.odboy.system.dal.mysql; import cn.odboy.system.dal.dataobject.SystemDeptTb; import cn.odboy.system.dal.dataobject.SystemRoleDeptTb; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import java.util.List; import java.util.Set; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemRoleMapper.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemRoleMapper.java index ffe20a7d..3948cfd1 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemRoleMapper.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemRoleMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,9 @@ package cn.odboy.system.dal.mysql; import cn.odboy.system.dal.dataobject.SystemRoleTb; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import java.util.List; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 角色 Mapper @@ -27,4 +29,5 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface SystemRoleMapper extends BaseMapper { + List listRoleLevelByRoleIds(@Param("roleIds") List roleIds); } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemRoleMenuMapper.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemRoleMenuMapper.java index 4d7dc633..f990d0a5 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemRoleMenuMapper.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemRoleMenuMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,9 +15,13 @@ */ package cn.odboy.system.dal.mysql; +import cn.odboy.system.dal.dataobject.SystemMenuTb; import cn.odboy.system.dal.dataobject.SystemRoleMenuTb; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import java.util.List; +import java.util.Set; /** * 角色菜单关联 Mapper @@ -27,4 +31,9 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface SystemRoleMenuMapper extends BaseMapper { + Set listMenuPermissionByRoleIds(@Param("roleIds") Set roleIds); + + List listMenuWithRoleIdsNeButton(@Param("roleIds") Set roleIds); + + List listMenuWithRoleIds(@Param("roleIds") Set roleIds); } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemUserJobMapper.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemUserJobMapper.java index 5cc06b8b..33670b9a 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemUserJobMapper.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemUserJobMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import java.util.Set; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Select; /** * 用户职位关联 Mapper diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemUserMapper.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemUserMapper.java index 097da24b..68ee8536 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemUserMapper.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemUserMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,10 @@ package cn.odboy.system.dal.mysql; import cn.odboy.system.dal.dataobject.SystemUserTb; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import java.util.List; import java.util.Set; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 用户 Mapper @@ -49,4 +51,6 @@ public interface SystemUserMapper extends BaseMapper { wrapper.set(SystemUserTb::getPassword, password); update(null, wrapper); } + + List listUsernameByIds(@Param("userIds") Set userIds); } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemUserRoleMapper.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemUserRoleMapper.java index f7deb075..ef71e9ff 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemUserRoleMapper.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/mysql/SystemUserRoleMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package cn.odboy.system.dal.mysql; import cn.odboy.system.dal.dataobject.SystemRoleTb; import cn.odboy.system.dal.dataobject.SystemUserRoleTb; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import java.util.List; import java.util.Set; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -26,4 +27,8 @@ import org.apache.ibatis.annotations.Param; public interface SystemUserRoleMapper extends BaseMapper { Set listUserRoleByUserId(@Param("userId") Long userId); + + Set listUserRoleLevelByUserId(@Param("userId") Long userId); + + Set listUserRoleIdByUserId(@Param("userId") Long userId); } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemCacheKey.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemCacheKey.java index db7bdcdb..3a2a51f7 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemCacheKey.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemCacheKey.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,50 +20,12 @@ package cn.odboy.system.dal.redis; */ public interface SystemCacheKey { - /** - * 用户 - */ - String USER_ID = "user::id:"; - /** - * 数据 - */ - String DATA_USER = "data::user:"; - /** - * 菜单 - */ - String MENU_ID = "menu::id:"; - String MENU_USER = "menu::user:"; - /** - * 角色授权 - */ - String ROLE_AUTH = "role::auth:"; - String ROLE_USER = "role::user:"; - /** - * 角色信息 - */ - String ROLE_ID = "role::id:"; - /** - * 部门 - */ - String DEPT_ID = "dept::id:"; - /** - * 岗位 - */ - String JOB_ID = "job::id:"; - /** - * 数据字典 - */ - String DICT_NAME = "dict::name:"; /** * 在线用户 */ - String ONLINE_USER = "online::token:"; + String ONLINE_USER = "user::token:"; /** * 登录验证码 */ String CAPTCHA_LOGIN = "captcha::login:"; - /** - * 用户信息 - */ - String USER_INFO = "user::info:"; } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemRedisKey.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemRedisKey.java index e8eb9240..1ffeb347 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemRedisKey.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemRedisKey.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.redis; /** diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemUserInfoDAO.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemUserInfoDAO.java index ccb32148..b52f0f77 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemUserInfoDAO.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemUserInfoDAO.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.redis; import cn.hutool.core.util.RandomUtil; diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemUserOnlineInfoDAO.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemUserOnlineInfoDAO.java index c5cb4168..4d2bfbc2 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemUserOnlineInfoDAO.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/dal/redis/SystemUserOnlineInfoDAO.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.dal.redis; import cn.hutool.core.util.StrUtil; diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/bizlock/BizLock.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/bizlock/BizLock.java index 300e717f..2f757f83 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/bizlock/BizLock.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/bizlock/BizLock.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/bizlock/BizLockAspect.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/bizlock/BizLockAspect.java index 4d0e1e3b..8ae55e4c 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/bizlock/BizLockAspect.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/bizlock/BizLockAspect.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,4 +84,4 @@ public class BizLockAspect { // 组合最终的key: bizName:解析后的key return String.format("%s:%s", bizLock.bizName(), value); } -} \ No newline at end of file +} diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/mybatisplus/MpMetaObjectHandler.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/mybatisplus/MpMetaObjectHandler.java index 00ab730a..c5e5fec5 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/mybatisplus/MpMetaObjectHandler.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/mybatisplus/MpMetaObjectHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLog.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLog.java index 40513b15..e298626d 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLog.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLog.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLogAspect.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLogAspect.java index 416c761d..3da5fd45 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLogAspect.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLogAspect.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +48,8 @@ import org.springframework.stereotype.Component; @Component public class OperationLogAspect { - @Autowired private SystemOperationLogMapper systemOperationLogMapper; + @Autowired + private SystemOperationLogMapper systemOperationLogMapper; @Around("@annotation(operationLog)") public Object operationLogCatch(ProceedingJoinPoint joinPoint, OperationLog operationLog) diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/config/AuthorityConfig.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/config/AuthorityConfig.java index 3807a828..b631d015 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/config/AuthorityConfig.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/config/AuthorityConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/config/SpringSecurityConfig.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/config/SpringSecurityConfig.java index 4fabab7b..1eaa95ec 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/config/SpringSecurityConfig.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/config/SpringSecurityConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/config/TokenConfigurer.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/config/TokenConfigurer.java index 06c9183e..e78c80ac 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/config/TokenConfigurer.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/config/TokenConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/KitSecurityHelper.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/KitSecurityHelper.java index 7a940c10..5a54d68d 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/KitSecurityHelper.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/KitSecurityHelper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/JwtAccessDeniedHandler.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/JwtAccessDeniedHandler.java index 33da3e77..a9cb5b86 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/JwtAccessDeniedHandler.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/JwtAccessDeniedHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/JwtAuthenticationEntryPoint.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/JwtAuthenticationEntryPoint.java index e84fbdf2..c2bcb064 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/JwtAuthenticationEntryPoint.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/JwtAuthenticationEntryPoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/TokenFilter.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/TokenFilter.java index 66302e69..0498a432 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/TokenFilter.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/TokenFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/TokenProvider.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/TokenProvider.java index 1e06d39a..732eadbc 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/TokenProvider.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/TokenProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/UserDetailsHandler.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/UserDetailsHandler.java index d7712692..dae17e19 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/UserDetailsHandler.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/permission/core/handler/UserDetailsHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/quartz/ActiveJobRegister.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/quartz/ActiveJobRegister.java index 3f5427c0..39970ef1 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/quartz/ActiveJobRegister.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/quartz/ActiveJobRegister.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,8 +15,10 @@ */ package cn.odboy.system.framework.quartz; +import cn.odboy.system.dal.dataobject.SystemQuartzJobTb; import cn.odboy.system.dal.model.response.SystemQuartzJobVo; import cn.odboy.system.service.SystemQuartzJobService; +import cn.odboy.util.KitBeanUtil; import java.util.List; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -40,8 +42,9 @@ public class ActiveJobRegister implements ApplicationRunner { */ @Override public void run(ApplicationArguments applicationArguments) { - List quartzJobs = systemQuartzJobService.listEnableQuartzJob(); - quartzJobs.forEach(quartzManage::addJob); + List quartzJobTbs = systemQuartzJobService.listEnableQuartzJob(); + List quartzJobVos = KitBeanUtil.copyToList(quartzJobTbs, SystemQuartzJobVo.class); + quartzJobVos.forEach(quartzManage::addJob); log.info("Timing task injection complete"); } } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/quartz/ExecutionJobBean.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/quartz/ExecutionJobBean.java index b41d2cd8..aa10cbc8 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/quartz/ExecutionJobBean.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/quartz/ExecutionJobBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/quartz/QuartzManage.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/quartz/QuartzManage.java index fa6d0006..40ef044c 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/quartz/QuartzManage.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/quartz/QuartzManage.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package cn.odboy.system.framework.quartz; import cn.odboy.framework.exception.BadRequestException; import cn.odboy.system.dal.dataobject.SystemQuartzJobTb; import cn.odboy.system.dal.model.response.SystemQuartzJobVo; +import cn.odboy.util.KitBeanUtil; import java.util.Date; import javax.annotation.Resource; import lombok.extern.slf4j.Slf4j; @@ -45,12 +46,17 @@ public class QuartzManage { public void addJob(SystemQuartzJobVo quartzJob) { try { + String uuid = JOB_NAME + quartzJob.getId(); // 构建job信息 - JobDetail jobDetail = - JobBuilder.newJob(ExecutionJobBean.class).withIdentity(JOB_NAME + quartzJob.getId()).build(); + JobDetail jobDetail = JobBuilder.newJob(ExecutionJobBean.class) + .withIdentity(uuid) + .build(); // 通过触发器名和cron 表达式创建 Trigger - Trigger trigger = TriggerBuilder.newTrigger().withIdentity(JOB_NAME + quartzJob.getId()).startNow() - .withSchedule(CronScheduleBuilder.cronSchedule(quartzJob.getCronExpression())).build(); + Trigger trigger = TriggerBuilder.newTrigger() + .withIdentity(uuid) + .startNow() + .withSchedule(CronScheduleBuilder.cronSchedule(quartzJob.getCronExpression())) + .build(); trigger.getJobDataMap().put(SystemQuartzJobTb.JOB_KEY, quartzJob); // 重置启动时间 ((CronTriggerImpl) trigger).setStartTime(new Date()); @@ -75,24 +81,25 @@ public class QuartzManage { * * @param quartzJob / */ - public void updateJobCron(SystemQuartzJobVo quartzJob) { + public void updateJobCron(SystemQuartzJobTb quartzJob) { try { - TriggerKey triggerKey = TriggerKey.triggerKey(JOB_NAME + quartzJob.getId()); + SystemQuartzJobVo quartzJobVo = KitBeanUtil.copyToClass(quartzJob, SystemQuartzJobVo.class); + TriggerKey triggerKey = TriggerKey.triggerKey(JOB_NAME + quartzJobVo.getId()); CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey); // 如果不存在则创建一个定时任务 if (trigger == null) { - addJob(quartzJob); + addJob(quartzJobVo); trigger = (CronTrigger) scheduler.getTrigger(triggerKey); } - CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(quartzJob.getCronExpression()); + CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(quartzJobVo.getCronExpression()); trigger = trigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(scheduleBuilder).build(); // 重置启动时间 ((CronTriggerImpl) trigger).setStartTime(new Date()); - trigger.getJobDataMap().put(SystemQuartzJobTb.JOB_KEY, quartzJob); + trigger.getJobDataMap().put(SystemQuartzJobTb.JOB_KEY, quartzJobVo); scheduler.rescheduleJob(triggerKey, trigger); // 暂停任务 - if (quartzJob.getIsPause()) { - pauseJob(quartzJob); + if (quartzJobVo.getIsPause()) { + pauseJob(quartzJobVo); } } catch (Exception e) { log.error("更新定时任务失败", e); @@ -144,7 +151,8 @@ public class QuartzManage { */ public void runJobNow(SystemQuartzJobVo quartzJob) { try { - TriggerKey triggerKey = TriggerKey.triggerKey(JOB_NAME + quartzJob.getId()); + String uuid = JOB_NAME + quartzJob.getId(); + TriggerKey triggerKey = TriggerKey.triggerKey(uuid); CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey); // 如果不存在则创建一个定时任务 if (trigger == null) { @@ -152,7 +160,7 @@ public class QuartzManage { } JobDataMap dataMap = new JobDataMap(); dataMap.put(SystemQuartzJobTb.JOB_KEY, quartzJob); - JobKey jobKey = JobKey.jobKey(JOB_NAME + quartzJob.getId()); + JobKey jobKey = JobKey.jobKey(uuid); scheduler.triggerJob(jobKey, dataMap); } catch (Exception e) { log.error("定时任务执行失败", e); diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/storage/OssStorageConfiguration.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/storage/OssStorageConfiguration.java index 23f954fc..05c6aaff 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/storage/OssStorageConfiguration.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/storage/OssStorageConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/storage/local/MultipartConfig.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/storage/local/MultipartConfig.java index a4ae4a2b..a11a5a23 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/storage/local/MultipartConfig.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/storage/local/MultipartConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,6 @@ import java.io.File; import javax.servlet.MultipartConfigElement; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.web.servlet.MultipartConfigFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -31,6 +30,7 @@ import org.springframework.util.unit.DataSize; @Slf4j @Configuration public class MultipartConfig { + @Autowired private AppProperties properties; @@ -53,4 +53,4 @@ public class MultipartConfig { factory.setLocation(location); return factory.createMultipartConfig(); } -} \ No newline at end of file +} diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/storage/minio/MinioRepository.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/storage/minio/MinioRepository.java index 8cf7e802..1c98f2b1 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/storage/minio/MinioRepository.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/storage/minio/MinioRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/job/TestTask.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/job/TestTask.java index 49559af6..7a7ea589 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/job/TestTask.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/job/TestTask.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/openapi/OpenCaptchaController.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/openapi/OpenCaptchaController.java index 88ef9508..7b299d4a 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/openapi/OpenCaptchaController.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/openapi/OpenCaptchaController.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemAuthService.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemAuthService.java index 2859ac41..99a0ba74 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemAuthService.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemAuthService.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.service; import cn.odboy.constant.SystemConst; @@ -14,13 +29,13 @@ import cn.odboy.system.framework.permission.core.handler.UserDetailsHandler; import cn.odboy.util.KitBeanUtil; import cn.odboy.util.KitRsaEncryptUtil; import cn.odboy.util.KitValidUtil; +import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; -import javax.servlet.http.HttpServletRequest; /** * 用户认证 @@ -28,76 +43,81 @@ import javax.servlet.http.HttpServletRequest; @Service public class SystemAuthService { - @Autowired - private AppProperties properties; - @Autowired - private SystemUserOnlineInfoDAO systemUserOnlineInfoDAO; - @Autowired - private TokenProvider tokenProvider; - @Autowired - private PasswordEncoder passwordEncoder; - @Autowired - private UserDetailsHandler userDetailsService; - @Autowired - private SystemCaptchaService systemCaptchaService; + @Autowired + private AppProperties properties; + @Autowired + private SystemUserOnlineInfoDAO systemUserOnlineInfoDAO; + @Autowired + private TokenProvider tokenProvider; + @Autowired + private PasswordEncoder passwordEncoder; + @Autowired + private UserDetailsHandler userDetailsService; + @Autowired + private SystemCaptchaService systemCaptchaService; - /** - * 登录 -> TestPassed - */ - public SystemAuthVo doLogin(SystemUserLoginArgs loginArgs, HttpServletRequest request) throws Exception { - KitValidUtil.notNull(loginArgs); + /** + * 登录 -> TestPassed + * + * @param loginArgs / + * @param request / + */ + public SystemAuthVo doLogin(SystemUserLoginArgs loginArgs, HttpServletRequest request) throws Exception { + KitValidUtil.notNull(loginArgs); - // 密码解密 - String password = - KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), loginArgs.getPassword()); - // 校验验证码 - systemCaptchaService.validate(loginArgs.getUuid(), loginArgs.getCode()); - // 获取用户信息 - SystemUserJwtVo jwtUser = userDetailsService.loadUserByUsername(loginArgs.getUsername()); - // 验证用户密码 - if (!passwordEncoder.matches(password, jwtUser.getPassword())) { - throw new BadRequestException("登录密码错误"); - } - - // 登录验证 - Authentication authentication = - new UsernamePasswordAuthenticationToken(jwtUser, null, jwtUser.getAuthorities()); - SecurityContextHolder.getContext().setAuthentication(authentication); - - // 生成令牌 - String token = tokenProvider.createToken(jwtUser); - // 返回 token 与 用户信息 - SystemAuthVo authInfo = new SystemAuthVo(); - authInfo.setToken(String.format("%s %s", SystemConst.TOKEN_PREFIX, token)); - /// 这里是为了清空密码 - authInfo.setUser(KitBeanUtil.copyToClass(jwtUser, SystemUserInfoVo.class)); - - if (properties.getLogin().isSingle()) { - // 踢掉之前已经登录的token - systemUserOnlineInfoDAO.kickOutByUsername(loginArgs.getUsername()); - } - // 保存在线信息 - systemUserOnlineInfoDAO.saveUserJwtModelByToken(jwtUser, token, request); - // 返回登录信息 - return authInfo; + // 密码解密 + String password = + KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), loginArgs.getPassword()); + // 校验验证码 + systemCaptchaService.validate(loginArgs.getUuid(), loginArgs.getCode()); + // 查询用户信息 + SystemUserJwtVo jwtUser = userDetailsService.loadUserByUsername(loginArgs.getUsername()); + // 验证用户密码 + if (!passwordEncoder.matches(password, jwtUser.getPassword())) { + throw new BadRequestException("登录密码错误"); } - /** - * 获取当前登录人信息 -> TestPassed - */ - public SystemUserJwtVo getCurrentUserInfo() { - SystemUserJwtVo jwtUser = (SystemUserJwtVo)KitSecurityHelper.getCurrentUser(); - if (jwtUser.getUser() != null) { - jwtUser.getUser().setPassword(null); - } - return jwtUser; - } + // 登录验证 + Authentication authentication = + new UsernamePasswordAuthenticationToken(jwtUser, null, jwtUser.getAuthorities()); + SecurityContextHolder.getContext().setAuthentication(authentication); - /** - * 退出登录 -> TestPassed - */ - public void doLogout(HttpServletRequest request) { - String token = tokenProvider.getToken(request); - systemUserOnlineInfoDAO.logoutByToken(token); + // 生成令牌 + String token = tokenProvider.createToken(jwtUser); + // 返回 token 与 用户信息 + SystemAuthVo authInfo = new SystemAuthVo(); + authInfo.setToken(String.format("%s %s", SystemConst.TOKEN_PREFIX, token)); + /// 这里是为了清空密码 + authInfo.setUser(KitBeanUtil.copyToClass(jwtUser, SystemUserInfoVo.class)); + + if (properties.getLogin().isSingle()) { + // 踢掉之前已经登录的token + systemUserOnlineInfoDAO.kickOutByUsername(loginArgs.getUsername()); } + // 保存在线信息 + systemUserOnlineInfoDAO.saveUserJwtModelByToken(jwtUser, token, request); + // 返回登录信息 + return authInfo; + } + + /** + * 查询当前登录人信息 -> TestPassed + */ + public SystemUserJwtVo getCurrentUserInfo() { + SystemUserJwtVo jwtUser = (SystemUserJwtVo) KitSecurityHelper.getCurrentUser(); + if (jwtUser.getUser() != null) { + jwtUser.getUser().setPassword(null); + } + return jwtUser; + } + + /** + * 退出登录 -> TestPassed + * + * @param request / + */ + public void doLogout(HttpServletRequest request) { + String token = tokenProvider.getToken(request); + systemUserOnlineInfoDAO.logoutByToken(token); + } } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemCaptchaService.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemCaptchaService.java index 2a6776e3..9f329856 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemCaptchaService.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemCaptchaService.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.service; import cn.hutool.core.util.IdUtil; @@ -10,9 +25,9 @@ import cn.odboy.framework.redis.KitRedisHelper; import cn.odboy.system.dal.model.response.SystemCaptchaVo; import cn.odboy.system.dal.redis.SystemCacheKey; import com.wf.captcha.base.Captcha; +import java.util.concurrent.TimeUnit; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.concurrent.TimeUnit; /** * 验证码 @@ -20,50 +35,49 @@ import java.util.concurrent.TimeUnit; @Service public class SystemCaptchaService { - @Autowired - private KitRedisHelper redisHelper; - @Autowired - private AppProperties properties; + @Autowired + private KitRedisHelper redisHelper; + @Autowired + private AppProperties properties; - /** - * 获取登录验证码 -> TestPassed - */ - public SystemCaptchaVo getLoginCaptcha() { - // 获取运算的结果 - Captcha captcha = properties.getLogin().getCaptchaSetting().getCaptcha(); - String uuid = SystemCacheKey.CAPTCHA_LOGIN + IdUtil.simpleUUID(); - //当验证码类型为 arithmetic时且长度 >= 2 时, captcha.text()的结果有几率为浮点型 - String captchaValue = captcha.text(); - if (captcha.getCharType() - 1 == CaptchaCodeEnum.ARITHMETIC.ordinal() && captchaValue.contains( - SystemConst.SYMBOL_DOT)) { - captchaValue = captchaValue.split("\\.")[0]; - } - // 保存 - redisHelper.set(uuid, captchaValue, properties.getLogin().getCaptchaSetting().getExpiration(), - TimeUnit.MINUTES); - // 验证码信息 - SystemCaptchaVo captchaVo = new SystemCaptchaVo(); - captchaVo.setUuid(uuid); - captchaVo.setImg(captcha.toBase64()); - return captchaVo; + /** + * 查询登录验证码 -> TestPassed + */ + public SystemCaptchaVo getLoginCaptcha() { + // 查询运算的结果 + Captcha captcha = properties.getLogin().getCaptchaSetting().getCaptcha(); + String uuid = SystemCacheKey.CAPTCHA_LOGIN + IdUtil.simpleUUID(); + //当验证码类型为 arithmetic时且长度 >= 2 时, captcha.text()的结果有几率为浮点型 + String captchaValue = captcha.text(); + if (captcha.getCharType() - 1 == CaptchaCodeEnum.ARITHMETIC.ordinal() && captchaValue.contains( + SystemConst.SYMBOL_DOT)) { + captchaValue = captchaValue.split("\\.")[0]; } + // 保存 + redisHelper.set(uuid, captchaValue, properties.getLogin().getCaptchaSetting().getExpiration(), TimeUnit.MINUTES); + // 验证码信息 + SystemCaptchaVo captchaVo = new SystemCaptchaVo(); + captchaVo.setUuid(uuid); + captchaVo.setImg(captcha.toBase64()); + return captchaVo; + } - /** - * 验证验证码 -> TestPassed - * - * @param uuid 验证码uuid - * @param inputCode 用户输入的验证码 - */ - public void validate(String uuid, String inputCode) { - // 查询验证码 - String code = redisHelper.get(uuid, String.class); - if (StrUtil.isBlank(code)) { - throw new BadRequestException("验证码不存在或已过期"); - } - // 清除验证码 - redisHelper.del(uuid); - if (StrUtil.isBlank(inputCode) || !code.equalsIgnoreCase(inputCode)) { - throw new BadRequestException("验证码错误"); - } + /** + * 验证验证码 -> TestPassed + * + * @param uuid 验证码uuid + * @param inputCode 用户输入的验证码 + */ + public void validate(String uuid, String inputCode) { + // 查询验证码 + String code = redisHelper.get(uuid, String.class); + if (StrUtil.isBlank(code)) { + throw new BadRequestException("验证码不存在或已过期"); } + // 清除验证码 + redisHelper.del(uuid); + if (StrUtil.isBlank(inputCode) || !code.equalsIgnoreCase(inputCode)) { + throw new BadRequestException("验证码错误"); + } + } } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDataService.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDataService.java index bc83e539..cffffba1 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDataService.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDataService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,14 +20,14 @@ import cn.odboy.system.constant.SystemDataScopeEnum; import cn.odboy.system.dal.dataobject.SystemDeptTb; import cn.odboy.system.dal.dataobject.SystemRoleTb; import cn.odboy.system.dal.model.response.SystemUserVo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; /** * 数据权限 @@ -37,61 +37,60 @@ import java.util.stream.Collectors; @Service public class SystemDataService { - @Autowired - private SystemUserRoleService systemUserRoleService; - @Autowired - private SystemDeptService systemDeptService; - @Autowired - private SystemRoleDeptService systemRoleDeptService; + @Autowired + private SystemUserRoleService systemUserRoleService; + @Autowired + private SystemDeptService systemDeptService; + @Autowired + private SystemRoleDeptService systemRoleDeptService; - /** - * 获取数据权限 -> TestPassed - * - * @param user / - * @return / - */ - public List queryDeptIdByArgs(SystemUserVo user) { - List deptIds = new ArrayList<>(); - // 查询用户角色 - Set roleList = systemUserRoleService.listUserRoleByUserId(user.getId()); - // 获取对应的部门ID - for (SystemRoleTb role : roleList) { - SystemDataScopeEnum dataScopeEnum = SystemDataScopeEnum.find(role.getDataScope()); - switch (Objects.requireNonNull(dataScopeEnum)) { - case THIS_LEVEL: - Long currentDeptId = user.getDept().getId(); - deptIds.add(currentDeptId); - break; - case CUSTOMIZE: - // 优化 283ms -> 51 ms - List customDeptIds = this.queryCustomDataPermissionByArgs(deptIds, role.getId()); - deptIds.addAll(customDeptIds); - break; - default: - return new ArrayList<>(); - } - } - return deptIds.stream().distinct().collect(Collectors.toList()); + /** + * 查询数据权限 -> TestPassed + * + * @param user / + * @return / + */ + public List queryDeptIdByArgs(SystemUserVo user) { + List deptIds = new ArrayList<>(); + // 查询用户角色 + Set roleList = systemUserRoleService.listUserRoleByUserId(user.getId()); + // 查询对应的部门ID + for (SystemRoleTb role : roleList) { + SystemDataScopeEnum dataScopeEnum = SystemDataScopeEnum.find(role.getDataScope()); + switch (Objects.requireNonNull(dataScopeEnum)) { + case THIS_LEVEL: + Long currentDeptId = user.getDept().getId(); + deptIds.add(currentDeptId); + break; + case CUSTOMIZE: + // 优化 283ms -> 51 ms + List customDeptIds = this.queryCustomDataPermissionByArgs(deptIds, role.getId()); + deptIds.addAll(customDeptIds); + break; + default: + return new ArrayList<>(); + } } + return deptIds.stream().distinct().collect(Collectors.toList()); + } - /** - * 获取自定义的数据权限 -> TestPassed - * - * @param deptIds 部门ID(外部数据) - * @param roleId 角色ID - * @return 数据权限ID(所有部门ID数据) - */ - private List queryCustomDataPermissionByArgs(List deptIds, Long roleId) { - Set deptList = systemRoleDeptService.listUserDeptByRoleId(roleId); - Map> deptPidMap = - systemDeptService.listPidNonNull().stream().collect(Collectors.groupingBy(SystemDeptTb::getPid)); - for (SystemDeptTb dept : deptList) { - deptIds.add(dept.getId()); - List deptChildren = deptPidMap.getOrDefault(dept.getId(), null); - if (CollUtil.isNotEmpty(deptChildren)) { - deptIds.addAll(systemDeptService.queryChildDeptIdByDeptIds(deptChildren, deptPidMap)); - } - } - return deptIds; + /** + * 查询自定义的数据权限 -> TestPassed + * + * @param deptIds 部门ID(外部数据) + * @param roleId 角色ID + * @return 数据权限ID(所有部门ID数据) + */ + private List queryCustomDataPermissionByArgs(List deptIds, Long roleId) { + Set deptList = systemRoleDeptService.listUserDeptByRoleId(roleId); + Map> deptPidMap = systemDeptService.listPidNonNull().stream().collect(Collectors.groupingBy(SystemDeptTb::getPid)); + for (SystemDeptTb dept : deptList) { + deptIds.add(dept.getId()); + List deptChildren = deptPidMap.getOrDefault(dept.getId(), null); + if (CollUtil.isNotEmpty(deptChildren)) { + deptIds.addAll(systemDeptService.queryChildDeptIdByDeptIds(deptChildren, deptPidMap)); + } } + return deptIds; + } } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDeptService.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDeptService.java index e7a7f069..c1c532c5 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDeptService.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDeptService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,10 +36,6 @@ import cn.odboy.util.KitClassUtil; import cn.odboy.util.KitValidUtil; import cn.odboy.util.xlsx.KitExcelExporter; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import javax.servlet.http.HttpServletResponse; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Collections; @@ -51,458 +47,462 @@ import java.util.Map; import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; @Service public class SystemDeptService { - @Autowired - private SystemDeptMapper systemDeptMapper; - @Autowired - private SystemUserDeptService systemUserDeptService; - @Autowired - private SystemRoleDeptService systemRoleDeptService; + @Autowired + private SystemDeptMapper systemDeptMapper; + @Autowired + private SystemUserDeptService systemUserDeptService; + @Autowired + private SystemRoleDeptService systemRoleDeptService; - /** - * 创建 -> TestPassed - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void saveDept(SystemCreateDeptArgs args) { - KitValidUtil.notNull(args); + /** + * 创建 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void saveDept(SystemCreateDeptArgs args) { + KitValidUtil.notNull(args); - SystemDeptTb record = KitBeanUtil.copyToClass(args, SystemDeptTb.class); - systemDeptMapper.insert(record); + SystemDeptTb record = KitBeanUtil.copyToClass(args, SystemDeptTb.class); + systemDeptMapper.insert(record); - this.updateDeptSubCnt(args.getPid()); + this.updateDeptSubCnt(args.getPid()); + } + + /** + * 编辑 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void updateDeptById(SystemDeptTb args) { + KitValidUtil.notNull(args); + // 旧的父部门 + Long oldPid = this.getDeptById(args.getId()).getPid(); + // 新的父部门 + Long newPid = args.getPid(); + if (args.getPid() != null && args.getId().equals(args.getPid())) { + throw new BadRequestException("上级不能为自己"); } + SystemDeptTb dept = systemDeptMapper.selectById(args.getId()); + args.setId(dept.getId()); + systemDeptMapper.updateById(args); + this.updateDeptSubCnt(oldPid); + this.updateDeptSubCnt(newPid); + } - /** - * 编辑 -> TestPassed - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void updateDeptById(SystemDeptTb args) { - KitValidUtil.notNull(args); - // 旧的父部门 - Long oldPid = this.getDeptById(args.getId()).getPid(); - // 新的父部门 - Long newPid = args.getPid(); - if (args.getPid() != null && args.getId().equals(args.getPid())) { - throw new BadRequestException("上级不能为自己"); + /** + * 根据部门id查询部门信息 -> TestPassed + * + * @param id 部门id + * @return / + */ + private SystemDeptTb getDeptById(Long id) { + return systemDeptMapper.selectById(id); + } + + /** + * 删除 + * + * @param ids / + */ + @Transactional(rollbackFor = Exception.class) + public void deleteDeptByIds(Set ids) { + // 查询部门, 和其所有子部门 + Set depts = this.traverseDeptByIdWithPids(ids); + // 验证是否被角色或用户关联 + this.verifyBindRelationByIds(depts); + for (SystemDeptVo dept : depts) { + systemDeptMapper.deleteById(dept.getId()); + this.updateDeptSubCnt(dept.getPid()); + } + } + + /** + * 更新父节点中子节点数目 -> TestPassed + * + * @param deptId 部门id + */ + @Transactional(rollbackFor = Exception.class) + public void updateDeptSubCnt(Long deptId) { + if (deptId != null) { + long count = this.countDeptByPid(deptId); + systemDeptMapper.updateDeptSubCountById(count, deptId); + } + } + + private long countDeptByPid(Long pid) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemDeptTb::getPid, pid); + return systemDeptMapper.selectCount(wrapper); + } + + /** + * 筛选出 list 中没有父部门(即 pid 不在其他部门 id 列表中的部门)的部门列表 + */ + private List deduplication(List list) { + List deptList = new ArrayList<>(); + // 使用 Set 存储所有部门的 id + Set idSet = list.stream().map(SystemDeptTb::getId).collect(Collectors.toSet()); + // 遍历部门列表, 筛选出没有父部门的部门 + for (SystemDeptTb dept : list) { + if (!idSet.contains(dept.getPid())) { + deptList.add(dept); + } + } + return deptList; + } + + private List queryDeptByArgs(SystemQueryDeptArgs args) { + KitValidUtil.notNull(args); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(CollUtil.isNotEmpty(args.getIds()), SystemDeptTb::getId, args.getIds()); + wrapper.like(StrUtil.isNotBlank(args.getName()), SystemDeptTb::getName, args.getName()); + wrapper.eq(args.getEnabled() != null, SystemDeptTb::getEnabled, args.getEnabled()); + wrapper.eq(args.getPid() != null, SystemDeptTb::getPid, args.getPid()); + wrapper.isNull(args.getPidIsNull() != null, SystemDeptTb::getPid); + if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { + wrapper.between(SystemDeptTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); + } + wrapper.orderByAsc(SystemDeptTb::getDeptSort); + return systemDeptMapper.selectList(wrapper); + } + + /** + * 查询所有数据 + * + * @param args / + * @param isQuery / + * @return / + * @throws Exception / + */ + public List queryAllDeptByArgs(SystemQueryDeptArgs args, Boolean isQuery) throws Exception { + String dataScopeType = KitSecurityHelper.getDataScopeType(); + if (isQuery) { + if (dataScopeType.equals(SystemDataScopeEnum.ALL.getValue())) { + args.setPidIsNull(true); + } + List fields = KitClassUtil.getAllFields(args.getClass(), new ArrayList<>()); + List fieldNames = new ArrayList<>() {{ + add("pidIsNull"); + add("enabled"); + }}; + for (Field field : fields) { + // 设置对象的访问权限, 保证对private的属性的访问 + field.setAccessible(true); + Object val = field.get(args); + if (fieldNames.contains(field.getName())) { + continue; } - SystemDeptTb dept = systemDeptMapper.selectById(args.getId()); - args.setId(dept.getId()); - systemDeptMapper.updateById(args); - this.updateDeptSubCnt(oldPid); - this.updateDeptSubCnt(newPid); - } - - /** - * 根据部门id获取部门信息 -> TestPassed - * - * @param id 部门id - * @return / - */ - private SystemDeptTb getDeptById(Long id) { - return systemDeptMapper.selectById(id); - } - - /** - * 删除 - * - * @param ids / - */ - @Transactional(rollbackFor = Exception.class) - public void deleteDeptByIds(Set ids) { - // 获取部门, 和其所有子部门 - Set depts = this.traverseDeptByIdWithPids(ids); - // 验证是否被角色或用户关联 - this.verifyBindRelationByIds(depts); - for (SystemDeptVo dept : depts) { - systemDeptMapper.deleteById(dept.getId()); - this.updateDeptSubCnt(dept.getPid()); + if (ObjectUtil.isNotNull(val)) { + args.setPidIsNull(null); + break; } + } } + // 数据权限 + args.setIds(KitSecurityHelper.getCurrentUserDataScope()); + List list = this.queryDeptByArgs(args); + // 如果为空, 就代表为自定义权限或者本级权限, 就需要去重, 不理解可以注释掉,看查询结果 + if (StrUtil.isBlank(dataScopeType)) { + return this.deduplication(list); + } + return list; + } - /** - * 更新父节点中子节点数目 -> TestPassed - * - * @param deptId / - */ - @Transactional(rollbackFor = Exception.class) - public void updateDeptSubCnt(Long deptId) { - if (deptId != null) { - long count = this.countDeptByPid(deptId); - systemDeptMapper.updateDeptSubCountById(count, deptId); + /** + * 根据ID查询 + * + * @param id / + * @return / + */ + public SystemDeptVo getDeptVoById(Long id) { + return KitBeanUtil.copyToClass(systemDeptMapper.selectById(id), SystemDeptVo.class); + } + + /** + * 查询部门下所有关联的部门 + * + * @param deptTbList / + * @param depts / + */ + private void queryRelationDeptByArgs(List deptTbList, Set depts) { + for (SystemDeptVo dept : deptTbList) { + depts.add(dept); + List deptList = this.listDeptVoByPid(dept.getId()); + if (CollUtil.isNotEmpty(deptList)) { + queryRelationDeptByArgs(deptList, depts); + } + } + } + + private List listDeptVoByPid(Long pid) { + return KitBeanUtil.copyToList(this.listDeptByPid(pid), SystemDeptVo.class); + } + + public List queryChildDeptIdByDeptIds(List deptList, Map> deptPidMap) { + List list = new ArrayList<>(); + for (SystemDeptTb systemDeptTb : deptList) { + if (systemDeptTb != null && systemDeptTb.getEnabled()) { + List deptList1 = deptPidMap.getOrDefault(systemDeptTb.getId(), null); + if (CollUtil.isNotEmpty(deptList1)) { + list.addAll(this.queryChildDeptIdByDeptIds(deptList1, deptPidMap)); } + list.add(systemDeptTb.getId()); + } } + return list; + } - private long countDeptByPid(Long pid) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemDeptTb::getPid, pid); - return systemDeptMapper.selectCount(wrapper); + /** + * 根据ID查询同级与上级数据 + * + * @param dept / + * @param deptList / + * @return / + */ + private List querySuperiorDeptByPid(SystemDeptVo dept, List deptList) { + if (dept.getPid() == null) { + deptList.addAll(this.listRootDept()); + return deptList; } + deptList.addAll(this.listDeptVoByPid(dept.getPid())); + return querySuperiorDeptByPid(this.getDeptVoById(dept.getPid()), deptList); + } - /** - * 筛选出 list 中没有父部门(即 pid 不在其他部门 id 列表中的部门)的部门列表 - */ - private List deduplication(List list) { - List deptList = new ArrayList<>(); - // 使用 Set 存储所有部门的 id - Set idSet = list.stream().map(SystemDeptTb::getId).collect(Collectors.toSet()); - // 遍历部门列表, 筛选出没有父部门的部门 - for (SystemDeptTb dept : list) { - if (!idSet.contains(dept.getPid())) { - deptList.add(dept); - } + private List listRootDept() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.isNull(SystemDeptTb::getPid); + return KitBeanUtil.copyToList(systemDeptMapper.selectList(wrapper), SystemDeptVo.class); + } + + /** + * 构建树形数据 + * + * @return / + */ + public KitPageResult searchDeptTree(List ids, Boolean exclude) { + Set deptSet1 = new LinkedHashSet<>(); + for (Long id : ids) { + // 同级数据 + SystemDeptVo dept = this.getDeptVoById(id); + // 上级数据 + List depts = this.querySuperiorDeptByPid(dept, new ArrayList<>()); + if (exclude) { + for (SystemDeptVo data : depts) { + if (data.getId().equals(dept.getPid())) { + data.setSubCount(data.getSubCount() - 1); + } } - return deptList; + // 编辑部门时不显示自己以及自己下级的数据, 避免出现PID数据环形问题 + depts = depts.stream().filter(i -> !ids.contains(i.getId())).collect(Collectors.toList()); + } + deptSet1.addAll(depts); } - - private List queryDeptByArgs(SystemQueryDeptArgs args) { - KitValidUtil.notNull(args); - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(CollUtil.isNotEmpty(args.getIds()), SystemDeptTb::getId, args.getIds()); - wrapper.like(StrUtil.isNotBlank(args.getName()), SystemDeptTb::getName, args.getName()); - wrapper.eq(args.getEnabled() != null, SystemDeptTb::getEnabled, args.getEnabled()); - wrapper.eq(args.getPid() != null, SystemDeptTb::getPid, args.getPid()); - wrapper.isNull(args.getPidIsNull() != null, SystemDeptTb::getPid); - if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { - wrapper.between(SystemDeptTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); + List deptList = new ArrayList<>(deptSet1); + // 构建部门树 + Set trees = new LinkedHashSet<>(); + Set deptSet = new LinkedHashSet<>(); + List deptNames = deptList.stream().map(SystemDeptVo::getName).collect(Collectors.toList()); + boolean isChild; + for (SystemDeptVo dept : deptList) { + isChild = false; + if (dept.getPid() == null) { + trees.add(dept); + } + for (SystemDeptVo it : deptList) { + if (it.getPid() != null && dept.getId().equals(it.getPid())) { + isChild = true; + if (dept.getChildren() == null) { + dept.setChildren(new ArrayList<>()); + } + dept.getChildren().add(it); } - wrapper.orderByAsc(SystemDeptTb::getDeptSort); - return systemDeptMapper.selectList(wrapper); + } + if (isChild) { + deptSet.add(dept); + } else if (dept.getPid() != null && !deptNames.contains(this.getDeptVoById(dept.getPid()).getName())) { + deptSet.add(dept); + } } + if (CollUtil.isEmpty(trees)) { + trees = deptSet; + } + KitPageResult baseResult = new KitPageResult<>(); + baseResult.setContent(CollUtil.isEmpty(trees) ? new ArrayList<>(deptSet) : new ArrayList<>(trees)); + baseResult.setTotalElements(deptSet.size()); + return baseResult; + } - /** - * 查询所有数据 - * - * @param args 条件 - * @param isQuery / - * @return / - * @throws Exception / - */ - public List queryAllDeptByArgs(SystemQueryDeptArgs args, Boolean isQuery) throws Exception { - String dataScopeType = KitSecurityHelper.getDataScopeType(); - if (isQuery) { - if (dataScopeType.equals(SystemDataScopeEnum.ALL.getValue())) { - args.setPidIsNull(true); - } - List fields = KitClassUtil.getAllFields(args.getClass(), new ArrayList<>()); - List fieldNames = new ArrayList<>() {{ - add("pidIsNull"); - add("enabled"); - }}; - for (Field field : fields) { - // 设置对象的访问权限, 保证对private的属性的访问 - field.setAccessible(true); - Object val = field.get(args); - if (fieldNames.contains(field.getName())) { - continue; - } - if (ObjectUtil.isNotNull(val)) { - args.setPidIsNull(null); - break; - } - } - } - // 数据权限 - args.setIds(KitSecurityHelper.getCurrentUserDataScope()); - List list = this.queryDeptByArgs(args); - // 如果为空, 就代表为自定义权限或者本级权限, 就需要去重, 不理解可以注释掉,看查询结果 - if (StrUtil.isBlank(dataScopeType)) { - return this.deduplication(list); - } - return list; + /** + * 验证是否被角色或用户关联 + * + * @param deptSet / + */ + public void verifyBindRelationByIds(Set deptSet) { + Set deptIds = deptSet.stream().map(SystemDeptVo::getId).collect(Collectors.toSet()); + if (systemUserDeptService.countUserByDeptIds(deptIds) > 0) { + throw new BadRequestException("所选部门存在用户关联,请解除后再试!"); } + if (systemRoleDeptService.countRoleByDeptIds(deptIds) > 0) { + throw new BadRequestException("所选部门存在角色关联,请解除后再试!"); + } + } - /** - * 根据ID查询 - * - * @param id / - * @return / - */ - public SystemDeptVo getDeptVoById(Long id) { - return KitBeanUtil.copyToClass(systemDeptMapper.selectById(id), SystemDeptVo.class); - } + private List listEnabledDepts() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemDeptTb::getEnabled, 1); + return systemDeptMapper.selectList(wrapper); + } - /** - * 获取部门下所有关联的部门 - * - * @param deptTbList / - * @param depts / - */ - private void queryRelationDeptByArgs(List deptTbList, Set depts) { - for (SystemDeptVo dept : deptTbList) { - depts.add(dept); - List deptList = this.listDeptVoByPid(dept.getId()); - if (CollUtil.isNotEmpty(deptList)) { - queryRelationDeptByArgs(deptList, depts); - } - } + /** + * 遍历所有部门和子部门 + * + * @param ids / + */ + public Set traverseDeptByIdWithPids(Set ids) { + Set depts = new HashSet<>(); + for (Long id : ids) { + // 根部门 + depts.add(this.getDeptVoById(id)); + // 子部门 + List deptList = this.listDeptVoByPid(id); + if (CollUtil.isNotEmpty(deptList)) { + queryRelationDeptByArgs(deptList, depts); + } } + return depts; + } - private List listDeptVoByPid(Long pid) { - return KitBeanUtil.copyToList(this.listDeptByPid(pid), SystemDeptVo.class); - } + public List listDeptSelectDataSource() { + List depts = this.listEnabledDepts(); + return buildDeptSelectOptions(depts); + } - public List queryChildDeptIdByDeptIds(List deptList, Map> deptPidMap) { - List list = new ArrayList<>(); - for (SystemDeptTb systemDeptTb : deptList) { - if (systemDeptTb != null && systemDeptTb.getEnabled()) { - List deptList1 = deptPidMap.getOrDefault(systemDeptTb.getId(), null); - if (CollUtil.isNotEmpty(deptList1)) { - list.addAll(this.queryChildDeptIdByDeptIds(deptList1, deptPidMap)); - } - list.add(systemDeptTb.getId()); - } - } - return list; + private List buildDeptSelectOptions(List depts) { + // 查询所有部门并按父子关系组织 + Map deptMap = + depts.stream().collect(Collectors.toMap(SystemDeptTb::getId, Function.identity())); + List options = new ArrayList<>(); + for (SystemDeptTb dept : depts) { + // 构建部门ID路径 + List pathIds = new ArrayList<>(); + buildDeptIdPath(dept, deptMap, pathIds); + // 反转路径,从顶级部门到当前部门 + Collections.reverse(pathIds); + SystemProductLineVo dto = new SystemProductLineVo(); + dto.setValue(dept.getId()); + dto.setIdPath(pathIds.stream().map(String::valueOf).collect(Collectors.joining("-"))); + // 保留名称路径用于显示 + dto.setLabel(buildNamePath(dept, deptMap)); + options.add(dto); } + // 按部门名称路径排序 + options.sort(Comparator.comparing(SystemProductLineVo::getLabel)); + return options; + } - /** - * 根据ID获取同级与上级数据 - * - * @param dept / - * @param deptList / - * @return / - */ - private List querySuperiorDeptByPid(SystemDeptVo dept, List deptList) { - if (dept.getPid() == null) { - deptList.addAll(this.listRootDept()); - return deptList; - } - deptList.addAll(this.listDeptVoByPid(dept.getPid())); - return querySuperiorDeptByPid(this.getDeptVoById(dept.getPid()), deptList); + private void buildDeptIdPath(SystemDeptTb dept, Map deptMap, List pathIds) { + pathIds.add(dept.getId()); + if (dept.getPid() != null && dept.getPid() != 0 && deptMap.containsKey(dept.getPid())) { + buildDeptIdPath(deptMap.get(dept.getPid()), deptMap, pathIds); } + } - private List listRootDept() { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.isNull(SystemDeptTb::getPid); - return KitBeanUtil.copyToList(systemDeptMapper.selectList(wrapper), SystemDeptVo.class); - } + private String buildNamePath(SystemDeptTb dept, Map deptMap) { + List pathNames = new ArrayList<>(); + buildDeptNamePath(dept, deptMap, pathNames); + Collections.reverse(pathNames); + return String.join(" / ", pathNames); + } - /** - * 构建树形数据 - * - * @return / - */ - public KitPageResult searchDeptTree(List ids, Boolean exclude) { - Set deptSet1 = new LinkedHashSet<>(); - for (Long id : ids) { - // 同级数据 - SystemDeptVo dept = this.getDeptVoById(id); - // 上级数据 - List depts = this.querySuperiorDeptByPid(dept, new ArrayList<>()); - if (exclude) { - for (SystemDeptVo data : depts) { - if (data.getId().equals(dept.getPid())) { - data.setSubCount(data.getSubCount() - 1); - } - } - // 编辑部门时不显示自己以及自己下级的数据, 避免出现PID数据环形问题 - depts = depts.stream().filter(i -> !ids.contains(i.getId())).collect(Collectors.toList()); - } - deptSet1.addAll(depts); - } - List deptList = new ArrayList<>(deptSet1); - // 构建部门树 - Set trees = new LinkedHashSet<>(); - Set deptSet = new LinkedHashSet<>(); - List deptNames = deptList.stream().map(SystemDeptVo::getName).collect(Collectors.toList()); - boolean isChild; - for (SystemDeptVo dept : deptList) { - isChild = false; - if (dept.getPid() == null) { - trees.add(dept); - } - for (SystemDeptVo it : deptList) { - if (it.getPid() != null && dept.getId().equals(it.getPid())) { - isChild = true; - if (dept.getChildren() == null) { - dept.setChildren(new ArrayList<>()); - } - dept.getChildren().add(it); - } - } - if (isChild) { - deptSet.add(dept); - } else if (dept.getPid() != null && !deptNames.contains(this.getDeptVoById(dept.getPid()).getName())) { - deptSet.add(dept); - } - } - if (CollUtil.isEmpty(trees)) { - trees = deptSet; - } - KitPageResult baseResult = new KitPageResult<>(); - baseResult.setContent(CollUtil.isEmpty(trees) ? new ArrayList<>(deptSet) : new ArrayList<>(trees)); - baseResult.setTotalElements(deptSet.size()); - return baseResult; + private void buildDeptNamePath(SystemDeptTb dept, Map deptMap, List pathNames) { + pathNames.add(dept.getName()); + if (dept.getPid() != null && dept.getPid() != 0 && deptMap.containsKey(dept.getPid())) { + buildDeptNamePath(deptMap.get(dept.getPid()), deptMap, pathNames); } + } - /** - * 验证是否被角色或用户关联 - * - * @param deptSet / - */ - public void verifyBindRelationByIds(Set deptSet) { - Set deptIds = deptSet.stream().map(SystemDeptVo::getId).collect(Collectors.toSet()); - if (systemUserDeptService.countUserByDeptIds(deptIds) > 0) { - throw new BadRequestException("所选部门存在用户关联,请解除后再试!"); - } - if (systemRoleDeptService.countRoleByDeptIds(deptIds) > 0) { - throw new BadRequestException("所选部门存在角色关联,请解除后再试!"); - } + public List listDeptSelectProDataSource() { + List depts = this.listEnabledDepts(); + // 查询所有部门并按父子关系组织 + Map deptMap = + depts.stream().collect(Collectors.toMap(SystemDeptTb::getId, Function.identity())); + List options = new ArrayList<>(); + // 构建树形结构 + for (SystemDeptTb dept : depts) { + // 只处理顶级部门(pid为null或0的部门) + if (dept.getPid() == null || dept.getPid() == 0) { + SystemProductLineTreeVo vo = buildDeptTreePro(dept, deptMap); + options.add(vo); + } } + // 按排序字段排序 + options.sort(Comparator.comparingInt(o -> { + Long id = Long.valueOf(o.getValue()); + return deptMap.get(id) != null ? deptMap.get(id).getDeptSort() : 0; + })); + return options; + } - private List listEnabledDepts() { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemDeptTb::getEnabled, 1); - return systemDeptMapper.selectList(wrapper); + /** + * 递归构建部门树 + * + * @param dept 当前部门 + * @param deptMap 部门映射 + * @return SystemProductLineTreeVo 树节点 + */ + private SystemProductLineTreeVo buildDeptTreePro(SystemDeptTb dept, Map deptMap) { + SystemProductLineTreeVo vo = new SystemProductLineTreeVo(); + vo.setValue(String.valueOf(dept.getId())); + vo.setLabel(dept.getName()); + // 查找子部门 + List children = new ArrayList<>(); + for (SystemDeptTb childDept : deptMap.values()) { + if (dept.getId().equals(childDept.getPid())) { + children.add(buildDeptTreePro(childDept, deptMap)); + } } + // 子部门按排序字段排序 + children.sort(Comparator.comparingInt(o -> { + Long id = Long.valueOf(o.getValue()); + return deptMap.get(id) != null ? deptMap.get(id).getDeptSort() : 0; + })); + vo.setChildren(children); + return vo; + } - /** - * 遍历所有部门和子部门 - * - * @param ids / - */ - public Set traverseDeptByIdWithPids(Set ids) { - Set depts = new HashSet<>(); - for (Long id : ids) { - // 根部门 - depts.add(this.getDeptVoById(id)); - // 子部门 - List deptList = this.listDeptVoByPid(id); - if (CollUtil.isNotEmpty(deptList)) { - queryRelationDeptByArgs(deptList, depts); - } - } - return depts; - } + public List listDeptByPid(long pid) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemDeptTb::getPid, pid); + return systemDeptMapper.selectList(wrapper); + } - public List listDeptSelectDataSource() { - List depts = this.listEnabledDepts(); - return buildDeptSelectOptions(depts); + public void exportDeptXlsx(HttpServletResponse response, SystemQueryDeptArgs args) throws Exception { + List systemDeptTbs = this.queryAllDeptByArgs(args, false); + List rowVos = new ArrayList<>(); + for (SystemDeptTb dataObject : systemDeptTbs) { + SystemDeptExportRowVo rowVo = new SystemDeptExportRowVo(); + rowVo.setName(dataObject.getName()); + rowVo.setEnabled(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR); + rowVo.setCreateTime(dataObject.getCreateTime()); + rowVos.add(rowVo); } + KitExcelExporter.exportSimple(response, "部门数据", SystemDeptExportRowVo.class, rowVos); + } - private List buildDeptSelectOptions(List depts) { - // 获取所有部门并按父子关系组织 - Map deptMap = - depts.stream().collect(Collectors.toMap(SystemDeptTb::getId, Function.identity())); - List options = new ArrayList<>(); - for (SystemDeptTb dept : depts) { - // 构建部门ID路径 - List pathIds = new ArrayList<>(); - buildDeptIdPath(dept, deptMap, pathIds); - // 反转路径,从顶级部门到当前部门 - Collections.reverse(pathIds); - SystemProductLineVo dto = new SystemProductLineVo(); - dto.setValue(dept.getId()); - dto.setIdPath(pathIds.stream().map(String::valueOf).collect(Collectors.joining("-"))); - // 保留名称路径用于显示 - dto.setLabel(buildNamePath(dept, deptMap)); - options.add(dto); - } - // 按部门名称路径排序 - options.sort(Comparator.comparing(SystemProductLineVo::getLabel)); - return options; - } - - private void buildDeptIdPath(SystemDeptTb dept, Map deptMap, List pathIds) { - pathIds.add(dept.getId()); - if (dept.getPid() != null && dept.getPid() != 0 && deptMap.containsKey(dept.getPid())) { - buildDeptIdPath(deptMap.get(dept.getPid()), deptMap, pathIds); - } - } - - private String buildNamePath(SystemDeptTb dept, Map deptMap) { - List pathNames = new ArrayList<>(); - buildDeptNamePath(dept, deptMap, pathNames); - Collections.reverse(pathNames); - return String.join(" / ", pathNames); - } - - private void buildDeptNamePath(SystemDeptTb dept, Map deptMap, List pathNames) { - pathNames.add(dept.getName()); - if (dept.getPid() != null && dept.getPid() != 0 && deptMap.containsKey(dept.getPid())) { - buildDeptNamePath(deptMap.get(dept.getPid()), deptMap, pathNames); - } - } - - public List listDeptSelectProDataSource() { - List depts = this.listEnabledDepts(); - // 获取所有部门并按父子关系组织 - Map deptMap = - depts.stream().collect(Collectors.toMap(SystemDeptTb::getId, Function.identity())); - List options = new ArrayList<>(); - // 构建树形结构 - for (SystemDeptTb dept : depts) { - // 只处理顶级部门(pid为null或0的部门) - if (dept.getPid() == null || dept.getPid() == 0) { - SystemProductLineTreeVo vo = buildDeptTreePro(dept, deptMap); - options.add(vo); - } - } - // 按排序字段排序 - options.sort(Comparator.comparingInt(o -> { - Long id = Long.valueOf(o.getValue()); - return deptMap.get(id) != null ? deptMap.get(id).getDeptSort() : 0; - })); - return options; - } - - /** - * 递归构建部门树 - * - * @param dept 当前部门 - * @param deptMap 部门映射 - * @return SystemProductLineTreeVo 树节点 - */ - private SystemProductLineTreeVo buildDeptTreePro(SystemDeptTb dept, Map deptMap) { - SystemProductLineTreeVo vo = new SystemProductLineTreeVo(); - vo.setValue(String.valueOf(dept.getId())); - vo.setLabel(dept.getName()); - // 查找子部门 - List children = new ArrayList<>(); - for (SystemDeptTb childDept : deptMap.values()) { - if (dept.getId().equals(childDept.getPid())) { - children.add(buildDeptTreePro(childDept, deptMap)); - } - } - // 子部门按排序字段排序 - children.sort(Comparator.comparingInt(o -> { - Long id = Long.valueOf(o.getValue()); - return deptMap.get(id) != null ? deptMap.get(id).getDeptSort() : 0; - })); - vo.setChildren(children); - return vo; - } - - public List listDeptByPid(long pid) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemDeptTb::getPid, pid); - return systemDeptMapper.selectList(wrapper); - } - - public void exportDeptXlsx(HttpServletResponse response, SystemQueryDeptArgs args) throws Exception { - List systemDeptTbs = this.queryAllDeptByArgs(args, false); - List rowVos = new ArrayList<>(); - for (SystemDeptTb dataObject : systemDeptTbs) { - SystemDeptExportRowVo rowVo = new SystemDeptExportRowVo(); - rowVo.setName(dataObject.getName()); - rowVo.setEnabled(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR); - rowVo.setCreateTime(dataObject.getCreateTime()); - rowVos.add(rowVo); - } - KitExcelExporter.exportSimple(response, "部门数据", SystemDeptExportRowVo.class, rowVos); - } - - public List listPidNonNull() { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemDeptTb::getEnabled, 1); - wrapper.isNotNull(SystemDeptTb::getPid); - return systemDeptMapper.selectList(wrapper); - } + public List listPidNonNull() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemDeptTb::getEnabled, 1); + wrapper.isNotNull(SystemDeptTb::getPid); + return systemDeptMapper.selectList(wrapper); + } } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDictDetailService.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDictDetailService.java index f7fac543..3ff44a2d 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDictDetailService.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDictDetailService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,122 +31,112 @@ import cn.odboy.util.KitValidUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; @Service public class SystemDictDetailService { - @Autowired - private SystemDictDetailMapper systemDictDetailMapper; - @Autowired - private SystemDictMapper systemDictMapper; + @Autowired + private SystemDictDetailMapper systemDictDetailMapper; + @Autowired + private SystemDictMapper systemDictMapper; - /** - * 创建 -> TestPassed - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void saveDictDetail(SystemCreateDictDetailArgs args) { - KitValidUtil.notNull(args); - KitValidUtil.notNull(args.getDict()); - SystemDictDetailTb dictDetail = KitBeanUtil.copyToClass(args, SystemDictDetailTb.class); - dictDetail.setDictId(args.getDict().getId()); - systemDictDetailMapper.insert(dictDetail); + /** + * 创建 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void saveDictDetail(SystemCreateDictDetailArgs args) { + KitValidUtil.notNull(args); + KitValidUtil.notNull(args.getDict()); + SystemDictDetailTb dictDetail = KitBeanUtil.copyToClass(args, SystemDictDetailTb.class); + dictDetail.setDictId(args.getDict().getId()); + systemDictDetailMapper.insert(dictDetail); + } + + /** + * 编辑 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void updateDictDetailById(SystemDictDetailTb args) { + SystemDictDetailTb dictDetail = systemDictDetailMapper.selectById(args.getId()); + args.setId(dictDetail.getId()); + systemDictDetailMapper.insertOrUpdate(args); + } + + /** + * 删除 -> TestPassed + * + * @param id / + */ + @Transactional(rollbackFor = Exception.class) + public void deleteDictDetailById(Long id) { + systemDictDetailMapper.deleteById(id); + } + + @Transactional(rollbackFor = Exception.class) + public void deleteDictDetailByDictIds(Set ids) { + if (CollUtil.isNotEmpty(ids)) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(SystemDictDetailTb::getDictId, ids); + systemDictDetailMapper.delete(wrapper); } + } - /** - * 编辑 -> TestPassed - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void updateDictDetailById(SystemDictDetailTb args) { - SystemDictDetailTb dictDetail = systemDictDetailMapper.selectById(args.getId()); - args.setId(dictDetail.getId()); - systemDictDetailMapper.insertOrUpdate(args); + /** + * 分页查询 -> TestPassed + * + * @param args 条件 + * @param page 分页参数 + * @return / + */ + public KitPageResult searchDictDetail(SystemQueryDictDetailArgs args, + Page page) { + IPage iPage = systemDictDetailMapper.selectPageByArgs(page, args); + List dictIds = + iPage.getRecords().stream().map(SystemDictDetailVo::getDictId).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(dictIds)) { + Map id2ItemMap = + systemDictMapper.selectByIds(dictIds).stream().collect(Collectors.toMap(SystemDictTb::getId, i -> i)); + for (SystemDictDetailVo record : iPage.getRecords()) { + record.setDict(id2ItemMap.get(record.getDictId())); + } } + return KitPageUtil.toPage(iPage); + } - /** - * 删除 -> TestPassed - * - * @param id / - */ - @Transactional(rollbackFor = Exception.class) - public void deleteDictDetailById(Long id) { - systemDictDetailMapper.deleteById(id); + /** + * 根据字典名称查询字典详情 -> TestPassed + * + * @param name 字典名称 + * @return / + */ + public List listDictDetailByName(String name) { + if (StrUtil.isBlank(name)) { + return new ArrayList<>(); } - - @Transactional(rollbackFor = Exception.class) - public void deleteDictDetailByDictIds(Set ids) { - if (CollUtil.isNotEmpty(ids)) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(SystemDictDetailTb::getDictId, ids); - systemDictDetailMapper.delete(wrapper); + List detailVos = systemDictDetailMapper.listDictDetailByName(name); + if (CollUtil.isNotEmpty(detailVos)) { + SystemDictDetailVo systemDictDetailVo = detailVos.stream().findFirst().orElse(null); + if (systemDictDetailVo != null) { + SystemDictTb systemDictTb = systemDictMapper.selectById(systemDictDetailVo.getDictId()); + if (systemDictTb != null) { + for (SystemDictDetailVo detailVo : detailVos) { + detailVo.setDict(systemDictTb); + } } + } } - - /** - * 分页查询 -> TestPassed - * - * @param args 条件 - * @param page 分页参数 - * @return / - */ - public KitPageResult searchDictDetail(SystemQueryDictDetailArgs args, - Page page) { - IPage iPage = systemDictDetailMapper.selectPageByArgs(page, args); - List dictIds = - iPage.getRecords().stream().map(SystemDictDetailVo::getDictId).collect(Collectors.toList()); - if (CollUtil.isNotEmpty(dictIds)) { - Map id2ItemMap = - systemDictMapper.selectByIds(dictIds).stream().collect(Collectors.toMap(SystemDictTb::getId, i -> i)); - for (SystemDictDetailVo record : iPage.getRecords()) { - record.setDict(id2ItemMap.get(record.getDictId())); - } - } - return KitPageUtil.toPage(iPage); - } - - /** - * 根据字典名称获取字典详情 -> TestPassed - * - * @param name 字典名称 - * @return / - */ - public List listDictDetailByName(String name) { - if (StrUtil.isBlank(name)) { - return new ArrayList<>(); - } - List detailVos = systemDictDetailMapper.listDictDetailByName(name); - if (CollUtil.isNotEmpty(detailVos)) { - SystemDictDetailVo systemDictDetailVo = detailVos.stream().findFirst().orElse(null); - if (systemDictDetailVo != null) { - SystemDictTb systemDictTb = systemDictMapper.selectById(systemDictDetailVo.getDictId()); - if (systemDictTb != null) { - for (SystemDictDetailVo detailVo : detailVos) { - detailVo.setDict(systemDictTb); - } - } - } - } - return detailVos; - } - - public Map> getDictDetailMap(String dictName) { - String[] names = dictName.split("[,, ]"); - Map> dictMap = new HashMap<>(16); - for (String name : names) { - dictMap.put(name, this.listDictDetailByName(name)); - } - return dictMap; - } + return detailVos; + } } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDictService.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDictService.java index ba298b9b..fbd69b6a 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDictService.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemDictService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,111 +29,111 @@ import cn.odboy.util.KitPageUtil; import cn.odboy.util.xlsx.KitExcelExporter; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; import java.util.List; import java.util.Set; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; @Service public class SystemDictService { - @Autowired - private SystemDictMapper systemDictMapper; - @Autowired - private SystemDictDetailService systemDictDetailService; + @Autowired + private SystemDictMapper systemDictMapper; + @Autowired + private SystemDictDetailService systemDictDetailService; - /** - * 创建 -> TestPassed - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void saveDict(SystemCreateDictArgs args) { - SystemDictTb dictTb = KitBeanUtil.copyToClass(args, SystemDictTb.class); - systemDictMapper.insert(dictTb); - } + /** + * 创建 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void saveDict(SystemCreateDictArgs args) { + SystemDictTb dictTb = KitBeanUtil.copyToClass(args, SystemDictTb.class); + systemDictMapper.insert(dictTb); + } - /** - * 编辑 -> TestPassed - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void updateDictById(SystemDictTb args) { - SystemDictTb dict = systemDictMapper.selectById(args.getId()); - dict.setName(args.getName()); - dict.setDescription(args.getDescription()); - systemDictMapper.insertOrUpdate(dict); - } + /** + * 编辑 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void updateDictById(SystemDictTb args) { + SystemDictTb dict = systemDictMapper.selectById(args.getId()); + dict.setName(args.getName()); + dict.setDescription(args.getDescription()); + systemDictMapper.insertOrUpdate(dict); + } - /** - * 删除 -> TestPassed - * - * @param ids / - */ - @Transactional(rollbackFor = Exception.class) - public void deleteDictByIds(Set ids) { - // 删除字典 - systemDictMapper.deleteByIds(ids); - // 删除字典详情 - systemDictDetailService.deleteDictDetailByDictIds(ids); - } + /** + * 删除 -> TestPassed + * + * @param ids / + */ + @Transactional(rollbackFor = Exception.class) + public void deleteDictByIds(Set ids) { + // 删除字典 + systemDictMapper.deleteByIds(ids); + // 删除字典详情 + systemDictDetailService.deleteDictDetailByDictIds(ids); + } - /** - * 分页查询 -> TestPassed - * - * @param args 条件 - * @param page 分页参数 - * @return / - */ - public KitPageResult searchDict(SystemQueryDictArgs args, Page page) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - this.injectQueryParams(args, wrapper); - Page selectPage = systemDictMapper.selectPage(page, wrapper); - return KitPageUtil.toPage(selectPage); - } + /** + * 分页查询 -> TestPassed + * + * @param args 条件 + * @param page 分页参数 + * @return / + */ + public KitPageResult searchDict(SystemQueryDictArgs args, Page page) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + this.injectQueryParams(args, wrapper); + Page selectPage = systemDictMapper.selectPage(page, wrapper); + return KitPageUtil.toPage(selectPage); + } - private void injectQueryParams(SystemQueryDictArgs args, LambdaQueryWrapper wrapper) { - if (args != null) { - wrapper.and(StrUtil.isNotBlank(args.getBlurry()), c -> c.like(SystemDictTb::getName, args.getBlurry()).or() - .like(SystemDictTb::getDescription, args.getBlurry())); - } + private void injectQueryParams(SystemQueryDictArgs args, LambdaQueryWrapper wrapper) { + if (args != null) { + wrapper.and(StrUtil.isNotBlank(args.getBlurry()), c -> c.like(SystemDictTb::getName, args.getBlurry()).or() + .like(SystemDictTb::getDescription, args.getBlurry())); } + } - public List queryDictByArgs(SystemQueryDictArgs args) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - this.injectQueryParams(args, wrapper); - return systemDictMapper.selectList(wrapper); - } + public List queryDictByArgs(SystemQueryDictArgs args) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + this.injectQueryParams(args, wrapper); + return systemDictMapper.selectList(wrapper); + } - public void exportDictXlsx(HttpServletResponse response, SystemQueryDictArgs args) { - List systemDictTbs = this.queryDictByArgs(args); - List rowVos = new ArrayList<>(); - for (SystemDictTb dataObject : systemDictTbs) { - List dictDetails = systemDictDetailService.listDictDetailByName(dataObject.getName()); - if (CollUtil.isEmpty(dictDetails)) { - SystemDictExportRowVo rowVo = new SystemDictExportRowVo(); - rowVo.setName(dataObject.getName()); - rowVo.setDescription(dataObject.getDescription()); - rowVo.setCreateTime(dataObject.getCreateTime()); - rowVo.setLabel(""); - rowVo.setValue(""); - rowVos.add(rowVo); - continue; - } - for (SystemDictDetailVo dictDetail : dictDetails) { - SystemDictExportRowVo rowVo = new SystemDictExportRowVo(); - rowVo.setName(dataObject.getName()); - rowVo.setDescription(dataObject.getDescription()); - rowVo.setCreateTime(dataObject.getCreateTime()); - rowVo.setLabel(dictDetail.getLabel()); - rowVo.setValue(dictDetail.getValue()); - rowVos.add(rowVo); - } - } - KitExcelExporter.exportSimple(response, "字典数据", SystemDictExportRowVo.class, rowVos); + public void exportDictXlsx(HttpServletResponse response, SystemQueryDictArgs args) { + List systemDictTbs = this.queryDictByArgs(args); + List rowVos = new ArrayList<>(); + for (SystemDictTb dataObject : systemDictTbs) { + List dictDetails = systemDictDetailService.listDictDetailByName(dataObject.getName()); + if (CollUtil.isEmpty(dictDetails)) { + SystemDictExportRowVo rowVo = new SystemDictExportRowVo(); + rowVo.setName(dataObject.getName()); + rowVo.setDescription(dataObject.getDescription()); + rowVo.setCreateTime(dataObject.getCreateTime()); + rowVo.setLabel(""); + rowVo.setValue(""); + rowVos.add(rowVo); + continue; + } + for (SystemDictDetailVo dictDetail : dictDetails) { + SystemDictExportRowVo rowVo = new SystemDictExportRowVo(); + rowVo.setName(dataObject.getName()); + rowVo.setDescription(dataObject.getDescription()); + rowVo.setCreateTime(dataObject.getCreateTime()); + rowVo.setLabel(dictDetail.getLabel()); + rowVo.setValue(dictDetail.getValue()); + rowVos.add(rowVo); + } } + KitExcelExporter.exportSimple(response, "字典数据", SystemDictExportRowVo.class, rowVos); + } } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemEmailService.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemEmailService.java index d18e303b..2907c878 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemEmailService.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemEmailService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,134 +30,134 @@ import cn.odboy.system.dal.model.request.SystemSendEmailArgs; import cn.odboy.system.dal.mysql.SystemEmailConfigMapper; import cn.odboy.util.KitDesEncryptUtil; import cn.odboy.util.KitResourceTemplateUtil; +import java.util.Collections; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Collections; @Slf4j @Service public class SystemEmailService { - @Autowired - private SystemEmailConfigMapper systemEmailConfigMapper; - @Autowired - private KitRedisHelper redisHelper; - @Autowired - private AppProperties properties; + @Autowired + private SystemEmailConfigMapper systemEmailConfigMapper; + @Autowired + private KitRedisHelper redisHelper; + @Autowired + private AppProperties properties; - /** - * 更新邮件配置 -> TestPassed - * - * @param emailConfig 邮箱配置 - */ - @Transactional(rollbackFor = Exception.class) - public void updateEmailConfigById(SystemEmailConfigTb emailConfig) throws Exception { - SystemEmailConfigTb systemEmailConfigTb = getLastEmailConfig(); - if (!emailConfig.getPassword().equals(systemEmailConfigTb.getPassword())) { - // 对称加密 - systemEmailConfigTb.setPassword(KitDesEncryptUtil.desEncrypt(emailConfig.getPassword())); - } - systemEmailConfigTb.setId(1L); - systemEmailConfigMapper.insertOrUpdate(systemEmailConfigTb); + /** + * 更新邮件配置 -> TestPassed + * + * @param emailConfig 邮箱配置 + */ + @Transactional(rollbackFor = Exception.class) + public void updateEmailConfigById(SystemEmailConfigTb emailConfig) throws Exception { + SystemEmailConfigTb systemEmailConfigTb = getLastEmailConfig(); + if (!emailConfig.getPassword().equals(systemEmailConfigTb.getPassword())) { + // 对称加密 + systemEmailConfigTb.setPassword(KitDesEncryptUtil.desEncrypt(emailConfig.getPassword())); } + systemEmailConfigTb.setId(1L); + systemEmailConfigMapper.insertOrUpdate(systemEmailConfigTb); + } - /** - * 发送邮件 -> TestPassed - * - * @param sendEmailRequest 邮件发送的内容 - */ - public void sendEmail(SystemSendEmailArgs sendEmailRequest) { - SystemEmailConfigTb systemEmailConfigTb = getLastEmailConfig(); - if (systemEmailConfigTb.getId() == null) { - throw new BadRequestException("请先配置, 再操作"); - } - // 封装 - MailAccount account = new MailAccount(); - // 设置用户 - String user = systemEmailConfigTb.getFromUser().split("@")[0]; - account.setUser(user); - account.setHost(systemEmailConfigTb.getHost()); - account.setPort(Integer.parseInt(systemEmailConfigTb.getPort())); - account.setAuth(true); - try { - // 对称解密 - account.setPass(KitDesEncryptUtil.desDecrypt(systemEmailConfigTb.getPassword())); - } catch (Exception e) { - throw new BadRequestException(e.getMessage()); - } - account.setFrom(systemEmailConfigTb.getUser() + "<" + systemEmailConfigTb.getFromUser() + ">"); - // ssl方式发送 - account.setSslEnable(true); - // 使用STARTTLS安全连接 - account.setStarttlsEnable(true); - // 解决jdk8之后默认禁用部分tls协议, 导致邮件发送失败的问题 - account.setSslProtocols("TLSv1 TLSv1.1 TLSv1.2"); - String content = sendEmailRequest.getContent(); - // 发送 - try { - int size = sendEmailRequest.getTos().size(); - Mail.create(account).setTos(sendEmailRequest.getTos().toArray(new String[size])) - .setTitle(sendEmailRequest.getSubject()).setContent(content).setHtml(true) - // 关闭session - .setUseGlobalSession(false).send(); - } catch (Exception e) { - log.error("邮件发送失败", e); - throw new BadRequestException("邮件发送失败"); - } + /** + * 发送邮件 -> TestPassed + * + * @param sendEmailRequest 邮件发送的内容 + */ + public void sendEmail(SystemSendEmailArgs sendEmailRequest) { + SystemEmailConfigTb systemEmailConfigTb = getLastEmailConfig(); + if (systemEmailConfigTb.getId() == null) { + throw new BadRequestException("请先配置, 再操作"); } + // 封装 + MailAccount account = new MailAccount(); + // 设置用户 + String user = systemEmailConfigTb.getFromUser().split("@")[0]; + account.setUser(user); + account.setHost(systemEmailConfigTb.getHost()); + account.setPort(Integer.parseInt(systemEmailConfigTb.getPort())); + account.setAuth(true); + try { + // 对称解密 + account.setPass(KitDesEncryptUtil.desDecrypt(systemEmailConfigTb.getPassword())); + } catch (Exception e) { + throw new BadRequestException(e.getMessage()); + } + account.setFrom(systemEmailConfigTb.getUser() + "<" + systemEmailConfigTb.getFromUser() + ">"); + // ssl方式发送 + account.setSslEnable(true); + // 使用STARTTLS安全连接 + account.setStarttlsEnable(true); + // 解决jdk8之后默认禁用部分tls协议, 导致邮件发送失败的问题 + account.setSslProtocols("TLSv1 TLSv1.1 TLSv1.2"); + String content = sendEmailRequest.getContent(); + // 发送 + try { + int size = sendEmailRequest.getTos().size(); + Mail.create(account).setTos(sendEmailRequest.getTos().toArray(new String[size])) + .setTitle(sendEmailRequest.getSubject()).setContent(content).setHtml(true) + // 关闭session + .setUseGlobalSession(false).send(); + } catch (Exception e) { + log.error("邮件发送失败", e); + throw new BadRequestException("邮件发送失败"); + } + } - /** - * 校验邮箱验证码 -> TestPassed - */ - public void checkEmailCaptchaV1(SystemCaptchaBizEnum biEnum, String email, String code) { - String redisKey = biEnum.getRedisKey() + email; - String value = redisHelper.get(redisKey, String.class); - if (value == null || !value.equals(code)) { - throw new BadRequestException("无效验证码"); - } else { - redisHelper.del(redisKey); - } + /** + * 校验邮箱验证码 -> TestPassed + */ + public void checkEmailCaptchaV1(SystemCaptchaBizEnum biEnum, String email, String code) { + String redisKey = biEnum.getRedisKey() + email; + String value = redisHelper.get(redisKey, String.class); + if (value == null || !value.equals(code)) { + throw new BadRequestException("无效验证码"); + } else { + redisHelper.del(redisKey); } + } - /** - * 发送给邮箱验证码 - */ - public void sendCaptcha(SystemCaptchaBizEnum biEnum, String email) { - if (biEnum == null) { - throw new BadRequestException("biEnum必填"); - } - String content; - String redisKey = biEnum.getRedisKey() + email; - String oldCode = redisHelper.get(redisKey, String.class); - if (oldCode == null) { - String code = RandomUtil.randomNumbers(6); - // 存入缓存 - if (!redisHelper.set(redisKey, code, properties.getCaptcha().getExpireTime())) { - throw new BadRequestException("服务异常, 请联系网站负责人"); - } - // 存在就再次发送原来的验证码 - content = KitResourceTemplateUtil.render(null, biEnum.getTemplateName(), Dict.create().set("code", code)); - } else { - content = - KitResourceTemplateUtil.render(null, biEnum.getTemplateName(), Dict.create().set("code", oldCode)); - } - SystemSendEmailArgs sendEmailRequest = - new SystemSendEmailArgs(Collections.singletonList(email), SystemConst.CURRENT_APP_TITLE, content); - sendEmail(sendEmailRequest); + /** + * 发送给邮箱验证码 + */ + public void sendCaptcha(SystemCaptchaBizEnum biEnum, String email) { + if (biEnum == null) { + throw new BadRequestException("biEnum必填"); } + String content; + String redisKey = biEnum.getRedisKey() + email; + String oldCode = redisHelper.get(redisKey, String.class); + if (oldCode == null) { + String code = RandomUtil.randomNumbers(6); + // 存入缓存 + if (!redisHelper.set(redisKey, code, properties.getCaptcha().getExpireTime())) { + throw new BadRequestException("服务异常, 请联系网站负责人"); + } + // 存在就再次发送原来的验证码 + content = KitResourceTemplateUtil.render(null, biEnum.getTemplateName(), Dict.create().set("code", code)); + } else { + content = + KitResourceTemplateUtil.render(null, biEnum.getTemplateName(), Dict.create().set("code", oldCode)); + } + SystemSendEmailArgs sendEmailRequest = + new SystemSendEmailArgs(Collections.singletonList(email), SystemConst.CURRENT_APP_TITLE, content); + sendEmail(sendEmailRequest); + } - public SystemEmailConfigTb getLastEmailConfig() { - SystemEmailConfigTb systemEmailConfigTb = systemEmailConfigMapper.selectById(1L); - return systemEmailConfigTb == null ? new SystemEmailConfigTb() : systemEmailConfigTb; - } + public SystemEmailConfigTb getLastEmailConfig() { + SystemEmailConfigTb systemEmailConfigTb = systemEmailConfigMapper.selectById(1L); + return systemEmailConfigTb == null ? new SystemEmailConfigTb() : systemEmailConfigTb; + } - public void checkEmailCaptcha(SystemCheckEmailCaptchaArgs args) { - SystemCaptchaBizEnum biEnum = SystemCaptchaBizEnum.getByBizCode(args.getBizCode()); - if (biEnum == null) { - throw new BadRequestException("不支持的业务"); - } - this.checkEmailCaptchaV1(biEnum, args.getEmail(), args.getCode()); + public void checkEmailCaptcha(SystemCheckEmailCaptchaArgs args) { + SystemCaptchaBizEnum biEnum = SystemCaptchaBizEnum.getByBizCode(args.getBizCode()); + if (biEnum == null) { + throw new BadRequestException("不支持的业务"); } + this.checkEmailCaptchaV1(biEnum, args.getEmail(), args.getCode()); + } } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemJobService.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemJobService.java index 392ffdbf..9f169be8 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemJobService.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemJobService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,129 +29,139 @@ import cn.odboy.util.KitPageUtil; import cn.odboy.util.xlsx.KitExcelExporter; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; import java.util.List; import java.util.Set; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; @Service public class SystemJobService { - @Autowired - private SystemJobMapper systemJobMapper; - @Autowired - private SystemUserJobService systemUserJobService; + @Autowired + private SystemJobMapper systemJobMapper; + @Autowired + private SystemUserJobService systemUserJobService; - /** - * 创建 -> TestPassed - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void saveJob(SystemCreateJobArgs args) { - SystemJobTb job = this.getJobByName(args.getName()); - if (job != null) { - throw new BadRequestException("职位名称已存在"); - } - SystemJobTb systemJobTb = KitBeanUtil.copyToClass(args, SystemJobTb.class); - systemJobMapper.insert(systemJobTb); + /** + * 创建 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void saveJob(SystemCreateJobArgs args) { + if (this.existJobWithName(args.getName())) { + throw new BadRequestException("职位名称已存在"); } + SystemJobTb systemJobTb = KitBeanUtil.copyToClass(args, SystemJobTb.class); + systemJobMapper.insert(systemJobTb); + } - /** - * 编辑 -> TestPassed - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void updateJobById(SystemJobTb args) { - SystemJobTb job = systemJobMapper.selectById(args.getId()); - SystemJobTb old = this.getJobByName(args.getName()); - if (old != null && !old.getId().equals(args.getId())) { - throw new BadRequestException("职位名称已存在"); - } - args.setId(job.getId()); - systemJobMapper.updateById(args); + /** + * 编辑 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void updateJobById(SystemJobTb args) { + SystemJobTb job = systemJobMapper.selectById(args.getId()); + if (this.existJobWithNameNeSelf(args.getName(), job.getId())) { + throw new BadRequestException("职位名称已存在"); } + args.setId(job.getId()); + systemJobMapper.updateById(args); + } - /** - * 删除 -> TestPassed - * - * @param ids / - */ - @Transactional(rollbackFor = Exception.class) - public void deleteJobByIds(Set ids) { - // 验证是否被用户关联 - this.verifyBindRelationByIds(ids); - systemJobMapper.deleteByIds(ids); - } + /** + * 删除 -> TestPassed + * + * @param ids / + */ + @Transactional(rollbackFor = Exception.class) + public void deleteJobByIds(Set ids) { + // 验证是否被用户关联 + this.verifyBindRelationByIds(ids); + systemJobMapper.deleteByIds(ids); + } - /** - * 分页查询 -> TestPassed - * - * @param args 条件 - * @param page 分页参数 - */ - public KitPageResult searchJobByArgs(SystemQueryJobArgs args, Page page) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - this.injectQueryParams(args, wrapper); - Page selectPage = systemJobMapper.selectPage(page, wrapper); - return KitPageUtil.toPage(selectPage); - } + /** + * 分页查询 -> TestPassed + * + * @param args 条件 + * @param page 分页参数 + */ + public KitPageResult searchJobByArgs(SystemQueryJobArgs args, Page page) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + this.injectQueryParams(args, wrapper); + Page selectPage = systemJobMapper.selectPage(page, wrapper); + return KitPageUtil.toPage(selectPage); + } - /** - * 查询全部数据 -> TestPassed - */ - public List queryJobByArgs(SystemQueryJobArgs args) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - this.injectQueryParams(args, wrapper); - return systemJobMapper.selectList(wrapper); - } + /** + * 查询全部数据 -> TestPassed + */ + public List queryJobByArgs(SystemQueryJobArgs args) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + this.injectQueryParams(args, wrapper); + return systemJobMapper.selectList(wrapper); + } - /** - * 验证是否被用户关联 -> TestPassed - * - * @param ids / - */ - public void verifyBindRelationByIds(Set ids) { - if (systemUserJobService.countUserByJobIds(ids) > 0) { - throw new BadRequestException("所选的岗位中存在用户关联, 请解除关联再试!"); - } + /** + * 验证是否被用户关联 -> TestPassed + * + * @param ids / + */ + public void verifyBindRelationByIds(Set ids) { + if (systemUserJobService.countUserByJobIds(ids) > 0) { + throw new BadRequestException("所选的岗位中存在用户关联, 请解除关联再试!"); } + } - public SystemJobTb getJobByName(String name) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemJobTb::getName, name); - return systemJobMapper.selectOne(wrapper); - } + /** + * 根据岗位名称查询岗位是否存在 -> TestPassed + */ + private boolean existJobWithName(String name) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemJobTb::getName, name); + return systemJobMapper.exists(wrapper); + } - public void injectQueryParams(SystemQueryJobArgs args, LambdaQueryWrapper wrapper) { - if (args != null) { - wrapper.like(StrUtil.isNotBlank(args.getName()), SystemJobTb::getName, args.getName()); - wrapper.eq(args.getEnabled() != null, SystemJobTb::getEnabled, args.getEnabled()); - if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { - wrapper.between(SystemJobTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); - } - } - wrapper.orderByDesc(SystemJobTb::getJobSort, SystemJobTb::getId); - } + /** + * 根据岗位名称和岗位id查询岗位是否存在 -> TestPassed + */ + private boolean existJobWithNameNeSelf(String name, Long currentJobId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemJobTb::getName, name); + wrapper.ne(SystemJobTb::getId, currentJobId); + return systemJobMapper.exists(wrapper); + } - public void exportJobXlsx(HttpServletResponse response, SystemQueryJobArgs args) { - List systemJobTbs = this.queryJobByArgs(args); - List rowVos = new ArrayList<>(); - for (SystemJobTb dataObject : systemJobTbs) { - SystemJobExportRowVo rowVo = new SystemJobExportRowVo(); - rowVo.setName(dataObject.getName()); - rowVo.setEnabled(dataObject.getEnabled() ? "启用" : "停用"); - rowVo.setCreateTime(dataObject.getCreateTime()); - rowVos.add(rowVo); - } - KitExcelExporter.exportSimple(response, "岗位数据", SystemJobExportRowVo.class, rowVos); + private void injectQueryParams(SystemQueryJobArgs args, LambdaQueryWrapper wrapper) { + if (args != null) { + wrapper.like(StrUtil.isNotBlank(args.getName()), SystemJobTb::getName, args.getName()); + wrapper.eq(args.getEnabled() != null, SystemJobTb::getEnabled, args.getEnabled()); + if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { + wrapper.between(SystemJobTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); + } } + wrapper.orderByDesc(SystemJobTb::getJobSort, SystemJobTb::getId); + } - public List listByIds(Set jobIds) { - return systemJobMapper.selectByIds(jobIds); + /** + * 导出岗位数据 -> TestPassed + */ + public void exportJobXlsx(HttpServletResponse response, SystemQueryJobArgs args) { + List systemJobTbs = this.queryJobByArgs(args); + List rowVos = new ArrayList<>(); + for (SystemJobTb dataObject : systemJobTbs) { + SystemJobExportRowVo rowVo = new SystemJobExportRowVo(); + rowVo.setName(dataObject.getName()); + rowVo.setEnabled(dataObject.getEnabled() ? "启用" : "停用"); + rowVo.setCreateTime(dataObject.getCreateTime()); + rowVos.add(rowVo); } + KitExcelExporter.exportSimple(response, "岗位数据", SystemJobExportRowVo.class, rowVos); + } } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemLocalStorageService.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemLocalStorageService.java index aef880cd..aa4e2afc 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemLocalStorageService.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemLocalStorageService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,6 @@ import cn.hutool.core.io.IORuntimeException; import cn.hutool.core.util.StrUtil; import cn.odboy.base.KitPageResult; import cn.odboy.constant.FileTypeEnum; -import cn.odboy.framework.context.KitSpringBeanHolder; import cn.odboy.framework.exception.BadRequestException; import cn.odboy.framework.properties.AppProperties; import cn.odboy.framework.server.core.KitFileLocalUploadHelper; @@ -36,142 +35,155 @@ import cn.odboy.util.KitPageUtil; import cn.odboy.util.xlsx.KitExcelExporter; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.multipart.MultipartFile; -import javax.servlet.http.HttpServletResponse; import java.io.File; import java.util.Date; import java.util.List; +import javax.servlet.http.HttpServletResponse; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; +@Slf4j @Service public class SystemLocalStorageService { - @Autowired - private SystemLocalStorageMapper systemLocalStorageMapper; - @Autowired - private KitFileLocalUploadHelper fileUploadPathHelper; - @Autowired - private AppProperties properties; + @Autowired + private SystemLocalStorageMapper systemLocalStorageMapper; + @Autowired + private KitFileLocalUploadHelper fileUploadPathHelper; + @Autowired + private AppProperties properties; + @Lazy + @Autowired + private SystemLocalStorageService localStorageService; - /** - * 上传 -> TestPassed - * - * @param name 文件名称 - * @param multipartFile 文件 - * @return / - */ - @Transactional(rollbackFor = Exception.class) - public SystemLocalStorageTb uploadFile(String name, MultipartFile multipartFile) { - long size = multipartFile.getSize(); - KitFileUtil.checkSize(properties.getOss().getMaxSize(), size); - String suffix = KitFileUtil.getSuffix(multipartFile.getOriginalFilename()); - String type = KitFileUtil.getFileType(suffix); - String uploadDateStr = DateUtil.format(new Date(), DatePattern.PURE_DATE_FORMAT); - File file = KitFileUtil.upload(multipartFile, fileUploadPathHelper.getPath() + uploadDateStr + File.separator); - if (file == null) { - throw new BadRequestException("上传失败"); - } - try { - String formatSize = KitFileUtil.getSize(size); - String prefixName = - StrUtil.isBlank(name) ? KitFileUtil.getPrefix(multipartFile.getOriginalFilename()) : name; - SystemLocalStorageTb localStorage = new SystemLocalStorageTb(); - localStorage.setRealName(file.getName()); - localStorage.setName(prefixName); - localStorage.setSuffix(suffix); - localStorage.setPath(file.getPath()); - localStorage.setType(type); - localStorage.setSize(formatSize); - localStorage.setDateGroup(uploadDateStr); - systemLocalStorageMapper.insert(localStorage); - return localStorage; - } catch (Exception e) { - KitFileUtil.del(file); - throw e; - } + /** + * 上传 -> TestPassed + * + * @param name 文件名称 + * @param multipartFile 文件 + * @return / + */ + @Transactional(rollbackFor = Exception.class) + public SystemLocalStorageTb uploadFile(String name, MultipartFile multipartFile) { + long size = multipartFile.getSize(); + KitFileUtil.checkSize(properties.getOss().getMaxSize(), size); + String suffix = KitFileUtil.getSuffix(multipartFile.getOriginalFilename()); + String type = KitFileUtil.getFileType(suffix); + String uploadDateStr = DateUtil.format(new Date(), DatePattern.PURE_DATE_FORMAT); + File file = KitFileUtil.upload(multipartFile, fileUploadPathHelper.getPath() + uploadDateStr + File.separator); + if (file == null) { + throw new BadRequestException("上传失败"); } + try { + String formatSize = KitFileUtil.getSize(size); + String prefixName = KitFileUtil.getPrefix(multipartFile.getOriginalFilename(), name); + SystemLocalStorageTb localStorage = new SystemLocalStorageTb(); + localStorage.setRealName(file.getName()); + localStorage.setName(prefixName); + localStorage.setSuffix(suffix); + localStorage.setPath(file.getPath()); + localStorage.setType(type); + localStorage.setSize(formatSize); + localStorage.setDateGroup(uploadDateStr); + systemLocalStorageMapper.insert(localStorage); + return localStorage; + } catch (Exception e) { + log.error("上传文件失败", e); + KitFileUtil.del(file); + throw e; + } + } - /** - * 编辑 -> TestPassed - * - * @param args 文件信息 - */ - @Transactional(rollbackFor = Exception.class) - public void updateLocalStorageById(SystemLocalStorageTb args) { - SystemLocalStorageTb localStorage = systemLocalStorageMapper.selectById(args.getId()); - localStorage.copy(args); - systemLocalStorageMapper.insertOrUpdate(localStorage); - } + /** + * 编辑 -> TestPassed + * + * @param args 文件信息 + */ + @Transactional(rollbackFor = Exception.class) + public void updateLocalStorageById(SystemLocalStorageTb args) { + systemLocalStorageMapper.updateById(args); + } - /** - * 多选删除 -> TestPassed - * - * @param ids / - */ - @Transactional(rollbackFor = Exception.class) - public void deleteFileByIds(Long[] ids) { - for (Long id : ids) { - SystemLocalStorageTb storage = systemLocalStorageMapper.selectById(id); - try { - KitFileUtil.del(storage.getPath()); - systemLocalStorageMapper.deleteById(storage); - } catch (IORuntimeException e) { - throw new BadRequestException("删除文件 " + storage.getName() + " 失败"); - } - } + /** + * 多选删除 -> TestPassed + * + * @param ids / + */ + @Transactional(rollbackFor = Exception.class) + public void deleteFileByIds(Long[] ids) { + for (Long id : ids) { + SystemLocalStorageTb storage = systemLocalStorageMapper.selectById(id); + try { + KitFileUtil.del(storage.getPath()); + systemLocalStorageMapper.deleteById(storage); + } catch (IORuntimeException e) { + throw new BadRequestException("删除文件 " + storage.getName() + " 失败"); + } } + } - /** - * 分页查询 -> TestPassed - * - * @param args 条件 - * @param page 分页参数 - * @return / - */ - public KitPageResult searchLocalStorage(SystemQueryStorageArgs args, - Page page) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - this.injectQueryParams(args, wrapper); - Page selectPage = systemLocalStorageMapper.selectPage(page, wrapper); - return KitPageUtil.toPage(selectPage); - } + /** + * 分页查询 -> TestPassed + * + * @param args 条件 + * @param page 分页参数 + * @return / + */ + public KitPageResult searchLocalStorage(SystemQueryStorageArgs args, + Page page) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + this.injectQueryParams(args, wrapper); + Page selectPage = systemLocalStorageMapper.selectPage(page, wrapper); + return KitPageUtil.toPage(selectPage); + } - private void injectQueryParams(SystemQueryStorageArgs args, LambdaQueryWrapper wrapper) { - if (args != null) { - wrapper.and(StrUtil.isNotBlank(args.getBlurry()), - c -> c.like(SystemLocalStorageTb::getName, args.getBlurry()).or() - .like(SystemLocalStorageTb::getSuffix, args.getBlurry()).or() - .like(SystemLocalStorageTb::getType, args.getBlurry()).or() - .like(SystemLocalStorageTb::getCreateBy, args.getBlurry())); - if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { - wrapper.between(SystemLocalStorageTb::getUpdateTime, args.getCreateTime().get(0), - args.getCreateTime().get(1)); - } - } - wrapper.orderByDesc(SystemLocalStorageTb::getId); + private void injectQueryParams(SystemQueryStorageArgs args, LambdaQueryWrapper wrapper) { + if (args != null) { + wrapper.and(StrUtil.isNotBlank(args.getBlurry()), + c -> c.like(SystemLocalStorageTb::getName, args.getBlurry()).or() + .like(SystemLocalStorageTb::getSuffix, args.getBlurry()).or() + .like(SystemLocalStorageTb::getType, args.getBlurry()).or() + .like(SystemLocalStorageTb::getCreateBy, args.getBlurry())); + if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { + wrapper.between(SystemLocalStorageTb::getUpdateTime, args.getCreateTime().get(0), + args.getCreateTime().get(1)); + } } + wrapper.orderByDesc(SystemLocalStorageTb::getId); + } - public List queryLocalStorageByArgs(SystemQueryStorageArgs args) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - this.injectQueryParams(args, wrapper); - return systemLocalStorageMapper.selectList(wrapper); - } + /** + * 查询文件上传记录 -> TestPassed + */ + public List queryLocalStorageByArgs(SystemQueryStorageArgs args) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + this.injectQueryParams(args, wrapper); + return systemLocalStorageMapper.selectList(wrapper); + } - public SystemLocalStorageTb uploadPictureV1(MultipartFile file) { - // 判断文件是否为图片 - String suffix = KitFileUtil.getSuffix(file.getOriginalFilename()); - if (!FileTypeEnum.IMAGE.getCode().equals(KitFileUtil.getFileType(suffix))) { - throw new BadRequestException("只能上传图片"); - } - return KitSpringBeanHolder.getBean(SystemLocalStorageService.class).uploadFile(null, file); + /** + * 上传图片 -> TestPassed + */ + @Transactional(rollbackFor = Exception.class) + public SystemLocalStorageTb uploadPicture(MultipartFile file) { + // 判断文件是否为图片 + String suffix = KitFileUtil.getSuffix(file.getOriginalFilename()); + if (!FileTypeEnum.IMAGE.getCode().equals(KitFileUtil.getFileType(suffix))) { + throw new BadRequestException("只能上传图片"); } + return localStorageService.uploadFile(null, file); + } - public void exportLocalStorageXlsx(HttpServletResponse response, SystemQueryStorageArgs args) { - List systemLocalStorageTbs = this.queryLocalStorageByArgs(args); - List rowVos = - KitBeanUtil.copyToList(systemLocalStorageTbs, SystemLocalStorageExportRowVo.class); - KitExcelExporter.exportSimple(response, "文件上传记录数据", SystemLocalStorageExportRowVo.class, rowVos); - } + /** + * 导出文件上传记录 -> TestPassed + */ + public void exportLocalStorageXlsx(HttpServletResponse response, SystemQueryStorageArgs args) { + List systemLocalStorageTbs = this.queryLocalStorageByArgs(args); + List rowVos = KitBeanUtil.copyToList(systemLocalStorageTbs, SystemLocalStorageExportRowVo.class); + KitExcelExporter.exportSimple(response, "文件上传记录数据", SystemLocalStorageExportRowVo.class, rowVos); + } } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemMenuService.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemMenuService.java index 470cbd1f..c91b23fc 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemMenuService.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemMenuService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,6 @@ import cn.odboy.system.dal.model.request.SystemQueryMenuArgs; import cn.odboy.system.dal.model.response.SystemMenuMetaVo; import cn.odboy.system.dal.model.response.SystemMenuRouterVo; import cn.odboy.system.dal.model.response.SystemMenuVo; -import cn.odboy.system.dal.model.response.SystemRoleVo; import cn.odboy.system.dal.mysql.SystemMenuMapper; import cn.odboy.system.framework.permission.core.KitSecurityHelper; import cn.odboy.util.KitBeanUtil; @@ -37,6 +36,7 @@ import cn.odboy.util.xlsx.KitExcelExporter; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletResponse; @@ -46,431 +46,542 @@ import java.util.HashSet; import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; -import java.util.Objects; +import java.util.Map; import java.util.Set; import java.util.stream.Collectors; @Service public class SystemMenuService { - @Autowired - private SystemMenuMapper systemMenuMapper; - @Autowired - private SystemRoleMenuService systemRoleMenuService; - @Autowired - private SystemUserRoleService systemUserRoleService; + @Autowired + private SystemMenuMapper systemMenuMapper; + @Autowired + private SystemRoleMenuService systemRoleMenuService; + @Autowired + private SystemUserRoleService systemUserRoleService; + @Lazy + @Autowired + private SystemMenuService proxyService; - /** - * 创建 - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void saveMenu(SystemMenuTb args) { - if (this.getMenuByTitle(args.getTitle()) != null) { - throw new BadRequestException("菜单标题已存在"); - } - if (StrUtil.isNotBlank(args.getComponentName())) { - if (this.getMenuByComponentName(args.getComponentName()) != null) { - throw new BadRequestException("菜单组件名称已存在"); + /** + * 创建 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void saveMenu(SystemMenuTb args) { + if (this.existMenuWithTitle(args.getTitle())) { + throw new BadRequestException("菜单标题已存在"); + } + if (StrUtil.isNotBlank(args.getComponentName())) { + if (this.existMenuWithComponentName(args.getComponentName())) { + throw new BadRequestException("菜单组件名称已存在"); + } + } + if (Long.valueOf(0L).equals(args.getPid())) { + // 顶级目录 + args.setPid(null); + } + if (args.getIFrame()) { + if (!(args.getPath().toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTP) || args.getPath() + .toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTPS))) { + throw new BadRequestException(SystemTransferProtocolConst.PREFIX_HTTPS_BAD_REQUEST); + } + } + systemMenuMapper.insert(args); + // 计算子节点数目 + args.setSubCount(0); + // 更新父节点菜单数目 + this.updateMenuSubCnt(args.getPid()); + } + + /** + * 根据组件名称查询菜单是否存在 -> TestPassed + * + * @param componentName 组件名称 + * @return / + */ + private boolean existMenuWithComponentName(String componentName) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemMenuTb::getComponentName, componentName); + return systemMenuMapper.exists(wrapper); + } + + /** + * 根据组件名称查询菜单是否存在 -> TestPassed + * + * @param componentName 组件名称 + * @return / + */ + private boolean existMenuWithComponentNameNeSelf(String componentName, Long currentMenuId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemMenuTb::getComponentName, componentName); + wrapper.ne(SystemMenuTb::getId, currentMenuId); + return systemMenuMapper.exists(wrapper); + } + + /** + * 根据菜单标题查询菜单是否存在 -> TestPassed + * + * @param title 菜单标题 + * @return / + */ + private boolean existMenuWithTitle(String title) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemMenuTb::getTitle, title); + return systemMenuMapper.exists(wrapper); + } + + /** + * 根据菜单标题查询菜单是否存在 -> TestPassed + * + * @param title 菜单标题 + * @return / + */ + private boolean existMenuWithTitleNeSelf(String title, Long currentMenuId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemMenuTb::getTitle, title); + wrapper.ne(SystemMenuTb::getId, currentMenuId); + return systemMenuMapper.exists(wrapper); + } + + /** + * 编辑 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void updateMenuById(SystemMenuTb args) { + if (args.getId().equals(args.getPid())) { + throw new BadRequestException("上级不能为自己"); + } + SystemMenuTb menu = systemMenuMapper.selectById(args.getId()); + if (args.getIFrame()) { + if (!(args.getPath().toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTP) || args.getPath() + .toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTPS))) { + throw new BadRequestException(SystemTransferProtocolConst.PREFIX_HTTPS_BAD_REQUEST); + } + } + if (this.existMenuWithTitleNeSelf(args.getTitle(), menu.getId())) { + throw new BadRequestException("菜单标题已存在"); + } + if (args.getPid().equals(0L)) { + args.setPid(null); + } + // 记录的父节点ID + Long oldPid = menu.getPid(); + Long newPid = args.getPid(); + if (StrUtil.isNotBlank(args.getComponentName())) { + if (this.existMenuWithComponentNameNeSelf(args.getTitle(), menu.getId())) { + throw new BadRequestException("菜单组件名称已存在"); + } + } + menu.setTitle(args.getTitle()); + menu.setComponent(args.getComponent()); + menu.setPath(args.getPath()); + menu.setIcon(args.getIcon()); + menu.setIFrame(args.getIFrame()); + menu.setPid(args.getPid()); + menu.setMenuSort(args.getMenuSort()); + menu.setCache(args.getCache()); + menu.setHidden(args.getHidden()); + menu.setComponentName(args.getComponentName()); + menu.setPermission(args.getPermission()); + menu.setType(args.getType()); + // auto fill + menu.setUpdateBy(null); + menu.setUpdateTime(null); + systemMenuMapper.updateById(menu); + // 计算父级菜单节点数目 + this.updateMenuSubCnt(oldPid); + this.updateMenuSubCnt(newPid); + } + + /** + * 删除 -> TestPassed + */ + @Transactional(rollbackFor = Exception.class) + public void deleteMenuByIds(Set ids) { + // Set menuSet = new HashSet<>(); + // for (Long id : ids) { + // List menuList = this.listMenuByPid(id); + // menuSet.add(this.getMenuVoById(id)); + // menuSet = this.queryChildMenuByArgs(menuList, menuSet); + // } + // List menuIds = menuSet.stream().map(SystemMenuVo::getId).filter(Objects::nonNull).distinct().collect(Collectors.toList()); + // if (CollUtil.isNotEmpty(menuIds)) { + // systemRoleMenuService.deleteRoleMenuByMenuIds(menuIds); + // systemMenuMapper.deleteByIds(menuIds); + // } + // for (SystemMenuVo menu : menuSet) { + // this.updateMenuSubCnt(menu.getPid()); + // } + // ========= 优化 20260114 ========= + if (CollUtil.isEmpty(ids)) { + return; + } + // 查询所有菜单数据 + List allMenus = systemMenuMapper.listAll(); + // 根据ID集合获取当前菜单和其子菜单 + Set allMenuIds = this.getAllMenuIdsWithChildren(ids, allMenus); + if (CollUtil.isNotEmpty(allMenuIds)) { + // 删除角色菜单关联 + systemRoleMenuService.deleteRoleMenuByMenuIds(allMenuIds); + // 批量删除菜单 + systemMenuMapper.deleteByIds(allMenuIds); + // 更新父级菜单子节点数量 + this.updateParentMenuCounts(allMenuIds, allMenus); + } + } + + /** + * 从所有菜单中找出指定ID及其子菜单ID + * + * @param rootIds 要删除的根菜单ID集合 + * @param allMenus 所有菜单数据 + * @return 包含根菜单及其所有子菜单的ID集合 + */ + private Set getAllMenuIdsWithChildren(Set rootIds, List allMenus) { + Set result = new HashSet<>(rootIds); + Set currentLevelIds = new HashSet<>(rootIds); + // 构建父ID到子菜单的映射 + Map> parentToChildrenMap = allMenus.stream().filter(menu -> menu.getPid() != null) + .collect(Collectors.groupingBy(SystemMenuTb::getPid)); + while (!currentLevelIds.isEmpty()) { + Set nextLevelIds = new HashSet<>(); + // 对于当前层级的每个菜单ID,查找其子菜单 + for (Long parentId : currentLevelIds) { + List children = parentToChildrenMap.get(parentId); + if (children != null && !children.isEmpty()) { + for (SystemMenuTb child : children) { + if (result.add(child.getId())) { // 如果成功添加(之前不存在),则继续查找其子菜单 + nextLevelIds.add(child.getId()); } + } } - if (Long.valueOf(0L).equals(args.getPid())) { - args.setPid(null); - } - if (args.getIFrame()) { - if (!(args.getPath().toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTP) || args.getPath() - .toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTPS))) { - throw new BadRequestException(SystemTransferProtocolConst.PREFIX_HTTPS_BAD_REQUEST); - } - } - systemMenuMapper.insert(args); - // 计算子节点数目 - args.setSubCount(0); - // 更新父节点菜单数目 - this.updateMenuSubCnt(args.getPid()); + } + currentLevelIds = nextLevelIds; } + return result; + } - /** - * 编辑 - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void updateMenuById(SystemMenuTb args) { - if (args.getId().equals(args.getPid())) { - throw new BadRequestException("上级不能为自己"); - } - SystemMenuTb menu = systemMenuMapper.selectById(args.getId()); - if (args.getIFrame()) { - if (!(args.getPath().toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTP) || args.getPath() - .toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTPS))) { - throw new BadRequestException(SystemTransferProtocolConst.PREFIX_HTTPS_BAD_REQUEST); - } - } - SystemMenuTb menu1 = this.getMenuByTitle(args.getTitle()); - if (menu1 != null && !menu1.getId().equals(menu.getId())) { - throw new BadRequestException("菜单标题已存在"); - } - if (args.getPid().equals(0L)) { - args.setPid(null); - } - // 记录的父节点ID - Long oldPid = menu.getPid(); - Long newPid = args.getPid(); - if (StrUtil.isNotBlank(args.getComponentName())) { - menu1 = this.getMenuByComponentName(args.getComponentName()); - if (menu1 != null && !menu1.getId().equals(menu.getId())) { - throw new BadRequestException("菜单组件名称已存在"); - } - } - menu.setTitle(args.getTitle()); - menu.setComponent(args.getComponent()); - menu.setPath(args.getPath()); - menu.setIcon(args.getIcon()); - menu.setIFrame(args.getIFrame()); - menu.setPid(args.getPid()); - menu.setMenuSort(args.getMenuSort()); - menu.setCache(args.getCache()); - menu.setHidden(args.getHidden()); - menu.setComponentName(args.getComponentName()); - menu.setPermission(args.getPermission()); - menu.setType(args.getType()); - // auto fill - menu.setUpdateBy(null); - menu.setUpdateTime(null); - systemMenuMapper.insertOrUpdate(menu); - // 计算父级菜单节点数目 - this.updateMenuSubCnt(oldPid); - this.updateMenuSubCnt(newPid); + /** + * 更新被删除菜单的父菜单子节点计数 + */ + private void updateParentMenuCounts(Set deletedMenuIds, List allMenus) { + // 获取被删除菜单的父ID + Set parentIds = + allMenus.stream().filter(menu -> deletedMenuIds.contains(menu.getId()) && menu.getPid() != null) + .map(SystemMenuTb::getPid).collect(Collectors.toSet()); + // 更新每个父菜单的子节点计数 + for (Long parentId : parentIds) { + proxyService.updateMenuSubCnt(parentId); } + } - /** - * 删除 - */ - @Transactional(rollbackFor = Exception.class) - public void deleteMenuByIds(Set ids) { - Set menuSet = new HashSet<>(); - for (Long id : ids) { - List menuList = this.listMenuByPid(id); - menuSet.add(this.getMenuVoById(id)); - menuSet = this.queryChildMenuByArgs(menuList, menuSet); - } - List menuIds = - menuSet.stream().map(SystemMenuVo::getId).filter(Objects::nonNull).distinct().collect(Collectors.toList()); - if (CollUtil.isNotEmpty(menuIds)) { - systemRoleMenuService.deleteRoleMenuByMenuIds(menuIds); - systemMenuMapper.deleteByIds(menuIds); - } - for (SystemMenuVo menu : menuSet) { - this.updateMenuSubCnt(menu.getPid()); - } + /** + * 根据菜单id查询目录 -> TestPassed + * + * @param id 菜单id + */ + private SystemMenuTb getMenuById(Long id) { + return systemMenuMapper.selectById(id); + } + + @Transactional(rollbackFor = Exception.class) + public void updateMenuSubCnt(Long menuId) { + if (menuId != null) { + long count = this.countMenuByPid(menuId); + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); + wrapper.eq(SystemMenuTb::getId, menuId); + wrapper.set(SystemMenuTb::getSubCount, count); + systemMenuMapper.update(wrapper); } + } - private SystemMenuVo getMenuVoById(Long id) { - return KitBeanUtil.copyToClass(systemMenuMapper.selectById(id), SystemMenuVo.class); - } - - @Transactional(rollbackFor = Exception.class) - public void updateMenuSubCnt(Long menuId) { - if (menuId != null) { - long count = this.countMenuByPid(menuId); - LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); - wrapper.eq(SystemMenuTb::getId, menuId); - wrapper.set(SystemMenuTb::getSubCount, count); - systemMenuMapper.update(wrapper); + /** + * 查询全部数据 + * + * @param args 条件 + * @param isQuery / + * @return / + * @throws Exception / + */ + public List queryAllMenu(SystemQueryMenuArgs args, Boolean isQuery) throws Exception { + if (Boolean.TRUE.equals(isQuery)) { + args.setPidIsNull(true); + List fields = KitClassUtil.getAllFields(args.getClass(), new ArrayList<>()); + for (Field field : fields) { + //设置对象的访问权限, 保证对private的属性的访问 + field.setAccessible(true); + Object val = field.get(args); + if ("pidIsNull".equals(field.getName())) { + continue; } - } - - /** - * 查询全部数据 - * - * @param args 条件 - * @param isQuery / - * @return / - * @throws Exception / - */ - public List queryAllMenu(SystemQueryMenuArgs args, Boolean isQuery) throws Exception { - if (Boolean.TRUE.equals(isQuery)) { - args.setPidIsNull(true); - List fields = KitClassUtil.getAllFields(args.getClass(), new ArrayList<>()); - for (Field field : fields) { - //设置对象的访问权限, 保证对private的属性的访问 - field.setAccessible(true); - Object val = field.get(args); - if ("pidIsNull".equals(field.getName())) { - continue; - } - // 如果有查询条件, 则不指定pidIsNull - if (ObjectUtil.isNotNull(val)) { - args.setPidIsNull(null); - break; - } - } + // 如果有查询条件, 则不指定pidIsNull + if (ObjectUtil.isNotNull(val)) { + args.setPidIsNull(null); + break; } - return this.queryMenuByArgs(args); + } } + return this.queryMenuByArgs(args); + } - /** - * 根据当前用户获取菜单 - * - * @param currentUserId / - * @return / - */ - public List listMenuByUserId(Long currentUserId) { - List roles = systemUserRoleService.queryRoleVoByUsersId(currentUserId); - Set roleIds = roles.stream().map(SystemRoleVo::getId).collect(Collectors.toSet()); - return new ArrayList<>(systemRoleMenuService.queryMenuByRoleIds(roleIds)); + /** + * 根据当前用户查询菜单 + * + * @param currentUserId / + * @return / + */ + public List listMenuByUserId(Long currentUserId) { +// List roles = systemUserRoleService.listRoleVoByUsersId(currentUserId); +// Set roleIds = roles.stream().map(SystemRoleVo::getId).collect(Collectors.toSet()); + Set roleIds = systemUserRoleService.listUserRoleIdByUserId(currentUserId); + return systemRoleMenuService.listMenuByRoleIds(roleIds, false); + } + +// /** +// * 查询所有子节点, 包含自身ID +// * +// * @param menuList / +// * @param menuSet / +// * @return / +// */ +// public Set queryChildMenuByArgs(List menuList, Set menuSet) { +// for (SystemMenuTb menu : menuList) { +// menuSet.add(menu); +// List menus = this.listMenuByPid(menu.getId()); +// if (CollUtil.isNotEmpty(menus)) { +// queryChildMenuByArgs(menus, menuSet); +// } +// } +// return menuSet; +// } + + /** + * 懒加载菜单数据 + * + * @param pid / + * @return / + */ + public List listMenuByPid(Long pid) { + List menus; + if (pid != null && !pid.equals(0L)) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemMenuTb::getPid, pid); + wrapper.orderByAsc(SystemMenuTb::getMenuSort); + return systemMenuMapper.selectList(wrapper); + } else { + menus = this.listRootMenu(); } + return menus; + } - /** - * 获取所有子节点, 包含自身ID - * - * @param menuList / - * @param menuSet / - * @return / - */ - public Set queryChildMenuByArgs(List menuList, Set menuSet) { - for (SystemMenuVo menu : menuList) { - menuSet.add(menu); - List menus = this.listMenuByPid(menu.getId()); - if (CollUtil.isNotEmpty(menus)) { - queryChildMenuByArgs(menus, menuSet); - } + /** + * 根据ID查询同级与上级数据 -> TestPassed + * + * @param menu / + * @param menus / + * @return / + */ + public List querySuperiorMenuByArgs(SystemMenuTb menu, List menus) { + if (menu.getPid() == null) { + menus.addAll(this.listRootMenu()); + return menus; + } + menus.addAll(this.listMenuByPid(menu.getPid())); + return querySuperiorMenuByArgs(this.getMenuById(menu.getPid()), menus); + } + + /** + * 构建菜单树 + * + * @param menus 原始数据 + * @return / + */ + public List buildMenuTree(List menus) { + List systemMenuVos = KitBeanUtil.copyToList(menus, SystemMenuVo.class); + List trees = new ArrayList<>(); + Set ids = new HashSet<>(); + for (SystemMenuVo menu : systemMenuVos) { + if (menu.getPid() == null) { + trees.add(menu); + } + for (SystemMenuVo it : systemMenuVos) { + if (menu.getId().equals(it.getPid())) { + if (menu.getChildren() == null) { + menu.setChildren(new ArrayList<>()); + } + menu.getChildren().add(it); + ids.add(it.getId()); } - return menuSet; + } } - - /** - * 懒加载菜单数据 - * - * @param pid / - * @return / - */ - public List listMenuByPid(Long pid) { - List menus; - if (pid != null && !pid.equals(0L)) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemMenuTb::getPid, pid); - wrapper.orderByAsc(SystemMenuTb::getMenuSort); - return KitBeanUtil.copyToList(systemMenuMapper.selectList(wrapper), SystemMenuVo.class); - } else { - menus = this.listRootMenu(); - } - return menus; + if (CollUtil.isNotEmpty(trees)) { + trees = systemMenuVos.stream().filter(s -> !ids.contains(s.getId())).collect(Collectors.toList()); } + return trees; + } - /** - * 根据ID获取同级与上级数据 - * - * @param menu / - * @param menus / - * @return / - */ - public List querySuperiorMenuByArgs(SystemMenuVo menu, List menus) { - if (menu.getPid() == null) { - menus.addAll(this.listRootMenu()); - return menus; - } - menus.addAll(this.listMenuByPid(menu.getPid())); - return querySuperiorMenuByArgs(this.getMenuVoById(menu.getPid()), menus); - } - - /** - * 构建菜单树 - * - * @param menus 原始数据 - * @return / - */ - public List buildMenuTree(List menus) { - List trees = new ArrayList<>(); - Set ids = new HashSet<>(); - for (SystemMenuVo menu : menus) { - if (menu.getPid() == null) { - trees.add(menu); - } - for (SystemMenuVo it : menus) { - if (menu.getId().equals(it.getPid())) { - if (menu.getChildren() == null) { - menu.setChildren(new ArrayList<>()); - } - menu.getChildren().add(it); - ids.add(it.getId()); - } - } - } - if (CollUtil.isNotEmpty(trees)) { - trees = menus.stream().filter(s -> !ids.contains(s.getId())).collect(Collectors.toList()); - } - return trees; - } - - /** - * 构建菜单树 - * - * @param menus / - * @return / - */ - public List buildMenuVo(List menus) { - List list = new LinkedList<>(); - for (SystemMenuVo menu : menus) { - if (menu != null) { - List menuList = menu.getChildren(); - SystemMenuRouterVo menuVo = new SystemMenuRouterVo(); - menuVo.setName( - ObjectUtil.isNotEmpty(menu.getComponentName()) ? menu.getComponentName() : menu.getTitle()); - // 一级目录需要加斜杠, 不然会报警告 - menuVo.setPath(menu.getPid() == null ? "/" + menu.getPath() : menu.getPath()); - menuVo.setHidden(menu.getHidden()); - // 如果不是外链 - if (!menu.getIFrame()) { - if (menu.getPid() == null) { - menuVo.setComponent(StrUtil.isEmpty(menu.getComponent()) ? "Layout" : menu.getComponent()); - // 如果不是一级菜单,并且菜单类型为目录,则代表是多级菜单 - } else if (menu.getType() == 0) { - menuVo.setComponent(StrUtil.isEmpty(menu.getComponent()) ? "ParentView" : menu.getComponent()); - } else if (StrUtil.isNotBlank(menu.getComponent())) { - menuVo.setComponent(menu.getComponent()); - } - } - menuVo.setMeta(new SystemMenuMetaVo(menu.getTitle(), menu.getIcon(), !menu.getCache())); - if (CollUtil.isNotEmpty(menuList)) { - menuVo.setAlwaysShow(true); - menuVo.setRedirect("noredirect"); - menuVo.setChildren(buildMenuVo(menuList)); - // 处理是一级菜单并且没有子菜单的情况 - } else if (menu.getPid() == null) { - SystemMenuRouterVo menuVo1 = getMenuVo(menu, menuVo); - menuVo.setName(null); - menuVo.setMeta(null); - menuVo.setComponent("Layout"); - List list1 = new ArrayList<>(); - list1.add(menuVo1); - menuVo.setChildren(list1); - } - list.add(menuVo); - } - } - return list; - } - - /** - * 获取 MenuResponse - * - * @param menu / - * @param menuVo / - * @return / - */ - private SystemMenuRouterVo getMenuVo(SystemMenuVo menu, SystemMenuRouterVo menuVo) { - SystemMenuRouterVo menuVo1 = new SystemMenuRouterVo(); - menuVo1.setMeta(menuVo.getMeta()); - // 非外链 + /** + * 构建菜单树 + * + * @param menus / + * @return / + */ + public List buildMenuVo(List menus) { + List list = new LinkedList<>(); + for (SystemMenuVo menu : menus) { + if (menu != null) { + List menuList = menu.getChildren(); + SystemMenuRouterVo menuVo = new SystemMenuRouterVo(); + menuVo.setName( + ObjectUtil.isNotEmpty(menu.getComponentName()) ? menu.getComponentName() : menu.getTitle()); + // 一级目录需要加斜杠, 不然会报警告 + menuVo.setPath(menu.getPid() == null ? "/" + menu.getPath() : menu.getPath()); + menuVo.setHidden(menu.getHidden()); + // 如果不是外链 if (!menu.getIFrame()) { - menuVo1.setPath("index"); - menuVo1.setName(menuVo.getName()); - menuVo1.setComponent(menuVo.getComponent()); - } else { - menuVo1.setPath(menu.getPath()); + if (menu.getPid() == null) { + menuVo.setComponent(StrUtil.isEmpty(menu.getComponent()) ? "Layout" : menu.getComponent()); + // 如果不是一级菜单,并且菜单类型为目录,则代表是多级菜单 + } else if (menu.getType() == 0) { + menuVo.setComponent(StrUtil.isEmpty(menu.getComponent()) ? "ParentView" : menu.getComponent()); + } else if (StrUtil.isNotBlank(menu.getComponent())) { + menuVo.setComponent(menu.getComponent()); + } } - return menuVo1; - } - - public List listMenuByIds(List ids) { - return KitBeanUtil.copyToList(systemMenuMapper.selectByIds(ids), SystemMenuVo.class); - } - - private SystemMenuTb getMenuByComponentName(String componentName) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemMenuTb::getComponentName, componentName); - return systemMenuMapper.selectOne(wrapper); - } - - private SystemMenuTb getMenuByTitle(String title) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemMenuTb::getTitle, title); - return systemMenuMapper.selectOne(wrapper); - } - - private Long countMenuByPid(Long pid) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemMenuTb::getPid, pid); - return systemMenuMapper.selectCount(wrapper); - } - - private List queryMenuByArgs(SystemQueryMenuArgs args) { - KitValidUtil.notNull(args); - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.isNull(args.getPidIsNull() != null, SystemMenuTb::getPid); - wrapper.eq(args.getPid() != null, SystemMenuTb::getPid, args.getPid()); - wrapper.and(StrUtil.isNotBlank(args.getBlurry()), c -> c.like(SystemMenuTb::getTitle, args.getBlurry()).or() - .like(SystemMenuTb::getComponentName, args.getBlurry()).or() - .like(SystemMenuTb::getPermission, args.getBlurry())); - if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { - wrapper.between(SystemMenuTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); + menuVo.setMeta(new SystemMenuMetaVo(menu.getTitle(), menu.getIcon(), !menu.getCache())); + if (CollUtil.isNotEmpty(menuList)) { + menuVo.setAlwaysShow(true); + menuVo.setRedirect("noredirect"); + menuVo.setChildren(buildMenuVo(menuList)); + // 处理是一级菜单并且没有子菜单的情况 + } else if (menu.getPid() == null) { + SystemMenuRouterVo menuVo1 = getMenuVo(menu, menuVo); + menuVo.setName(null); + menuVo.setMeta(null); + menuVo.setComponent("Layout"); + List list1 = new ArrayList<>(); + list1.add(menuVo1); + menuVo.setChildren(list1); } - wrapper.orderByAsc(SystemMenuTb::getMenuSort); - return systemMenuMapper.selectList(wrapper); + list.add(menuVo); + } } + return list; + } - private List listRootMenu() { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.isNull(SystemMenuTb::getPid); - wrapper.orderByAsc(SystemMenuTb::getMenuSort); - return KitBeanUtil.copyToList(systemMenuMapper.selectList(wrapper), SystemMenuVo.class); + /** + * 查询 MenuResponse + * + * @param menu / + * @param menuVo / + * @return / + */ + private SystemMenuRouterVo getMenuVo(SystemMenuVo menu, SystemMenuRouterVo menuVo) { + SystemMenuRouterVo menuVo1 = new SystemMenuRouterVo(); + menuVo1.setMeta(menuVo.getMeta()); + // 非外链 + if (!menu.getIFrame()) { + menuVo1.setPath("index"); + menuVo1.setName(menuVo.getName()); + menuVo1.setComponent(menuVo.getComponent()); + } else { + menuVo1.setPath(menu.getPath()); } + return menuVo1; + } - public List buildFrontMenus() { - List originMenus = this.listMenuByUserId(KitSecurityHelper.getCurrentUserId()); - List targetMenus = this.buildMenuTree(originMenus); - return this.buildMenuVo(targetMenus); + public List listMenuByIds(List ids) { + return systemMenuMapper.selectByIds(ids); + } + + private Long countMenuByPid(Long pid) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemMenuTb::getPid, pid); + return systemMenuMapper.selectCount(wrapper); + } + + private List queryMenuByArgs(SystemQueryMenuArgs args) { + KitValidUtil.notNull(args); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.isNull(args.getPidIsNull() != null, SystemMenuTb::getPid); + wrapper.eq(args.getPid() != null, SystemMenuTb::getPid, args.getPid()); + wrapper.and(StrUtil.isNotBlank(args.getBlurry()), c -> c.like(SystemMenuTb::getTitle, args.getBlurry()).or() + .like(SystemMenuTb::getComponentName, args.getBlurry()).or() + .like(SystemMenuTb::getPermission, args.getBlurry())); + if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { + wrapper.between(SystemMenuTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); } + wrapper.orderByAsc(SystemMenuTb::getMenuSort); + return systemMenuMapper.selectList(wrapper); + } - public Set listChildMenuSetByMenuId(Long id) { - Set menuSet = new HashSet<>(); - List menuList = this.listMenuByPid(id); - menuSet.add(this.getMenuVoById(id)); - menuSet = this.queryChildMenuByArgs(menuList, menuSet); - return menuSet.stream().map(SystemMenuVo::getId).collect(Collectors.toSet()); - } + /** + * 查询根目录 -> TestPassed + */ + private List listRootMenu() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.isNull(SystemMenuTb::getPid); + wrapper.orderByAsc(SystemMenuTb::getMenuSort); + return systemMenuMapper.selectList(wrapper); + } - public List listMenuSuperior(List ids) { - Set menus; - List systemMenuTbs; - if (CollUtil.isNotEmpty(ids)) { - menus = new LinkedHashSet<>(this.listMenuByIds(ids)); - for (SystemMenuVo menu : menus) { - List menuList = this.querySuperiorMenuByArgs(menu, new ArrayList<>()); - for (SystemMenuVo data : menuList) { - if (data.getId().equals(menu.getPid())) { - data.setSubCount(data.getSubCount() - 1); - } - } - menus.addAll(menuList); - } - // 编辑菜单时不显示自己以及自己下级的数据, 避免出现PID数据环形问题 - menus = menus.stream().filter(i -> !ids.contains(i.getId())).collect(Collectors.toSet()); - List newMenuList = new ArrayList<>(menus); - systemMenuTbs = this.buildMenuTree(newMenuList); - } else { - systemMenuTbs = this.listMenuByPid(null); + public List buildFrontMenus() { + List originMenus = this.listMenuByUserId(KitSecurityHelper.getCurrentUserId()); + List targetMenus = this.buildMenuTree(originMenus); + return this.buildMenuVo(targetMenus); + } + + public Set listChildMenuSetByMenuId(Long id) { +// Set menuSet = new HashSet<>(); +// List menuList = this.listMenuByPid(id); +// menuSet.add(this.getMenuById(id)); +// menuSet = this.queryChildMenuByArgs(menuList, menuSet); +// return menuSet.stream().map(SystemMenuTb::getId).collect(Collectors.toSet()); + List allMenus = systemMenuMapper.listAll(); + return this.getAllMenuIdsWithChildren(CollUtil.newHashSet(id), allMenus); + } + + public List listMenuSuperior(List ids) { + Set menus; + if (CollUtil.isNotEmpty(ids)) { + menus = new LinkedHashSet<>(this.listMenuByIds(ids)); + for (SystemMenuTb menu : menus) { + List menuList = this.querySuperiorMenuByArgs(menu, new ArrayList<>()); + for (SystemMenuTb data : menuList) { + if (data.getId().equals(menu.getPid())) { + data.setSubCount(data.getSubCount() - 1); + } } - return systemMenuTbs; + menus.addAll(menuList); + } + // 编辑菜单时不显示自己以及自己下级的数据, 避免出现PID数据环形问题 + menus = menus.stream().filter(i -> !ids.contains(i.getId())).collect(Collectors.toSet()); + List newMenuList = new ArrayList<>(menus); + return this.buildMenuTree(newMenuList); + } else { + List records = this.listMenuByPid(null); + return KitBeanUtil.copyToList(records, SystemMenuVo.class); } + } - public void exportMenuXlsx(HttpServletResponse response, SystemQueryMenuArgs args) throws Exception { - List systemMenuTbs = this.queryAllMenu(args, false); - List rowVos = new ArrayList<>(); - for (SystemMenuTb dataObject : systemMenuTbs) { - SystemMenuExportRowVo rowVo = new SystemMenuExportRowVo(); - rowVo.setTitle(dataObject.getTitle()); - rowVo.setType(dataObject.getType() == null ? "目录" : dataObject.getType() == 1 ? "菜单" : "按钮"); - rowVo.setPermission(dataObject.getPermission()); - rowVo.setIFrame(dataObject.getIFrame() ? SystemYesOrNoChConst.YES_STR : SystemYesOrNoChConst.NO_STR); - rowVo.setHidden(dataObject.getHidden() ? SystemYesOrNoChConst.NO_STR : SystemYesOrNoChConst.YES_STR); - rowVo.setCache(dataObject.getCache() ? SystemYesOrNoChConst.YES_STR : SystemYesOrNoChConst.NO_STR); - rowVo.setCreateTime(dataObject.getCreateTime()); - rowVos.add(rowVo); - } - KitExcelExporter.exportSimple(response, "菜单数据", SystemMenuExportRowVo.class, rowVos); + public void exportMenuXlsx(HttpServletResponse response, SystemQueryMenuArgs args) throws Exception { + List systemMenuTbs = this.queryAllMenu(args, false); + List rowVos = new ArrayList<>(); + for (SystemMenuTb dataObject : systemMenuTbs) { + SystemMenuExportRowVo rowVo = new SystemMenuExportRowVo(); + rowVo.setTitle(dataObject.getTitle()); + rowVo.setType(dataObject.getType() == null ? "目录" : dataObject.getType() == 1 ? "菜单" : "按钮"); + rowVo.setPermission(dataObject.getPermission()); + rowVo.setIFrame(dataObject.getIFrame() ? SystemYesOrNoChConst.YES_STR : SystemYesOrNoChConst.NO_STR); + rowVo.setHidden(dataObject.getHidden() ? SystemYesOrNoChConst.NO_STR : SystemYesOrNoChConst.YES_STR); + rowVo.setCache(dataObject.getCache() ? SystemYesOrNoChConst.YES_STR : SystemYesOrNoChConst.NO_STR); + rowVo.setCreateTime(dataObject.getCreateTime()); + rowVos.add(rowVo); } + KitExcelExporter.exportSimple(response, "菜单数据", SystemMenuExportRowVo.class, rowVos); + } } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemMonitorService.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemMonitorService.java index a58f1636..f7eb1867 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemMonitorService.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemMonitorService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,13 @@ import cn.hutool.core.date.DateUtil; import cn.odboy.constant.SystemConst; import cn.odboy.util.KitFileUtil; import cn.odboy.util.KitIPUtil; +import java.lang.management.ManagementFactory; +import java.text.DecimalFormat; +import java.util.Arrays; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import oshi.SystemInfo; @@ -32,184 +39,177 @@ import oshi.software.os.OSFileStore; import oshi.software.os.OperatingSystem; import oshi.util.FormatUtil; import oshi.util.Util; -import java.lang.management.ManagementFactory; -import java.text.DecimalFormat; -import java.util.Arrays; -import java.util.Date; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; @Slf4j @Service public class SystemMonitorService { - private final DecimalFormat df = new DecimalFormat("0.00"); + private final DecimalFormat df = new DecimalFormat("0.00"); - /** - * 查询服务器监控信息 -> TestPassed - * - * @return Map - */ - public Map getServerMonitorInfo() { - Map resultMap = new LinkedHashMap<>(8); - try { - SystemInfo si = new SystemInfo(); - OperatingSystem os = si.getOperatingSystem(); - HardwareAbstractionLayer hal = si.getHardware(); - // 系统信息 - resultMap.put("sys", getSystemInfo(os)); - // cpu 信息 - resultMap.put("cpu", getCpuInfo(hal.getProcessor())); - // 内存信息 - resultMap.put("memory", getMemoryInfo(hal.getMemory())); - // 交换区信息 - resultMap.put("swap", getSwapInfo(hal.getMemory())); - // 磁盘 - resultMap.put("disk", getDiskInfo(os)); - resultMap.put("time", DateUtil.format(new Date(), "HH:mm:ss")); - } catch (Exception e) { - log.error(e.getMessage(), e); - } - return resultMap; + /** + * 查询服务器监控信息 -> TestPassed + * + * @return Map + */ + public Map getServerMonitorInfo() { + Map resultMap = new LinkedHashMap<>(8); + try { + SystemInfo si = new SystemInfo(); + OperatingSystem os = si.getOperatingSystem(); + HardwareAbstractionLayer hal = si.getHardware(); + // 系统信息 + resultMap.put("sys", getSystemInfo(os)); + // cpu 信息 + resultMap.put("cpu", getCpuInfo(hal.getProcessor())); + // 内存信息 + resultMap.put("memory", getMemoryInfo(hal.getMemory())); + // 交换区信息 + resultMap.put("swap", getSwapInfo(hal.getMemory())); + // 磁盘 + resultMap.put("disk", getDiskInfo(os)); + resultMap.put("time", DateUtil.format(new Date(), "HH:mm:ss")); + } catch (Exception e) { + log.error(e.getMessage(), e); } + return resultMap; + } - /** - * 获取磁盘信息 - * - * @return / - */ - private Map getDiskInfo(OperatingSystem os) { - Map diskInfo = new LinkedHashMap<>(); - FileSystem fileSystem = os.getFileSystem(); - List fsArray = fileSystem.getFileStores(); - String osName = System.getProperty("os.name"); - long available = 0, total = 0; - for (OSFileStore fs : fsArray) { - // windows 需要将所有磁盘分区累加, linux 和 mac 直接累加会出现磁盘重复的问题, 待修复 - if (osName.toLowerCase().startsWith(SystemConst.WIN)) { - available += fs.getUsableSpace(); - total += fs.getTotalSpace(); - } else { - available = fs.getUsableSpace(); - total = fs.getTotalSpace(); - break; - } - } - long used = total - available; - diskInfo.put("total", total > 0 ? KitFileUtil.getSize(total) : "?"); - diskInfo.put("available", KitFileUtil.getSize(available)); - diskInfo.put("used", KitFileUtil.getSize(used)); - if (total != 0) { - diskInfo.put("usageRate", df.format(used / (double)total * 100)); - } else { - diskInfo.put("usageRate", 0); - } - return diskInfo; + /** + * 查询磁盘信息 -> TestPassed + * + * @return / + */ + private Map getDiskInfo(OperatingSystem os) { + Map diskInfo = new LinkedHashMap<>(); + FileSystem fileSystem = os.getFileSystem(); + List fsArray = fileSystem.getFileStores(); + String osName = System.getProperty("os.name"); + long available = 0, total = 0; + for (OSFileStore fs : fsArray) { + // windows 需要将所有磁盘分区累加, linux 和 mac 直接累加会出现磁盘重复的问题, 待修复 + if (osName.toLowerCase().startsWith(SystemConst.WIN)) { + available += fs.getUsableSpace(); + total += fs.getTotalSpace(); + } else { + available = fs.getUsableSpace(); + total = fs.getTotalSpace(); + break; + } } + long used = total - available; + diskInfo.put("total", total > 0 ? KitFileUtil.getSize(total) : "?"); + diskInfo.put("available", KitFileUtil.getSize(available)); + diskInfo.put("used", KitFileUtil.getSize(used)); + if (total != 0) { + diskInfo.put("usageRate", df.format(used / (double) total * 100)); + } else { + diskInfo.put("usageRate", 0); + } + return diskInfo; + } - /** - * 获取交换区信息 - * - * @param memory / - * @return / - */ - private Map getSwapInfo(GlobalMemory memory) { - Map swapInfo = new LinkedHashMap<>(); - VirtualMemory virtualMemory = memory.getVirtualMemory(); - long total = virtualMemory.getSwapTotal(); - long used = virtualMemory.getSwapUsed(); - swapInfo.put("total", FormatUtil.formatBytes(total)); - swapInfo.put("used", FormatUtil.formatBytes(used)); - swapInfo.put("available", FormatUtil.formatBytes(total - used)); - if (used == 0) { - swapInfo.put("usageRate", 0); - } else { - swapInfo.put("usageRate", df.format(used / (double)total * 100)); - } - return swapInfo; + /** + * 查询交换区信息 -> TestPassed + * + * @param memory / + * @return / + */ + private Map getSwapInfo(GlobalMemory memory) { + Map swapInfo = new LinkedHashMap<>(); + VirtualMemory virtualMemory = memory.getVirtualMemory(); + long total = virtualMemory.getSwapTotal(); + long used = virtualMemory.getSwapUsed(); + swapInfo.put("total", FormatUtil.formatBytes(total)); + swapInfo.put("used", FormatUtil.formatBytes(used)); + swapInfo.put("available", FormatUtil.formatBytes(total - used)); + if (used == 0) { + swapInfo.put("usageRate", 0); + } else { + swapInfo.put("usageRate", df.format(used / (double) total * 100)); } + return swapInfo; + } - /** - * 获取内存信息 - * - * @param memory / - * @return / - */ - private Map getMemoryInfo(GlobalMemory memory) { - Map memoryInfo = new LinkedHashMap<>(); - memoryInfo.put("total", FormatUtil.formatBytes(memory.getTotal())); - memoryInfo.put("available", FormatUtil.formatBytes(memory.getAvailable())); - memoryInfo.put("used", FormatUtil.formatBytes(memory.getTotal() - memory.getAvailable())); - memoryInfo.put("usageRate", - df.format((memory.getTotal() - memory.getAvailable()) / (double)memory.getTotal() * 100)); - return memoryInfo; - } + /** + * 查询内存信息 -> TestPassed + * + * @param memory / + * @return / + */ + private Map getMemoryInfo(GlobalMemory memory) { + Map memoryInfo = new LinkedHashMap<>(); + memoryInfo.put("total", FormatUtil.formatBytes(memory.getTotal())); + memoryInfo.put("available", FormatUtil.formatBytes(memory.getAvailable())); + memoryInfo.put("used", FormatUtil.formatBytes(memory.getTotal() - memory.getAvailable())); + memoryInfo.put("usageRate", + df.format((memory.getTotal() - memory.getAvailable()) / (double) memory.getTotal() * 100)); + return memoryInfo; + } - /** - * 获取Cpu相关信息 - * - * @param processor / - * @return / - */ - private Map getCpuInfo(CentralProcessor processor) { - Map cpuInfo = new LinkedHashMap<>(); - cpuInfo.put("name", processor.getProcessorIdentifier().getName()); - cpuInfo.put("package", processor.getPhysicalPackageCount() + "个物理CPU"); - cpuInfo.put("core", processor.getPhysicalProcessorCount() + "个物理核心"); - cpuInfo.put("coreNumber", processor.getPhysicalProcessorCount()); - cpuInfo.put("logic", processor.getLogicalProcessorCount() + "个逻辑CPU"); - // CPU信息 - long[] prevTicks = processor.getSystemCpuLoadTicks(); - // 默认等待300毫秒... - long time = 300; - Util.sleep(time); - long[] ticks = processor.getSystemCpuLoadTicks(); - long minCpuLoadTick = 1000; - while (Arrays.toString(prevTicks).equals(Arrays.toString(ticks)) && time < minCpuLoadTick) { - time += 25; - Util.sleep(25); - ticks = processor.getSystemCpuLoadTicks(); - } - long user = - ticks[CentralProcessor.TickType.USER.getIndex()] - prevTicks[CentralProcessor.TickType.USER.getIndex()]; - long nice = - ticks[CentralProcessor.TickType.NICE.getIndex()] - prevTicks[CentralProcessor.TickType.NICE.getIndex()]; - long sys = - ticks[CentralProcessor.TickType.SYSTEM.getIndex()] - prevTicks[CentralProcessor.TickType.SYSTEM.getIndex()]; - long idle = - ticks[CentralProcessor.TickType.IDLE.getIndex()] - prevTicks[CentralProcessor.TickType.IDLE.getIndex()]; - long ioWait = - ticks[CentralProcessor.TickType.IOWAIT.getIndex()] - prevTicks[CentralProcessor.TickType.IOWAIT.getIndex()]; - long irq = - ticks[CentralProcessor.TickType.IRQ.getIndex()] - prevTicks[CentralProcessor.TickType.IRQ.getIndex()]; - long softIrq = - ticks[CentralProcessor.TickType.SOFTIRQ.getIndex()] - prevTicks[CentralProcessor.TickType.SOFTIRQ.getIndex()]; - long steal = - ticks[CentralProcessor.TickType.STEAL.getIndex()] - prevTicks[CentralProcessor.TickType.STEAL.getIndex()]; - long totalCpu = user + nice + sys + idle + ioWait + irq + softIrq + steal; - cpuInfo.put("used", df.format(100d * user / totalCpu + 100d * sys / totalCpu)); - cpuInfo.put("idle", df.format(100d * idle / totalCpu)); - return cpuInfo; + /** + * 查询Cpu相关信息 -> TestPassed + * + * @param processor / + * @return / + */ + private Map getCpuInfo(CentralProcessor processor) { + Map cpuInfo = new LinkedHashMap<>(); + cpuInfo.put("name", processor.getProcessorIdentifier().getName()); + cpuInfo.put("package", processor.getPhysicalPackageCount() + "个物理CPU"); + cpuInfo.put("core", processor.getPhysicalProcessorCount() + "个物理核心"); + cpuInfo.put("coreNumber", processor.getPhysicalProcessorCount()); + cpuInfo.put("logic", processor.getLogicalProcessorCount() + "个逻辑CPU"); + // CPU信息 + long[] prevTicks = processor.getSystemCpuLoadTicks(); + // 默认等待300毫秒... + long time = 300; + Util.sleep(time); + long[] ticks = processor.getSystemCpuLoadTicks(); + long minCpuLoadTick = 1000; + while (Arrays.toString(prevTicks).equals(Arrays.toString(ticks)) && time < minCpuLoadTick) { + time += 25; + Util.sleep(25); + ticks = processor.getSystemCpuLoadTicks(); } + long user = + ticks[CentralProcessor.TickType.USER.getIndex()] - prevTicks[CentralProcessor.TickType.USER.getIndex()]; + long nice = + ticks[CentralProcessor.TickType.NICE.getIndex()] - prevTicks[CentralProcessor.TickType.NICE.getIndex()]; + long sys = + ticks[CentralProcessor.TickType.SYSTEM.getIndex()] - prevTicks[CentralProcessor.TickType.SYSTEM.getIndex()]; + long idle = + ticks[CentralProcessor.TickType.IDLE.getIndex()] - prevTicks[CentralProcessor.TickType.IDLE.getIndex()]; + long ioWait = + ticks[CentralProcessor.TickType.IOWAIT.getIndex()] - prevTicks[CentralProcessor.TickType.IOWAIT.getIndex()]; + long irq = + ticks[CentralProcessor.TickType.IRQ.getIndex()] - prevTicks[CentralProcessor.TickType.IRQ.getIndex()]; + long softIrq = + ticks[CentralProcessor.TickType.SOFTIRQ.getIndex()] - prevTicks[CentralProcessor.TickType.SOFTIRQ.getIndex()]; + long steal = + ticks[CentralProcessor.TickType.STEAL.getIndex()] - prevTicks[CentralProcessor.TickType.STEAL.getIndex()]; + long totalCpu = user + nice + sys + idle + ioWait + irq + softIrq + steal; + cpuInfo.put("used", df.format(100d * user / totalCpu + 100d * sys / totalCpu)); + cpuInfo.put("idle", df.format(100d * idle / totalCpu)); + return cpuInfo; + } - /** - * 获取系统相关信息,系统、运行天数、系统IP - * - * @param os / - * @return / - */ - private Map getSystemInfo(OperatingSystem os) { - Map systemInfo = new LinkedHashMap<>(); - // jvm 运行时间 - long time = ManagementFactory.getRuntimeMXBean().getStartTime(); - Date date = new Date(time); - // 计算项目运行时间 - String formatBetween = DateUtil.formatBetween(date, new Date(), Level.HOUR); - // 系统信息 - systemInfo.put("os", os.toString()); - systemInfo.put("day", formatBetween); - systemInfo.put("ip", KitIPUtil.getLocalIp()); - return systemInfo; - } + /** + * 查询系统相关信息,系统、运行天数、系统IP -> TestPassed + * + * @param os / + * @return / + */ + private Map getSystemInfo(OperatingSystem os) { + Map systemInfo = new LinkedHashMap<>(); + // jvm 运行时间 + long time = ManagementFactory.getRuntimeMXBean().getStartTime(); + Date date = new Date(time); + // 计算项目运行时间 + String formatBetween = DateUtil.formatBetween(date, new Date(), Level.HOUR); + // 系统信息 + systemInfo.put("os", os.toString()); + systemInfo.put("day", formatBetween); + systemInfo.put("ip", KitIPUtil.getLocalIp()); + return systemInfo; + } } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemOperationLogService.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemOperationLogService.java index 337cdf16..a76e9cf9 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemOperationLogService.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemOperationLogService.java @@ -1,3 +1,18 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.service; import cn.odboy.base.KitPageArgs; @@ -14,16 +29,16 @@ import org.springframework.stereotype.Service; @Service public class SystemOperationLogService { - @Autowired - private SystemOperationLogMapper systemOperationLogMapper; + @Autowired + private SystemOperationLogMapper systemOperationLogMapper; - /** - * 查询用户操作日志 - */ - public IPage searchUserLog(KitPageArgs pageArgs) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemOperationLogTb::getUsername, KitSecurityHelper.getCurrentUsername()); - Page page = new Page<>(pageArgs.getPage(), pageArgs.getSize()); - return systemOperationLogMapper.selectPage(page, wrapper); - } + /** + * 查询用户操作日志 -> TestPassed + */ + public IPage searchUserLog(KitPageArgs pageArgs) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemOperationLogTb::getUsername, KitSecurityHelper.getCurrentUsername()); + Page page = new Page<>(pageArgs.getPage(), pageArgs.getSize()); + return systemOperationLogMapper.selectPage(page, wrapper); + } } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemOssStorageService.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemOssStorageService.java index 5234b0a6..377c5224 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemOssStorageService.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemOssStorageService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,9 +21,9 @@ import cn.odboy.system.dal.model.request.SystemQueryStorageArgs; import cn.odboy.system.dal.model.response.SystemOssStorageVo; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; -import org.springframework.web.multipart.MultipartFile; -import javax.servlet.http.HttpServletResponse; import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.web.multipart.MultipartFile; /** *

@@ -35,13 +35,13 @@ import java.util.List; */ public interface SystemOssStorageService extends IService { - KitPageResult searchOssStorage(SystemQueryStorageArgs args, Page page); + KitPageResult searchOssStorage(SystemQueryStorageArgs args, Page page); - List queryOssStorage(SystemQueryStorageArgs args); + List queryOssStorage(SystemQueryStorageArgs args); - String uploadFile(MultipartFile file); + String uploadFile(MultipartFile file); - void deleteFileByIds(Long[] ids); + void deleteFileByIds(Long[] ids); - void exportOssStorageXlsx(HttpServletResponse response, SystemQueryStorageArgs args); + void exportOssStorageXlsx(HttpServletResponse response, SystemQueryStorageArgs args); } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemQuartzJobService.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemQuartzJobService.java index fb2de69b..44b2e8c2 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemQuartzJobService.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemQuartzJobService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,287 +34,294 @@ import cn.odboy.system.dal.mysql.SystemQuartzLogMapper; import cn.odboy.system.framework.quartz.QuartzManage; import cn.odboy.util.KitBeanUtil; import cn.odboy.util.KitPageUtil; -import cn.odboy.util.KitValidUtil; import cn.odboy.util.xlsx.KitExcelExporter; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.quartz.CronExpression; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Set; +import javax.servlet.http.HttpServletResponse; +import org.quartz.CronExpression; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; @Service public class SystemQuartzJobService { - @Autowired - private SystemQuartzJobMapper systemQuartzJobMapper; - @Autowired - private SystemQuartzLogMapper systemQuartzLogMapper; - @Autowired - private QuartzManage quartzManage; - @Autowired - private KitRedisHelper redisHelper; + @Autowired + private SystemQuartzJobMapper systemQuartzJobMapper; + @Autowired + private SystemQuartzLogMapper systemQuartzLogMapper; + @Autowired + private QuartzManage quartzManage; + @Autowired + private KitRedisHelper redisHelper; - /** - * 验证Bean是不是合法的, 合法的定时任务 Bean 需要用 @Service 定义 - * - * @param beanName Bean名称 - */ - private void checkBean(String beanName) { - // 避免调用攻击者可以从SpringContextHolder获得控制jdbcTemplate类 - // 并使用getDeclaredMethod调用jdbcTemplate的queryForMap函数,执行任意sql命令。 - if (!KitSpringBeanHolder.getAllServiceBeanName().contains(beanName)) { - throw new BadRequestException("非法的 Bean,请重新输入!"); - } + /** + * 验证Bean是不是合法的, 合法的定时任务 Bean 需要用 @Service 定义 + * + * @param beanName Bean名称 + */ + private void checkBean(String beanName) { + // 避免调用攻击者可以从SpringContextHolder获得控制jdbcTemplate类 + // 并使用getDeclaredMethod调用jdbcTemplate的queryForMap函数,执行任意sql命令。 + if (!KitSpringBeanHolder.getAllServiceBeanName().contains(beanName)) { + throw new BadRequestException("非法的 Bean,请重新输入!"); } + } - /** - * 创建 - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void createJob(SystemQuartzJobVo args) { - if (args.getId() != null) { - throw new BadRequestException("无效参数id"); - } - // 验证Bean是不是合法的, 合法的定时任务 Bean 需要用 @Service 定义 - checkBean(args.getBeanName()); - if (!CronExpression.isValidExpression(args.getCronExpression())) { - throw new BadRequestException("cron表达式格式错误"); - } - SystemQuartzJobTb record = KitBeanUtil.copyToClass(args, SystemQuartzJobTb.class); - systemQuartzJobMapper.insert(record); - quartzManage.addJob(args); + /** + * 创建 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void createJob(SystemQuartzJobTb args) { + if (args.getId() != null) { + throw new BadRequestException("无效参数id"); } + // 验证Bean是不是合法的, 合法的定时任务 Bean 需要用 @Service 定义 + checkBean(args.getBeanName()); + if (!CronExpression.isValidExpression(args.getCronExpression())) { + throw new BadRequestException("cron表达式格式错误"); + } + systemQuartzJobMapper.insert(args); + SystemQuartzJobVo quartzJobVo = KitBeanUtil.copyToClass(args, SystemQuartzJobVo.class); + quartzManage.addJob(quartzJobVo); + } - /** - * 修改任务并重新调度 - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void updateQuartzJobResumeCron(SystemUpdateQuartzJobArgs args) { - // 验证Bean是不是合法的, 合法的定时任务 Bean 需要用 @Service 定义 - checkBean(args.getBeanName()); - if (!CronExpression.isValidExpression(args.getCronExpression())) { - throw new BadRequestException("cron表达式格式错误"); - } - if (StrUtil.isNotBlank(args.getSubTask())) { - List tasks = Arrays.asList(args.getSubTask().split("[,,]")); - if (tasks.contains(args.getId().toString())) { - throw new BadRequestException("子任务中不能添加当前任务ID"); - } - } - SystemQuartzJobTb jobTb = KitBeanUtil.copyToClass(args, SystemQuartzJobTb.class); - systemQuartzJobMapper.insertOrUpdate(jobTb); - SystemQuartzJobVo jobVo = KitBeanUtil.copyToClass(args, SystemQuartzJobVo.class); - quartzManage.updateJobCron(jobVo); + /** + * 修改任务并重新调度 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void updateQuartzJobResumeCron(SystemUpdateQuartzJobArgs args) { + // 验证Bean是不是合法的, 合法的定时任务 Bean 需要用 @Service 定义 + checkBean(args.getBeanName()); + if (!CronExpression.isValidExpression(args.getCronExpression())) { + throw new BadRequestException("cron表达式格式错误"); } + if (StrUtil.isNotBlank(args.getSubTask())) { + List tasks = Arrays.asList(args.getSubTask().split("[,,]")); + if (tasks.contains(args.getId().toString())) { + throw new BadRequestException("子任务中不能添加当前任务ID"); + } + } + SystemQuartzJobTb jobTb = KitBeanUtil.copyToClass(args, SystemQuartzJobTb.class); + systemQuartzJobMapper.updateById(jobTb); + quartzManage.updateJobCron(jobTb); + } - /** - * 更改定时任务状态 - * - * @param quartzJob / - */ - @Transactional(rollbackFor = Exception.class) - public void switchQuartzJobStatus(SystemQuartzJobVo quartzJob) { - // 置换暂停状态 - if (quartzJob.getIsPause()) { - quartzManage.resumeJob(quartzJob); - quartzJob.setIsPause(false); - } else { - quartzManage.pauseJob(quartzJob); - quartzJob.setIsPause(true); - } - SystemQuartzJobTb quartzJobTb = KitBeanUtil.copyToClass(quartzJob, SystemQuartzJobTb.class); - systemQuartzJobMapper.insertOrUpdate(quartzJobTb); + /** + * 更改定时任务状态 -> TestPassed + * + * @param quartzJobVo / + */ + @Transactional(rollbackFor = Exception.class) + public void switchQuartzJobStatus(SystemQuartzJobVo quartzJobVo) { + // 置换暂停状态 + if (quartzJobVo.getIsPause()) { + quartzManage.resumeJob(quartzJobVo); + quartzJobVo.setIsPause(false); + } else { + quartzManage.pauseJob(quartzJobVo); + quartzJobVo.setIsPause(true); } + SystemQuartzJobTb record = KitBeanUtil.copyToClass(quartzJobVo, SystemQuartzJobTb.class); + systemQuartzJobMapper.updateById(record); + } - /** - * 立即执行定时任务 - * - * @param quartzJob / - */ - public void startQuartzJob(SystemQuartzJobVo quartzJob) { - quartzManage.runJobNow(quartzJob); - } + /** + * 立即执行定时任务 -> TestPassed + * + * @param quartzJob / + */ + public void startQuartzJob(SystemQuartzJobVo quartzJob) { + quartzManage.runJobNow(quartzJob); + } - /** - * 删除任务 - * - * @param ids / - */ - @Transactional(rollbackFor = Exception.class) - public void deleteJobByIds(Set ids) { - for (Long id : ids) { - SystemQuartzJobTb quartzJob = systemQuartzJobMapper.selectById(id); - quartzManage.deleteJob(quartzJob); - systemQuartzJobMapper.deleteById(quartzJob); - } + /** + * 删除任务 -> TestPassed + * + * @param ids / + */ + @Transactional(rollbackFor = Exception.class) + public void deleteJobByIds(Set ids) { + for (Long id : ids) { + SystemQuartzJobTb quartzJob = systemQuartzJobMapper.selectById(id); + quartzManage.deleteJob(quartzJob); + systemQuartzJobMapper.deleteById(quartzJob); } + } - /** - * 执行子任务 - * - * @param tasks / - * @throws InterruptedException / - */ - @Transactional(rollbackFor = Exception.class) - public void startSubQuartJob(String[] tasks) throws InterruptedException { - for (String id : tasks) { - if (StrUtil.isBlank(id)) { - // 如果是手动清除子任务id, 会出现id为空字符串的问题 - continue; - } - SystemQuartzJobVo quartzJob = systemQuartzJobMapper.selectVoById(id); - if (quartzJob == null) { - // 防止子任务不存在 - continue; - } - // 执行任务 - String uuid = IdUtil.simpleUUID(); - quartzJob.setUuid(uuid); - // 执行任务 - startQuartzJob(quartzJob); - // 获取执行状态, 如果执行失败则停止后面的子任务执行 - Boolean result = redisHelper.get(uuid, Boolean.class); - while (result == null) { - // 休眠5秒, 再次获取子任务执行情况 - Thread.sleep(5000); - result = redisHelper.get(uuid, Boolean.class); - } - if (!result) { - redisHelper.del(uuid); - break; - } - } + /** + * 执行子任务 -> TestPassed + * + * @param tasks / + * @throws InterruptedException / + */ + @Transactional(rollbackFor = Exception.class) + public void startSubQuartJob(String[] tasks) throws InterruptedException { + for (String id : tasks) { + if (StrUtil.isBlank(id)) { + // 如果是手动清除子任务id, 会出现id为空字符串的问题 + continue; + } + SystemQuartzJobTb quartzJobTb = systemQuartzJobMapper.selectById(id); + if (quartzJobTb == null) { + // 防止子任务不存在 + continue; + } + SystemQuartzJobVo quartzJobVo = KitBeanUtil.copyToClass(quartzJobTb, SystemQuartzJobVo.class); + // 执行任务 + String uuid = IdUtil.simpleUUID(); + quartzJobVo.setUuid(uuid); + startQuartzJob(quartzJobVo); + // 查询执行状态, 如果执行失败则停止后面的子任务执行 + Boolean result = redisHelper.get(uuid, Boolean.class); + while (result == null) { + // 休眠5秒, 再次查询子任务执行情况 + Thread.sleep(5000); + result = redisHelper.get(uuid, Boolean.class); + } + if (!result) { + redisHelper.del(uuid); + break; + } } + } - /** - * 分页查询 - * - * @param args 条件 - * @param page 分页参数 - * @return / - */ - public KitPageResult searchQuartzJobByArgs(SystemQueryQuartzJobArgs args, - Page page) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - this.injectQuartzJobQueryParams(args, wrapper); - return KitPageUtil.toPage(systemQuartzJobMapper.selectPage(page, wrapper)); - } + /** + * 分页查询 -> TestPassed + * + * @param args 条件 + * @param page 分页参数 + * @return / + */ + public KitPageResult searchQuartzJobByArgs(SystemQueryQuartzJobArgs args, Page page) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + this.injectQuartzJobQueryParams(args, wrapper); + return KitPageUtil.toPage(systemQuartzJobMapper.selectPage(page, wrapper)); + } - private void injectQuartzJobQueryParams(SystemQueryQuartzJobArgs args, - LambdaQueryWrapper wrapper) { - KitValidUtil.notNull(args); - wrapper.like(StrUtil.isNotBlank(args.getJobName()), SystemQuartzJobTb::getJobName, args.getJobName()); - if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { - wrapper.between(SystemQuartzJobTb::getUpdateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); - } - wrapper.orderByDesc(SystemQuartzJobTb::getId); + private void injectQuartzJobQueryParams(SystemQueryQuartzJobArgs args, LambdaQueryWrapper wrapper) { + if (args != null) { + wrapper.like(StrUtil.isNotBlank(args.getJobName()), SystemQuartzJobTb::getJobName, args.getJobName()); + if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { + wrapper.between(SystemQuartzJobTb::getUpdateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); + } } + wrapper.orderByDesc(SystemQuartzJobTb::getId); + } - private void injectQuartzLogQueryParams(SystemQueryQuartzJobArgs args, - LambdaQueryWrapper wrapper) { - if (args != null) { - wrapper.like(StrUtil.isNotBlank(args.getJobName()), SystemQuartzLogTb::getJobName, args.getJobName()); - wrapper.eq(args.getIsSuccess() != null, SystemQuartzLogTb::getIsSuccess, args.getIsSuccess()); - if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { - wrapper.between(SystemQuartzLogTb::getCreateTime, args.getCreateTime().get(0), - args.getCreateTime().get(1)); - } - } - wrapper.orderByDesc(SystemQuartzLogTb::getId); + private void injectQuartzLogQueryParams(SystemQueryQuartzJobArgs args, LambdaQueryWrapper wrapper) { + if (args != null) { + wrapper.like(StrUtil.isNotBlank(args.getJobName()), SystemQuartzLogTb::getJobName, args.getJobName()); + wrapper.eq(args.getIsSuccess() != null, SystemQuartzLogTb::getIsSuccess, args.getIsSuccess()); + if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { + wrapper.between(SystemQuartzLogTb::getCreateTime, args.getCreateTime().get(0), + args.getCreateTime().get(1)); + } } + wrapper.orderByDesc(SystemQuartzLogTb::getId); + } - /** - * 分页查询日志 - * - * @param args 条件 - * @param page 分页参数 - * @return / - */ - public KitPageResult searchQuartzLogByArgs(SystemQueryQuartzJobArgs args, - Page page) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - this.injectQuartzLogQueryParams(args, wrapper); - return KitPageUtil.toPage(systemQuartzLogMapper.selectPage(page, wrapper)); - } + /** + * 分页查询日志 -> TestPassed + * + * @param args 条件 + * @param page 分页参数 + * @return / + */ + public KitPageResult searchQuartzLogByArgs(SystemQueryQuartzJobArgs args, Page page) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + this.injectQuartzLogQueryParams(args, wrapper); + return KitPageUtil.toPage(systemQuartzLogMapper.selectPage(page, wrapper)); + } - /** - * 查询全部 - * - * @param args 条件 - * @return / - */ - public List queryQuartzJobByArgs(SystemQueryQuartzJobArgs args) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - this.injectQuartzJobQueryParams(args, wrapper); - return systemQuartzJobMapper.selectList(wrapper); - } + /** + * 查询全部 -> TestPassed + * + * @param args 条件 + * @return / + */ + public List queryQuartzJobByArgs(SystemQueryQuartzJobArgs args) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + this.injectQuartzJobQueryParams(args, wrapper); + return systemQuartzJobMapper.selectList(wrapper); + } - /** - * 查询全部 - * - * @param args 条件 - * @return / - */ - public List queryQuartzLogByArgs(SystemQueryQuartzJobArgs args) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - this.injectQuartzLogQueryParams(args, wrapper); - return systemQuartzLogMapper.selectList(wrapper); - } + /** + * 查询全部 -> TestPassed + * + * @param args 条件 + * @return / + */ + public List queryQuartzLogByArgs(SystemQueryQuartzJobArgs args) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + this.injectQuartzLogQueryParams(args, wrapper); + return systemQuartzLogMapper.selectList(wrapper); + } - public SystemQuartzJobVo getQuartzJobById(Long id) { - return KitBeanUtil.copyToClass(systemQuartzJobMapper.selectById(id), SystemQuartzJobVo.class); - } + /** + * 查询启用的定时任务 -> TestPassed + */ + public List listEnableQuartzJob() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemQuartzJobTb::getIsPause, 0); + return systemQuartzJobMapper.selectList(wrapper); + } - public List listEnableQuartzJob() { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemQuartzJobTb::getIsPause, 0); - return KitBeanUtil.copyToList(systemQuartzJobMapper.selectList(wrapper), SystemQuartzJobVo.class); + /** + * 导出定时任务数据 -> TestPassed + */ + public void exportQuartzJobXlsx(HttpServletResponse response, SystemQueryQuartzJobArgs args) { + List systemQuartzJobTbs = this.queryQuartzJobByArgs(args); + List rowVos = new ArrayList<>(); + for (SystemQuartzJobTb dataObject : systemQuartzJobTbs) { + SystemQuartzJobExportRowVo rowVo = new SystemQuartzJobExportRowVo(); + rowVo.setJobName(dataObject.getJobName()); + rowVo.setBeanName(dataObject.getBeanName()); + rowVo.setMethodName(dataObject.getMethodName()); + rowVo.setParams(dataObject.getParams()); + rowVo.setCronExpression(dataObject.getCronExpression()); + rowVo.setIsPause(dataObject.getIsPause() ? "暂停中" : "运行中"); + rowVo.setDescription(dataObject.getDescription()); + rowVo.setCreateTime(dataObject.getCreateTime()); + rowVos.add(rowVo); } + KitExcelExporter.exportSimple(response, "定时任务数据", SystemQuartzJobExportRowVo.class, rowVos); + } - public void exportQuartzJobXlsx(HttpServletResponse response, SystemQueryQuartzJobArgs args) { - List systemQuartzJobTbs = this.queryQuartzJobByArgs(args); - List rowVos = new ArrayList<>(); - for (SystemQuartzJobTb dataObject : systemQuartzJobTbs) { - SystemQuartzJobExportRowVo rowVo = new SystemQuartzJobExportRowVo(); - rowVo.setJobName(dataObject.getJobName()); - rowVo.setBeanName(dataObject.getBeanName()); - rowVo.setMethodName(dataObject.getMethodName()); - rowVo.setParams(dataObject.getParams()); - rowVo.setCronExpression(dataObject.getCronExpression()); - rowVo.setIsPause(dataObject.getIsPause() ? "暂停中" : "运行中"); - rowVo.setDescription(dataObject.getDescription()); - rowVo.setCreateTime(dataObject.getCreateTime()); - rowVos.add(rowVo); - } - KitExcelExporter.exportSimple(response, "定时任务数据", SystemQuartzJobExportRowVo.class, rowVos); + /** + * 导出定时任务日志数据 -> TestPassed + */ + public void exportQuartzLogXlsx(HttpServletResponse response, SystemQueryQuartzJobArgs args) { + List systemQuartzLogTbs = this.queryQuartzLogByArgs(args); + List rowVos = new ArrayList<>(); + for (SystemQuartzLogTb dataObject : systemQuartzLogTbs) { + SystemQuartzLogExportRowVo rowVo = new SystemQuartzLogExportRowVo(); + rowVo.setJobName(dataObject.getJobName()); + rowVo.setBeanName(dataObject.getBeanName()); + rowVo.setMethodName(dataObject.getMethodName()); + rowVo.setParams(dataObject.getParams()); + rowVo.setCronExpression(dataObject.getCronExpression()); + rowVo.setExceptionDetail(dataObject.getExceptionDetail()); + rowVo.setTime(dataObject.getTime()); + rowVo.setStatus(dataObject.getIsSuccess() ? "成功" : "失败"); + rowVo.setCreateTime(dataObject.getCreateTime()); + rowVos.add(rowVo); } + KitExcelExporter.exportSimple(response, "定时任务日志数据", SystemQuartzLogExportRowVo.class, rowVos); + } - public void exportQuartzLogXlsx(HttpServletResponse response, SystemQueryQuartzJobArgs args) { - List systemQuartzLogTbs = this.queryQuartzLogByArgs(args); - List rowVos = new ArrayList<>(); - for (SystemQuartzLogTb dataObject : systemQuartzLogTbs) { - SystemQuartzLogExportRowVo rowVo = new SystemQuartzLogExportRowVo(); - rowVo.setJobName(dataObject.getJobName()); - rowVo.setBeanName(dataObject.getBeanName()); - rowVo.setMethodName(dataObject.getMethodName()); - rowVo.setParams(dataObject.getParams()); - rowVo.setCronExpression(dataObject.getCronExpression()); - rowVo.setExceptionDetail(dataObject.getExceptionDetail()); - rowVo.setTime(dataObject.getTime()); - rowVo.setStatus(dataObject.getIsSuccess() ? "成功" : "失败"); - rowVo.setCreateTime(dataObject.getCreateTime()); - rowVos.add(rowVo); - } - KitExcelExporter.exportSimple(response, "定时任务日志数据", SystemQuartzLogExportRowVo.class, rowVos); - } + /** + * 根据任务id查询定时任务 -> TestPassed + */ + public SystemQuartzJobTb getQuartzJobById(Long id) { + return systemQuartzJobMapper.selectById(id); + } } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemRoleDeptService.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemRoleDeptService.java index 316ccbc5..d49b4493 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemRoleDeptService.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemRoleDeptService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,65 +20,75 @@ import cn.odboy.system.dal.dataobject.SystemDeptTb; import cn.odboy.system.dal.dataobject.SystemRoleDeptTb; import cn.odboy.system.dal.mysql.SystemRoleDeptMapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.List; import java.util.Set; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; @Service public class SystemRoleDeptService { - @Autowired - private SystemRoleDeptMapper systemRoleDeptMapper; + @Autowired + private SystemRoleDeptMapper systemRoleDeptMapper; - @Transactional(rollbackFor = Exception.class) - public void batchDeleteRoleDept(Set roleIds) { - if (CollUtil.isNotEmpty(roleIds)) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(SystemRoleDeptTb::getRoleId, roleIds); - systemRoleDeptMapper.delete(wrapper); - } + /** + * 批量删除角色部门关联 -> TestPassed + * + * @param roleIds 角色id集合 + */ + @Transactional(rollbackFor = Exception.class) + public void batchDeleteRoleDept(Set roleIds) { + if (CollUtil.isNotEmpty(roleIds)) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(SystemRoleDeptTb::getRoleId, roleIds); + systemRoleDeptMapper.delete(wrapper); } + } - @Transactional(rollbackFor = Exception.class) - public void batchInsertRoleDept(Set depts, Long id) { - if (CollUtil.isNotEmpty(depts)) { - List records = new ArrayList<>(); - for (SystemDeptTb dept : depts) { - SystemRoleDeptTb record = new SystemRoleDeptTb(); - record.setRoleId(id); - record.setDeptId(dept.getId()); - records.add(record); - } - systemRoleDeptMapper.insert(records); - } + /** + * 批量绑定角色部门关联 -> TestPassed + * + * @param depts 部门集合 + * @param roleId 角色id + */ + @Transactional(rollbackFor = Exception.class) + public void batchInsertRoleDept(Set depts, Long roleId) { + if (CollUtil.isNotEmpty(depts)) { + List records = new ArrayList<>(); + for (SystemDeptTb dept : depts) { + SystemRoleDeptTb record = new SystemRoleDeptTb(); + record.setRoleId(roleId); + record.setDeptId(dept.getId()); + records.add(record); + } + systemRoleDeptMapper.insert(records); } + } - /** - * 根据部门ID统计角色数量 - * - * @param deptIds 部门ID集合 - * @return / - */ - public Long countRoleByDeptIds(Set deptIds) { - if (CollUtil.isEmpty(deptIds)) { - return 0L; - } - - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(SystemRoleDeptTb::getDeptId, deptIds); - return systemRoleDeptMapper.selectCount(wrapper); + /** + * 根据部门ID统计角色数量 -> TestPassed + * + * @param deptIds 部门id集合 + * @return / + */ + public Long countRoleByDeptIds(Set deptIds) { + if (CollUtil.isEmpty(deptIds)) { + return 0L; } + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(SystemRoleDeptTb::getDeptId, deptIds); + return systemRoleDeptMapper.selectCount(wrapper); + } - /** - * 根据角色id查询部门信息 - * - * @param roleId 角色id - * @return / - */ - public Set listUserDeptByRoleId(Long roleId) { - return systemRoleDeptMapper.listUserDeptByRoleId(roleId); - } + /** + * 根据角色id查询部门信息 -> TestPassed + * + * @param roleId 角色id + * @return / + */ + public Set listUserDeptByRoleId(Long roleId) { + return systemRoleDeptMapper.listUserDeptByRoleId(roleId); + } } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemRoleMenuService.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemRoleMenuService.java index c86ef87b..c5624ca7 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemRoleMenuService.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemRoleMenuService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,18 +16,15 @@ package cn.odboy.system.service; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; import cn.odboy.system.dal.dataobject.SystemMenuTb; import cn.odboy.system.dal.dataobject.SystemRoleMenuTb; -import cn.odboy.system.dal.model.response.SystemMenuVo; -import cn.odboy.system.dal.mysql.SystemMenuMapper; import cn.odboy.system.dal.mysql.SystemRoleMenuMapper; -import cn.odboy.util.KitBeanUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; -import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import java.util.stream.Collectors; @@ -35,70 +32,105 @@ import java.util.stream.Collectors; @Service public class SystemRoleMenuService { - @Autowired - private SystemRoleMenuMapper systemRoleMenuMapper; - @Autowired - private SystemMenuMapper systemMenuMapper; + @Autowired + private SystemRoleMenuMapper systemRoleMenuMapper; - @Transactional(rollbackFor = Exception.class) - public void deleteRoleMenuByRoleId(Long roleId) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemRoleMenuTb::getRoleId, roleId); - systemRoleMenuMapper.delete(wrapper); + /** + * 删除角色菜单关联 -> TestPassed + * + * @param roleId 角色id + */ + @Transactional(rollbackFor = Exception.class) + public void deleteRoleMenuByRoleId(Long roleId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemRoleMenuTb::getRoleId, roleId); + systemRoleMenuMapper.delete(wrapper); + } + + /** + * 批量绑定角色菜单关联 -> TestPassed + * + * @param menus 菜单集合 + * @param roleId 角色id + */ + @Transactional(rollbackFor = Exception.class) + public void batchInsertRoleMenu(Set menus, Long roleId) { + if (CollUtil.isNotEmpty(menus)) { + List records = new ArrayList<>(); + for (SystemMenuTb menu : menus) { + SystemRoleMenuTb record = new SystemRoleMenuTb(); + record.setMenuId(menu.getId()); + record.setRoleId(roleId); + records.add(record); + } + systemRoleMenuMapper.insert(records); } + } - @Transactional(rollbackFor = Exception.class) - public void batchInsertRoleMenu(Set menus, Long roleId) { - if (CollUtil.isNotEmpty(menus)) { - List records = new ArrayList<>(); - for (SystemMenuVo menu : menus) { - SystemRoleMenuTb record = new SystemRoleMenuTb(); - record.setMenuId(menu.getId()); - record.setRoleId(roleId); - records.add(record); - } - systemRoleMenuMapper.insert(records); - } + /** + * 批量删除角色菜单关联 -> TestPassed + * + * @param roleIds 角色id集合 + */ + @Transactional(rollbackFor = Exception.class) + public void batchDeleteRoleMenu(Set roleIds) { + if (CollUtil.isNotEmpty(roleIds)) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(SystemRoleMenuTb::getRoleId, roleIds); + systemRoleMenuMapper.delete(wrapper); } + } - @Transactional(rollbackFor = Exception.class) - public void batchDeleteRoleMenu(Set roleIds) { - if (CollUtil.isNotEmpty(roleIds)) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(SystemRoleMenuTb::getRoleId, roleIds); - systemRoleMenuMapper.delete(wrapper); - } + /** + * @param roleIds 角色id集合 -> TestPassed + * @return / + */ + public List listMenuByRoleIds(Set roleIds, boolean hasButton) { + if (CollUtil.isEmpty(roleIds)) { + return new ArrayList<>(); } - - public LinkedHashSet queryMenuByRoleIds(Set roleIds) { - if (CollUtil.isEmpty(roleIds)) { - return new LinkedHashSet<>(); - } - LambdaQueryWrapper roleMenuWrapper = new LambdaQueryWrapper<>(); - roleMenuWrapper.in(SystemRoleMenuTb::getRoleId, roleIds); - List menuIds = systemRoleMenuMapper.selectList(roleMenuWrapper).stream().map(SystemRoleMenuTb::getMenuId) - .collect(Collectors.toList()); - if (CollUtil.isEmpty(menuIds)) { - return new LinkedHashSet<>(); - } - LambdaQueryWrapper menuWrapper = new LambdaQueryWrapper<>(); - menuWrapper.in(SystemMenuTb::getId, menuIds); - // 排除"按钮" - menuWrapper.ne(SystemMenuTb::getType, 2); - menuWrapper.orderByAsc(SystemMenuTb::getMenuSort); - - List systemMenuTbs = systemMenuMapper.selectList(menuWrapper); - List systemMenuVos = KitBeanUtil.copyToList(systemMenuTbs, SystemMenuVo.class); - return new LinkedHashSet<>(systemMenuVos); +// LambdaQueryWrapper roleMenuWrapper = new LambdaQueryWrapper<>(); +// roleMenuWrapper.in(SystemRoleMenuTb::getRoleId, roleIds); +// List menuIds = systemRoleMenuMapper.selectList(roleMenuWrapper).stream().map(SystemRoleMenuTb::getMenuId) +// .collect(Collectors.toList()); +// if (CollUtil.isEmpty(menuIds)) { +// return new ArrayList<>(); +// } +// LambdaQueryWrapper menuWrapper = new LambdaQueryWrapper<>(); +// menuWrapper.in(SystemMenuTb::getId, menuIds); +// // 排除"按钮" +// menuWrapper.ne(SystemMenuTb::getType, 2); +// menuWrapper.orderByAsc(SystemMenuTb::getMenuSort); +// return systemMenuMapper.selectList(menuWrapper); + if (hasButton){ + return systemRoleMenuMapper.listMenuWithRoleIds(roleIds); } + return systemRoleMenuMapper.listMenuWithRoleIdsNeButton(roleIds); + } - @Transactional(rollbackFor = Exception.class) - public void deleteRoleMenuByMenuIds(List menuIds) { - if (CollUtil.isEmpty(menuIds)) { - return; - } - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(SystemRoleMenuTb::getMenuId, menuIds); - systemRoleMenuMapper.delete(wrapper); + /** + * 批量删除菜单角色关联 -> TestPassed + * + * @param menuIds 菜单id集合 + */ + @Transactional(rollbackFor = Exception.class) + public void deleteRoleMenuByMenuIds(Set menuIds) { + if (CollUtil.isEmpty(menuIds)) { + return; } + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(SystemRoleMenuTb::getMenuId, menuIds); + systemRoleMenuMapper.delete(wrapper); + } + + /** + * 根据角色id集合查询菜单权限 -> TestPassed + * + * @param roleIds 角色id集合 + * @return / + */ + public List listMenuPermissionByRoleIds(Set roleIds) { + Set permissions = systemRoleMenuMapper.listMenuPermissionByRoleIds(roleIds); + return permissions.stream().filter(StrUtil::isNotBlank).collect(Collectors.toList()); + } } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemRoleService.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemRoleService.java index b13e0fc7..07fd61c1 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemRoleService.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemRoleService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,11 +20,11 @@ import cn.hutool.core.lang.Dict; import cn.hutool.core.util.StrUtil; import cn.odboy.base.KitPageResult; import cn.odboy.framework.exception.BadRequestException; +import cn.odboy.system.dal.dataobject.SystemMenuTb; import cn.odboy.system.dal.dataobject.SystemRoleTb; import cn.odboy.system.dal.model.export.SystemRoleExportRowVo; import cn.odboy.system.dal.model.request.SystemCreateRoleArgs; import cn.odboy.system.dal.model.request.SystemQueryRoleArgs; -import cn.odboy.system.dal.model.response.SystemMenuVo; import cn.odboy.system.dal.model.response.SystemRoleCodeVo; import cn.odboy.system.dal.model.response.SystemRoleVo; import cn.odboy.system.dal.model.response.SystemUserVo; @@ -32,9 +32,9 @@ import cn.odboy.system.dal.mysql.SystemRoleMapper; import cn.odboy.system.framework.permission.core.KitSecurityHelper; import cn.odboy.util.KitBeanUtil; import cn.odboy.util.KitPageUtil; -import cn.odboy.util.KitValidUtil; import cn.odboy.util.xlsx.KitExcelExporter; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -50,246 +50,234 @@ import java.util.stream.Collectors; @Service public class SystemRoleService { - @Autowired - private SystemRoleMapper systemRoleMapper; - @Autowired - private SystemRoleMenuService systemRoleMenuService; - @Autowired - private SystemRoleDeptService systemRoleDeptService; - @Autowired - private SystemUserRoleService systemUserRoleService; + @Autowired + private SystemRoleMapper systemRoleMapper; + @Autowired + private SystemRoleMenuService systemRoleMenuService; + @Autowired + private SystemRoleDeptService systemRoleDeptService; + @Autowired + private SystemUserRoleService systemUserRoleService; - /** - * 创建 -> TestPassed - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void saveRole(SystemCreateRoleArgs args) { - checkRoleLevels(args.getLevel()); - if (this.countRoleByName(args.getName()) > 0) { - throw new BadRequestException("角色名称已存在"); - } - SystemRoleTb roleTb = KitBeanUtil.copyToClass(args, SystemRoleTb.class); - systemRoleMapper.insert(roleTb); - // 判断是否有部门数据, 若有, 则需创建关联 - if (CollUtil.isNotEmpty(args.getDepts())) { - systemRoleDeptService.batchInsertRoleDept(args.getDepts(), roleTb.getId()); - } + /** + * 创建 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void saveRole(SystemCreateRoleArgs args) { + checkRoleLevels(args.getLevel()); + if (this.existRoleWithName(args.getName())) { + throw new BadRequestException("角色名称已存在"); } + SystemRoleTb roleTb = KitBeanUtil.copyToClass(args, SystemRoleTb.class); + systemRoleMapper.insert(roleTb); + // 判断是否有部门数据, 若有, 则需创建关联 + if (CollUtil.isNotEmpty(args.getDepts())) { + systemRoleDeptService.batchInsertRoleDept(args.getDepts(), roleTb.getId()); + } + } - private SystemRoleTb getRoleByName(String name) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemRoleTb::getName, name); - return systemRoleMapper.selectOne(wrapper); - } + private boolean existRoleWithName(String name) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemRoleTb::getName, name); + return systemRoleMapper.exists(wrapper); + } - private long countRoleByName(String name) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemRoleTb::getName, name); - return systemRoleMapper.selectCount(wrapper); - } + private boolean existRoleWithNameNeSelf(String name, Long roleId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemRoleTb::getName, name); + wrapper.eq(SystemRoleTb::getId, roleId); + return systemRoleMapper.exists(wrapper); + } - /** - * 修改 -> TestPassed - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void updateRoleById(SystemRoleVo args) { - checkRoleLevels(args.getLevel()); - SystemRoleTb role = this.getRoleTbById(args.getId()); - SystemRoleTb role1 = this.getRoleByName(args.getName()); - if (role1 != null && !role1.getId().equals(role.getId())) { - throw new BadRequestException("角色名称已存在"); - } - role.setName(args.getName()); - role.setDescription(args.getDescription()); - role.setDataScope(args.getDataScope()); - role.setLevel(args.getLevel()); - // 更新 - systemRoleMapper.insertOrUpdate(role); - // 删除关联部门数据 - systemRoleDeptService.batchDeleteRoleDept(Collections.singleton(args.getId())); - // 判断是否有部门数据, 若有, 则需更新关联 - if (CollUtil.isNotEmpty(args.getDepts())) { - systemRoleDeptService.batchInsertRoleDept(args.getDepts(), args.getId()); - } + /** + * 修改 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void updateRoleById(SystemRoleVo args) { + checkRoleLevels(args.getLevel()); + SystemRoleTb role = systemRoleMapper.selectById(args.getId()); + if (this.existRoleWithNameNeSelf(args.getName(), role.getId())) { + throw new BadRequestException("角色名称已存在"); } + role.setName(args.getName()); + role.setDescription(args.getDescription()); + role.setDataScope(args.getDataScope()); + role.setLevel(args.getLevel()); + // 更新 + systemRoleMapper.updateById(role); + // 删除关联部门数据 + systemRoleDeptService.batchDeleteRoleDept(Collections.singleton(args.getId())); + // 判断是否有部门数据, 若有, 则需更新关联 + if (CollUtil.isNotEmpty(args.getDepts())) { + systemRoleDeptService.batchInsertRoleDept(args.getDepts(), args.getId()); + } + } - private SystemRoleTb getRoleTbById(Long id) { - return systemRoleMapper.selectById(id); + /** + * 修改绑定的菜单 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void updateBindMenuById(SystemRoleVo args) { + SystemRoleTb role = systemRoleMapper.selectById(args.getId()); + checkRoleLevels(role.getLevel()); + // 更新菜单 + systemRoleMenuService.deleteRoleMenuByRoleId(role.getId()); + Set menus = args.getMenus(); + if (CollUtil.isNotEmpty(menus)) { + systemRoleMenuService.batchInsertRoleMenu(menus, role.getId()); } + } - /** - * 修改绑定的菜单 -> TestPassed - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void updateBindMenuById(SystemRoleVo args) { - SystemRoleTb role = systemRoleMapper.selectById(args.getId()); - checkRoleLevels(role.getLevel()); - // 更新菜单 - systemRoleMenuService.deleteRoleMenuByRoleId(role.getId()); - // 判断是否为空 - Set menus = args.getMenus(); - if (CollUtil.isNotEmpty(menus)) { - systemRoleMenuService.batchInsertRoleMenu(menus, role.getId()); - } + /** + * 删除 -> TestPassed + * + * @param ids / + */ + @Transactional(rollbackFor = Exception.class) + public void deleteRoleByIds(Set ids) { + List roleLevels = systemRoleMapper.listRoleLevelByRoleIds(new ArrayList<>(ids)); + for (Integer roleLevel : roleLevels) { + checkRoleLevels(roleLevel); } + // 验证是否被用户关联 + this.verifyBindRelationByIds(ids); + // 删除角色 + systemRoleMapper.deleteByIds(ids); + // 删除角色部门关联数据、角色菜单关联数据 + systemRoleDeptService.batchDeleteRoleDept(ids); + systemRoleMenuService.batchDeleteRoleMenu(ids); + } - /** - * 删除 -> TestPassed - * - * @param ids / - */ - @Transactional(rollbackFor = Exception.class) - public void deleteRoleByIds(Set ids) { - List roleLevels = systemRoleMapper.selectByIds(ids).stream().map(SystemRoleTb::getLevel).distinct() - .collect(Collectors.toList()); - for (Integer roleLevel : roleLevels) { - checkRoleLevels(roleLevel); - } - // 验证是否被用户关联 - this.verifyBindRelationByIds(ids); - // 删除角色 - systemRoleMapper.deleteByIds(ids); - // 删除角色部门关联数据、角色菜单关联数据 - systemRoleDeptService.batchDeleteRoleDept(ids); - systemRoleMenuService.batchDeleteRoleMenu(ids); - } + /** + * 查询全部角色 -> TestPassed + */ + public List listAllRole() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.orderByDesc(SystemRoleTb::getCreateTime); + return systemRoleMapper.selectList(wrapper); + } - /** - * 查询全部角色 -> TestPassed - */ - public List listAllRole() { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.orderByAsc(SystemRoleTb::getLevel); - return systemRoleMapper.selectList(wrapper); - } + /** + * 根据条件查询全部角色 -> TestPassed + * + * @param args 条件 + * @param rolePage 分页参数 + * @return / + */ + public List queryRoleByArgs(SystemQueryRoleArgs args, Page rolePage) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + this.injectQueryParams(args, wrapper); + return systemRoleMapper.selectList(wrapper); + } - /** - * 根据条件查询全部角色 -> TestPassed - * - * @param args 条件 - * @param rolePage 分页参数 - * @return / - */ - public List queryRoleByArgs(SystemQueryRoleArgs args, Page rolePage) { - KitValidUtil.notNull(args); - // 查询角色基本信息 - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.and(StrUtil.isNotBlank(args.getBlurry()), c -> c.like(SystemRoleTb::getName, args.getBlurry()).or() - .like(SystemRoleTb::getDescription, args.getBlurry())); - if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { - wrapper.between(SystemRoleTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); - } - wrapper.orderByAsc(SystemRoleTb::getLevel); - List roles; - if (rolePage == null) { - roles = systemRoleMapper.selectList(wrapper); - } else { - Page page = systemRoleMapper.selectPage(rolePage, wrapper); - roles = page.getRecords(); - } - return roles.stream().map(systemUserRoleService::convertToRoleVo).collect(Collectors.toList()); + private void injectQueryParams(SystemQueryRoleArgs args, LambdaQueryWrapper wrapper) { + if (args != null) { + wrapper.and(StrUtil.isNotBlank(args.getBlurry()), c -> c.like(SystemRoleTb::getName, args.getBlurry()).or() + .like(SystemRoleTb::getDescription, args.getBlurry())); + if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { + wrapper.between(SystemRoleTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); + } } + wrapper.orderByAsc(SystemRoleTb::getLevel); + } - /** - * 分页查询角色 -> TestPassed - * - * @param args 条件 - * @param page 分页条件 - * @return / - */ - public KitPageResult searchRoleByArgs(SystemQueryRoleArgs args, Page page) { - List roles = this.queryRoleByArgs(args, page); - Long total = this.countRoleByArgs(args); - return KitPageUtil.toPage(roles, total); - } + /** + * 分页查询角色 -> TestPassed + * + * @param args 条件 + * @param page 分页条件 + * @return / + */ + public KitPageResult searchRoleByArgs(SystemQueryRoleArgs args, Page page) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + this.injectQueryParams(args, wrapper); + IPage data = systemRoleMapper.selectPage(page, wrapper).convert(systemUserRoleService::convertToRoleVo); + return KitPageUtil.toPage(data); + } - /** - * 获取用户权限信息 -> TestPassed - * - * @param user 用户信息 - * @return 权限信息 - */ - public List buildUserRolePermissions(SystemUserVo user) { - Set permissions = new HashSet<>(); - // 如果是管理员直接返回 - if (user.getIsAdmin()) { - permissions.add("admin"); - return permissions.stream().map(SystemRoleCodeVo::new).collect(Collectors.toList()); - } - List roles = systemUserRoleService.queryRoleVoByUsersId(user.getId()); - permissions = roles.stream().flatMap(role -> role.getMenus().stream()).map(SystemMenuVo::getPermission) - .filter(StrUtil::isNotBlank).collect(Collectors.toSet()); - return permissions.stream().map(SystemRoleCodeVo::new).collect(Collectors.toList()); + /** + * 查询用户权限信息 -> TestPassed? + * + * @param user 用户信息 + * @return 权限信息 + */ + public List buildUserRolePermissions(SystemUserVo user) { + Set permissions = new HashSet<>(); + // 如果是管理员直接返回 + if (user.getIsAdmin()) { + permissions.add("admin"); + return permissions.stream().map(SystemRoleCodeVo::new).collect(Collectors.toList()); } +// List roles = systemUserRoleService.listRoleVoByUsersId(user.getId()); +// permissions = roles.stream().flatMap(role -> role.getMenus().stream()).map(SystemMenuVo::getPermission) +// .filter(StrUtil::isNotBlank).collect(Collectors.toSet()); +// return permissions.stream().map(SystemRoleCodeVo::new).collect(Collectors.toList()); + Set roleIds = systemUserRoleService.listUserRoleIdByUserId(user.getId()); + // 查询角色权限 + if (CollUtil.isNotEmpty(roleIds)) { + return systemRoleMenuService.listMenuPermissionByRoleIds(roleIds).stream().map(SystemRoleCodeVo::new).collect(Collectors.toList()); + } + // 没有包含任何角色,赋予默认权限 + permissions.add("IsAJoker"); + return permissions.stream().map(SystemRoleCodeVo::new).collect(Collectors.toList()); + } - /** - * 验证是否被用户关联 -> TestPassed - * - * @param ids / - */ - public void verifyBindRelationByIds(Set ids) { - if (systemUserRoleService.countUserByRoleIds(ids) > 0) { - throw new BadRequestException("所选角色存在用户关联, 请解除关联再试!"); - } + /** + * 验证是否被用户关联 -> TestPassed + * + * @param ids / + */ + public void verifyBindRelationByIds(Set ids) { + if (systemUserRoleService.existUserWithRoleIds(ids)) { + throw new BadRequestException("所选角色存在用户关联, 请解除关联再试!"); } + } - public Long countRoleByArgs(SystemQueryRoleArgs args) { - KitValidUtil.notNull(args); - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.and(StrUtil.isNotBlank(args.getBlurry()), c -> c.like(SystemRoleTb::getName, args.getBlurry()).or() - .like(SystemRoleTb::getDescription, args.getBlurry())); - if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { - wrapper.between(SystemRoleTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); - } - return systemRoleMapper.selectCount(wrapper); + public SystemRoleVo getRoleVoById(Long id) { + SystemRoleTb roleTb = systemRoleMapper.selectById(id); + if (roleTb == null) { + return null; } + return systemUserRoleService.convertToRoleVo(roleTb); + } - public SystemRoleVo getRoleById(Long id) { - SystemRoleTb roleTb = systemRoleMapper.selectById(id); - if (roleTb == null) { - return null; - } - return systemUserRoleService.convertToRoleVo(roleTb); - } + public Dict getCurrentUserRoleLevel() { + return Dict.create().set("level", checkRoleLevels(null)); + } - public Dict getCurrentUserRoleLevel() { - return Dict.create().set("level", checkRoleLevels(null)); + /** + * 检查用户的角色级别 -> TestPassed + * + * @return / + */ + private int checkRoleLevels(Integer level) { + Set levels = systemUserRoleService.listUserRoleLevelByUserId(KitSecurityHelper.getCurrentUserId()); + int min = Collections.min(levels); + if (level != null) { + if (level < min) { + throw new BadRequestException("权限不足, 你的角色级别:" + min + ", 低于操作的角色级别:" + level); + } } + return min; + } - /** - * 检查用户的角色级别 -> TestPassed - * - * @return / - */ - private int checkRoleLevels(Integer level) { - List levels = systemUserRoleService.queryRoleVoByUsersId(KitSecurityHelper.getCurrentUserId()).stream() - .map(SystemRoleVo::getLevel).collect(Collectors.toList()); - int min = Collections.min(levels); - if (level != null) { - if (level < min) { - throw new BadRequestException("权限不足, 你的角色级别:" + min + ", 低于操作的角色级别:" + level); - } - } - return min; - } - - public void exportRoleXlsx(HttpServletResponse response, SystemQueryRoleArgs args) { - List systemRoleVos = this.queryRoleByArgs(args, null); - List rowVos = new ArrayList<>(); - for (SystemRoleVo dataObject : systemRoleVos) { - SystemRoleExportRowVo rowVo = new SystemRoleExportRowVo(); - rowVo.setName(dataObject.getName()); - rowVo.setLevel(dataObject.getLevel()); - rowVo.setDescription(dataObject.getDescription()); - rowVo.setCreateTime(dataObject.getCreateTime()); - rowVos.add(rowVo); - } - KitExcelExporter.exportSimple(response, "部门数据", SystemRoleExportRowVo.class, rowVos); + public void exportRoleXlsx(HttpServletResponse response, SystemQueryRoleArgs args) { + List systemRoleVos = this.queryRoleByArgs(args, null); + List rowVos = new ArrayList<>(); + for (SystemRoleTb dataObject : systemRoleVos) { + SystemRoleExportRowVo rowVo = new SystemRoleExportRowVo(); + rowVo.setName(dataObject.getName()); + rowVo.setLevel(dataObject.getLevel()); + rowVo.setDescription(dataObject.getDescription()); + rowVo.setCreateTime(dataObject.getCreateTime()); + rowVos.add(rowVo); } + KitExcelExporter.exportSimple(response, "部门数据", SystemRoleExportRowVo.class, rowVos); + } } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserDeptService.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserDeptService.java index 986789d2..d0da4e43 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserDeptService.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserDeptService.java @@ -1,21 +1,39 @@ +/* + * Copyright 2021-2026 Odboy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package cn.odboy.system.service; import cn.odboy.system.dal.dataobject.SystemUserTb; import cn.odboy.system.dal.mysql.SystemUserMapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.Set; @Service public class SystemUserDeptService { - @Autowired - private SystemUserMapper systemUserMapper; + @Autowired + private SystemUserMapper systemUserMapper; - public long countUserByDeptIds(Set deptIds) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(SystemUserTb::getDeptId, deptIds); - return systemUserMapper.selectCount(wrapper); - } + /** + * 根据部门id统计用户数量 -> TestPassed + */ + public long countUserByDeptIds(Set deptIds) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(SystemUserTb::getDeptId, deptIds); + return systemUserMapper.selectCount(wrapper); + } } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserJobService.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserJobService.java index c0b9057e..e2d75ac4 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserJobService.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserJobService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,58 +20,70 @@ import cn.odboy.system.dal.dataobject.SystemJobTb; import cn.odboy.system.dal.dataobject.SystemUserJobTb; import cn.odboy.system.dal.mysql.SystemUserJobMapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.List; import java.util.Set; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; @Service public class SystemUserJobService { - @Autowired - private SystemUserJobMapper systemUserJobMapper; + @Autowired + private SystemUserJobMapper systemUserJobMapper; - @Transactional(rollbackFor = Exception.class) - public void batchInsertUserJob(Set jobs, Long userId) { - if (CollUtil.isNotEmpty(jobs)) { - List records = new ArrayList<>(); - for (SystemJobTb job : jobs) { - SystemUserJobTb record = new SystemUserJobTb(); - record.setUserId(userId); - record.setJobId(job.getId()); - records.add(record); - } - systemUserJobMapper.insert(records); - } + /** + * 批量绑定用户岗位 -> TestPassed + */ + @Transactional(rollbackFor = Exception.class) + public void batchInsertUserJob(Set jobs, Long userId) { + if (CollUtil.isNotEmpty(jobs)) { + List records = new ArrayList<>(); + for (SystemJobTb job : jobs) { + SystemUserJobTb record = new SystemUserJobTb(); + record.setUserId(userId); + record.setJobId(job.getId()); + records.add(record); + } + systemUserJobMapper.insert(records); } + } - @Transactional(rollbackFor = Exception.class) - public void batchDeleteUserJob(Set userIds) { - if (CollUtil.isNotEmpty(userIds)) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(SystemUserJobTb::getUserId, userIds); - systemUserJobMapper.delete(wrapper); - } + /** + * 批量解绑用户岗位 -> TestPassed + */ + @Transactional(rollbackFor = Exception.class) + public void batchDeleteUserJob(Set userIds) { + if (CollUtil.isNotEmpty(userIds)) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(SystemUserJobTb::getUserId, userIds); + systemUserJobMapper.delete(wrapper); } + } - /** - * 根据岗位ID统计用户数量 - * - * @param jobIds 岗位ID集合 - * @return / - */ - public Long countUserByJobIds(Set jobIds) { - if (CollUtil.isEmpty(jobIds)) { - return 0L; - } - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(SystemUserJobTb::getJobId, jobIds); - return systemUserJobMapper.selectCount(wrapper); + /** + * 根据岗位ID统计用户数量 -> TestPassed + * + * @param jobIds / + * @return / + */ + public Long countUserByJobIds(Set jobIds) { + if (CollUtil.isEmpty(jobIds)) { + return 0L; } + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(SystemUserJobTb::getJobId, jobIds); + return systemUserJobMapper.selectCount(wrapper); + } - public Set listUserJobByUserId(Long userId) { - return systemUserJobMapper.listUserJobByUserId(userId); - } + /** + * 根据用户id查询岗位 -> TestPassed + * + * @param userId / + * @return / + */ + public Set listUserJobByUserId(Long userId) { + return systemUserJobMapper.listUserJobByUserId(userId); + } } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserRoleService.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserRoleService.java index 1ca2321f..76d6e861 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserRoleService.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserRoleService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,9 @@ package cn.odboy.system.service; import cn.hutool.core.collection.CollUtil; import cn.odboy.framework.exception.BadRequestException; import cn.odboy.system.dal.dataobject.SystemDeptTb; +import cn.odboy.system.dal.dataobject.SystemMenuTb; import cn.odboy.system.dal.dataobject.SystemRoleTb; import cn.odboy.system.dal.dataobject.SystemUserRoleTb; -import cn.odboy.system.dal.model.response.SystemMenuVo; import cn.odboy.system.dal.model.response.SystemRoleVo; import cn.odboy.system.dal.model.response.SystemUserVo; import cn.odboy.system.dal.mysql.SystemRoleMapper; @@ -33,6 +33,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Collections; +import java.util.HashSet; import java.util.List; import java.util.Objects; import java.util.Set; @@ -41,122 +42,155 @@ import java.util.stream.Collectors; @Service public class SystemUserRoleService { - @Autowired - private SystemRoleMapper systemRoleMapper; - @Autowired - private SystemUserRoleMapper systemUserRoleMapper; - @Autowired - private SystemRoleMenuService systemRoleMenuService; - @Autowired - private SystemRoleDeptService systemRoleDeptService; + @Autowired + private SystemRoleMapper systemRoleMapper; + @Autowired + private SystemUserRoleMapper systemUserRoleMapper; + @Autowired + private SystemRoleMenuService systemRoleMenuService; + @Autowired + private SystemRoleDeptService systemRoleDeptService; - @Transactional(rollbackFor = Exception.class) - public void batchInsertUserRole(Set roles, Long userId) { - if (CollUtil.isNotEmpty(roles)) { - List records = new ArrayList<>(); - for (SystemRoleTb role : roles) { - SystemUserRoleTb record = new SystemUserRoleTb(); - record.setUserId(userId); - record.setRoleId(role.getId()); - records.add(record); - } - systemUserRoleMapper.insert(records); - } + /** + * 批量绑定用户角色 -> TestPassed + */ + @Transactional(rollbackFor = Exception.class) + public void batchInsertUserRole(Set roles, Long userId) { + if (CollUtil.isNotEmpty(roles)) { + List records = new ArrayList<>(); + for (SystemRoleTb role : roles) { + SystemUserRoleTb record = new SystemUserRoleTb(); + record.setUserId(userId); + record.setRoleId(role.getId()); + records.add(record); + } + systemUserRoleMapper.insert(records); } + } - @Transactional(rollbackFor = Exception.class) - public void batchDeleteUserRole(Set userIds) { - if (CollUtil.isNotEmpty(userIds)) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(SystemUserRoleTb::getUserId, userIds); - systemUserRoleMapper.delete(wrapper); - } + /** + * 批量解绑用户角色 -> TestPassed + */ + @Transactional(rollbackFor = Exception.class) + public void batchDeleteUserRole(Set userIds) { + if (CollUtil.isNotEmpty(userIds)) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(SystemUserRoleTb::getUserId, userIds); + systemUserRoleMapper.delete(wrapper); } + } - /** - * 转换为SystemRoleVo并关联查询菜单和部门信息 - * - * @param role 角色基本信息 - * @return 包含关联信息的SystemRoleVo - */ - public SystemRoleVo convertToRoleVo(SystemRoleTb role) { - if (role == null) { - return null; - } - SystemRoleVo roleVo = KitBeanUtil.copyToClass(role, SystemRoleVo.class); - // 查询关联的菜单信息 - Set menus = systemRoleMenuService.queryMenuByRoleIds(Collections.singleton(role.getId())); - roleVo.setMenus(menus); - // 查询关联的部门信息 - Set depts = systemRoleDeptService.listUserDeptByRoleId(role.getId()); - roleVo.setDepts(depts); - return roleVo; + /** + * 转换为SystemRoleVo并关联查询菜单和部门信息 + * + * @param role 角色基本信息 + * @return 包含关联信息的SystemRoleVo + */ + public SystemRoleVo convertToRoleVo(SystemRoleTb role) { + if (role == null) { + return null; } + SystemRoleVo roleVo = KitBeanUtil.copyToClass(role, SystemRoleVo.class); + // 查询关联的菜单信息 + List menus = systemRoleMenuService.listMenuByRoleIds(Collections.singleton(role.getId()), true); + roleVo.setMenus(new HashSet<>(menus)); + // 查询关联的部门信息 + Set depts = systemRoleDeptService.listUserDeptByRoleId(role.getId()); + roleVo.setDepts(depts); + return roleVo; + } - /** - * 根据用户ID查询 - * - * @param userId 用户ID - * @return / - */ - public List queryRoleVoByUsersId(Long userId) { - Set roles = this.listUserRoleByUserId(userId); - return roles.stream().map(this::convertToRoleVo).collect(Collectors.toList()); - } + /** + * 根据用户ID查询 -> TestPassed + * + * @param userId 用户ID + * @return / + */ + public List listRoleVoByUsersId(Long userId) { + Set roles = this.listUserRoleByUserId(userId); + return roles.stream().map(this::convertToRoleVo).collect(Collectors.toList()); + } - /** - * 根据角色查询角色级别 -> TestPassed - * - * @param roles / - * @return / - */ - public Integer getDeptLevelByRoles(Set roles) { - if (CollUtil.isEmpty(roles)) { - // 最小权限 - return Integer.MAX_VALUE; - } - List roleIds = - roles.stream().map(SystemRoleTb::getId).filter(Objects::nonNull).distinct().collect(Collectors.toList()); - if (CollUtil.isEmpty(roleIds)) { - // 最小权限 - return Integer.MAX_VALUE; - } - List roleLevels = systemRoleMapper.selectList( - new LambdaQueryWrapper().select(SystemRoleTb::getLevel).isNotNull(SystemRoleTb::getLevel) - .in(SystemRoleTb::getId, roleIds)).stream().map(SystemRoleTb::getLevel).distinct() - .collect(Collectors.toList()); - if (CollUtil.isEmpty(roleLevels)) { - // 最小权限 - return Integer.MAX_VALUE; - } - return Collections.min(roleLevels); + /** + * 根据角色查询角色级别 -> TestPassed + * + * @param roles / + * @return / + */ + public Integer getDeptLevelByRoles(Set roles) { + if (CollUtil.isEmpty(roles)) { + // 最小权限 + return Integer.MAX_VALUE; } + List roleIds = roles.stream().map(SystemRoleTb::getId).filter(Objects::nonNull).distinct().collect(Collectors.toList()); + if (CollUtil.isEmpty(roleIds)) { + // 最小权限 + return Integer.MAX_VALUE; + } + List roleLevels = systemRoleMapper.listRoleLevelByRoleIds(roleIds); + if (CollUtil.isEmpty(roleLevels)) { + // 最小权限 + return Integer.MAX_VALUE; + } + return Collections.min(roleLevels); + } - /** - * 如果当前用户的角色级别低于创建用户的角色级别,则抛出权限不足的错误 - * - * @param args / - */ - public void checkLevel(SystemUserVo args) { - Integer currentLevel = Collections.min( - this.queryRoleVoByUsersId(KitSecurityHelper.getCurrentUserId()).stream().map(SystemRoleVo::getLevel) - .collect(Collectors.toList())); - Integer optLevel = this.getDeptLevelByRoles(args.getRoles()); - if (currentLevel > optLevel) { - throw new BadRequestException("角色权限不足"); - } + /** + * 如果当前用户的角色级别低于创建用户的角色级别,则抛出权限不足的错误 -> TestPassed + * + * @param args / + */ + public void checkLevel(SystemUserVo args) { + Set roleLevels = systemUserRoleMapper.listUserRoleLevelByUserId(KitSecurityHelper.getCurrentUserId()); + Integer currentLevel = Collections.min(roleLevels); + Integer optLevel = this.getDeptLevelByRoles(args.getRoles()); + if (currentLevel > optLevel) { + throw new BadRequestException("角色权限不足"); } + } - public long countUserByRoleIds(Set ids) { - if (CollUtil.isEmpty(ids)) { - return 0L; - } - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(SystemUserRoleTb::getRoleId, ids); - return systemUserRoleMapper.selectCount(wrapper); - } + /** + * 根据用户id查询角色 -> TestPassed + * + * @param userId / + * @return / + */ + public Set listUserRoleByUserId(Long userId) { + return systemUserRoleMapper.listUserRoleByUserId(userId); + } - public Set listUserRoleByUserId(Long userId) { - return systemUserRoleMapper.listUserRoleByUserId(userId); + /** + * 根据用户id查询角色级别集合 -> TestPassed + * + * @param userId / + * @return / + */ + public Set listUserRoleLevelByUserId(Long userId) { + return systemUserRoleMapper.listUserRoleLevelByUserId(userId); + } + + /** + * 根据用户id查询角色id集合 -> TestPassed + * + * @param userId / + * @return / + */ + public Set listUserRoleIdByUserId(Long userId) { + return systemUserRoleMapper.listUserRoleIdByUserId(userId); + } + + /** + * 根据角色id集合判断是否存在关联用户 -> TestPassed + * + * @param ids 角色id集合 + * @return / + */ + public boolean existUserWithRoleIds(Set ids) { + if (CollUtil.isEmpty(ids)) { + return false; } + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(SystemUserRoleTb::getRoleId, ids); + return systemUserRoleMapper.exists(wrapper); + } } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserService.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserService.java index 0943c00b..b162f38e 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserService.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/SystemUserService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,6 @@ import cn.odboy.system.dal.dataobject.SystemUserTb; import cn.odboy.system.dal.model.export.SystemUserExportRowVo; import cn.odboy.system.dal.model.request.SystemQueryUserArgs; import cn.odboy.system.dal.model.request.SystemUpdateUserPasswordArgs; -import cn.odboy.system.dal.model.response.SystemRoleVo; import cn.odboy.system.dal.model.response.SystemUserVo; import cn.odboy.system.dal.mysql.SystemUserMapper; import cn.odboy.system.dal.redis.SystemUserInfoDAO; @@ -42,18 +41,10 @@ import cn.odboy.util.KitBeanUtil; import cn.odboy.util.KitFileUtil; import cn.odboy.util.KitPageUtil; import cn.odboy.util.KitRsaEncryptUtil; -import cn.odboy.util.KitValidUtil; import cn.odboy.util.xlsx.KitExcelExporter; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.crypto.password.PasswordEncoder; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.ObjectUtils; -import org.springframework.web.multipart.MultipartFile; -import javax.servlet.http.HttpServletResponse; import java.io.File; import java.util.ArrayList; import java.util.Collections; @@ -63,449 +54,470 @@ import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.ObjectUtils; +import org.springframework.web.multipart.MultipartFile; @Service public class SystemUserService { - @Autowired - private SystemUserMapper systemUserMapper; - @Autowired - private SystemDeptService systemDeptService; - @Autowired - private SystemUserJobService systemUserJobService; - @Autowired - private SystemUserRoleService systemUserRoleService; - @Autowired - private SystemEmailService systemEmailService; - @Autowired - private SystemDataService systemDataService; - @Autowired - private SystemUserInfoDAO systemUserInfoDAO; - @Autowired - private SystemUserOnlineInfoDAO systemUserOnlineInfoDAO; - @Autowired - private KitFileLocalUploadHelper fileUploadPathHelper; - @Autowired - private AppProperties properties; - @Autowired - private PasswordEncoder passwordEncoder; + @Autowired + private SystemUserMapper systemUserMapper; + @Autowired + private SystemDeptService systemDeptService; + @Autowired + private SystemUserJobService systemUserJobService; + @Autowired + private SystemUserRoleService systemUserRoleService; + @Autowired + private SystemEmailService systemEmailService; + @Autowired + private SystemDataService systemDataService; + @Autowired + private SystemUserInfoDAO systemUserInfoDAO; + @Autowired + private SystemUserOnlineInfoDAO systemUserOnlineInfoDAO; + @Autowired + private KitFileLocalUploadHelper fileUploadPathHelper; + @Autowired + private AppProperties properties; + @Autowired + private PasswordEncoder passwordEncoder; - /** - * 新增用户 - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void saveUser(SystemUserVo args) { - systemUserRoleService.checkLevel(args); - SystemUserTb record = KitBeanUtil.copyToClass(args, SystemUserTb.class); - // 默认密码 123456 - record.setPassword(passwordEncoder.encode("123456")); - record.setDeptId(args.getDept().getId()); - if (this.getUserByUsername(record.getUsername()) != null) { - throw new BadRequestException("用户名已存在"); - } - if (this.getUserByEmail(record.getEmail()) != null) { - throw new BadRequestException("邮箱已存在"); - } - if (this.getUserByPhone(record.getPhone()) != null) { - throw new BadRequestException("手机号已存在"); - } - // 保存用户 - systemUserMapper.insert(record); - // 保存用户岗位 - systemUserJobService.batchInsertUserJob(args.getJobs(), record.getId()); - // 保存用户角色 - systemUserRoleService.batchInsertUserRole(args.getRoles(), record.getId()); + /** + * 新增用户 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void saveUser(SystemUserVo args) { + systemUserRoleService.checkLevel(args); + SystemUserTb record = KitBeanUtil.copyToClass(args, SystemUserTb.class); + // 默认密码 123456 + record.setPassword(passwordEncoder.encode("123456")); + record.setDeptId(args.getDept().getId()); + if (this.existUserWithUsername(record.getUsername())) { + throw new BadRequestException("用户名已存在"); } - - /** - * 编辑用户 - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void updateUserById(SystemUserVo args) { - systemUserRoleService.checkLevel(args); - SystemUserTb user = systemUserMapper.selectById(args.getId()); - SystemUserTb user1 = this.getUserByUsername(args.getUsername()); - SystemUserTb user2 = this.getUserByEmail(args.getEmail()); - SystemUserTb user3 = this.getUserByPhone(args.getPhone()); - if (user1 != null && !user.getId().equals(user1.getId())) { - throw new BadRequestException("用户名已存在"); - } - if (user2 != null && !user.getId().equals(user2.getId())) { - throw new BadRequestException("邮箱已存在"); - } - if (user3 != null && !user.getId().equals(user3.getId())) { - throw new BadRequestException("手机号已存在"); - } - // 如果用户被禁用, 则清除用户登录信息 - if (!args.getEnabled()) { - systemUserOnlineInfoDAO.kickOutByUsername(args.getUsername()); - } - user.setDeptId(args.getDept().getId()); - user.setUsername(args.getUsername()); - user.setEmail(args.getEmail()); - user.setEnabled(args.getEnabled()); - user.setPhone(args.getPhone()); - user.setNickName(args.getNickName()); - user.setGender(args.getGender()); - systemUserMapper.updateById(user); - // 清除用户登录缓存 - systemUserInfoDAO.deleteUserLoginInfoByUserName(user.getUsername()); - // 更新用户岗位 - systemUserJobService.batchDeleteUserJob(Collections.singleton(args.getId())); - systemUserJobService.batchInsertUserJob(args.getJobs(), args.getId()); - // 更新用户角色 - systemUserRoleService.batchDeleteUserRole(Collections.singleton(args.getId())); - systemUserRoleService.batchInsertUserRole(args.getRoles(), args.getId()); + if (this.existUserWithEmail(record.getEmail())) { + throw new BadRequestException("邮箱已存在"); } - - /** - * 用户自助修改资料 - * - * @param args / - */ - @Transactional(rollbackFor = Exception.class) - public void updateUserCenterInfoById(SystemUserTb args) { - if (!args.getId().equals(KitSecurityHelper.getCurrentUserId())) { - throw new BadRequestException("不能修改他人资料"); - } - SystemUserTb user = systemUserMapper.selectById(args.getId()); - SystemUserTb user1 = this.getUserByPhone(args.getPhone()); - if (user1 != null && !user.getId().equals(user1.getId())) { - throw new BadRequestException("手机号已存在"); - } - user.setNickName(args.getNickName()); - user.setPhone(args.getPhone()); - user.setGender(args.getGender()); - systemUserMapper.insertOrUpdate(user); - systemUserInfoDAO.deleteUserLoginInfoByUserName(user.getUsername()); + if (this.existUserWithPhone(record.getPhone())) { + throw new BadRequestException("手机号已存在"); } + // 保存用户 + systemUserMapper.insert(record); + // 保存用户岗位 + systemUserJobService.batchInsertUserJob(args.getJobs(), record.getId()); + // 保存用户角色 + systemUserRoleService.batchInsertUserRole(args.getRoles(), record.getId()); + } - /** - * 删除用户 - * - * @param ids / - */ - @Transactional(rollbackFor = Exception.class) - public void deleteUserByIds(Set ids) { - Long currentUserId = KitSecurityHelper.getCurrentUserId(); - // 校验权限 - for (Long id : ids) { - Integer currentLevel = Collections.min( - systemUserRoleService.queryRoleVoByUsersId(currentUserId).stream().map(SystemRoleVo::getLevel) - .collect(Collectors.toList())); - Integer optLevel = Collections.min( - systemUserRoleService.queryRoleVoByUsersId(id).stream().map(SystemRoleVo::getLevel) - .collect(Collectors.toList())); - if (currentLevel > optLevel) { - throw new BadRequestException("角色权限不足, 不能删除:" + this.getUserById(id).getUsername()); - } - } - // 清理缓存 - List usernameList = systemUserMapper.selectByIds(ids).stream().map(SystemUserTb::getUsername).distinct() - .collect(Collectors.toList()); - for (String username : usernameList) { - systemUserInfoDAO.deleteUserLoginInfoByUserName(username); - } - // 删除用户 - systemUserMapper.deleteByIds(ids); - // 删除用户岗位 - systemUserJobService.batchDeleteUserJob(ids); - // 删除用户角色 - systemUserRoleService.batchDeleteUserRole(ids); + private boolean existUserWithPhone(String phone) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemUserTb::getPhone, phone); + wrapper.eq(SystemUserTb::getEnabled, 1); + return systemUserMapper.exists(wrapper); + } + + private boolean existUserWithEmail(String email) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemUserTb::getEmail, email); + wrapper.eq(SystemUserTb::getEnabled, 1); + return systemUserMapper.exists(wrapper); + } + + private boolean existUserWithUsername(String username) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemUserTb::getUsername, username); + wrapper.eq(SystemUserTb::getEnabled, 1); + return systemUserMapper.exists(wrapper); + } + + /** + * 编辑用户 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void updateUserById(SystemUserVo args) { + systemUserRoleService.checkLevel(args); + SystemUserTb user = systemUserMapper.selectById(args.getId()); + if (this.existUserWithUsernameNeSelf(args.getUsername(), user.getId())) { + throw new BadRequestException("用户名已存在"); } - - /** - * 修改密码 - * - * @param username 用户名 - * @param args 参数 - */ - @Transactional(rollbackFor = Exception.class) - public void updateUserPasswordByUsername(String username, SystemUpdateUserPasswordArgs args) throws Exception { - String oldPass = KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), args.getOldPass()); - String newPass = KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), args.getNewPass()); - SystemUserTb user = this.getUserByUsername(username); - if (!passwordEncoder.matches(oldPass, user.getPassword())) { - throw new BadRequestException("修改失败,旧密码错误"); - } - if (passwordEncoder.matches(newPass, user.getPassword())) { - throw new BadRequestException("新密码不能与旧密码相同"); - } - String encryptPassword = passwordEncoder.encode(newPass); - systemUserMapper.updateUserPasswordByUsername(username, encryptPassword); - systemUserInfoDAO.deleteUserLoginInfoByUserName(username); + if (this.existUserWithEmailNeSelf(args.getEmail(), user.getId())) { + throw new BadRequestException("邮箱已存在"); } - - /** - * 重置密码 - * - * @param ids 用户id - */ - @Transactional(rollbackFor = Exception.class) - public void resetUserPasswordByIds(Set ids) { - String defaultPwd = passwordEncoder.encode("123456"); - List users = systemUserMapper.selectByIds(ids); - // 清除缓存 - for (SystemUserTb user : users) { - // 清除缓存 - systemUserInfoDAO.deleteUserLoginInfoByUserName(user.getUsername()); - // 强制退出 - systemUserOnlineInfoDAO.kickOutByUsername(user.getUsername()); - } - // 重置密码 - systemUserMapper.updateUserPasswordByUserIds(defaultPwd, ids); + if (this.existUserWithPhoneNeSelf(args.getPhone(), user.getId())) { + throw new BadRequestException("手机号已存在"); } - - /** - * 修改头像 - * - * @param multipartFile 文件 - * @return / - */ - @Transactional(rollbackFor = Exception.class) - public Map updateUserAvatar(MultipartFile multipartFile) { - SystemUserTb user = this.getUserByUsername(KitSecurityHelper.getCurrentUsername()); - String username = user.getUsername(); - if (StrUtil.isBlank(username)) { - throw new BadRequestException("异常用户数据, 请联系管理员处理"); - } - // 文件大小验证 - KitFileUtil.checkSize(fileUploadPathHelper.getAvatarMaxSize(), multipartFile.getSize()); - // 验证文件上传的格式 - String image = "gif jpg png jpeg"; - String fileType = KitFileUtil.getSuffix(multipartFile.getOriginalFilename()); - if (fileType != null && !image.contains(fileType)) { - throw new BadRequestException("文件格式错误!, 仅支持 " + image + " 格式"); - } - String oldPath = user.getAvatarPath(); - File file = KitFileUtil.upload(multipartFile, fileUploadPathHelper.getPath()); - user.setAvatarPath(Objects.requireNonNull(file).getPath()); - user.setAvatarName(file.getName()); - systemUserMapper.insertOrUpdate(user); - if (StrUtil.isNotBlank(oldPath)) { - KitFileUtil.del(oldPath); - } - systemUserInfoDAO.deleteUserLoginInfoByUserName(username); - return new HashMap<>(1) {{ - put("avatar", file.getName()); - }}; + // 如果用户被禁用, 则清除用户登录信息 + if (!args.getEnabled()) { + systemUserOnlineInfoDAO.kickOutByUsername(args.getUsername()); } + user.setDeptId(args.getDept().getId()); + user.setUsername(args.getUsername()); + user.setEmail(args.getEmail()); + user.setEnabled(args.getEnabled()); + user.setPhone(args.getPhone()); + user.setNickName(args.getNickName()); + user.setGender(args.getGender()); + systemUserMapper.updateById(user); + // 清除用户登录缓存 + systemUserInfoDAO.deleteUserLoginInfoByUserName(user.getUsername()); + // 更新用户岗位 + systemUserJobService.batchDeleteUserJob(Collections.singleton(args.getId())); + systemUserJobService.batchInsertUserJob(args.getJobs(), args.getId()); + // 更新用户角色 + systemUserRoleService.batchDeleteUserRole(Collections.singleton(args.getId())); + systemUserRoleService.batchInsertUserRole(args.getRoles(), args.getId()); + } - /** - * 修改邮箱 - * - * @param username 用户名 - * @param args 参数 - * @param code 验证码 - */ - @Transactional(rollbackFor = Exception.class) - public void updateUserEmailByUsername(String username, SystemUserTb args, String code) throws Exception { - String password = - KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), args.getPassword()); - SystemUserTb user = this.getUserByUsername(username); - if (!passwordEncoder.matches(password, user.getPassword())) { - throw new BadRequestException("密码错误"); - } - systemEmailService.checkEmailCaptchaV1(SystemCaptchaBizEnum.EMAIL_RESET_EMAIL_CODE, args.getEmail(), code); - systemUserMapper.updateUserEmailByUsername(username, args.getEmail()); - systemUserInfoDAO.deleteUserLoginInfoByUserName(username); + private boolean existUserWithPhoneNeSelf(String phone, Long currentUserId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemUserTb::getPhone, phone); + wrapper.ne(SystemUserTb::getId, currentUserId); + return systemUserMapper.exists(wrapper); + } + + private boolean existUserWithEmailNeSelf(String email, Long currentUserId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemUserTb::getEmail, email); + wrapper.ne(SystemUserTb::getId, currentUserId); + return systemUserMapper.exists(wrapper); + } + + private boolean existUserWithUsernameNeSelf(String username, Long currentUserId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemUserTb::getUsername, username); + wrapper.ne(SystemUserTb::getId, currentUserId); + return systemUserMapper.exists(wrapper); + } + + /** + * 用户自助修改资料 -> TestPassed + * + * @param args / + */ + @Transactional(rollbackFor = Exception.class) + public void updateUserCenterInfoById(SystemUserTb args) { + if (!args.getId().equals(KitSecurityHelper.getCurrentUserId())) { + throw new BadRequestException("不能修改他人资料"); } - - /** - * 查询全部 - * - * @param args 条件 - * @param page 分页参数 - * @return / - */ - public KitPageResult searchUserByArgs(SystemQueryUserArgs args, Page page) { - // 查询用户基本信息 - LambdaQueryWrapper wrapper = this.buildUserQueryWrapper(args); - IPage userPage = systemUserMapper.selectPage(page, wrapper); - List users = userPage.getRecords(); - // 转换为SystemUserVo并关联查询 - List userVos = - users.stream().map(m -> this.convertToUserVo(m, false)).collect(Collectors.toList()); - return KitPageUtil.toPage(userVos, userPage.getTotal()); + SystemUserTb user = systemUserMapper.selectById(args.getId()); + if (this.existUserWithPhoneNeSelf(args.getPhone(), user.getId())) { + throw new BadRequestException("手机号已存在"); } + user.setNickName(args.getNickName()); + user.setPhone(args.getPhone()); + user.setGender(args.getGender()); + systemUserMapper.updateById(user); + systemUserInfoDAO.deleteUserLoginInfoByUserName(user.getUsername()); + } - public long countUserByArgs(SystemQueryUserArgs args) { - LambdaQueryWrapper wrapper = this.buildUserQueryWrapper(args); - return systemUserMapper.selectCount(wrapper); + /** + * 删除用户 -> TestPassed + * + * @param ids / + */ + @Transactional(rollbackFor = Exception.class) + public void deleteUserByIds(Set ids) { + Long currentUserId = KitSecurityHelper.getCurrentUserId(); + // 校验权限 + for (Long id : ids) { + Integer currentLevel = Collections.min(systemUserRoleService.listUserRoleLevelByUserId(currentUserId)); + Integer optLevel = Collections.min(systemUserRoleService.listUserRoleLevelByUserId(id)); + if (currentLevel > optLevel) { + SystemUserTb systemUserTb = systemUserMapper.selectById(id); + throw new BadRequestException("角色权限不足, 不能删除:" + systemUserTb.getUsername()); + } } - - /** - * 根据ID查询 - * - * @param id ID - * @return / - */ - public SystemUserTb getUserById(long id) { - return systemUserMapper.selectById(id); + // 清理缓存 + List usernameList = systemUserMapper.listUsernameByIds(ids); + for (String username : usernameList) { + systemUserInfoDAO.deleteUserLoginInfoByUserName(username); } + // 删除用户 + systemUserMapper.deleteByIds(ids); + // 删除用户岗位 + systemUserJobService.batchDeleteUserJob(ids); + // 删除用户角色 + systemUserRoleService.batchDeleteUserRole(ids); + } - public List queryUserMetadataOptions(KitPageArgs pageArgs) { - SystemQueryUserArgs args = pageArgs.getArgs(); - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.select(SystemUserTb::getId, SystemUserTb::getDeptId, SystemUserTb::getEmail, SystemUserTb::getPhone); - wrapper.and(c -> { - c.eq(SystemUserTb::getPhone, args.getBlurry()); - c.or(); - c.eq(SystemUserTb::getEmail, args.getBlurry()); - c.or(); - c.like(SystemUserTb::getUsername, args.getBlurry()); - c.or(); - c.like(SystemUserTb::getNickName, args.getBlurry()); + /** + * 修改密码 -> TestPassed + * + * @param username 用户名 + * @param args 参数 + */ + @Transactional(rollbackFor = Exception.class) + public void updateUserPasswordByUsername(String username, SystemUpdateUserPasswordArgs args) throws Exception { + String oldPass = KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), args.getOldPass()); + String newPass = KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), args.getNewPass()); + SystemUserTb user = this.getUserByUsername(username); + if (!passwordEncoder.matches(oldPass, user.getPassword())) { + throw new BadRequestException("修改失败,旧密码错误"); + } + if (passwordEncoder.matches(newPass, user.getPassword())) { + throw new BadRequestException("新密码不能与旧密码相同"); + } + String encryptPassword = passwordEncoder.encode(newPass); + systemUserMapper.updateUserPasswordByUsername(username, encryptPassword); + systemUserInfoDAO.deleteUserLoginInfoByUserName(username); + } + + /** + * 重置密码 -> TestPassed + * + * @param ids 用户id + */ + @Transactional(rollbackFor = Exception.class) + public void resetUserPasswordByIds(Set ids) { + String defaultPwd = passwordEncoder.encode("123456"); + List users = systemUserMapper.listUsernameByIds(ids); + // 清除缓存 + for (String username : users) { + // 清除缓存 + systemUserInfoDAO.deleteUserLoginInfoByUserName(username); + // 强制退出 + systemUserOnlineInfoDAO.kickOutByUsername(username); + } + // 重置密码 + systemUserMapper.updateUserPasswordByUserIds(defaultPwd, ids); + } + + /** + * 修改头像 -> TestPassed + * + * @param multipartFile 文件 + * @return / + */ + @Transactional(rollbackFor = Exception.class) + public Map updateUserAvatar(MultipartFile multipartFile) { + SystemUserTb user = this.getUserByUsername(KitSecurityHelper.getCurrentUsername()); + String username = user.getUsername(); + if (StrUtil.isBlank(username)) { + throw new BadRequestException("异常用户数据, 请联系管理员处理!"); + } + // 文件大小验证 + KitFileUtil.checkSize(fileUploadPathHelper.getAvatarMaxSize(), multipartFile.getSize()); + // 验证文件上传的格式 + String image = "gif jpg png jpeg"; + String fileType = KitFileUtil.getSuffix(multipartFile.getOriginalFilename()); + if (fileType != null && !image.contains(fileType)) { + throw new BadRequestException("文件格式错误, 仅支持 " + image + " 格式!"); + } + String oldPath = user.getAvatarPath(); + File file = KitFileUtil.upload(multipartFile, fileUploadPathHelper.getPath()); + user.setAvatarPath(Objects.requireNonNull(file).getPath()); + user.setAvatarName(file.getName()); + systemUserMapper.updateById(user); + if (StrUtil.isNotBlank(oldPath)) { + KitFileUtil.del(oldPath); + } + systemUserInfoDAO.deleteUserLoginInfoByUserName(username); + return new HashMap<>(1) {{ + put("avatar", file.getName()); + }}; + } + + /** + * 修改邮箱 -> TestPassed + * + * @param username 用户名 + * @param args 参数 + * @param code 验证码 + */ + @Transactional(rollbackFor = Exception.class) + public void updateUserEmailByUsername(String username, SystemUserTb args, String code) throws Exception { + String password = KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), args.getPassword()); + SystemUserTb user = this.getUserByUsername(username); + if (!passwordEncoder.matches(password, user.getPassword())) { + throw new BadRequestException("密码错误"); + } + systemEmailService.checkEmailCaptchaV1(SystemCaptchaBizEnum.EMAIL_RESET_EMAIL_CODE, args.getEmail(), code); + systemUserMapper.updateUserEmailByUsername(username, args.getEmail()); + systemUserInfoDAO.deleteUserLoginInfoByUserName(username); + } + + /** + * 查询全部 -> TestPassed + * + * @param args 条件 + * @param page 分页参数 + * @return / + */ + public KitPageResult searchUserByArgs(SystemQueryUserArgs args, Page page) { + // 查询用户基本信息 + LambdaQueryWrapper wrapper = this.buildUserQueryWrapper(args); + IPage userPage = systemUserMapper.selectPage(page, wrapper); + List users = userPage.getRecords(); + // 转换为SystemUserVo并关联查询 + List userVos = users.stream().map(m -> this.convertToUserVo(m, false)).collect(Collectors.toList()); + return KitPageUtil.toPage(userVos, userPage.getTotal()); + } + + public long countUserByArgs(SystemQueryUserArgs args) { + LambdaQueryWrapper wrapper = this.buildUserQueryWrapper(args); + return systemUserMapper.selectCount(wrapper); + } + + public List queryUserMetadataOptions(KitPageArgs pageArgs) { + SystemQueryUserArgs args = pageArgs.getArgs(); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.select(SystemUserTb::getId, SystemUserTb::getDeptId, SystemUserTb::getEmail, SystemUserTb::getPhone); + wrapper.and(c -> { + c.eq(SystemUserTb::getPhone, args.getBlurry()); + c.or(); + c.eq(SystemUserTb::getEmail, args.getBlurry()); + c.or(); + c.like(SystemUserTb::getUsername, args.getBlurry()); + c.or(); + c.like(SystemUserTb::getNickName, args.getBlurry()); + }); + return systemUserMapper.selectPage(new Page<>(pageArgs.getPage(), 50), wrapper).getRecords().stream().map(m -> { + Map ext = new HashMap<>(1); + ext.put("id", m.getId()); + ext.put("deptId", m.getDeptId()); + ext.put("email", m.getEmail()); + ext.put("phone", m.getPhone()); + return KitSelectOptionVo.builder().label(m.getNickName()).value(String.valueOf(m.getId())).ext(ext).build(); + }).collect(Collectors.toList()); + } + + /** + * 构建用户查询条件 -> TestPassed + * + * @param args 查询条件 + * @return / + */ + private LambdaQueryWrapper buildUserQueryWrapper(SystemQueryUserArgs args) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + if (args != null) { + if (args.getId() != null) { + wrapper.eq(SystemUserTb::getId, args.getId()); + } + if (args.getEnabled() != null) { + wrapper.eq(SystemUserTb::getEnabled, args.getEnabled()); + } + if (CollUtil.isNotEmpty(args.getDeptIds())) { + wrapper.in(SystemUserTb::getDeptId, args.getDeptIds()); + } + if (StrUtil.isNotBlank(args.getBlurry())) { + wrapper.and(w -> w.like(SystemUserTb::getUsername, args.getBlurry()).or() + .like(SystemUserTb::getNickName, args.getBlurry()).or().like(SystemUserTb::getEmail, args.getBlurry())); + } + if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { + wrapper.between(SystemUserTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); + } + } + wrapper.orderByDesc(SystemUserTb::getCreateTime); + return wrapper; + } + + /** + * 转换为SystemUserVo并关联查询部门、角色、岗位信息 -> TestPassed + * + * @param user 用户基本信息 + * @param includePassword 是否包含用户密码 + * @return 包含关联信息的SystemUserVo + */ + private SystemUserVo convertToUserVo(SystemUserTb user, boolean includePassword) { + if (user == null) { + return null; + } + if (!includePassword) { + // 查询用户时,清空密码 + user.setPassword(null); + } + SystemUserVo userVo = KitBeanUtil.copyToClass(user, SystemUserVo.class); + // 查询关联的部门信息 + if (user.getDeptId() != null) { + userVo.setDept(systemDeptService.getDeptVoById(user.getDeptId())); + } + // 查询关联的岗位信息 + userVo.setJobs(systemUserJobService.listUserJobByUserId(user.getId())); + // 查询关联的角色信息 + userVo.setRoles(systemUserRoleService.listUserRoleByUserId(user.getId())); + return userVo; + } + + public SystemUserTb getUserByUsername(String username) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SystemUserTb::getUsername, username); + wrapper.eq(SystemUserTb::getEnabled, 1); + return systemUserMapper.selectOne(wrapper); + } + + public SystemUserVo getUserVoWithPasswordByUsername(String username) { + return this.convertToUserVo(this.getUserByUsername(username), true); + } + + public SystemUserVo getUserVoByUsername(String username) { + return this.convertToUserVo(this.getUserByUsername(username), false); + } + + /** + * 聚合查询 -> TestPassed + */ + public KitPageResult aggregationSearchUserByArgs(Page page, SystemQueryUserArgs args, + String currentUsername) { + if (!ObjectUtils.isEmpty(args.getDeptId())) { + args.getDeptIds().add(args.getDeptId()); + // 先查找是否存在子节点 + List data = systemDeptService.listDeptByPid(args.getDeptId()); + Map> deptPidMap = systemDeptService.listPidNonNull().stream().collect(Collectors.groupingBy(SystemDeptTb::getPid)); + // 然后把子节点的ID都加入到集合中 + args.getDeptIds().addAll(systemDeptService.queryChildDeptIdByDeptIds(data, deptPidMap)); + } + // 数据权限 + List dataScopes = systemDataService.queryDeptIdByArgs(this.getUserVoByUsername(currentUsername)); + // args.getDeptIds() 不为空并且数据权限不为空则取交集 + if (!CollUtil.isEmpty(args.getDeptIds()) && !CollUtil.isEmpty(dataScopes)) { + // 取交集 + args.getDeptIds().retainAll(dataScopes); + if (!CollUtil.isEmpty(args.getDeptIds())) { + return this.searchUserByArgs(args, page); + } + } else { + // 否则取并集 + args.getDeptIds().addAll(dataScopes); + return this.searchUserByArgs(args, page); + } + return KitPageUtil.emptyData(); + } + + /** + * 导出 -> TestPassed + */ + public void exportUserXlsx(HttpServletResponse response, SystemQueryUserArgs args) { + long totalCount = this.countUserByArgs(args); + KitExcelExporter.exportByPage(response, "用户数据", SystemUserExportRowVo.class, totalCount, + (long pageNum, long pageSize) -> { + KitPageResult pageResult = this.searchUserByArgs(args, new Page<>(pageNum, pageSize)); + List rowVos = new ArrayList<>(); + for (SystemUserVo dataObject : pageResult.getContent()) { + SystemUserExportRowVo rowVo = new SystemUserExportRowVo(); + rowVo.setUsername(dataObject.getUsername()); + rowVo.setRoles( + dataObject.getRoles().stream().map(SystemRoleTb::getName).collect(Collectors.joining(","))); + rowVo.setDept(dataObject.getDept().getName()); + rowVo.setJobs( + dataObject.getJobs().stream().map(SystemJobTb::getName).collect(Collectors.joining(","))); + rowVo.setEmail(dataObject.getEmail()); + rowVo.setStatus(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR); + rowVo.setMobile(dataObject.getPhone()); + rowVo.setUpdatePwdTime(dataObject.getPwdResetTime()); + rowVo.setCreateTime(dataObject.getCreateTime()); + rowVos.add(rowVo); + } + return rowVos; }); - return systemUserMapper.selectPage(new Page<>(pageArgs.getPage(), 50), wrapper).getRecords().stream().map(m -> { - Map ext = new HashMap<>(1); - ext.put("id", m.getId()); - ext.put("deptId", m.getDeptId()); - ext.put("email", m.getEmail()); - ext.put("phone", m.getPhone()); - return KitSelectOptionVo.builder().label(m.getNickName()).value(String.valueOf(m.getId())).ext(ext).build(); - }).collect(Collectors.toList()); - } - - /** - * 构建用户查询条件 - * - * @param args 查询条件 - * @return / - */ - private LambdaQueryWrapper buildUserQueryWrapper(SystemQueryUserArgs args) { - KitValidUtil.notNull(args); - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - if (args.getId() != null) { - wrapper.eq(SystemUserTb::getId, args.getId()); - } - if (args.getEnabled() != null) { - wrapper.eq(SystemUserTb::getEnabled, args.getEnabled()); - } - if (CollUtil.isNotEmpty(args.getDeptIds())) { - wrapper.in(SystemUserTb::getDeptId, args.getDeptIds()); - } - if (StrUtil.isNotBlank(args.getBlurry())) { - wrapper.and(w -> w.like(SystemUserTb::getUsername, args.getBlurry()).or() - .like(SystemUserTb::getNickName, args.getBlurry()).or().like(SystemUserTb::getEmail, args.getBlurry())); - } - if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { - wrapper.between(SystemUserTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1)); - } - wrapper.orderByDesc(SystemUserTb::getCreateTime); - return wrapper; - } - - /** - * 转换为SystemUserVo并关联查询部门、角色、岗位信息 - * - * @param user 用户基本信息 - * @param includePassword 是否包含用户密码 - * @return 包含关联信息的SystemUserVo - */ - private SystemUserVo convertToUserVo(SystemUserTb user, boolean includePassword) { - if (user == null) { - return null; - } - if (!includePassword) { - // 查询用户时,清空密码 - user.setPassword(null); - } - SystemUserVo userVo = KitBeanUtil.copyToClass(user, SystemUserVo.class); - // 查询关联的部门信息 - if (user.getDeptId() != null) { - userVo.setDept(systemDeptService.getDeptVoById(user.getDeptId())); - } - // 查询关联的岗位信息 - userVo.setJobs(systemUserJobService.listUserJobByUserId(user.getId())); - // 查询关联的角色信息 - userVo.setRoles(systemUserRoleService.listUserRoleByUserId(user.getId())); - return userVo; - } - - public SystemUserTb getUserByUsername(String username) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemUserTb::getUsername, username); - wrapper.eq(SystemUserTb::getEnabled, 1); - return systemUserMapper.selectOne(wrapper); - } - - public SystemUserVo getUserVoWithPasswordByUsername(String username) { - return this.convertToUserVo(this.getUserByUsername(username), true); - } - - public SystemUserVo getUserVoByUsername(String username) { - return this.convertToUserVo(this.getUserByUsername(username), false); - } - - public SystemUserTb getUserByEmail(String email) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemUserTb::getEmail, email); - wrapper.eq(SystemUserTb::getEnabled, 1); - return systemUserMapper.selectOne(wrapper); - } - - public SystemUserTb getUserByPhone(String phone) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SystemUserTb::getPhone, phone); - wrapper.eq(SystemUserTb::getEnabled, 1); - return systemUserMapper.selectOne(wrapper); - } - - public KitPageResult aggregationSearchUserByArgs(Page page, SystemQueryUserArgs args, - String currentUsername) { - if (!ObjectUtils.isEmpty(args.getDeptId())) { - args.getDeptIds().add(args.getDeptId()); - // 先查找是否存在子节点 - List data = systemDeptService.listDeptByPid(args.getDeptId()); - Map> deptPidMap = - systemDeptService.listPidNonNull().stream().collect(Collectors.groupingBy(SystemDeptTb::getPid)); - // 然后把子节点的ID都加入到集合中 - args.getDeptIds().addAll(systemDeptService.queryChildDeptIdByDeptIds(data, deptPidMap)); - } - // 数据权限 - List dataScopes = systemDataService.queryDeptIdByArgs(this.getUserVoByUsername(currentUsername)); - // args.getDeptIds() 不为空并且数据权限不为空则取交集 - if (!CollUtil.isEmpty(args.getDeptIds()) && !CollUtil.isEmpty(dataScopes)) { - // 取交集 - args.getDeptIds().retainAll(dataScopes); - if (!CollUtil.isEmpty(args.getDeptIds())) { - return this.searchUserByArgs(args, page); - } - } else { - // 否则取并集 - args.getDeptIds().addAll(dataScopes); - return this.searchUserByArgs(args, page); - } - return KitPageUtil.emptyData(); - } - - public void exportUserXlsx(HttpServletResponse response, SystemQueryUserArgs args) { - long totalCount = this.countUserByArgs(args); - KitExcelExporter.exportByPage(response, "用户数据", SystemUserExportRowVo.class, totalCount, - (long pageNum, long pageSize) -> { - KitPageResult pageResult = this.searchUserByArgs(args, new Page<>(pageNum, pageSize)); - List rowVos = new ArrayList<>(); - for (SystemUserVo dataObject : pageResult.getContent()) { - SystemUserExportRowVo rowVo = new SystemUserExportRowVo(); - rowVo.setUsername(dataObject.getUsername()); - rowVo.setRoles( - dataObject.getRoles().stream().map(SystemRoleTb::getName).collect(Collectors.joining(","))); - rowVo.setDept(dataObject.getDept().getName()); - rowVo.setJobs( - dataObject.getJobs().stream().map(SystemJobTb::getName).collect(Collectors.joining(","))); - rowVo.setEmail(dataObject.getEmail()); - rowVo.setStatus(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR); - rowVo.setMobile(dataObject.getPhone()); - rowVo.setUpdatePwdTime(dataObject.getPwdResetTime()); - rowVo.setCreateTime(dataObject.getCreateTime()); - rowVos.add(rowVo); - } - return rowVos; - }); - } + } } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/impl/SystemMinioStorageServiceImpl.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/impl/SystemMinioStorageServiceImpl.java index 5ac7dc3b..7e96e052 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/impl/SystemMinioStorageServiceImpl.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/service/impl/SystemMinioStorageServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,13 +39,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import java.io.File; +import java.util.List; +import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.util.List; /** *

@@ -59,110 +59,110 @@ import java.util.List; public class SystemMinioStorageServiceImpl extends ServiceImpl implements SystemOssStorageService { - @Autowired - private MinioRepository minioRepository; - @Autowired - private AppProperties properties; - @Autowired - private KitFileLocalUploadHelper fileLocalUploadHelper; - @Autowired - private SystemOssStorageMapper systemOssStorageMapper; + @Autowired + private MinioRepository minioRepository; + @Autowired + private AppProperties properties; + @Autowired + private KitFileLocalUploadHelper fileLocalUploadHelper; + @Autowired + private SystemOssStorageMapper systemOssStorageMapper; - @Override - public KitPageResult searchOssStorage(SystemQueryStorageArgs args, - Page page) { - IPage ossStorageTbs = this.selectOssStorageByArgs(args, page); - for (SystemOssStorageVo storageVo : ossStorageTbs.getRecords()) { - storageVo.setFileSizeDesc(KitFileUtil.getSize(storageVo.getFileSize())); - } - return KitPageUtil.toPage(ossStorageTbs); + @Override + public KitPageResult searchOssStorage(SystemQueryStorageArgs args, + Page page) { + IPage ossStorageTbs = this.selectOssStorageByArgs(args, page); + for (SystemOssStorageVo storageVo : ossStorageTbs.getRecords()) { + storageVo.setFileSizeDesc(KitFileUtil.getSize(storageVo.getFileSize())); } + return KitPageUtil.toPage(ossStorageTbs); + } - private IPage selectOssStorageByArgs(SystemQueryStorageArgs args, - Page page) { - KitValidUtil.notNull(args); - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.and(StrUtil.isNotBlank(args.getBlurry()), - c -> c.like(SystemOssStorageTb::getFileName, args.getBlurry()).or() - .like(SystemOssStorageTb::getFilePrefix, args.getBlurry()).or() - .like(SystemOssStorageTb::getFileMime, args.getBlurry()).or() - .like(SystemOssStorageTb::getFileMd5, args.getBlurry())); - if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { - wrapper.between(SystemOssStorageTb::getUpdateTime, args.getCreateTime().get(0), - args.getCreateTime().get(1)); - } - wrapper.orderByAsc(SystemOssStorageTb::getId); - return systemOssStorageMapper.selectPage(page, wrapper) - .convert(i -> KitBeanUtil.copyToClass(i, SystemOssStorageVo.class)); + private IPage selectOssStorageByArgs(SystemQueryStorageArgs args, + Page page) { + KitValidUtil.notNull(args); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.and(StrUtil.isNotBlank(args.getBlurry()), + c -> c.like(SystemOssStorageTb::getFileName, args.getBlurry()).or() + .like(SystemOssStorageTb::getFilePrefix, args.getBlurry()).or() + .like(SystemOssStorageTb::getFileMime, args.getBlurry()).or() + .like(SystemOssStorageTb::getFileMd5, args.getBlurry())); + if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) { + wrapper.between(SystemOssStorageTb::getUpdateTime, args.getCreateTime().get(0), + args.getCreateTime().get(1)); } + wrapper.orderByAsc(SystemOssStorageTb::getId); + return systemOssStorageMapper.selectPage(page, wrapper) + .convert(i -> KitBeanUtil.copyToClass(i, SystemOssStorageVo.class)); + } - @Override - public List queryOssStorage(SystemQueryStorageArgs args) { - // 防止刷数据 - Page page = new Page<>(1, 500); - return searchOssStorage(args, page).getContent(); - } + @Override + public List queryOssStorage(SystemQueryStorageArgs args) { + // 防止刷数据 + Page page = new Page<>(1, 500); + return searchOssStorage(args, page).getContent(); + } - @Override - @Transactional(rollbackFor = Exception.class) - public String uploadFile(MultipartFile file) { - String originalFilename = file.getOriginalFilename(); - if (StrUtil.isBlank(originalFilename)) { - throw new BadRequestException("文件名不能为空"); - } - StorageOSSModel ossConfig = properties.getOss(); - long fileSize = file.getSize(); - String contentType = file.getContentType(); - KitFileUtil.checkSize(ossConfig.getMaxSize(), fileSize); - // 按天分组 - String nowDateStr = KitDateUtil.getNowDateStr(); - // 上传到本地临时目录 - File tempFile = KitFileUtil.upload(file, fileLocalUploadHelper.getPath() + nowDateStr + File.separator); - if (tempFile == null) { - throw new BadRequestException("上传失败"); - } - // 校验文件md5, 看是否已存在云端(不确定, 可能云端已经删除, 但是正常来说云端是不允许私自删除的, 所以这里忽略云端不存在的情况) - String md5 = KitFileUtil.getMd5(tempFile); - SystemOssStorageTb systemOssStorageTb = this.getOssStorageByMd5(md5); - if (systemOssStorageTb != null) { - // 重新生成7天链接 - return minioRepository.generatePreviewUrl(systemOssStorageTb.getObjectName()); - } - // 上传到OSS - SystemOssStorageTb storageTb = minioRepository.upload(tempFile, originalFilename, fileSize, contentType, md5); - if (storageTb == null) { - throw new BadRequestException("文件上传失败"); - } - save(storageTb); - return minioRepository.generatePreviewUrl(storageTb.getObjectName()); + @Override + @Transactional(rollbackFor = Exception.class) + public String uploadFile(MultipartFile file) { + String originalFilename = file.getOriginalFilename(); + if (StrUtil.isBlank(originalFilename)) { + throw new BadRequestException("文件名不能为空"); } + StorageOSSModel ossConfig = properties.getOss(); + long fileSize = file.getSize(); + String contentType = file.getContentType(); + KitFileUtil.checkSize(ossConfig.getMaxSize(), fileSize); + // 按天分组 + String nowDateStr = KitDateUtil.getNowDateStr(); + // 上传到本地临时目录 + File tempFile = KitFileUtil.upload(file, fileLocalUploadHelper.getPath() + nowDateStr + File.separator); + if (tempFile == null) { + throw new BadRequestException("上传失败"); + } + // 校验文件md5, 看是否已存在云端(不确定, 可能云端已经删除, 但是正常来说云端是不允许私自删除的, 所以这里忽略云端不存在的情况) + String md5 = KitFileUtil.getMd5(tempFile); + SystemOssStorageTb systemOssStorageTb = this.getOssStorageByMd5(md5); + if (systemOssStorageTb != null) { + // 重新生成7天链接 + return minioRepository.generatePreviewUrl(systemOssStorageTb.getObjectName()); + } + // 上传到OSS + SystemOssStorageTb storageTb = minioRepository.upload(tempFile, originalFilename, fileSize, contentType, md5); + if (storageTb == null) { + throw new BadRequestException("文件上传失败"); + } + save(storageTb); + return minioRepository.generatePreviewUrl(storageTb.getObjectName()); + } - /** - * 多选删除 - * - * @param ids / - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void deleteFileByIds(Long[] ids) { - for (Long id : ids) { - SystemOssStorageTb storage = getById(id); - minioRepository.removeBucketFile(storage.getObjectName()); - removeById(storage); - } + /** + * 多选删除 + * + * @param ids / + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteFileByIds(Long[] ids) { + for (Long id : ids) { + SystemOssStorageTb storage = getById(id); + minioRepository.removeBucketFile(storage.getObjectName()); + removeById(storage); } + } - @Override - public void exportOssStorageXlsx(HttpServletResponse response, SystemQueryStorageArgs args) { - List systemOssStorageVos = this.queryOssStorage(args); - // KitXlsxExportUtil.exportFile(response, "OSS文件上传记录数据", systemOssStorageVos, SystemOssStorageExportRowVo.class, - // (dataObject) -> CollUtil.newArrayList(KitBeanUtil.copyProperties(dataObject, SystemOssStorageExportRowVo.class))); - List rowVos = - KitBeanUtil.copyToList(systemOssStorageVos, SystemOssStorageExportRowVo.class); - KitExcelExporter.exportSimple(response, "OSS文件上传记录数据", SystemOssStorageExportRowVo.class, rowVos); - } + @Override + public void exportOssStorageXlsx(HttpServletResponse response, SystemQueryStorageArgs args) { + List systemOssStorageVos = this.queryOssStorage(args); + // KitXlsxExportUtil.exportFile(response, "OSS文件上传记录数据", systemOssStorageVos, SystemOssStorageExportRowVo.class, + // (dataObject) -> CollUtil.newArrayList(KitBeanUtil.copyProperties(dataObject, SystemOssStorageExportRowVo.class))); + List rowVos = + KitBeanUtil.copyToList(systemOssStorageVos, SystemOssStorageExportRowVo.class); + KitExcelExporter.exportSimple(response, "OSS文件上传记录数据", SystemOssStorageExportRowVo.class, rowVos); + } - private SystemOssStorageTb getOssStorageByMd5(String md5) { - return lambdaQuery().eq(SystemOssStorageTb::getFileMd5, md5).one(); - } + private SystemOssStorageTb getOssStorageByMd5(String md5) { + return lambdaQuery().eq(SystemOssStorageTb::getFileMd5, md5).one(); + } } diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/util/KitSqlUtil.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/util/KitSqlUtil.java index 63d538b5..7ab4e498 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/util/KitSqlUtil.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/util/KitSqlUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-system/src/main/resources/mapper/SystemDictDetailMapper.xml b/cutejava/cutejava-module-system/src/main/resources/mapper/SystemDictDetailMapper.xml index ad6e4642..c8985ddd 100644 --- a/cutejava/cutejava-module-system/src/main/resources/mapper/SystemDictDetailMapper.xml +++ b/cutejava/cutejava-module-system/src/main/resources/mapper/SystemDictDetailMapper.xml @@ -1,29 +1,29 @@ - - + + diff --git a/cutejava/cutejava-module-system/src/main/resources/mapper/SystemRoleMapper.xml b/cutejava/cutejava-module-system/src/main/resources/mapper/SystemRoleMapper.xml new file mode 100644 index 00000000..486a3730 --- /dev/null +++ b/cutejava/cutejava-module-system/src/main/resources/mapper/SystemRoleMapper.xml @@ -0,0 +1,13 @@ + + + + + diff --git a/cutejava/cutejava-module-system/src/main/resources/mapper/SystemRoleMenuMapper.xml b/cutejava/cutejava-module-system/src/main/resources/mapper/SystemRoleMenuMapper.xml new file mode 100644 index 00000000..c19292ae --- /dev/null +++ b/cutejava/cutejava-module-system/src/main/resources/mapper/SystemRoleMenuMapper.xml @@ -0,0 +1,40 @@ + + + + + + + diff --git a/cutejava/cutejava-module-system/src/main/resources/mapper/SystemUserMapper.xml b/cutejava/cutejava-module-system/src/main/resources/mapper/SystemUserMapper.xml new file mode 100644 index 00000000..87c7aad5 --- /dev/null +++ b/cutejava/cutejava-module-system/src/main/resources/mapper/SystemUserMapper.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/cutejava/cutejava-module-system/src/main/resources/mapper/SystemUserRoleMapper.xml b/cutejava/cutejava-module-system/src/main/resources/mapper/SystemUserRoleMapper.xml index 177b248e..19b83a1f 100644 --- a/cutejava/cutejava-module-system/src/main/resources/mapper/SystemUserRoleMapper.xml +++ b/cutejava/cutejava-module-system/src/main/resources/mapper/SystemUserRoleMapper.xml @@ -7,4 +7,16 @@ LEFT JOIN system_users_roles t2 ON t1.role_id = t2.role_id WHERE t2.user_id = #{userId} + + diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/constant/TaskChangeTypeEnum.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/constant/TaskChangeTypeEnum.java index 6d207108..e89270cb 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/constant/TaskChangeTypeEnum.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/constant/TaskChangeTypeEnum.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/constant/TaskStatusEnum.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/constant/TaskStatusEnum.java index ff694321..ba909156 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/constant/TaskStatusEnum.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/constant/TaskStatusEnum.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/controller/TaskTestsController.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/controller/TaskTestsController.java index 208fa520..9a7f329d 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/controller/TaskTestsController.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/controller/TaskTestsController.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/TaskJobBean.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/TaskJobBean.java index 8631f7a0..d390162a 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/TaskJobBean.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/TaskJobBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/TaskManage.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/TaskManage.java index a722d520..ba7b3400 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/TaskManage.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/TaskManage.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/TaskStepExecutor.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/TaskStepExecutor.java index a56ec20f..d9378d61 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/TaskStepExecutor.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/TaskStepExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/impl/TaskStepNodeBuildJava.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/impl/TaskStepNodeBuildJava.java index be202e44..a4692189 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/impl/TaskStepNodeBuildJava.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/impl/TaskStepNodeBuildJava.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/impl/TaskStepNodeDeployJava.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/impl/TaskStepNodeDeployJava.java index 37e11fb0..12830fd3 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/impl/TaskStepNodeDeployJava.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/impl/TaskStepNodeDeployJava.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/impl/TaskStepNodeInit.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/impl/TaskStepNodeInit.java index 4a2adfcf..15f2b52d 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/impl/TaskStepNodeInit.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/impl/TaskStepNodeInit.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/impl/TaskStepNodeMergeBranch.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/impl/TaskStepNodeMergeBranch.java index 442aab2c..380105ce 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/impl/TaskStepNodeMergeBranch.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/core/impl/TaskStepNodeMergeBranch.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/dataobject/TaskInstanceDetailTb.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/dataobject/TaskInstanceDetailTb.java index eb040ad3..5514975e 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/dataobject/TaskInstanceDetailTb.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/dataobject/TaskInstanceDetailTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/dataobject/TaskInstanceInfoTb.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/dataobject/TaskInstanceInfoTb.java index bb2bb838..36a0c187 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/dataobject/TaskInstanceInfoTb.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/dataobject/TaskInstanceInfoTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/dataobject/TaskInstanceStepDetailTb.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/dataobject/TaskInstanceStepDetailTb.java index 04238676..3c69c2c3 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/dataobject/TaskInstanceStepDetailTb.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/dataobject/TaskInstanceStepDetailTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/dataobject/TaskTemplateInfoTb.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/dataobject/TaskTemplateInfoTb.java index b1a3ba56..942199b4 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/dataobject/TaskTemplateInfoTb.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/dataobject/TaskTemplateInfoTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/model/TaskInstanceNodeVo.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/model/TaskInstanceNodeVo.java index a9dea70b..e6dd8bac 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/model/TaskInstanceNodeVo.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/model/TaskInstanceNodeVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/model/TaskTemplateInfoVo.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/model/TaskTemplateInfoVo.java index 7028ebe2..a89a7a6c 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/model/TaskTemplateInfoVo.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/model/TaskTemplateInfoVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/model/TaskTemplateNodeOperateButtonVo.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/model/TaskTemplateNodeOperateButtonVo.java index 3140f825..13149734 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/model/TaskTemplateNodeOperateButtonVo.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/model/TaskTemplateNodeOperateButtonVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,4 +46,4 @@ public class TaskTemplateNodeOperateButtonVo extends KitObject { * 默认附加参数 */ private Map parameters = new HashMap<>(); -} \ No newline at end of file +} diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/model/TaskTemplateNodeVo.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/model/TaskTemplateNodeVo.java index c2189617..452f9b31 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/model/TaskTemplateNodeVo.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/model/TaskTemplateNodeVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/mysql/TaskInstanceDetailMapper.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/mysql/TaskInstanceDetailMapper.java index c79849e5..d5fb9618 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/mysql/TaskInstanceDetailMapper.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/mysql/TaskInstanceDetailMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/mysql/TaskInstanceInfoMapper.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/mysql/TaskInstanceInfoMapper.java index 682b0b8c..aa3e0498 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/mysql/TaskInstanceInfoMapper.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/mysql/TaskInstanceInfoMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/mysql/TaskInstanceStepDetailMapper.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/mysql/TaskInstanceStepDetailMapper.java index 67451484..29ee185c 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/mysql/TaskInstanceStepDetailMapper.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/mysql/TaskInstanceStepDetailMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/mysql/TaskTemplateInfoMapper.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/mysql/TaskTemplateInfoMapper.java index 3a646577..efc58273 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/mysql/TaskTemplateInfoMapper.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/dal/mysql/TaskTemplateInfoMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/service/TaskInstanceDetailService.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/service/TaskInstanceDetailService.java index be7c69e9..0f3b9434 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/service/TaskInstanceDetailService.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/service/TaskInstanceDetailService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/service/TaskInstanceInfoService.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/service/TaskInstanceInfoService.java index 97437c85..cbcbd5aa 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/service/TaskInstanceInfoService.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/service/TaskInstanceInfoService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/service/TaskInstanceStepDetailService.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/service/TaskInstanceStepDetailService.java index 6284be14..714fbbc9 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/service/TaskInstanceStepDetailService.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/service/TaskInstanceStepDetailService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/service/TaskTemplateInfoService.java b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/service/TaskTemplateInfoService.java index 6f0a9195..d89a1ca5 100644 --- a/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/service/TaskTemplateInfoService.java +++ b/cutejava/cutejava-module-task-v1/src/main/java/cn/odboy/task/service/TaskTemplateInfoService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/constant/TaskChangeTypeEnum.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/constant/TaskChangeTypeEnum.java index 6d207108..e89270cb 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/constant/TaskChangeTypeEnum.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/constant/TaskChangeTypeEnum.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/constant/TaskStatusEnum.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/constant/TaskStatusEnum.java index ff694321..ba909156 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/constant/TaskStatusEnum.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/constant/TaskStatusEnum.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/controller/TaskTestsController.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/controller/TaskTestsController.java index 208fa520..9a7f329d 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/controller/TaskTestsController.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/controller/TaskTestsController.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/TaskJobBean.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/TaskJobBean.java index 2317be99..0954075f 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/TaskJobBean.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/TaskJobBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/TaskManage.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/TaskManage.java index 0bc73a1b..dd4a9789 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/TaskManage.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/TaskManage.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/TaskStepExecutor.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/TaskStepExecutor.java index 21483e9b..06b21b88 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/TaskStepExecutor.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/TaskStepExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/impl/TaskStepNodeBuildJava.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/impl/TaskStepNodeBuildJava.java index be202e44..a4692189 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/impl/TaskStepNodeBuildJava.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/impl/TaskStepNodeBuildJava.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/impl/TaskStepNodeDeployJava.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/impl/TaskStepNodeDeployJava.java index 37e11fb0..12830fd3 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/impl/TaskStepNodeDeployJava.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/impl/TaskStepNodeDeployJava.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/impl/TaskStepNodeInit.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/impl/TaskStepNodeInit.java index 4a2adfcf..15f2b52d 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/impl/TaskStepNodeInit.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/impl/TaskStepNodeInit.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/impl/TaskStepNodeMergeBranch.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/impl/TaskStepNodeMergeBranch.java index 442aab2c..380105ce 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/impl/TaskStepNodeMergeBranch.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/core/impl/TaskStepNodeMergeBranch.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/dataobject/TaskInstanceDetailTb.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/dataobject/TaskInstanceDetailTb.java index eb040ad3..5514975e 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/dataobject/TaskInstanceDetailTb.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/dataobject/TaskInstanceDetailTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/dataobject/TaskInstanceInfoTb.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/dataobject/TaskInstanceInfoTb.java index bb2bb838..36a0c187 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/dataobject/TaskInstanceInfoTb.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/dataobject/TaskInstanceInfoTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/dataobject/TaskInstanceStepDetailTb.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/dataobject/TaskInstanceStepDetailTb.java index 04238676..3c69c2c3 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/dataobject/TaskInstanceStepDetailTb.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/dataobject/TaskInstanceStepDetailTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/dataobject/TaskTemplateInfoTb.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/dataobject/TaskTemplateInfoTb.java index b1a3ba56..942199b4 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/dataobject/TaskTemplateInfoTb.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/dataobject/TaskTemplateInfoTb.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/model/TaskInstanceNodeVo.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/model/TaskInstanceNodeVo.java index a9dea70b..e6dd8bac 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/model/TaskInstanceNodeVo.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/model/TaskInstanceNodeVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/model/TaskTemplateInfoVo.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/model/TaskTemplateInfoVo.java index 7028ebe2..a89a7a6c 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/model/TaskTemplateInfoVo.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/model/TaskTemplateInfoVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/model/TaskTemplateNodeOperateButtonVo.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/model/TaskTemplateNodeOperateButtonVo.java index 3140f825..13149734 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/model/TaskTemplateNodeOperateButtonVo.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/model/TaskTemplateNodeOperateButtonVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,4 +46,4 @@ public class TaskTemplateNodeOperateButtonVo extends KitObject { * 默认附加参数 */ private Map parameters = new HashMap<>(); -} \ No newline at end of file +} diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/model/TaskTemplateNodeVo.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/model/TaskTemplateNodeVo.java index c2189617..452f9b31 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/model/TaskTemplateNodeVo.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/model/TaskTemplateNodeVo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/mysql/TaskInstanceDetailMapper.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/mysql/TaskInstanceDetailMapper.java index c79849e5..d5fb9618 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/mysql/TaskInstanceDetailMapper.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/mysql/TaskInstanceDetailMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/mysql/TaskInstanceInfoMapper.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/mysql/TaskInstanceInfoMapper.java index 682b0b8c..aa3e0498 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/mysql/TaskInstanceInfoMapper.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/mysql/TaskInstanceInfoMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/mysql/TaskInstanceStepDetailMapper.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/mysql/TaskInstanceStepDetailMapper.java index 67451484..29ee185c 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/mysql/TaskInstanceStepDetailMapper.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/mysql/TaskInstanceStepDetailMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/mysql/TaskTemplateInfoMapper.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/mysql/TaskTemplateInfoMapper.java index 3a646577..efc58273 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/mysql/TaskTemplateInfoMapper.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/dal/mysql/TaskTemplateInfoMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/service/TaskInstanceDetailService.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/service/TaskInstanceDetailService.java index 36c6fe94..692cb1a6 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/service/TaskInstanceDetailService.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/service/TaskInstanceDetailService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -115,4 +115,4 @@ public class TaskInstanceDetailService { public void removeByIds(List taskInstanceDetailIds) { taskInstanceDetailMapper.deleteByIds(taskInstanceDetailIds); } -} \ No newline at end of file +} diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/service/TaskInstanceInfoService.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/service/TaskInstanceInfoService.java index 103fb74a..820fa6ef 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/service/TaskInstanceInfoService.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/service/TaskInstanceInfoService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -113,4 +113,4 @@ public class TaskInstanceInfoService { public TaskInstanceInfoTb getById(Long id) { return taskInstanceInfoMapper.selectById(id); } -} \ No newline at end of file +} diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/service/TaskInstanceStepDetailService.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/service/TaskInstanceStepDetailService.java index 4102c85e..c8e9e7f5 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/service/TaskInstanceStepDetailService.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/service/TaskInstanceStepDetailService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/service/TaskTemplateInfoService.java b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/service/TaskTemplateInfoService.java index 6f0a9195..d89a1ca5 100644 --- a/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/service/TaskTemplateInfoService.java +++ b/cutejava/cutejava-module-task-v2/src/main/java/cn/odboy/task/service/TaskTemplateInfoService.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-starter/src/main/java/cn/odboy/AppRun.java b/cutejava/cutejava-starter/src/main/java/cn/odboy/AppRun.java index 04b35d94..d214a4a7 100644 --- a/cutejava/cutejava-starter/src/main/java/cn/odboy/AppRun.java +++ b/cutejava/cutejava-starter/src/main/java/cn/odboy/AppRun.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-starter/src/main/java/cn/odboy/GenCode.java b/cutejava/cutejava-starter/src/main/java/cn/odboy/GenCode.java index 9f44c44f..6836c9cb 100644 --- a/cutejava/cutejava-starter/src/main/java/cn/odboy/GenCode.java +++ b/cutejava/cutejava-starter/src/main/java/cn/odboy/GenCode.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-starter/src/main/java/cn/odboy/HealthCheckPointer.java b/cutejava/cutejava-starter/src/main/java/cn/odboy/HealthCheckPointer.java index b9b36166..b2bef407 100644 --- a/cutejava/cutejava-starter/src/main/java/cn/odboy/HealthCheckPointer.java +++ b/cutejava/cutejava-starter/src/main/java/cn/odboy/HealthCheckPointer.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-starter/src/test/java/cn/odboy/MyBatisMapperTests.java b/cutejava/cutejava-starter/src/test/java/cn/odboy/MyBatisMapperTests.java index 86fb5cae..14cb5d8e 100644 --- a/cutejava/cutejava-starter/src/test/java/cn/odboy/MyBatisMapperTests.java +++ b/cutejava/cutejava-starter/src/test/java/cn/odboy/MyBatisMapperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-starter/src/test/java/cn/odboy/SystemApplicationTests.java b/cutejava/cutejava-starter/src/test/java/cn/odboy/SystemApplicationTests.java index fb91edb9..a6ab603e 100644 --- a/cutejava/cutejava-starter/src/test/java/cn/odboy/SystemApplicationTests.java +++ b/cutejava/cutejava-starter/src/test/java/cn/odboy/SystemApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-starter/src/test/java/cn/odboy/util/KitDesEncryptUtilTest.java b/cutejava/cutejava-starter/src/test/java/cn/odboy/util/KitDesEncryptUtilTest.java index 0e560a13..2e8c0c4d 100644 --- a/cutejava/cutejava-starter/src/test/java/cn/odboy/util/KitDesEncryptUtilTest.java +++ b/cutejava/cutejava-starter/src/test/java/cn/odboy/util/KitDesEncryptUtilTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-starter/src/test/java/cn/odboy/util/KitFileUtilTest.java b/cutejava/cutejava-starter/src/test/java/cn/odboy/util/KitFileUtilTest.java index d5f5ec3c..4c34e7f4 100644 --- a/cutejava/cutejava-starter/src/test/java/cn/odboy/util/KitFileUtilTest.java +++ b/cutejava/cutejava-starter/src/test/java/cn/odboy/util/KitFileUtilTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-starter/src/test/java/cn/odboy/util/KitStringUtilTest.java b/cutejava/cutejava-starter/src/test/java/cn/odboy/util/KitStringUtilTest.java index 936e725c..57d84f43 100644 --- a/cutejava/cutejava-starter/src/test/java/cn/odboy/util/KitStringUtilTest.java +++ b/cutejava/cutejava-starter/src/test/java/cn/odboy/util/KitStringUtilTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cutejava/cutejava-starter/src/test/java/cn/odboy/util/WorkTimeTests.java b/cutejava/cutejava-starter/src/test/java/cn/odboy/util/WorkTimeTests.java index 06dafdef..2dedc135 100644 --- a/cutejava/cutejava-starter/src/test/java/cn/odboy/util/WorkTimeTests.java +++ b/cutejava/cutejava-starter/src/test/java/cn/odboy/util/WorkTimeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2025 Odboy + * Copyright 2021-2026 Odboy * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.