mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 16:23:42 +08:00 
			
		
		
		
	update 优化 代码书写格式
This commit is contained in:
		@@ -81,6 +81,7 @@ public class FlwNodeExtServiceImpl implements NodeExtService {
 | 
				
			|||||||
     * @param sources 数据来源(枚举类或字典类型)
 | 
					     * @param sources 数据来源(枚举类或字典类型)
 | 
				
			||||||
     * @return 构建的 `NodeExt` 对象
 | 
					     * @return 构建的 `NodeExt` 对象
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
 | 
					    @SuppressWarnings("unchecked cast")
 | 
				
			||||||
    private NodeExt buildNodeExt(String code, String name, int type, List<Object> sources) {
 | 
					    private NodeExt buildNodeExt(String code, String name, int type, List<Object> sources) {
 | 
				
			||||||
        NodeExt nodeExt = new NodeExt();
 | 
					        NodeExt nodeExt = new NodeExt();
 | 
				
			||||||
        nodeExt.setCode(code);
 | 
					        nodeExt.setCode(code);
 | 
				
			||||||
@@ -89,7 +90,7 @@ public class FlwNodeExtServiceImpl implements NodeExtService {
 | 
				
			|||||||
        nodeExt.setChilds(sources.stream()
 | 
					        nodeExt.setChilds(sources.stream()
 | 
				
			||||||
            .map(source -> {
 | 
					            .map(source -> {
 | 
				
			||||||
                if (source instanceof Class<?> clazz && NodeExtEnum.class.isAssignableFrom(clazz)) {
 | 
					                if (source instanceof Class<?> clazz && NodeExtEnum.class.isAssignableFrom(clazz)) {
 | 
				
			||||||
                    return buildChildNode((Class<? extends Enum<?>>) clazz);
 | 
					                    return buildChildNode((Class<? extends NodeExtEnum>) clazz);
 | 
				
			||||||
                } else if (source instanceof String dictType) {
 | 
					                } else if (source instanceof String dictType) {
 | 
				
			||||||
                    return buildChildNode(dictType);
 | 
					                    return buildChildNode(dictType);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@@ -107,7 +108,7 @@ public class FlwNodeExtServiceImpl implements NodeExtService {
 | 
				
			|||||||
     * @param enumClass 枚举类,必须实现 `NodeExtEnum` 接口
 | 
					     * @param enumClass 枚举类,必须实现 `NodeExtEnum` 接口
 | 
				
			||||||
     * @return 构建的 `ChildNode` 对象
 | 
					     * @return 构建的 `ChildNode` 对象
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private NodeExt.ChildNode buildChildNode(Class<? extends Enum<?>> enumClass) {
 | 
					    private NodeExt.ChildNode buildChildNode(Class<? extends NodeExtEnum> enumClass) {
 | 
				
			||||||
        if (!enumClass.isEnum()) {
 | 
					        if (!enumClass.isEnum()) {
 | 
				
			||||||
            return null;
 | 
					            return null;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -117,7 +118,6 @@ public class FlwNodeExtServiceImpl implements NodeExtService {
 | 
				
			|||||||
        childNode.setCode(simpleName);
 | 
					        childNode.setCode(simpleName);
 | 
				
			||||||
        // 字典,下拉框和复选框时用到
 | 
					        // 字典,下拉框和复选框时用到
 | 
				
			||||||
        childNode.setDict(Arrays.stream(enumClass.getEnumConstants())
 | 
					        childNode.setDict(Arrays.stream(enumClass.getEnumConstants())
 | 
				
			||||||
            .filter(NodeExtEnum.class::isInstance)
 | 
					 | 
				
			||||||
            .map(NodeExtEnum.class::cast)
 | 
					            .map(NodeExtEnum.class::cast)
 | 
				
			||||||
            .map(x ->
 | 
					            .map(x ->
 | 
				
			||||||
                new NodeExt.DictItem(x.getLabel(), x.getValue(), x.isSelected())
 | 
					                new NodeExt.DictItem(x.getLabel(), x.getValue(), x.isSelected())
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user