Java Code Examples for org.mybatis.generator.api.IntrospectedTable#getTableConfiguration()
The following examples show how to use
org.mybatis.generator.api.IntrospectedTable#getTableConfiguration() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OracleSupport.java From mybatis-generator-plus with Apache License 2.0 | 6 votes |
/** * 在单条插入动态sql中增加查询序列,以实现oracle主键自增 * * @author 吴帅 * @parameter @param element * @parameter @param introspectedTable * @createDate 2015年9月29日 下午12:00:37 */ @Override public void adaptInsertSelective(XmlElement element, IntrospectedTable introspectedTable) { TableConfiguration tableConfiguration = introspectedTable.getTableConfiguration(); Properties properties = tableConfiguration.getProperties(); String incrementFieldName = properties.getProperty("incrementField"); if (incrementFieldName != null) {// 有自增字段的配置 List<Element> elements = element.getElements(); XmlElement selectKey = new XmlElement("selectKey"); selectKey.addAttribute(new Attribute("keyProperty", incrementFieldName)); selectKey.addAttribute(new Attribute("resultType", "java.lang.Long")); selectKey.addAttribute(new Attribute("order", "BEFORE")); selectKey.addElement(new TextElement("select ")); XmlElement includeSeq = new XmlElement("include"); includeSeq.addAttribute(new Attribute("refid", "TABLE_SEQUENCE")); selectKey.addElement(includeSeq); selectKey.addElement(new TextElement(" from dual")); elements.add(0, selectKey); } }
Example 2
Source File: UpdateByOptimisticLockMethodGenerator.java From mybatis-generator-plus with Apache License 2.0 | 6 votes |
@Override public void addMethod(Interface interfaze, IntrospectedTable introspectedTable) { TableConfiguration tableConfiguration = introspectedTable.getTableConfiguration(); Properties properties = tableConfiguration.getProperties(); String versionField = properties.getProperty("versionField"); if (versionField == null || versionField == "") { return; } Set<FullyQualifiedJavaType> importedTypes = new TreeSet<>(); FullyQualifiedJavaType parameterType; if (introspectedTable.getRules().generateRecordWithBLOBsClass()) { parameterType = new FullyQualifiedJavaType(introspectedTable.getRecordWithBLOBsType()); } else { parameterType = new FullyQualifiedJavaType(introspectedTable.getBaseRecordType()); } importedTypes.add(parameterType); Method method = new Method(); method.setVisibility(JavaVisibility.PUBLIC); method.setReturnType(FullyQualifiedJavaType.getIntInstance()); method.setName(METHOD_NAME); method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$ interfaze.addImportedTypes(importedTypes); interfaze.addMethod(method); }
Example 3
Source File: CustomPlugin.java From mybatis-generator-plus with Apache License 2.0 | 6 votes |
/** * 增加数据源名称字段 * * @author 吴帅 * @parameter @param interfaze * @parameter @param introspectedTable * @createDate 2015年10月2日 上午10:06:47 */ private void addDataSourceNameField(Interface interfaze, IntrospectedTable introspectedTable) { TableConfiguration tableConfiguration = introspectedTable.getTableConfiguration(); Properties properties = tableConfiguration.getProperties(); String dataSourceName = properties.getProperty("dataSourceName"); if (dataSourceName == null || dataSourceName == "") { return; } Field field = new Field(); field.setVisibility(JavaVisibility.PUBLIC); field.setStatic(true); field.setFinal(true); field.setType(FullyQualifiedJavaType.getStringInstance()); field.setName("DATA_SOURCE_NAME"); field.setInitializationString("\"" + dataSourceName + "\""); interfaze.addField(field); }
Example 4
Source File: BaseRules.java From mapper-generator-javafx with Apache License 2.0 | 5 votes |
public BaseRules(IntrospectedTable introspectedTable) { super(); this.introspectedTable = introspectedTable; this.tableConfiguration = introspectedTable.getTableConfiguration(); String modelOnly = tableConfiguration.getProperty(PropertyRegistry.TABLE_MODEL_ONLY); isModelOnly = StringUtility.isTrue(modelOnly); }
Example 5
Source File: JavaBeansUtil.java From mapper-generator-javafx with Apache License 2.0 | 5 votes |
private static boolean isTrimStringsEnabled(IntrospectedTable table) { TableConfiguration tableConfiguration = table.getTableConfiguration(); String trimSpaces = tableConfiguration.getProperties().getProperty( PropertyRegistry.MODEL_GENERATOR_TRIM_STRINGS); if (trimSpaces != null) { return isTrue(trimSpaces); } return isTrimStringsEnabled(table.getContext()); }
Example 6
Source File: BaseRules.java From mybatis-generator-core-fix with Apache License 2.0 | 5 votes |
/** * Instantiates a new base rules. * * @param introspectedTable * the introspected table */ public BaseRules(IntrospectedTable introspectedTable) { super(); this.introspectedTable = introspectedTable; this.tableConfiguration = introspectedTable.getTableConfiguration(); String modelOnly = tableConfiguration.getProperty(PropertyRegistry.TABLE_MODEL_ONLY); isModelOnly = StringUtility.isTrue(modelOnly); }
Example 7
Source File: BaseRules.java From mybatis-generator-plus with Apache License 2.0 | 5 votes |
/** * */ public BaseRules(IntrospectedTable introspectedTable) { super(); this.introspectedTable = introspectedTable; this.tableConfiguration = introspectedTable.getTableConfiguration(); String modelOnly = tableConfiguration.getProperty(PropertyRegistry.TABLE_MODEL_ONLY); isModelOnly = StringUtility.isTrue(modelOnly); }