hubin пре 7 година
родитељ
комит
45b0f634c3

+ 399 - 399
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/activerecord/Model.java

@@ -1,399 +1,399 @@
-/*
- * Copyright (c) 2011-2020, hubin (jobob@qq.com).
- * <p>
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.baomidou.mybatisplus.extension.activerecord;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.ibatis.session.SqlSession;
-import org.springframework.transaction.annotation.Transactional;
-
-import com.baomidou.mybatisplus.core.conditions.Wrapper;
-import com.baomidou.mybatisplus.core.enums.SqlMethod;
-import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
-import com.baomidou.mybatisplus.core.pagination.Page;
-import com.baomidou.mybatisplus.core.toolkit.sql.SqlHelper;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
-import com.baomidou.mybatisplus.extension.toolkit.SqlRunner;
-
-/**
- * <p>
- * ActiveRecord 模式 CRUD
- * </p>
- *
- * @param <T>
- * @author hubin
- * @Date 2016-11-06
- */
-public abstract class Model<T extends Model> implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * <p>
-     * 插入(字段选择插入)
-     * </p>
-     */
-    @Transactional(rollbackFor = Exception.class)
-    public boolean insert() {
-        return SqlHelper.retBool(sqlSession().insert(sqlStatement(SqlMethod.INSERT_ONE), this));
-    }
-
-    /**
-     * <p>
-     * 插入(所有字段插入)
-     * </p>
-     */
-    @Transactional(rollbackFor = Exception.class)
-    public boolean insertAllColumn() {
-        return SqlHelper.retBool(sqlSession().insert(sqlStatement(SqlMethod.INSERT_ONE_ALL_COLUMN), this));
-    }
-
-    /**
-     * <p>
-     * 插入 OR 更新
-     * </p>
-     */
-    @Transactional(rollbackFor = Exception.class)
-    public boolean insertOrUpdate() {
-        if (StringUtils.checkValNull(pkVal())) {
-            // insert
-            return insert();
-        } else {
-            /*
-             * 更新成功直接返回,失败执行插入逻辑
-             */
-            return updateById() || insert();
-        }
-    }
-
-    /**
-     * <p>
-     * 根据 ID 删除
-     * </p>
-     *
-     * @param id 主键ID
-     * @return
-     */
-    @Transactional(rollbackFor = Exception.class)
-    public boolean deleteById(Serializable id) {
-        return SqlHelper.delBool(sqlSession().delete(sqlStatement(SqlMethod.DELETE_BY_ID), id));
-    }
-
-    /**
-     * <p>
-     * 根据主键删除
-     * </p>
-     *
-     * @return
-     */
-    @Transactional(rollbackFor = Exception.class)
-    public boolean deleteById() {
-        if (StringUtils.checkValNull(pkVal())) {
-            throw new MybatisPlusException("deleteById primaryKey is null.");
-        }
-        return deleteById(this.pkVal());
-    }
-
-    /**
-     * <p>
-     * 删除记录
-     * </p>
-     *
-     * @param whereClause 查询条件
-     * @param args        查询条件值
-     * @return
-     */
-    @Transactional(rollbackFor = Exception.class)
-    public boolean delete(String whereClause, Object... args) {
-        return delete(Wrapper.<T>getInstance().where(whereClause, args));
-    }
-
-    /**
-     * <p>
-     * 删除记录
-     * </p>
-     *
-     * @param wrapper
-     * @return
-     */
-    @Transactional(rollbackFor = Exception.class)
-    public boolean delete(Wrapper wrapper) {
-        Map<String, Object> map = new HashMap<>();
-        map.put("ew", wrapper);
-        return SqlHelper.delBool(sqlSession().delete(sqlStatement(SqlMethod.DELETE), map));
-    }
-
-    /**
-     * <p>
-     * 更新(字段选择更新)
-     * </p>
-     */
-    @Transactional(rollbackFor = Exception.class)
-    public boolean updateById() {
-        if (StringUtils.checkValNull(pkVal())) {
-            throw new MybatisPlusException("updateById primaryKey is null.");
-        }
-        // updateById
-        Map<String, Object> map = new HashMap<>();
-        map.put("et", this);
-        return SqlHelper.retBool(sqlSession().update(sqlStatement(SqlMethod.UPDATE_BY_ID), map));
-    }
-
-    /**
-     * <p>
-     * 更新(所有字段更新)
-     * </p>
-     */
-    @Transactional(rollbackFor = Exception.class)
-    public boolean updateAllColumnById() {
-        if (StringUtils.checkValNull(pkVal())) {
-            throw new MybatisPlusException("updateAllColumnById primaryKey is null.");
-        }
-        // updateAllColumnById
-        Map<String, Object> map = new HashMap<>();
-        map.put("et", this);
-        return SqlHelper.retBool(sqlSession().update(sqlStatement(SqlMethod.UPDATE_ALL_COLUMN_BY_ID), map));
-    }
-
-    /**
-     * <p>
-     * 执行 SQL 更新
-     * </p>
-     *
-     * @param whereClause 查询条件
-     * @param args        查询条件值
-     * @return
-     */
-    @Transactional(rollbackFor = Exception.class)
-    public boolean update(String whereClause, Object... args) {
-        // update
-        return update(Wrapper.<T>getInstance().where(whereClause, args));
-    }
-
-    /**
-     * <p>
-     * 执行 SQL 更新
-     * </p>
-     *
-     * @param wrapper
-     * @return
-     */
-    @Transactional(rollbackFor = Exception.class)
-    public boolean update(Wrapper wrapper) {
-        Map<String, Object> map = new HashMap<>();
-        map.put("et", this);
-        map.put("ew", wrapper);
-        // update
-        return SqlHelper.retBool(sqlSession().update(sqlStatement(SqlMethod.UPDATE), map));
-    }
-
-    /**
-     * <p>
-     * 查询所有
-     * </p>
-     *
-     * @return
-     */
-    public List<T> selectAll() {
-        return sqlSession().selectList(sqlStatement(SqlMethod.SELECT_LIST));
-    }
-
-    /**
-     * <p>
-     * 根据 ID 查询
-     * </p>
-     *
-     * @param id 主键ID
-     * @return
-     */
-    public T selectById(Serializable id) {
-        return sqlSession().selectOne(sqlStatement(SqlMethod.SELECT_BY_ID), id);
-    }
-
-    /**
-     * <p>
-     * 根据主键查询
-     * </p>
-     *
-     * @return
-     */
-    public T selectById() {
-        if (StringUtils.checkValNull(pkVal())) {
-            throw new MybatisPlusException("selectById primaryKey is null.");
-        }
-        return selectById(this.pkVal());
-    }
-
-    /**
-     * <p>
-     * 查询总记录数
-     * </p>
-     *
-     * @param wrapper
-     * @return
-     */
-
-    public List<T> selectList(Wrapper wrapper) {
-        Map<String, Object> map = new HashMap<>();
-        map.put("ew", wrapper);
-        return sqlSession().selectList(sqlStatement(SqlMethod.SELECT_LIST), map);
-    }
-
-    /**
-     * <p>
-     * 查询所有
-     * </p>
-     *
-     * @param whereClause
-     * @param args
-     * @return
-     */
-    public List<T> selectList(String whereClause, Object... args) {
-        return selectList(Wrapper.<T>getInstance().where(whereClause, args));
-    }
-
-    /**
-     * <p>
-     * 查询一条记录
-     * </p>
-     *
-     * @param wrapper
-     * @return
-     */
-    public T selectOne(Wrapper wrapper) {
-        return SqlHelper.getObject(selectList(wrapper));
-    }
-
-    /**
-     * <p>
-     * 查询一条记录
-     * </p>
-     *
-     * @param whereClause
-     * @param args
-     * @return
-     */
-    public T selectOne(String whereClause, Object... args) {
-        return selectOne(Wrapper.<T>getInstance().where(whereClause, args));
-    }
-
-    /**
-     * <p>
-     * 翻页查询
-     * </p>
-     *
-     * @param page    翻页查询条件
-     * @param wrapper
-     * @return
-     */
-    public Page<T> selectPage(Page<T> page, Wrapper<T> wrapper) {
-        Map<String, Object> map = new HashMap<>();
-        wrapper = (Wrapper<T>) SqlHelper.fillWrapper(page, wrapper);
-        map.put("ew", wrapper);
-        List<T> tl = sqlSession().selectList(sqlStatement(SqlMethod.SELECT_PAGE), map, page);
-        page.setRecords(tl);
-        return page;
-    }
-
-    /**
-     * <p>
-     * 查询所有(分页)
-     * </p>
-     *
-     * @param page
-     * @param whereClause
-     * @param args
-     * @return
-     */
-    @SuppressWarnings("unchecked")
-    public Page<T> selectPage(Page<T> page, String whereClause, Object... args) {
-        return selectPage(page, Wrapper.<T>getInstance().where(whereClause, args));
-    }
-
-    /**
-     * <p>
-     * 查询总数
-     * </p>
-     *
-     * @param whereClause 查询条件
-     * @param args        查询条件值
-     * @return
-     */
-    public int selectCount(String whereClause, Object... args) {
-        return selectCount(Wrapper.<T>getInstance().where(whereClause, args));
-    }
-
-    /**
-     * <p>
-     * 查询总数
-     * </p>
-     *
-     * @param wrapper
-     * @return
-     */
-    public int selectCount(Wrapper wrapper) {
-        Map<String, Object> map = new HashMap<>();
-        map.put("ew", wrapper);
-        return SqlHelper.retCount(sqlSession().<Integer>selectOne(sqlStatement(SqlMethod.SELECT_COUNT), map));
-    }
-
-    /**
-     * <p>
-     * 执行 SQL
-     * </p>
-     */
-    public SqlRunner sql() {
-        return new SqlRunner(getClass());
-    }
-
-    /**
-     * <p>
-     * 获取Session 默认自动提交
-     * <p/>
-     */
-    protected SqlSession sqlSession() {
-        return SqlHelper.sqlSession(getClass());
-    }
-
-    /**
-     * 获取SqlStatement
-     *
-     * @param sqlMethod
-     * @return
-     */
-    protected String sqlStatement(SqlMethod sqlMethod) {
-        return sqlStatement(sqlMethod.getMethod());
-    }
-
-    /**
-     * 获取SqlStatement
-     *
-     * @param sqlMethod
-     * @return
-     */
-    protected String sqlStatement(String sqlMethod) {
-        return SqlHelper.table(getClass()).getSqlStatement(sqlMethod);
-    }
-
-    /**
-     * 主键值
-     */
-    protected abstract Serializable pkVal();
-
-}
+///*
+// * Copyright (c) 2011-2020, hubin (jobob@qq.com).
+// * <p>
+// * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// * use this file except in compliance with the License. You may obtain a copy of
+// * the License at
+// * <p>
+// * http://www.apache.org/licenses/LICENSE-2.0
+// * <p>
+// * Unless required by applicable law or agreed to in writing, software
+// * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// * License for the specific language governing permissions and limitations under
+// * the License.
+// */
+//package com.baomidou.mybatisplus.extension.activerecord;
+//
+//import java.io.Serializable;
+//import java.util.HashMap;
+//import java.util.List;
+//import java.util.Map;
+//
+//import org.apache.ibatis.session.SqlSession;
+//import org.springframework.transaction.annotation.Transactional;
+//
+//import com.baomidou.mybatisplus.core.conditions.Wrapper;
+//import com.baomidou.mybatisplus.core.enums.SqlMethod;
+//import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
+//import com.baomidou.mybatisplus.core.pagination.Page;
+//import com.baomidou.mybatisplus.core.toolkit.sql.SqlHelper;
+//import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+//import com.baomidou.mybatisplus.extension.toolkit.SqlRunner;
+//
+///**
+// * <p>
+// * ActiveRecord 模式 CRUD
+// * </p>
+// *
+// * @param <T>
+// * @author hubin
+// * @Date 2016-11-06
+// */
+//public abstract class Model<T extends Model> implements Serializable {
+//
+//    private static final long serialVersionUID = 1L;
+//
+//    /**
+//     * <p>
+//     * 插入(字段选择插入)
+//     * </p>
+//     */
+//    @Transactional(rollbackFor = Exception.class)
+//    public boolean insert() {
+//        return SqlHelper.retBool(sqlSession().insert(sqlStatement(SqlMethod.INSERT_ONE), this));
+//    }
+//
+//    /**
+//     * <p>
+//     * 插入(所有字段插入)
+//     * </p>
+//     */
+//    @Transactional(rollbackFor = Exception.class)
+//    public boolean insertAllColumn() {
+//        return SqlHelper.retBool(sqlSession().insert(sqlStatement(SqlMethod.INSERT_ONE_ALL_COLUMN), this));
+//    }
+//
+//    /**
+//     * <p>
+//     * 插入 OR 更新
+//     * </p>
+//     */
+//    @Transactional(rollbackFor = Exception.class)
+//    public boolean insertOrUpdate() {
+//        if (StringUtils.checkValNull(pkVal())) {
+//            // insert
+//            return insert();
+//        } else {
+//            /*
+//             * 更新成功直接返回,失败执行插入逻辑
+//             */
+//            return updateById() || insert();
+//        }
+//    }
+//
+//    /**
+//     * <p>
+//     * 根据 ID 删除
+//     * </p>
+//     *
+//     * @param id 主键ID
+//     * @return
+//     */
+//    @Transactional(rollbackFor = Exception.class)
+//    public boolean deleteById(Serializable id) {
+//        return SqlHelper.delBool(sqlSession().delete(sqlStatement(SqlMethod.DELETE_BY_ID), id));
+//    }
+//
+//    /**
+//     * <p>
+//     * 根据主键删除
+//     * </p>
+//     *
+//     * @return
+//     */
+//    @Transactional(rollbackFor = Exception.class)
+//    public boolean deleteById() {
+//        if (StringUtils.checkValNull(pkVal())) {
+//            throw new MybatisPlusException("deleteById primaryKey is null.");
+//        }
+//        return deleteById(this.pkVal());
+//    }
+//
+//    /**
+//     * <p>
+//     * 删除记录
+//     * </p>
+//     *
+//     * @param whereClause 查询条件
+//     * @param args        查询条件值
+//     * @return
+//     */
+//    @Transactional(rollbackFor = Exception.class)
+//    public boolean delete(String whereClause, Object... args) {
+//        return delete(Wrapper.<T>getInstance().where(whereClause, args));
+//    }
+//
+//    /**
+//     * <p>
+//     * 删除记录
+//     * </p>
+//     *
+//     * @param wrapper
+//     * @return
+//     */
+//    @Transactional(rollbackFor = Exception.class)
+//    public boolean delete(Wrapper wrapper) {
+//        Map<String, Object> map = new HashMap<>();
+//        map.put("ew", wrapper);
+//        return SqlHelper.delBool(sqlSession().delete(sqlStatement(SqlMethod.DELETE), map));
+//    }
+//
+//    /**
+//     * <p>
+//     * 更新(字段选择更新)
+//     * </p>
+//     */
+//    @Transactional(rollbackFor = Exception.class)
+//    public boolean updateById() {
+//        if (StringUtils.checkValNull(pkVal())) {
+//            throw new MybatisPlusException("updateById primaryKey is null.");
+//        }
+//        // updateById
+//        Map<String, Object> map = new HashMap<>();
+//        map.put("et", this);
+//        return SqlHelper.retBool(sqlSession().update(sqlStatement(SqlMethod.UPDATE_BY_ID), map));
+//    }
+//
+//    /**
+//     * <p>
+//     * 更新(所有字段更新)
+//     * </p>
+//     */
+//    @Transactional(rollbackFor = Exception.class)
+//    public boolean updateAllColumnById() {
+//        if (StringUtils.checkValNull(pkVal())) {
+//            throw new MybatisPlusException("updateAllColumnById primaryKey is null.");
+//        }
+//        // updateAllColumnById
+//        Map<String, Object> map = new HashMap<>();
+//        map.put("et", this);
+//        return SqlHelper.retBool(sqlSession().update(sqlStatement(SqlMethod.UPDATE_ALL_COLUMN_BY_ID), map));
+//    }
+//
+//    /**
+//     * <p>
+//     * 执行 SQL 更新
+//     * </p>
+//     *
+//     * @param whereClause 查询条件
+//     * @param args        查询条件值
+//     * @return
+//     */
+//    @Transactional(rollbackFor = Exception.class)
+//    public boolean update(String whereClause, Object... args) {
+//        // update
+//        return update(Wrapper.<T>getInstance().where(whereClause, args));
+//    }
+//
+//    /**
+//     * <p>
+//     * 执行 SQL 更新
+//     * </p>
+//     *
+//     * @param wrapper
+//     * @return
+//     */
+//    @Transactional(rollbackFor = Exception.class)
+//    public boolean update(Wrapper wrapper) {
+//        Map<String, Object> map = new HashMap<>();
+//        map.put("et", this);
+//        map.put("ew", wrapper);
+//        // update
+//        return SqlHelper.retBool(sqlSession().update(sqlStatement(SqlMethod.UPDATE), map));
+//    }
+//
+//    /**
+//     * <p>
+//     * 查询所有
+//     * </p>
+//     *
+//     * @return
+//     */
+//    public List<T> selectAll() {
+//        return sqlSession().selectList(sqlStatement(SqlMethod.SELECT_LIST));
+//    }
+//
+//    /**
+//     * <p>
+//     * 根据 ID 查询
+//     * </p>
+//     *
+//     * @param id 主键ID
+//     * @return
+//     */
+//    public T selectById(Serializable id) {
+//        return sqlSession().selectOne(sqlStatement(SqlMethod.SELECT_BY_ID), id);
+//    }
+//
+//    /**
+//     * <p>
+//     * 根据主键查询
+//     * </p>
+//     *
+//     * @return
+//     */
+//    public T selectById() {
+//        if (StringUtils.checkValNull(pkVal())) {
+//            throw new MybatisPlusException("selectById primaryKey is null.");
+//        }
+//        return selectById(this.pkVal());
+//    }
+//
+//    /**
+//     * <p>
+//     * 查询总记录数
+//     * </p>
+//     *
+//     * @param wrapper
+//     * @return
+//     */
+//
+//    public List<T> selectList(Wrapper wrapper) {
+//        Map<String, Object> map = new HashMap<>();
+//        map.put("ew", wrapper);
+//        return sqlSession().selectList(sqlStatement(SqlMethod.SELECT_LIST), map);
+//    }
+//
+//    /**
+//     * <p>
+//     * 查询所有
+//     * </p>
+//     *
+//     * @param whereClause
+//     * @param args
+//     * @return
+//     */
+//    public List<T> selectList(String whereClause, Object... args) {
+//        return selectList(Wrapper.<T>getInstance().where(whereClause, args));
+//    }
+//
+//    /**
+//     * <p>
+//     * 查询一条记录
+//     * </p>
+//     *
+//     * @param wrapper
+//     * @return
+//     */
+//    public T selectOne(Wrapper wrapper) {
+//        return SqlHelper.getObject(selectList(wrapper));
+//    }
+//
+//    /**
+//     * <p>
+//     * 查询一条记录
+//     * </p>
+//     *
+//     * @param whereClause
+//     * @param args
+//     * @return
+//     */
+//    public T selectOne(String whereClause, Object... args) {
+//        return selectOne(Wrapper.<T>getInstance().where(whereClause, args));
+//    }
+//
+//    /**
+//     * <p>
+//     * 翻页查询
+//     * </p>
+//     *
+//     * @param page    翻页查询条件
+//     * @param wrapper
+//     * @return
+//     */
+//    public Page<T> selectPage(Page<T> page, Wrapper<T> wrapper) {
+//        Map<String, Object> map = new HashMap<>();
+//        wrapper = (Wrapper<T>) SqlHelper.fillWrapper(page, wrapper);
+//        map.put("ew", wrapper);
+//        List<T> tl = sqlSession().selectList(sqlStatement(SqlMethod.SELECT_PAGE), map, page);
+//        page.setRecords(tl);
+//        return page;
+//    }
+//
+//    /**
+//     * <p>
+//     * 查询所有(分页)
+//     * </p>
+//     *
+//     * @param page
+//     * @param whereClause
+//     * @param args
+//     * @return
+//     */
+//    @SuppressWarnings("unchecked")
+//    public Page<T> selectPage(Page<T> page, String whereClause, Object... args) {
+//        return selectPage(page, Wrapper.<T>getInstance().where(whereClause, args));
+//    }
+//
+//    /**
+//     * <p>
+//     * 查询总数
+//     * </p>
+//     *
+//     * @param whereClause 查询条件
+//     * @param args        查询条件值
+//     * @return
+//     */
+//    public int selectCount(String whereClause, Object... args) {
+//        return selectCount(Wrapper.<T>getInstance().where(whereClause, args));
+//    }
+//
+//    /**
+//     * <p>
+//     * 查询总数
+//     * </p>
+//     *
+//     * @param wrapper
+//     * @return
+//     */
+//    public int selectCount(Wrapper wrapper) {
+//        Map<String, Object> map = new HashMap<>();
+//        map.put("ew", wrapper);
+//        return SqlHelper.retCount(sqlSession().<Integer>selectOne(sqlStatement(SqlMethod.SELECT_COUNT), map));
+//    }
+//
+//    /**
+//     * <p>
+//     * 执行 SQL
+//     * </p>
+//     */
+//    public SqlRunner sql() {
+//        return new SqlRunner(getClass());
+//    }
+//
+//    /**
+//     * <p>
+//     * 获取Session 默认自动提交
+//     * <p/>
+//     */
+//    protected SqlSession sqlSession() {
+//        return SqlHelper.sqlSession(getClass());
+//    }
+//
+//    /**
+//     * 获取SqlStatement
+//     *
+//     * @param sqlMethod
+//     * @return
+//     */
+//    protected String sqlStatement(SqlMethod sqlMethod) {
+//        return sqlStatement(sqlMethod.getMethod());
+//    }
+//
+//    /**
+//     * 获取SqlStatement
+//     *
+//     * @param sqlMethod
+//     * @return
+//     */
+//    protected String sqlStatement(String sqlMethod) {
+//        return SqlHelper.table(getClass()).getSqlStatement(sqlMethod);
+//    }
+//
+//    /**
+//     * 主键值
+//     */
+//    protected abstract Serializable pkVal();
+//
+//}

