修改注释

master
星期八 5 years ago
parent 764b585eae
commit e8aa0312bd
  1. 13
      src/main/java/com/lq/code/executor/processor/InstantiationTracingBeanPostProcessor.java
  2. 13
      src/main/java/com/lq/code/interceptor/PageInteceptor.java

@ -4,14 +4,16 @@ import com.lq.code.dto.QueueDto;
import com.lq.code.util.BeanUtil;
import com.lq.code.util.jdbc.JdbcUtils;
import com.lq.code.util.sql.AbstractDbBuiler;
import com.lq.code.util.sql.MysqlBuilder;
import com.lq.code.util.sql.SqlConstant;
import com.lq.code.util.sql.factory.DbBuilerFactory;
import com.lq.code.util.sql.factory.impl.DefaultDbBuilerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import java.util.Set;
/**
* Created by qi_liang on 2018/6/1.
* @author qi
*/
public class InstantiationTracingBeanPostProcessor implements ApplicationListener<ContextRefreshedEvent> {
@ -42,15 +44,12 @@ public class InstantiationTracingBeanPostProcessor implements ApplicationListene
//需要执行的逻辑代码,当spring容器初始化完成后就会执行该方法。
//扫描实体类
if (isUpdateDB) {
long startTime = System.currentTimeMillis();
Set<Class> set = BeanUtil.getClassSet(packagePath);
QueueDto<Class> queueDto = BeanUtil.getQueueDto(packagePath);
AbstractDbBuiler dbBuiler = new MysqlBuilder();
// String sql = dbBuiler.automaticUpdateDbNew(queueDto);
DbBuilerFactory dbBuilerFactory = new DefaultDbBuilerFactory();
AbstractDbBuiler dbBuiler = dbBuilerFactory.getSqlBuilder(SqlConstant.DB_TYPE_MYSQL);
String sql = dbBuiler.automaticUpdateDb(set);
JdbcUtils.createTable(sql);
System.out.println("=========实体同步数据结构===========");
System.out.println(System.currentTimeMillis()-startTime+"毫秒");
}
}
}

@ -2,6 +2,8 @@ package com.lq.code.interceptor;
import com.lq.code.util.StringUtil;
import com.lq.code.util.sql.*;
import com.lq.code.util.sql.factory.DbBuilerFactory;
import com.lq.code.util.sql.factory.impl.DefaultDbBuilerFactory;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.executor.statement.StatementHandler;
import org.apache.ibatis.mapping.BoundSql;
@ -17,7 +19,7 @@ import java.sql.Connection;
import java.util.Properties;
/**
* Created by qi_liang on 2018/2/16.
* @author qi
*/
//注解拦截器并签名
//@Signature 拦截的类签名 type 拦截的类 method 类里面的方法 args方法里面的参数
@ -48,13 +50,8 @@ public class PageInteceptor implements Interceptor {
BoundSql boundSql=(BoundSql)metaStatementHandler.getValue("delegate.boundSql");
String sql=boundSql.getSql();
PageInterface pageInterface=(PageInterface)boundSql.getParameterObject();
AbstractDbBuiler db = null;
if (SqlConstant.DB_TYPE_MYSQL.equals(dialect)){
db = new MysqlBuilder();
}
if (SqlConstant.DB_TYPE_ORACLE.equals(dialect)){
db = new OracleBuiler();
}
DbBuilerFactory dbBuilerFactory = new DefaultDbBuilerFactory();
AbstractDbBuiler db = dbBuilerFactory.getSqlBuilder(dialect);
String pageSql=db.concatPageSql(sql,pageInterface);
metaStatementHandler.setValue("delegate.boundSql.sql",pageSql);

Loading…
Cancel
Save