!79 清理注释掉的代码

Merge pull request !79 from 王帅/main
This commit is contained in:
Michael Yang 2023-06-21 01:27:21 +00:00 committed by Gitee
commit 51df4b93e6
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
13 changed files with 94 additions and 122 deletions

View File

@ -1,17 +1,17 @@
/** /*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com). * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p> * <p>
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* <p> * <p>
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* <p> * <p>
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.mybatisflex.core.audit; package com.mybatisflex.core.audit;
@ -28,7 +28,6 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
*/ */
public class ScheduledMessageCollector implements MessageCollector, Runnable { public class ScheduledMessageCollector implements MessageCollector, Runnable {
private final long period;
private final ScheduledExecutorService scheduler; private final ScheduledExecutorService scheduler;
private final MessageReporter messageSender; private final MessageReporter messageSender;
@ -41,7 +40,6 @@ public class ScheduledMessageCollector implements MessageCollector, Runnable {
public ScheduledMessageCollector(long period, MessageReporter messageSender) { public ScheduledMessageCollector(long period, MessageReporter messageSender) {
this.period = period;
this.messageSender = messageSender; this.messageSender = messageSender;
this.scheduler = Executors.newSingleThreadScheduledExecutor(runnable -> { this.scheduler = Executors.newSingleThreadScheduledExecutor(runnable -> {
Thread thread = new Thread(runnable, "ScheduledMessageCollector"); Thread thread = new Thread(runnable, "ScheduledMessageCollector");

View File

@ -82,7 +82,7 @@ public class HttpUtil {
private static SSLSocketFactory initSSLSocketFactory() { private static SSLSocketFactory initSSLSocketFactory() {
try { try {
TrustManager[] tm = {new HttpUtil.TrustAnyTrustManager()}; TrustManager[] tm = {new HttpUtil.TrustAnyTrustManager()};
SSLContext sslContext = SSLContext.getInstance("TLS"); // ("TLS", "SunJSSE"); SSLContext sslContext = SSLContext.getInstance("TLS"); // "TLS", "SunJSSE"
sslContext.init(null, tm, new java.security.SecureRandom()); sslContext.init(null, tm, new java.security.SecureRandom());
return sslContext.getSocketFactory(); return sslContext.getSocketFactory();
} catch (Exception e) { } catch (Exception e) {

View File

@ -244,7 +244,6 @@ public class CommonsDialectImpl implements IDialect {
//fix: support schema //fix: support schema
QueryTable queryTable = queryTables.get(0); QueryTable queryTable = queryTables.get(0);
// String tableName = queryTables.get(0).getName();
sql.append(UPDATE).append(queryTable.toSql(this)).append(SET); sql.append(UPDATE).append(queryTable.toSql(this)).append(SET);
int index = 0; int index = 0;
for (String modifyAttr : modifyAttrs) { for (String modifyAttr : modifyAttrs) {
@ -380,8 +379,8 @@ public class CommonsDialectImpl implements IDialect {
buildHavingSql(sqlBuilder, queryWrapper, allTables); buildHavingSql(sqlBuilder, queryWrapper, allTables);
//ignore orderBy and limit //ignore orderBy and limit
//buildOrderBySql(sqlBuilder, queryWrapper); //buildOrderBySql(sqlBuilder, queryWrapper)
//buildLimitSql(sqlBuilder, queryWrapper); //buildLimitSql(sqlBuilder, queryWrapper)
List<String> endFragments = CPI.getEndFragments(queryWrapper); List<String> endFragments = CPI.getEndFragments(queryWrapper);
if (CollectionUtil.isNotEmpty(endFragments)) { if (CollectionUtil.isNotEmpty(endFragments)) {
@ -618,8 +617,8 @@ public class CommonsDialectImpl implements IDialect {
buildHavingSql(sqlBuilder, queryWrapper, allTables); buildHavingSql(sqlBuilder, queryWrapper, allTables);
//ignore orderBy and limit //ignore orderBy and limit
//buildOrderBySql(sqlBuilder, queryWrapper); //buildOrderBySql(sqlBuilder, queryWrapper)
//buildLimitSql(sqlBuilder, queryWrapper); //buildLimitSql(sqlBuilder, queryWrapper)
return sqlBuilder.toString(); return sqlBuilder.toString();
} }

View File

@ -1,17 +1,17 @@
/** /*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com). * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p> * <p>
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* <p> * <p>
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* <p> * <p>
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.mybatisflex.core.javassist; package com.mybatisflex.core.javassist;
@ -39,7 +39,6 @@ public class ModifyAttrsRecordHandler implements MethodHandler {
if (originalMethod.getName().startsWith("set")){ if (originalMethod.getName().startsWith("set")){
String property = StringUtil.firstCharToLowerCase(originalMethod.getName().substring(3)); String property = StringUtil.firstCharToLowerCase(originalMethod.getName().substring(3));
modifyAttrs.add(property); modifyAttrs.add(property);
// ((ModifyAttrsRecord) self).addModifyAttr(property);
} }
return proxyMethod.invoke(self, args); return proxyMethod.invoke(self, args);

View File

@ -107,7 +107,7 @@ public class MybatisKeyGeneratorUtil {
//看到有的框架把 keyGenerator 添加到 mybatis 的当前配置里去其实是完全没必要的 //看到有的框架把 keyGenerator 添加到 mybatis 的当前配置里去其实是完全没必要的
//因为只有在 xml 解析的时候才可能存在多一个 MappedStatement 拥有同一个 keyGenerator 的情况 //因为只有在 xml 解析的时候才可能存在多一个 MappedStatement 拥有同一个 keyGenerator 的情况
//当前每个方法都拥有一个自己的 keyGenerator 没必要添加 //当前每个方法都拥有一个自己的 keyGenerator 没必要添加
//this.addKeyGenerator(selectId, keyGenerator); //addKeyGenerator(selectId, keyGenerator)
return new SelectKeyGenerator(keyMappedStatement, isKeyBefore(idInfo, globalKeyConfig)); return new SelectKeyGenerator(keyMappedStatement, isKeyBefore(idInfo, globalKeyConfig));
} }

View File

@ -1,17 +1,17 @@
/** /*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com). * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p> * <p>
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* <p> * <p>
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* <p> * <p>
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.mybatisflex.core.keygen; package com.mybatisflex.core.keygen;
@ -128,7 +128,7 @@ public class RowKeyGenerator implements KeyGenerator, IMultiKeyGenerator {
//看到有的框架把 keyGenerator 添加到 mybatis 的当前配置里去其实是完全没必要的 //看到有的框架把 keyGenerator 添加到 mybatis 的当前配置里去其实是完全没必要的
//因为只有在 xml 解析的时候才可能存在多一个 MappedStatement 拥有同一个 keyGenerator 的情况 //因为只有在 xml 解析的时候才可能存在多一个 MappedStatement 拥有同一个 keyGenerator 的情况
//当前每个方法都拥有一个自己的 keyGenerator 没必要添加 //当前每个方法都拥有一个自己的 keyGenerator 没必要添加
//this.addKeyGenerator(selectId, keyGenerator); //addKeyGenerator(selectId, keyGenerator)
return new SelectKeyGenerator(keyMappedStatement, rowKey.isBefore()); return new SelectKeyGenerator(keyMappedStatement, rowKey.isBefore());
} }

View File

@ -99,8 +99,6 @@ public class FlexConfiguration extends Configuration {
@Override @Override
public ResultSetHandler newResultSetHandler(Executor executor, MappedStatement mappedStatement public ResultSetHandler newResultSetHandler(Executor executor, MappedStatement mappedStatement
, RowBounds rowBounds, ParameterHandler parameterHandler, ResultHandler resultHandler, BoundSql boundSql) { , RowBounds rowBounds, ParameterHandler parameterHandler, ResultHandler resultHandler, BoundSql boundSql) {
// ResultSetHandler resultSetHandler = new DefaultResultSetHandler(executor, mappedStatement, parameterHandler,
// resultHandler, boundSql, rowBounds);
ResultSetHandler resultSetHandler = new FlexResultSetHandler(executor, mappedStatement, parameterHandler, ResultSetHandler resultSetHandler = new FlexResultSetHandler(executor, mappedStatement, parameterHandler,
resultHandler, boundSql, rowBounds); resultHandler, boundSql, rowBounds);
return (ResultSetHandler) interceptorChain.pluginAll(resultSetHandler); return (ResultSetHandler) interceptorChain.pluginAll(resultSetHandler);

View File

@ -1,17 +1,17 @@
/** /*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com). * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p> * <p>
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* <p> * <p>
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* <p> * <p>
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.mybatisflex.core.mybatis; package com.mybatisflex.core.mybatis;
@ -41,20 +41,6 @@ public class FlexPreparedStatementHandler extends PreparedStatementHandler {
@Override @Override
protected Statement instantiateStatement(Connection connection) throws SQLException { protected Statement instantiateStatement(Connection connection) throws SQLException {
// String sql = boundSql.getSql();
// if (mappedStatement.getKeyGenerator() instanceof Jdbc3KeyGenerator) {
// String[] keyColumnNames = mappedStatement.getKeyColumns();
// if (keyColumnNames == null) {
// return connection.prepareStatement(sql, PreparedStatement.RETURN_GENERATED_KEYS);
// } else {
// return connection.prepareStatement(sql, keyColumnNames);
// }
// } else if (mappedStatement.getResultSetType() == ResultSetType.DEFAULT) {
// return connection.prepareStatement(sql);
// } else {
// return connection.prepareStatement(sql, mappedStatement.getResultSetType().getValue(), ResultSet.CONCUR_READ_ONLY);
// }
String sql = boundSql.getSql(); String sql = boundSql.getSql();
KeyGenerator keyGenerator = mappedStatement.getKeyGenerator(); KeyGenerator keyGenerator = mappedStatement.getKeyGenerator();
if (keyGenerator instanceof Jdbc3KeyGenerator) { if (keyGenerator instanceof Jdbc3KeyGenerator) {

View File

@ -1,17 +1,17 @@
/** /*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com). * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p> * <p>
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* <p> * <p>
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* <p> * <p>
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.mybatisflex.core.mybatis; package com.mybatisflex.core.mybatis;
@ -54,7 +54,6 @@ public class FlexStatementHandler implements StatementHandler {
delegate = new SimpleStatementHandler(executor, ms, parameter, rowBounds, resultHandler, boundSql); delegate = new SimpleStatementHandler(executor, ms, parameter, rowBounds, resultHandler, boundSql);
break; break;
case PREPARED: case PREPARED:
// delegate = new PreparedStatementHandler(executor, ms, parameter, rowBounds, resultHandler, boundSql);
// use FlexPreparedStatementHandler to replace PreparedStatementHandler // use FlexPreparedStatementHandler to replace PreparedStatementHandler
delegate = new FlexPreparedStatementHandler(executor, ms, parameter, rowBounds, resultHandler, boundSql); delegate = new FlexPreparedStatementHandler(executor, ms, parameter, rowBounds, resultHandler, boundSql);
break; break;

View File

@ -1,27 +1,24 @@
/** /*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com). * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p> * <p>
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* <p> * <p>
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* <p> * <p>
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.mybatisflex.core.row; package com.mybatisflex.core.row;
import com.mybatisflex.core.FlexConsts;
public interface BatchArgsSetter { public interface BatchArgsSetter {
Object[] NONE_ARGS = FlexConsts.EMPTY_ARRAY;
int getBatchSize(); int getBatchSize();
Object[] getSqlArgs(int index); Object[] getSqlArgs(int index);
} }

View File

@ -221,9 +221,6 @@ public class TableInfoFactory {
if (genericType instanceof ParameterizedType) { if (genericType instanceof ParameterizedType) {
Class<?> actualTypeArgument = (Class<?>) ((ParameterizedType) genericType).getActualTypeArguments()[0]; Class<?> actualTypeArgument = (Class<?>) ((ParameterizedType) genericType).getActualTypeArguments()[0];
//需排除 List<String> List<Long> 等场景 //需排除 List<String> List<Long> 等场景
/*if (!defaultSupportColumnTypes.contains(actualTypeArgument)) {
tableInfo.addCollectionType(field, actualTypeArgument);
}*/
tableInfo.addCollectionType(field, actualTypeArgument); tableInfo.addCollectionType(field, actualTypeArgument);
} }
} }

View File

@ -111,7 +111,6 @@ public class MapperUtil {
// 获取 join 语句中使用到的表名 // 获取 join 语句中使用到的表名
List<String> joinTables = new ArrayList<>(); List<String> joinTables = new ArrayList<>();
// Map<String, String> joinTables = new HashMap<>();
joins.forEach(join -> { joins.forEach(join -> {
QueryTable joinQueryTable = CPI.getJoinQueryTable(join); QueryTable joinQueryTable = CPI.getJoinQueryTable(join);
if (joinQueryTable != null && StringUtil.isNotBlank(joinQueryTable.getName())) { if (joinQueryTable != null && StringUtil.isNotBlank(joinQueryTable.getName())) {

View File

@ -92,8 +92,8 @@ public class UpdateEntity {
if (value != null) { if (value != null) {
reflector.getSetInvoker(propertyName).invoke(newEntity, new Object[]{value}); reflector.getSetInvoker(propertyName).invoke(newEntity, new Object[]{value});
} }
} catch (Exception e) { } catch (Exception ignored) {
//ignore; // do nothing here.
} }
} }