格式化代码.
This commit is contained in:
parent
d0de7f2842
commit
52e289148a
@ -15,14 +15,20 @@
|
||||
*/
|
||||
package com.baomidou.mybatisplus.core.toolkit;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* SQL 表名解析
|
||||
* <p>
|
||||
* https://github.com/mnadeem/sql-table-name-parser
|
||||
* <a href="https://github.com/mnadeem/sql-table-name-parser">...</a>
|
||||
* <p>
|
||||
* Ultra light, Ultra fast parser to extract table name out SQLs, supports oracle dialect SQLs as well.
|
||||
* USE: new TableNameParser(sql).tables()
|
||||
@ -123,7 +129,7 @@ public final class TableNameParser {
|
||||
* @param sql SQL
|
||||
* @return 语句
|
||||
*/
|
||||
protected List<SqlToken> fetchAllTokens(String sql) {
|
||||
private List<SqlToken> fetchAllTokens(String sql) {
|
||||
List<SqlToken> tokens = new ArrayList<>();
|
||||
Matcher matcher = NON_SQL_TOKEN_PATTERN.matcher(sql);
|
||||
int last = 0;
|
||||
|
@ -35,9 +35,12 @@ import java.util.function.Consumer;
|
||||
* @since 2021-07-23
|
||||
*/
|
||||
public class DdlScript {
|
||||
private DataSource dataSource;
|
||||
private IDdlGenerator ddlGenerator;
|
||||
private boolean autoCommit;
|
||||
|
||||
private final DataSource dataSource;
|
||||
|
||||
private final IDdlGenerator ddlGenerator;
|
||||
|
||||
private final boolean autoCommit;
|
||||
|
||||
public DdlScript(DataSource dataSource) {
|
||||
this(dataSource, null);
|
||||
|
@ -28,6 +28,7 @@ import java.util.function.Consumer;
|
||||
* @since 2021-09-23
|
||||
*/
|
||||
public class SimpleDdl implements IDdl {
|
||||
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
|
||||
@ -40,4 +41,5 @@ public class SimpleDdl implements IDdl {
|
||||
public List<String> getSqlFiles() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public class ServiceImpl<M extends BaseMapper<T>, T> implements IService<T> {
|
||||
|
||||
private final ConversionService conversionService = DefaultConversionService.getSharedInstance();
|
||||
|
||||
protected Log log = LogFactory.getLog(getClass());
|
||||
protected final Log log = LogFactory.getLog(getClass());
|
||||
|
||||
@Autowired
|
||||
protected M baseMapper;
|
||||
@ -71,14 +71,14 @@ public class ServiceImpl<M extends BaseMapper<T>, T> implements IService<T> {
|
||||
return baseMapper;
|
||||
}
|
||||
|
||||
protected Class<T> entityClass = currentModelClass();
|
||||
protected final Class<T> entityClass = currentModelClass();
|
||||
|
||||
@Override
|
||||
public Class<T> getEntityClass() {
|
||||
return entityClass;
|
||||
}
|
||||
|
||||
protected Class<M> mapperClass = currentMapperClass();
|
||||
protected final Class<M> mapperClass = currentMapperClass();
|
||||
|
||||
/**
|
||||
* 判断数据库操作是否成功
|
||||
|
@ -53,14 +53,14 @@ public class InjectionConfig {
|
||||
* 自定义模板文件,key为文件名称,value为模板路径(已弃用,换成了customFiles,3.5.4版本会删除此方法)
|
||||
*/
|
||||
@Deprecated
|
||||
private Map<String, String> customFile = new HashMap<>();
|
||||
private final Map<String, String> customFile = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 自定义模板文件列表
|
||||
*
|
||||
* @since 3.5.3
|
||||
*/
|
||||
private List<CustomFile> customFiles = new ArrayList<>();
|
||||
private final List<CustomFile> customFiles = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 是否覆盖已有文件(默认 false)(已弃用,已放到自定义文件类CustomFile中,3.5.4版本会删除此方法)
|
||||
@ -73,7 +73,6 @@ public class InjectionConfig {
|
||||
/**
|
||||
* 输出文件前
|
||||
*/
|
||||
@NotNull
|
||||
public void beforeOutputFile(TableInfo tableInfo, Map<String, Object> objectMap) {
|
||||
if (!customMap.isEmpty()) {
|
||||
objectMap.putAll(customMap);
|
||||
@ -195,4 +194,5 @@ public class InjectionConfig {
|
||||
return this.injectionConfig;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ import java.util.*;
|
||||
*/
|
||||
public abstract class BaseKeyWordsHandler implements IKeyWordsHandler {
|
||||
|
||||
public Set<String> keyWords;
|
||||
public final Set<String> keyWords;
|
||||
|
||||
public BaseKeyWordsHandler(@NotNull List<String> keyWords) {
|
||||
this.keyWords = new HashSet<>(keyWords);
|
||||
@ -47,4 +47,5 @@ public abstract class BaseKeyWordsHandler implements IKeyWordsHandler {
|
||||
public boolean isKeyWords(@NotNull String columnName) {
|
||||
return getKeyWords().contains(columnName.toUpperCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,7 +32,8 @@ import java.util.List;
|
||||
*/
|
||||
@Slf4j
|
||||
public class DdlApplicationRunner implements ApplicationRunner {
|
||||
private List<IDdl> ddlList;
|
||||
|
||||
private final List<IDdl> ddlList;
|
||||
|
||||
public DdlApplicationRunner(List<IDdl> ddlList) {
|
||||
this.ddlList = ddlList;
|
||||
@ -51,4 +52,5 @@ public class DdlApplicationRunner implements ApplicationRunner {
|
||||
}
|
||||
log.debug(" ... DDL end create ... ");
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user