当前位置: 首页>>代码示例>>Java>>正文


Java IntrospectedTable.getBaseRecordType方法代码示例

本文整理汇总了Java中org.mybatis.generator.api.IntrospectedTable.getBaseRecordType方法的典型用法代码示例。如果您正苦于以下问题:Java IntrospectedTable.getBaseRecordType方法的具体用法?Java IntrospectedTable.getBaseRecordType怎么用?Java IntrospectedTable.getBaseRecordType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.mybatis.generator.api.IntrospectedTable的用法示例。


在下文中一共展示了IntrospectedTable.getBaseRecordType方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateService

import org.mybatis.generator.api.IntrospectedTable; //导入方法依赖的package包/类
private GeneratedJavaFile generateService(IntrospectedTable table) {
    // 获取实体类型
    FullyQualifiedJavaType entityType = new FullyQualifiedJavaType(table.getBaseRecordType());
    // 获取主键类型
    FullyQualifiedJavaType primaryType = table.getPrimaryKeyColumns().get(0).getFullyQualifiedJavaType();
    // 生成 Service 名称
    String service = targetPackage + "." + table.getFullyQualifiedTable().getDomainObjectName() + "Service";
    // 构造 Service 文件
    Interface interfaze = new Interface(new FullyQualifiedJavaType(service));
    // 设置作用域
    interfaze.setVisibility(JavaVisibility.PUBLIC);
    // import
    interfaze.addImportedType(new FullyQualifiedJavaType(baseService));
    interfaze.addImportedType(entityType);
    interfaze.addSuperInterface(new FullyQualifiedJavaType(
            baseService + "<" + entityType.getShortName() + "," + primaryType.getShortName() + ">"));
    ElementHelper.addAuthorTag(interfaze, false);
    return new GeneratedJavaFile(interfaze, targetProject, new DefaultJavaFormatter());
}
 
开发者ID:drtrang,项目名称:mybatis-generator-extension,代码行数:20,代码来源:ServicePlugin.java

示例2: generateServiceImpl

import org.mybatis.generator.api.IntrospectedTable; //导入方法依赖的package包/类
private GeneratedJavaFile generateServiceImpl(IntrospectedTable table) {
    FullyQualifiedJavaType entityType = new FullyQualifiedJavaType(table.getBaseRecordType());
    FullyQualifiedJavaType primaryType = table.getPrimaryKeyColumns().get(0).getFullyQualifiedJavaType();
    String domainObjectName = table.getFullyQualifiedTable().getDomainObjectName();
    String service = targetPackage + "." + domainObjectName + "Service";
    String serviceImpl = targetPackage + ".impl." + domainObjectName + "ServiceImpl";
    TopLevelClass clazz = new TopLevelClass(new FullyQualifiedJavaType(serviceImpl));
    clazz.addImportedType(new FullyQualifiedJavaType(baseServiceImpl));
    clazz.addImportedType(entityType);
    clazz.addImportedType(new FullyQualifiedJavaType(service));
    clazz.addImportedType(new FullyQualifiedJavaType("org.springframework.stereotype.Service"));
    clazz.addAnnotation("@Service(\"" + firstLetterLowerCase(domainObjectName + "Service") + "\")");
    clazz.setVisibility(JavaVisibility.PUBLIC);
    clazz.setSuperClass(new FullyQualifiedJavaType(
            baseServiceImpl + "<" + entityType.getShortName() + "," + primaryType.getShortName() + ">"));
    clazz.addSuperInterface(new FullyQualifiedJavaType(service));
    ElementHelper.addAuthorTag(clazz, false);
    return new GeneratedJavaFile(clazz, targetProject, new DefaultJavaFormatter());
}
 
开发者ID:drtrang,项目名称:mybatis-generator-extension,代码行数:20,代码来源:ServicePlugin.java

示例3: clientGenerated

import org.mybatis.generator.api.IntrospectedTable; //导入方法依赖的package包/类
/**
 * 生成的 Mapper 接口
 */
@Override
public boolean clientGenerated(Interface interfaze, TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
    // 获取实体类
    FullyQualifiedJavaType entityType = new FullyQualifiedJavaType(introspectedTable.getBaseRecordType());
    // import 实体类
    interfaze.addImportedType(entityType);
    // import 接口
    interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Mapper"));
    // 添加 @Mapper 注解
    interfaze.addAnnotation("@Mapper");
    for (String mapper : mappers) {
        // import mappers
        interfaze.addImportedType(new FullyQualifiedJavaType(mapper));
        // 添加父类
        interfaze.addSuperInterface(new FullyQualifiedJavaType(mapper + "<" + entityType.getShortName() + ">"));
    }
    interfaze.addJavaDocLine("/**");
    interfaze.addJavaDocLine(" * " + interfaze.getType().getShortName());
    ElementHelper.addAuthorTag(interfaze, false);
    interfaze.addJavaDocLine(" */");
    return true;
}
 
开发者ID:drtrang,项目名称:mybatis-generator-extension,代码行数:26,代码来源:MapperPlugin.java

示例4: clientGenerated

import org.mybatis.generator.api.IntrospectedTable; //导入方法依赖的package包/类
/**
 * 生成的Mapper接口
 *
 * @param interfaze
 * @param topLevelClass
 * @param introspectedTable
 * @return
 */
@Override
public boolean clientGenerated(Interface interfaze, TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
    //获取实体类
    FullyQualifiedJavaType entityType = new FullyQualifiedJavaType(introspectedTable.getBaseRecordType());
    //主键
    FullyQualifiedJavaType idType = null;
    List<IntrospectedColumn> columns = introspectedTable.getPrimaryKeyColumns();
    for (IntrospectedColumn col : columns) {
        idType = javaTypeResolver.calculateJavaType(col);
        break;
    }
    //import接口
    for (String mapper : mappers) {
        interfaze.addImportedType(new FullyQualifiedJavaType(mapper));
        interfaze.addSuperInterface(
                new FullyQualifiedJavaType(mapper + "<" + entityType.getShortName() + "," + idType.getShortName() + ">"));
    }
    //import实体类
    interfaze.addImportedType(entityType);
    return true;
}
 
开发者ID:warlock-china,项目名称:azeroth,代码行数:30,代码来源:CrudSupportPlugin.java

示例5: clientGenerated

import org.mybatis.generator.api.IntrospectedTable; //导入方法依赖的package包/类
/**
 * 生成的Mapper接口
 *
 * @param interfaze
 * @param topLevelClass
 * @param introspectedTable
 * @return
 */
@Override
public boolean clientGenerated(Interface interfaze, TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
    //获取实体类
    FullyQualifiedJavaType entityType = new FullyQualifiedJavaType(introspectedTable.getBaseRecordType());
    //import接口
    for (String mapper : mappers) {
        interfaze.addImportedType(new FullyQualifiedJavaType(mapper));
        interfaze.addSuperInterface(new FullyQualifiedJavaType(mapper + "<" + entityType.getShortName() + ">"));
    }
    //import实体类
    interfaze.addImportedType(entityType);
    return true;
}
 
开发者ID:Yanweichen,项目名称:MybatisGeneatorUtil,代码行数:22,代码来源:MapperPlugin.java

示例6: clientGenerated

import org.mybatis.generator.api.IntrospectedTable; //导入方法依赖的package包/类
@Override
public boolean clientGenerated(Interface interfaze, TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
    FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType("BaseMapper<" + introspectedTable.getBaseRecordType() + ">");
    FullyQualifiedJavaType imp = new FullyQualifiedJavaType("com.zhu8fei.framework.core.mybatis.mapper.BaseMapper");
    FullyQualifiedJavaType reposImp = new FullyQualifiedJavaType("org.springframework.stereotype.Repository");
    interfaze.addSuperInterface(fqjt);// 添加 extends BaseDao<User>
    interfaze.addImportedType(imp);// 添加import common.BaseDao;
    interfaze.addImportedType(reposImp);
    interfaze.addAnnotation("@Repository");
    return true;
}
 
开发者ID:easymall,项目名称:easymall,代码行数:12,代码来源:MybatisTempletPlugin.java

示例7: getModelTypeWithoutBLOBs

import org.mybatis.generator.api.IntrospectedTable; //导入方法依赖的package包/类
/**
 * 获取Model没有BLOBs类时的类型
 * @param introspectedTable
 * @return
 */
public static FullyQualifiedJavaType getModelTypeWithoutBLOBs(IntrospectedTable introspectedTable) {
    FullyQualifiedJavaType type;
    if (introspectedTable.getRules().generateBaseRecordClass()) {
        type = new FullyQualifiedJavaType(introspectedTable.getBaseRecordType());
    } else if (introspectedTable.getRules().generatePrimaryKeyClass()) {
        type = new FullyQualifiedJavaType(introspectedTable.getPrimaryKeyType());
    } else {
        throw new RuntimeException(getString("RuntimeError.12"));
    }
    return type;
}
 
开发者ID:itfsw,项目名称:mybatis-generator-plugin,代码行数:17,代码来源:JavaElementGeneratorTools.java

示例8: getModelTypeWithBLOBs

import org.mybatis.generator.api.IntrospectedTable; //导入方法依赖的package包/类
/**
 * 获取Model有BLOBs类时的类型
 * @param introspectedTable
 * @return
 */
public static FullyQualifiedJavaType getModelTypeWithBLOBs(IntrospectedTable introspectedTable) {
    FullyQualifiedJavaType type;
    if (introspectedTable.getRules().generateRecordWithBLOBsClass()) {
        type = new FullyQualifiedJavaType(introspectedTable.getRecordWithBLOBsType());
    } else {
        // the blob fields must be rolled up into the base class
        type = new FullyQualifiedJavaType(introspectedTable.getBaseRecordType());
    }
    return type;
}
 
开发者ID:itfsw,项目名称:mybatis-generator-plugin,代码行数:16,代码来源:JavaElementGeneratorTools.java


注:本文中的org.mybatis.generator.api.IntrospectedTable.getBaseRecordType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。