批量替换表前缀修改
This commit is contained in:
		
							parent
							
								
									7604d59e49
								
							
						
					
					
						commit
						c0cd030d0f
					
				@ -166,12 +166,32 @@ public class GenUtils
 | 
				
			|||||||
        if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix))
 | 
					        if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix))
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            String[] searchList = StringUtils.split(tablePrefix, ",");
 | 
					            String[] searchList = StringUtils.split(tablePrefix, ",");
 | 
				
			||||||
            String[] replacementList = emptyList(searchList.length);
 | 
					            tableName = replaceFirst(tableName, searchList);
 | 
				
			||||||
            tableName = StringUtils.replaceEach(tableName, searchList, replacementList);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return StringUtils.convertToCamelCase(tableName);
 | 
					        return StringUtils.convertToCamelCase(tableName);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 批量替换前缀
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param replacementm 替换值
 | 
				
			||||||
 | 
					     * @param searchList 替换列表
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public static String replaceFirst(String replacementm, String[] searchList)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        String text = StringUtils.EMPTY;
 | 
				
			||||||
 | 
					        for (String searchString : searchList)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (replacementm.startsWith(searchString))
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                text = replacementm.replaceFirst(searchString, "");
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return text;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 关键字替换
 | 
					     * 关键字替换
 | 
				
			||||||
     * 
 | 
					     * 
 | 
				
			||||||
@ -219,20 +239,4 @@ public class GenUtils
 | 
				
			|||||||
            return 0;
 | 
					            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;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user