com.revengemission.plugins.mybatis.ModifyUpdateSqlPlugin Maven / Gradle / Ivy
package com.revengemission.plugins.mybatis;
import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.dom.xml.XmlElement;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* 修改自动生成的update语句
*/
public class ModifyUpdateSqlPlugin extends AbstractXmbgPlugin {
Map todo = new LinkedHashMap<>();
@Override
public void initialized(IntrospectedTable introspectedTable) {
todo.clear();
properties.forEach((k, v) -> {
todo.put(k.toString().trim(), v.toString().trim());
});
}
@Override
public boolean validate(List list) {
return true;
}
@Override
public boolean sqlMapUpdateByExampleSelectiveElementGenerated(
XmlElement element, IntrospectedTable introspectedTable) {
replaceElement(element, todo);
return true;
}
@Override
public boolean sqlMapUpdateByExampleWithBLOBsElementGenerated(
XmlElement element, IntrospectedTable introspectedTable) {
replaceElement(element, todo);
return true;
}
@Override
public boolean sqlMapUpdateByExampleWithoutBLOBsElementGenerated(
XmlElement element, IntrospectedTable introspectedTable) {
replaceElement(element, todo);
return true;
}
@Override
public boolean sqlMapUpdateByPrimaryKeySelectiveElementGenerated(
XmlElement element, IntrospectedTable introspectedTable) {
replaceElement(element, todo);
return true;
}
@Override
public boolean sqlMapUpdateByPrimaryKeyWithoutBLOBsElementGenerated(
XmlElement element, IntrospectedTable introspectedTable) {
replaceElement(element, todo);
return true;
}
@Override
public boolean sqlMapUpdateByPrimaryKeyWithBLOBsElementGenerated(
XmlElement element, IntrospectedTable introspectedTable) {
replaceElement(element, todo);
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy