| | |
| | | package org.dromara.generator.util; |
| | | |
| | | import org.dromara.generator.constant.GenConstants; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.satoken.utils.LoginHelper; |
| | | import org.dromara.generator.config.GenConfig; |
| | | import org.dromara.generator.domain.GenTable; |
| | | import org.dromara.generator.domain.GenTableColumn; |
| | | import lombok.AccessLevel; |
| | | import lombok.NoArgsConstructor; |
| | | import org.apache.commons.lang3.RegExUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.generator.config.GenConfig; |
| | | import org.dromara.generator.constant.GenConstants; |
| | | import org.dromara.generator.domain.GenTable; |
| | | import org.dromara.generator.domain.GenTableColumn; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | |
| | | /** |
| | | * 初始化表信息 |
| | | */ |
| | | public static void initTable(GenTable genTable, String operName) { |
| | | public static void initTable(GenTable genTable, Long operId) { |
| | | genTable.setClassName(convertClassName(genTable.getTableName())); |
| | | genTable.setPackageName(GenConfig.getPackageName()); |
| | | genTable.setModuleName(getModuleName(GenConfig.getPackageName())); |
| | | genTable.setBusinessName(getBusinessName(genTable.getTableName())); |
| | | genTable.setFunctionName(replaceText(genTable.getTableComment())); |
| | | genTable.setFunctionAuthor(GenConfig.getAuthor()); |
| | | genTable.setCreateBy(LoginHelper.getUserId()); |
| | | genTable.setCreateBy(operId); |
| | | } |
| | | |
| | | /** |
| | |
| | | String text = replacementm; |
| | | for (String searchString : searchList) { |
| | | if (replacementm.startsWith(searchString)) { |
| | | text = replacementm.replaceFirst(searchString, ""); |
| | | text = replacementm.replaceFirst(searchString, StringUtils.EMPTY); |
| | | break; |
| | | } |
| | | } |
| | |
| | | * @return 截取后的列类型 |
| | | */ |
| | | public static String getDbType(String columnType) { |
| | | if (StringUtils.indexOf(columnType, '(') > 0) { |
| | | if (StringUtils.indexOf(columnType, "(") > 0) { |
| | | return StringUtils.substringBefore(columnType, "("); |
| | | } else { |
| | | return columnType; |
| | |
| | | * @return 截取后的列类型 |
| | | */ |
| | | public static Integer getColumnLength(String columnType) { |
| | | if (StringUtils.indexOf(columnType, '(') > 0) { |
| | | if (StringUtils.indexOf(columnType, "(") > 0) { |
| | | String length = StringUtils.substringBetween(columnType, "(", ")"); |
| | | return Integer.valueOf(length); |
| | | } else { |