本文整理汇总了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());
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}