Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

16章无法兼容15章逻辑 #1

Open
wangzhihui1797 opened this issue Apr 18, 2023 · 0 comments
Open

16章无法兼容15章逻辑 #1

wangzhihui1797 opened this issue Apr 18, 2023 · 0 comments

Comments

@wangzhihui1797
Copy link

wangzhihui1797 commented Apr 18, 2023

问题描述:16章新增了解析动态标签"if"和"trim"的逻辑,但是忽略了对“selectKey”标签的特殊处理,导致程序错误。

代码位置:https://github.com/fuzhengwei/book-small-mybatis/blob/main/mybatis-step-16/src/main/java/cn/bugstack/mybatis/scripting/xmltags/XMLScriptBuilder.java#L67

解决方案:由于本人能力有限,只能针对"selectKey“标签的分支进行countinue处理,请小傅哥看到帮忙解决,十分感谢。
} else if (child.getNodeType() == Node.ELEMENT_NODE) {
String nodeName = child.getName();
if (nodeName.equals("selectKey")) {
continue;
}
NodeHandler handler = nodeHandlerMap.get(nodeName);
if (handler == null) {
throw new RuntimeException("Unknown element <" + nodeName + "> in SQL statement.");
}
handler.handleNode(element.element(child.getName()), contents);
isDynamic = true;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant