本文整理汇总了Java中com.baomidou.mybatisplus.generator.config.rules.DbColumnType类的典型用法代码示例。如果您正苦于以下问题:Java DbColumnType类的具体用法?Java DbColumnType怎么用?Java DbColumnType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DbColumnType类属于com.baomidou.mybatisplus.generator.config.rules包,在下文中一共展示了DbColumnType类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCapitalName
import com.baomidou.mybatisplus.generator.config.rules.DbColumnType; //导入依赖的package包/类
/**
* 按JavaBean规则来生成get和set方法
*/
public String getCapitalName() {
if (propertyName.length() <= 1) {
return propertyName.toUpperCase();
}
String setGetName = propertyName;
if (DbColumnType.BASE_BOOLEAN.getType().equalsIgnoreCase(columnType.getType())) {
setGetName = StringUtils.removeIsPrefixIfBoolean(setGetName, Boolean.class);
}
// 第一个字母 小写、 第二个字母 大写 ,特殊处理
String firstChar = setGetName.substring(0, 1);
if (Character.isLowerCase(firstChar.toCharArray()[0])
&& Character.isUpperCase(setGetName.substring(1, 2).toCharArray()[0])) {
return firstChar.toLowerCase() + setGetName.substring(1);
}
return firstChar.toUpperCase() + setGetName.substring(1);
}
示例2: processTypeConvert
import com.baomidou.mybatisplus.generator.config.rules.DbColumnType; //导入依赖的package包/类
@Override
public DbColumnType processTypeConvert(String fieldType) {
String t = fieldType.toLowerCase();
if (t.contains("char") || t.contains("text") || t.contains("xml")) {
return DbColumnType.STRING;
} else if (t.contains("bigint")) {
return DbColumnType.LONG;
} else if (t.contains("int")) {
return DbColumnType.INTEGER;
} else if (t.contains("date") || t.contains("time")) {
return DbColumnType.DATE;
} else if (t.contains("text")) {
return DbColumnType.STRING;
} else if (t.contains("bit")) {
return DbColumnType.BOOLEAN;
} else if (t.contains("decimal") || t.contains("numeric")) {
return DbColumnType.DOUBLE;
} else if (t.contains("money")) {
return DbColumnType.BIG_DECIMAL;
} else if (t.contains("binary") || t.contains("image")) {
return DbColumnType.BYTE_ARRAY;
} else if (t.contains("float") || t.contains("real")) {
return DbColumnType.FLOAT;
}
return DbColumnType.STRING;
}
示例3: processTypeConvert
import com.baomidou.mybatisplus.generator.config.rules.DbColumnType; //导入依赖的package包/类
@Override
public DbColumnType processTypeConvert(String fieldType) {
String t = fieldType.toLowerCase();
if (t.contains("char") || t.contains("text")) {
return DbColumnType.STRING;
} else if (t.contains("bigint")) {
return DbColumnType.LONG;
} else if (t.contains("int")) {
return DbColumnType.INTEGER;
} else if (t.contains("date") || t.contains("time") || t.contains("year")) {
return DbColumnType.DATE;
} else if (t.contains("text")) {
return DbColumnType.STRING;
} else if (t.contains("bit")) {
return DbColumnType.BOOLEAN;
} else if (t.contains("decimal")) {
return DbColumnType.BIG_DECIMAL;
} else if (t.contains("clob")) {
return DbColumnType.CLOB;
} else if (t.contains("blob")) {
return DbColumnType.BYTE_ARRAY;
} else if (t.contains("float")) {
return DbColumnType.FLOAT;
} else if (t.contains("double")) {
return DbColumnType.DOUBLE;
} else if (t.contains("json") || t.contains("enum")) {
return DbColumnType.STRING;
} else if (t.contains("boolean")) {
return DbColumnType.BOOLEAN;
}
return DbColumnType.STRING;
}
示例4: processTypeConvert
import com.baomidou.mybatisplus.generator.config.rules.DbColumnType; //导入依赖的package包/类
@Override
public DbColumnType processTypeConvert(String fieldType) {
String t = fieldType.toLowerCase();
if (t.contains("char") || t.contains("text")) {
return DbColumnType.STRING;
} else if (t.contains("bigint")) {
return DbColumnType.LONG;
} else if (t.contains("int")) {
return DbColumnType.INTEGER;
} else if (t.contains("date") || t.contains("time") || t.contains("year")) {
return DbColumnType.DATE;
} else if (t.contains("text")) {
return DbColumnType.STRING;
} else if (t.contains("bit")) {
return DbColumnType.BOOLEAN;
} else if (t.contains("decimal")) {
return DbColumnType.BIG_DECIMAL;
} else if (t.contains("clob")) {
return DbColumnType.CLOB;
} else if (t.contains("blob")) {
return DbColumnType.BLOB;
} else if (t.contains("binary")) {
return DbColumnType.BYTE_ARRAY;
} else if (t.contains("float")) {
return DbColumnType.FLOAT;
} else if (t.contains("double")) {
return DbColumnType.DOUBLE;
} else if (t.contains("json") || t.contains("enum")) {
return DbColumnType.STRING;
}
return DbColumnType.STRING;
}
示例5: processTypeConvert
import com.baomidou.mybatisplus.generator.config.rules.DbColumnType; //导入依赖的package包/类
@Override
public DbColumnType processTypeConvert(String fieldType) {
String t = fieldType.toUpperCase();
if (t.contains("CHAR")) {
return DbColumnType.STRING;
} else if (t.contains("DATE") || t.contains("TIMESTAMP")) {
return DbColumnType.DATE;
} else if (t.contains("NUMBER")) {
if (t.matches("NUMBER\\(+\\d\\)")) {
return DbColumnType.INTEGER;
} else if (t.matches("NUMBER\\(+\\d{2}+\\)")) {
return DbColumnType.LONG;
}
return DbColumnType.DOUBLE;
} else if (t.contains("FLOAT")) {
return DbColumnType.FLOAT;
} else if (t.contains("clob")) {
return DbColumnType.CLOB;
} else if (t.contains("BLOB")) {
return DbColumnType.OBJECT;
} else if (t.contains("binary")) {
return DbColumnType.BYTE_ARRAY;
} else if (t.contains("RAW")) {
return DbColumnType.BYTE_ARRAY;
}
return DbColumnType.STRING;
}
示例6: getColumnType
import com.baomidou.mybatisplus.generator.config.rules.DbColumnType; //导入依赖的package包/类
public DbColumnType getColumnType() {
return columnType;
}
示例7: setColumnType
import com.baomidou.mybatisplus.generator.config.rules.DbColumnType; //导入依赖的package包/类
public void setColumnType(DbColumnType columnType) {
this.columnType = columnType;
}
示例8: processTypeConvert
import com.baomidou.mybatisplus.generator.config.rules.DbColumnType; //导入依赖的package包/类
/**
* <p>
* 执行类型转换
* </p>
*
* @param fieldType 字段类型
* @return
*/
DbColumnType processTypeConvert(String fieldType);