| | |
| | | { |
| | | column.setHtmlType(GenConstants.HTML_INPUT); |
| | | |
| | | // 如果是浮点型 |
| | | // 如果是浮点型 统一用BigDecimal |
| | | String[] str = StringUtils.split(StringUtils.substringBetween(column.getColumnType(), "(", ")"), ","); |
| | | if (str != null && str.length == 2 && Integer.parseInt(str[1]) > 0) |
| | | { |
| | | column.setJavaType(GenConstants.TYPE_DOUBLE); |
| | | column.setJavaType(GenConstants.TYPE_BIGDECIMAL); |
| | | } |
| | | // 如果是整形 |
| | | else if (str != null && str.length == 1 && Integer.parseInt(str[0]) <= 10) |
| | |
| | | if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) |
| | | { |
| | | String[] searchList = StringUtils.split(tablePrefix, ","); |
| | | String[] replacementList = emptyList(searchList.length); |
| | | tableName = StringUtils.replaceEach(tableName, searchList, replacementList); |
| | | tableName = replaceFirst(tableName, searchList); |
| | | } |
| | | return StringUtils.convertToCamelCase(tableName); |
| | | } |
| | | |
| | | /** |
| | | * 批量替换前缀 |
| | | * |
| | | * @param replacementm 替换值 |
| | | * @param searchList 替换列表 |
| | | * @return |
| | | */ |
| | | public static String replaceFirst(String replacementm, String[] searchList) |
| | | { |
| | | String text = replacementm; |
| | | for (String searchString : searchList) |
| | | { |
| | | if (replacementm.startsWith(searchString)) |
| | | { |
| | | text = replacementm.replaceFirst(searchString, ""); |
| | | break; |
| | | } |
| | | } |
| | | return text; |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取空数组列表 |
| | | * |
| | | * @param length 长度 |
| | | * @return 数组信息 |
| | | */ |
| | | public static String[] emptyList(int length) |
| | | { |
| | | String[] values = new String[length]; |
| | | for (int i = 0; i < length; i++) |
| | | { |
| | | values[i] = StringUtils.EMPTY; |
| | | } |
| | | return values; |
| | | } |
| | | } |