All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mboog.generator.plugins.pagination.PostgreSQLPaginationPlugin Maven / Gradle / Ivy

There is a newer version: 1.2.4
Show newest version
package mboog.generator.plugins.pagination;

import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.dom.xml.Attribute;
import org.mybatis.generator.api.dom.xml.TextElement;
import org.mybatis.generator.api.dom.xml.XmlElement;

import java.util.List;

/**
 * @author LiYi
 */
public class PostgreSQLPaginationPlugin extends AbstractPaginationPlugin {

    @Override
    public String getDataBaseType() {
        return null;
    }

    @Override
    public boolean sqlMapSelectByExampleWithoutBLOBsElementGenerated(XmlElement element,
                                                                     IntrospectedTable introspectedTable) {

        XmlElement isNotNullElement = new XmlElement("if");
        isNotNullElement.addAttribute(new Attribute("test", "limitStart != null"));
        isNotNullElement.addElement(new TextElement("limit ${limitStart} offset ${limitEnd}"));
        element.addElement(isNotNullElement);
        return super.sqlMapUpdateByExampleWithoutBLOBsElementGenerated(element, introspectedTable);
    }

    @Override
    public boolean validate(List warnings) {
        return true;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy