mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 17:18:24 +08:00
v1.0.0 prepare
This commit is contained in:
parent
d43768d77e
commit
418313872f
@ -15,8 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.mybatisflex.annotation;
|
package com.mybatisflex.annotation;
|
||||||
|
|
||||||
import com.mybatisflex.core.enums.KeyType;
|
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
@Inherited
|
@Inherited
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
* 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.enums;
|
package com.mybatisflex.annotation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID 生成策略
|
* ID 生成策略
|
||||||
@ -32,11 +32,6 @@ public @interface Table {
|
|||||||
*/
|
*/
|
||||||
String schema() default "";
|
String schema() default "";
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否使用 mybatis 缓存
|
|
||||||
*/
|
|
||||||
boolean useCached() default false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 默认为 驼峰属性 转换为 下划线字段
|
* 默认为 驼峰属性 转换为 下划线字段
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
package com.mybatisflex.core;
|
package com.mybatisflex.core;
|
||||||
|
|
||||||
import com.mybatisflex.core.dialect.DbType;
|
import com.mybatisflex.core.dialect.DbType;
|
||||||
import com.mybatisflex.core.enums.KeyType;
|
import com.mybatisflex.annotation.KeyType;
|
||||||
import org.apache.ibatis.session.Configuration;
|
import org.apache.ibatis.session.Configuration;
|
||||||
import org.apache.ibatis.session.SqlSessionFactory;
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.mybatisflex.core.key;
|
package com.mybatisflex.core.key;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
import com.mybatisflex.core.FlexConsts;
|
import com.mybatisflex.core.FlexConsts;
|
||||||
import com.mybatisflex.core.FlexGlobalConfig;
|
import com.mybatisflex.core.FlexGlobalConfig;
|
||||||
import com.mybatisflex.core.exception.FlexExceptions;
|
import com.mybatisflex.core.exception.FlexExceptions;
|
||||||
@ -33,7 +34,7 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* 通过 java 编码的方式生成主键
|
* 通过 java 编码的方式生成主键
|
||||||
* 当主键类型配置为 KeyType#Generator 时,使用此生成器生成
|
* 当主键类型配置为 KeyType#Generator 时,使用此生成器生成
|
||||||
* {@link com.mybatisflex.core.enums.KeyType#Generator}
|
* {@link KeyType#Generator}
|
||||||
*/
|
*/
|
||||||
public class CustomKeyGenerator implements KeyGenerator {
|
public class CustomKeyGenerator implements KeyGenerator {
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ package com.mybatisflex.core.key;
|
|||||||
|
|
||||||
import com.mybatisflex.core.FlexConsts;
|
import com.mybatisflex.core.FlexConsts;
|
||||||
import com.mybatisflex.core.FlexGlobalConfig;
|
import com.mybatisflex.core.FlexGlobalConfig;
|
||||||
import com.mybatisflex.core.enums.KeyType;
|
import com.mybatisflex.annotation.KeyType;
|
||||||
import com.mybatisflex.core.exception.FlexExceptions;
|
import com.mybatisflex.core.exception.FlexExceptions;
|
||||||
import com.mybatisflex.core.table.IdInfo;
|
import com.mybatisflex.core.table.IdInfo;
|
||||||
import com.mybatisflex.core.table.TableInfo;
|
import com.mybatisflex.core.table.TableInfo;
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.mybatisflex.core.key;
|
package com.mybatisflex.core.key;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
import com.mybatisflex.core.FlexConsts;
|
import com.mybatisflex.core.FlexConsts;
|
||||||
import com.mybatisflex.core.exception.FlexExceptions;
|
import com.mybatisflex.core.exception.FlexExceptions;
|
||||||
import com.mybatisflex.core.row.Row;
|
import com.mybatisflex.core.row.Row;
|
||||||
@ -29,7 +30,7 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* 通过 java 编码的方式生成主键
|
* 通过 java 编码的方式生成主键
|
||||||
* 当主键类型配置为 KeyType#Generator 时,使用此生成器生成
|
* 当主键类型配置为 KeyType#Generator 时,使用此生成器生成
|
||||||
* {@link com.mybatisflex.core.enums.KeyType#Generator}
|
* {@link KeyType#Generator}
|
||||||
*/
|
*/
|
||||||
public class RowCustomKeyGenerator implements KeyGenerator {
|
public class RowCustomKeyGenerator implements KeyGenerator {
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
package com.mybatisflex.core.key;
|
package com.mybatisflex.core.key;
|
||||||
|
|
||||||
import com.mybatisflex.core.FlexConsts;
|
import com.mybatisflex.core.FlexConsts;
|
||||||
import com.mybatisflex.core.enums.KeyType;
|
import com.mybatisflex.annotation.KeyType;
|
||||||
import com.mybatisflex.core.row.Row;
|
import com.mybatisflex.core.row.Row;
|
||||||
import com.mybatisflex.core.row.RowKey;
|
import com.mybatisflex.core.row.RowKey;
|
||||||
import com.mybatisflex.core.util.ArrayUtil;
|
import com.mybatisflex.core.util.ArrayUtil;
|
||||||
|
|||||||
@ -47,12 +47,10 @@ public class FlexConfiguration extends Configuration {
|
|||||||
public FlexConfiguration(Environment environment) {
|
public FlexConfiguration(Environment environment) {
|
||||||
super(environment);
|
super(environment);
|
||||||
setMapUnderscoreToCamelCase(true);
|
setMapUnderscoreToCamelCase(true);
|
||||||
// setLogImpl(StdOutImpl.class);
|
|
||||||
initDefaultMappers();
|
initDefaultMappers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public FlexConfiguration() {
|
public FlexConfiguration() {
|
||||||
// setLogImpl(StdOutImpl.class);
|
|
||||||
initDefaultMappers();
|
initDefaultMappers();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +91,6 @@ public class FlexConfiguration extends Configuration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addMappedStatement(MappedStatement ms) {
|
public void addMappedStatement(MappedStatement ms) {
|
||||||
//替换 RowMapper.insertRow 的主键生成器
|
//替换 RowMapper.insertRow 的主键生成器
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.mybatisflex.core.row;
|
package com.mybatisflex.core.row;
|
||||||
|
|
||||||
import com.mybatisflex.core.enums.KeyType;
|
import com.mybatisflex.annotation.KeyType;
|
||||||
import com.mybatisflex.core.util.SqlUtil;
|
import com.mybatisflex.core.util.SqlUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
package com.mybatisflex.core.table;
|
package com.mybatisflex.core.table;
|
||||||
|
|
||||||
import com.mybatisflex.annotation.Id;
|
import com.mybatisflex.annotation.Id;
|
||||||
import com.mybatisflex.core.enums.KeyType;
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
|
||||||
public class IdInfo extends ColumnInfo {
|
public class IdInfo extends ColumnInfo {
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
package com.mybatisflex.core.table;
|
package com.mybatisflex.core.table;
|
||||||
|
|
||||||
import com.mybatisflex.core.FlexConsts;
|
import com.mybatisflex.core.FlexConsts;
|
||||||
import com.mybatisflex.core.enums.KeyType;
|
import com.mybatisflex.annotation.KeyType;
|
||||||
import com.mybatisflex.core.javassist.ModifyAttrsRecord;
|
import com.mybatisflex.core.javassist.ModifyAttrsRecord;
|
||||||
import com.mybatisflex.core.row.Row;
|
import com.mybatisflex.core.row.Row;
|
||||||
import com.mybatisflex.core.util.ArrayUtil;
|
import com.mybatisflex.core.util.ArrayUtil;
|
||||||
@ -38,7 +38,6 @@ public class TableInfo {
|
|||||||
private String schema; //schema
|
private String schema; //schema
|
||||||
private String tableName; //表名
|
private String tableName; //表名
|
||||||
private Class<?> entityClass; //实体类
|
private Class<?> entityClass; //实体类
|
||||||
private boolean useCached = false;
|
|
||||||
private boolean camelToUnderline = true;
|
private boolean camelToUnderline = true;
|
||||||
|
|
||||||
//逻辑删除数据库列名
|
//逻辑删除数据库列名
|
||||||
@ -105,14 +104,6 @@ public class TableInfo {
|
|||||||
this.entityClass = entityClass;
|
this.entityClass = entityClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUseCached() {
|
|
||||||
return useCached;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUseCached(boolean useCached) {
|
|
||||||
this.useCached = useCached;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCamelToUnderline() {
|
public boolean isCamelToUnderline() {
|
||||||
return camelToUnderline;
|
return camelToUnderline;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -95,7 +95,6 @@ public class TableInfos {
|
|||||||
if (table != null) {
|
if (table != null) {
|
||||||
tableInfo.setTableName(table.value());
|
tableInfo.setTableName(table.value());
|
||||||
tableInfo.setSchema(table.schema());
|
tableInfo.setSchema(table.schema());
|
||||||
tableInfo.setUseCached(table.useCached());
|
|
||||||
tableInfo.setCamelToUnderline(table.camelToUnderline());
|
tableInfo.setCamelToUnderline(table.camelToUnderline());
|
||||||
} else {
|
} else {
|
||||||
//默认为类名转驼峰下划线
|
//默认为类名转驼峰下划线
|
||||||
|
|||||||
@ -3,7 +3,7 @@ package com.mybatisflex.test;
|
|||||||
import com.mybatisflex.annotation.Column;
|
import com.mybatisflex.annotation.Column;
|
||||||
import com.mybatisflex.annotation.Id;
|
import com.mybatisflex.annotation.Id;
|
||||||
import com.mybatisflex.annotation.Table;
|
import com.mybatisflex.annotation.Table;
|
||||||
import com.mybatisflex.core.enums.KeyType;
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ package com.mybatisflex.test;
|
|||||||
|
|
||||||
import com.mybatisflex.annotation.Id;
|
import com.mybatisflex.annotation.Id;
|
||||||
import com.mybatisflex.annotation.Table;
|
import com.mybatisflex.annotation.Table;
|
||||||
import com.mybatisflex.core.enums.KeyType;
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ package com.mybatisflex.test.model;
|
|||||||
|
|
||||||
import com.mybatisflex.annotation.Id;
|
import com.mybatisflex.annotation.Id;
|
||||||
import com.mybatisflex.annotation.Table;
|
import com.mybatisflex.annotation.Table;
|
||||||
import com.mybatisflex.core.enums.KeyType;
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user