+ 1 - 1
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/service/impl/ServiceImpl.java

@@ -390,7 +390,7 @@ public class ServiceImpl<M extends BaseMapper<T>, T> implements IService<T> {
     @Override
     //TODO 3.0
     public Page<T> selectPage(Page<T> page) {
-        return selectPage(page, Wrapper.<T>getInstance());
+        return null;//selectPage(page, Wrapper.<T>getInstance());
     }
 
     @Override

+ 2 - 2
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/AutoGenerator.java

@@ -25,7 +25,6 @@ import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.Version;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
 import com.baomidou.mybatisplus.generator.config.GlobalConfig;
 import com.baomidou.mybatisplus.generator.config.PackageConfig;
@@ -136,7 +135,8 @@ public class AutoGenerator {
             /* ---------- 添加导入包 ---------- */
             if (config.getGlobalConfig().isActiveRecord()) {
                 // 开启 ActiveRecord 模式
-                tableInfo.setImportPackages(Model.class.getCanonicalName());
+                // todo
+              //  tableInfo.setImportPackages(Model.class.getCanonicalName());
             }
             if (tableInfo.isConvert()) {
                 // 表注解

+ 1 - 1
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/po/TableInfo.java

@@ -66,7 +66,7 @@ public class TableInfo {
             this.convert = false;
         } else {
             // 转换字段
-            if (StrategyConfig.DB_COLUMN_UNDERLINE) {
+            if (strategyConfig.isDbColumnUnderline()) {
                 // 包含大写处理
                 if (StringUtils.containsUpperCase(name)) {
                     this.convert = true;

+ 17 - 0
mybatis-plus/build.gradle

@@ -2,4 +2,21 @@ dependencies {
     compile project(":mybatis-plus-extension")
     compile project(":mybatis-plus-generator")
 
+    testCompile 'org.springframework:spring-webL:4.3.5.RELEASE'
+    testCompile 'javax.servlet:servlet-api:2.5'
+
+    testCompile rootProject.ext.dependencies["spring-test"]
+    testCompile rootProject.ext.dependencies["fastjson"]
+
+    testCompile rootProject.ext.dependencies["hikaricp"]
+    testCompile rootProject.ext.dependencies["commons-dbcp2"]
+    testCompile rootProject.ext.dependencies["druid"]
+    testCompile rootProject.ext.dependencies["tomcatjdbc"]
+
+    testCompile rootProject.ext.dependencies["h2"]
+    testCompile rootProject.ext.dependencies["sqlserver"]
+    testCompile rootProject.ext.dependencies["postgresql"]
+    testCompile rootProject.ext.dependencies["oracle"]
+    testCompile rootProject.ext.dependencies["mysql"]
+
 }

+ 11 - 0
mybatis-plus/src/test/java/com/baomidou/test/SqlTest.java

@@ -0,0 +1,11 @@
+package com.baomidou.test;
+
+import org.junit.Test;
+
+public class SqlTest {
+
+    @Test
+    public void test(){
+        System.out.println(1);
+    }
+}