mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-10-31 10:57:13 +08:00 
			
		
		
		
	style: 适配 Java 11 新 API
1.对 Optional 的 isPresent() 取反用法 => isEmpty() 2.集合 toArray(new String[0]) 用法 => toArray(String[]::new)
This commit is contained in:
		| @@ -200,14 +200,14 @@ public class MailUtils { | ||||
|         // 设置收信人 | ||||
|         // 抄送人 | ||||
|         if (CollUtil.isNotEmpty(ccs)) { | ||||
|             messageHelper.setCc(ccs.toArray(new String[0])); | ||||
|             messageHelper.setCc(ccs.toArray(String[]::new)); | ||||
|         } | ||||
|         // 密送人 | ||||
|         if (CollUtil.isNotEmpty(bccs)) { | ||||
|             messageHelper.setBcc(bccs.toArray(new String[0])); | ||||
|             messageHelper.setBcc(bccs.toArray(String[]::new)); | ||||
|         } | ||||
|         // 收件人 | ||||
|         messageHelper.setTo(tos.toArray(new String[0])); | ||||
|         messageHelper.setTo(tos.toArray(String[]::new)); | ||||
|  | ||||
|         // 设置附件 | ||||
|         if (ArrayUtil.isNotEmpty(files)) { | ||||
|   | ||||
| @@ -16,7 +16,10 @@ | ||||
|  | ||||
| package top.charles7c.cnadmin.webapi.controller.common; | ||||
|  | ||||
| import java.util.*; | ||||
| import java.util.Arrays; | ||||
| import java.util.List; | ||||
| import java.util.Optional; | ||||
| import java.util.Set; | ||||
| import java.util.stream.Collectors; | ||||
|  | ||||
| import lombok.RequiredArgsConstructor; | ||||
| @@ -25,7 +28,10 @@ import io.swagger.v3.oas.annotations.Operation; | ||||
| import io.swagger.v3.oas.annotations.tags.Tag; | ||||
|  | ||||
| import org.springframework.validation.annotation.Validated; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | ||||
| import org.springframework.web.bind.annotation.PathVariable; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
|  | ||||
| import cn.hutool.core.lang.tree.Tree; | ||||
| import cn.hutool.core.util.ClassUtil; | ||||
| @@ -92,7 +98,7 @@ public class CommonController { | ||||
|         Set<Class<?>> classSet = ClassUtil.scanPackageBySuper(properties.getBasePackage(), BaseEnum.class); | ||||
|         Optional<Class<?>> first = | ||||
|             classSet.stream().filter(c -> c.getSimpleName().equalsIgnoreCase(enumTypeName)).findFirst(); | ||||
|         if (!first.isPresent()) { | ||||
|         if (first.isEmpty()) { | ||||
|             return R.fail("枚举字典不存在"); | ||||
|         } | ||||
|         // 转换枚举为字典列表 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user