Skip to content

Add clientUpdateByPrimaryKeyMethodGenerated method #1118

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

Merged
merged 2 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1274,4 +1274,16 @@ public boolean shouldGenerate(IntrospectedTable introspectedTable) {

return true;
}

@Override
public boolean clientUpdateByPrimaryKeyMethodGenerated(Method method, Interface interfaze,
IntrospectedTable introspectedTable) {
for (Plugin plugin : plugins) {
if (!plugin.clientUpdateByPrimaryKeyMethodGenerated(method, interfaze, introspectedTable)) {
return false;
}
}

return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2044,4 +2044,30 @@ default boolean clientUpdateByPrimaryKeyMethodGenerated(KotlinFunction kotlinFun
default boolean shouldGenerate(IntrospectedTable introspectedTable) {
return true;
}

/**
* The motivation for adding this method can be found in
* https://github.com/mybatis/generator/issues/1116
*
* This method is called when the updateByPrimaryKey method
* has been generated in the dynamic SQL runtime client interface.
*
* @param method
* the generated updateByPrimaryKey method
* @param interfaze
* the partially implemented client interface. You can add
* additional imported classes to the interface if
* necessary.
* @param introspectedTable
* The class containing information about the table as
* introspected from the database
* @return true if the method should be generated, false if the generated
* method should be ignored. In the case of multiple plugins, the
* first plugin returning false will disable the calling of further
* plugins.
*/
default boolean clientUpdateByPrimaryKeyMethodGenerated(Method method,
Interface interfaze, IntrospectedTable introspectedTable) {
return clientUpdateByPrimaryKeyWithBLOBsMethodGenerated(method, interfaze, introspectedTable);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public MethodAndImports generateMethodAndImports() {

@Override
public boolean callPlugins(Method method, Interface interfaze) {
return context.getPlugins().clientUpdateByPrimaryKeyWithBLOBsMethodGenerated(method,
return context.getPlugins().clientUpdateByPrimaryKeyMethodGenerated(method,
interfaze, introspectedTable);
}

Expand Down