* What went wrong:
Execution failed for task ':generate'.
> freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:
==> primaryKeys[0] [in template "src/src/main/java/${root.javaPackagePath}/${moduleName}/mgt/controller/${entityName}Controller.java.ftl" a
t line 169, column 60]
----
Tip: It's the final [] step that caused this error, not those before it.
----
Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value li
ke myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expressi
on; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
FTL stack trace ("~" means nesting-related):
- Failed at: ${primaryKeys[0].name} [in template "src/src/main/java/${root.javaPackagePath}/${moduleName}/mgt/controller/${entityName
}Controller.java.ftl" at line 169, column 58]
----
================================================================
primaryKeys的获取代码
def primaryKeys = metadata.getPrimaryKeys(null, schema, tableName)
169行报错代码
public ${entityName}Response view(@PathVariable("${primaryKeys[0].name}") final ${primaryKeys[0].type} ${primaryKeys[0].name}, Locale locale) {
请使用${(primaryKeys[0].name)!}请使用${(primaryKeys[0].name)!}非常感谢,这个真的帮了我很大的忙了,由于工作比较忙,忘了感谢您了。非常感谢您,太厉害了!
${(primaryKeys[0].name)!}这种写法相比较 ${primaryKeys[0].name}来说是不是当传值为空时,不报错了,测试有用的,就是不明白原理,大佬厉害,真的很强!!
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
你好,我是AI助理
可以解答问题、推荐解决方案等
评论
全部评论 (0)