Search in sources :

Example 6 with Rules

use of org.mybatis.generator.internal.rules.Rules in project generator by mybatis.

the class ExtendedDAOMethodNameCalculator method getSelectByExampleWithBLOBsMethodName.

/**
     * 1. if this will be the only selectByExample, then the result should be
     * selectByExample. 2. Else the method name should be
     * selectByExampleWithBLOBs
     */
public String getSelectByExampleWithBLOBsMethodName(IntrospectedTable introspectedTable) {
    StringBuilder sb = new StringBuilder();
    //$NON-NLS-1$
    sb.append("select");
    sb.append(introspectedTable.getFullyQualifiedTable().getDomainObjectName());
    //$NON-NLS-1$
    sb.append("ByExample");
    Rules rules = introspectedTable.getRules();
    if (rules.generateSelectByExampleWithoutBLOBs()) {
        //$NON-NLS-1$
        sb.append("WithBLOBs");
    }
    return sb.toString();
}
Also used : Rules(org.mybatis.generator.internal.rules.Rules)

Example 7 with Rules

use of org.mybatis.generator.internal.rules.Rules in project generator by mybatis.

the class DAOGenerator method addUpdateByExampleParmsInnerclass.

protected void addUpdateByExampleParmsInnerclass(TopLevelClass topLevelClass, Interface interfaze) {
    Rules rules = introspectedTable.getRules();
    if (rules.generateUpdateByExampleSelective() || rules.generateUpdateByExampleWithBLOBs() || rules.generateUpdateByExampleWithoutBLOBs()) {
        AbstractDAOElementGenerator methodGenerator = new UpdateByExampleParmsInnerclassGenerator();
        initializeAndExecuteGenerator(methodGenerator, topLevelClass, interfaze);
    }
}
Also used : AbstractDAOElementGenerator(org.mybatis.generator.codegen.ibatis2.dao.elements.AbstractDAOElementGenerator) UpdateByExampleParmsInnerclassGenerator(org.mybatis.generator.codegen.ibatis2.dao.elements.UpdateByExampleParmsInnerclassGenerator) Rules(org.mybatis.generator.internal.rules.Rules)

Example 8 with Rules

use of org.mybatis.generator.internal.rules.Rules in project generator by mybatis.

the class ExtendedDAOMethodNameCalculator method getUpdateByExampleWithoutBLOBsMethodName.

public String getUpdateByExampleWithoutBLOBsMethodName(IntrospectedTable introspectedTable) {
    StringBuilder sb = new StringBuilder();
    //$NON-NLS-1$
    sb.append("update");
    sb.append(introspectedTable.getFullyQualifiedTable().getDomainObjectName());
    Rules rules = introspectedTable.getRules();
    if (!rules.generateUpdateByExampleWithBLOBs()) {
        //$NON-NLS-1$
        sb.append("ByExample");
    } else if (rules.generateRecordWithBLOBsClass()) {
        //$NON-NLS-1$
        sb.append("ByExample");
    } else {
        //$NON-NLS-1$
        sb.append("ByExampleWithoutBLOBs");
    }
    return sb.toString();
}
Also used : Rules(org.mybatis.generator.internal.rules.Rules)

Aggregations

Rules (org.mybatis.generator.internal.rules.Rules)8 ArrayList (java.util.ArrayList)1 CommentGenerator (org.mybatis.generator.api.CommentGenerator)1 FullyQualifiedTable (org.mybatis.generator.api.FullyQualifiedTable)1 CompilationUnit (org.mybatis.generator.api.dom.java.CompilationUnit)1 Field (org.mybatis.generator.api.dom.java.Field)1 FullyQualifiedJavaType (org.mybatis.generator.api.dom.java.FullyQualifiedJavaType)1 Method (org.mybatis.generator.api.dom.java.Method)1 Parameter (org.mybatis.generator.api.dom.java.Parameter)1 TopLevelClass (org.mybatis.generator.api.dom.java.TopLevelClass)1 AbstractDAOElementGenerator (org.mybatis.generator.codegen.ibatis2.dao.elements.AbstractDAOElementGenerator)1 UpdateByExampleParmsInnerclassGenerator (org.mybatis.generator.codegen.ibatis2.dao.elements.UpdateByExampleParmsInnerclassGenerator)1