增加AbstractDataSqlSource
This commit is contained in:
3283
src/main/java/org/redkale/source/AbstractDataSqlSource.java
Normal file
3283
src/main/java/org/redkale/source/AbstractDataSqlSource.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -30,7 +30,7 @@ import org.redkale.util.*;
|
|||||||
@AutoLoad(false)
|
@AutoLoad(false)
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ResourceType(DataSource.class)
|
@ResourceType(DataSource.class)
|
||||||
public class DataJdbcSource extends DataSqlSource {
|
public class DataJdbcSource extends AbstractDataSqlSource {
|
||||||
|
|
||||||
protected ConnectionPool readPool;
|
protected ConnectionPool readPool;
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import org.redkale.util.*;
|
|||||||
@AutoLoad(false)
|
@AutoLoad(false)
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ResourceType(DataSource.class)
|
@ResourceType(DataSource.class)
|
||||||
public class DataMemorySource extends DataSqlSource implements SearchSource {
|
public class DataMemorySource extends AbstractDataSqlSource implements SearchSource {
|
||||||
|
|
||||||
public DataMemorySource(String name) {
|
public DataMemorySource(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -126,7 +126,7 @@ public class FilterJoinNode extends FilterNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <T> CharSequence createSQLExpress(DataSqlSource source, final EntityInfo<T> info, final Map<Class, String> joinTabalis) {
|
protected <T> CharSequence createSQLExpress(AbstractDataSqlSource source, final EntityInfo<T> info, final Map<Class, String> joinTabalis) {
|
||||||
return super.createSQLExpress(source, this.joinEntity == null ? info : this.joinEntity, joinTabalis);
|
return super.createSQLExpress(source, this.joinEntity == null ? info : this.joinEntity, joinTabalis);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -297,14 +297,14 @@ public class FilterNode { //FilterNode 不能实现Serializable接口, 否则
|
|||||||
/**
|
/**
|
||||||
* 该方法需要重载
|
* 该方法需要重载
|
||||||
*
|
*
|
||||||
* @param source DataSqlSource
|
* @param source AbstractDataSqlSource
|
||||||
* @param <T> Entity类的泛型
|
* @param <T> Entity类的泛型
|
||||||
* @param joinTabalis 关联表的集合
|
* @param joinTabalis 关联表的集合
|
||||||
* @param info EntityInfo
|
* @param info EntityInfo
|
||||||
*
|
*
|
||||||
* @return JOIN的SQL语句
|
* @return JOIN的SQL语句
|
||||||
*/
|
*/
|
||||||
protected <T> CharSequence createSQLExpress(DataSqlSource source, final EntityInfo<T> info, final Map<Class, String> joinTabalis) {
|
protected <T> CharSequence createSQLExpress(AbstractDataSqlSource source, final EntityInfo<T> info, final Map<Class, String> joinTabalis) {
|
||||||
CharSequence sb0 = this.column == null || this.column.isEmpty() || this.column.charAt(0) == '#' || info == null
|
CharSequence sb0 = this.column == null || this.column.isEmpty() || this.column.charAt(0) == '#' || info == null
|
||||||
? null : createElementSQLExpress(source, info, joinTabalis == null ? null : joinTabalis.get(info.getType()));
|
? null : createElementSQLExpress(source, info, joinTabalis == null ? null : joinTabalis.get(info.getType()));
|
||||||
if (this.nodes == null) {
|
if (this.nodes == null) {
|
||||||
@@ -396,7 +396,7 @@ public class FilterNode { //FilterNode 不能实现Serializable接口, 否则
|
|||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final <T> CharSequence createElementSQLExpress(DataSqlSource source, final EntityInfo<T> info, String talis) {
|
protected final <T> CharSequence createElementSQLExpress(AbstractDataSqlSource source, final EntityInfo<T> info, String talis) {
|
||||||
final Object val0 = getValue();
|
final Object val0 = getValue();
|
||||||
if (needSplit(val0)) {
|
if (needSplit(val0)) {
|
||||||
if (val0 instanceof Collection) {
|
if (val0 instanceof Collection) {
|
||||||
@@ -452,7 +452,7 @@ public class FilterNode { //FilterNode 不能实现Serializable接口, 否则
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> CharSequence createElementSQLExpress(DataSqlSource source, final EntityInfo<T> info, String talis, Object val0) {
|
private <T> CharSequence createElementSQLExpress(AbstractDataSqlSource source, final EntityInfo<T> info, String talis, Object val0) {
|
||||||
if (column == null || this.column.isEmpty() || this.column.charAt(0) == '#') {
|
if (column == null || this.column.isEmpty() || this.column.charAt(0) == '#') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,9 +71,9 @@ public class FilterNodeTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T> CharSequence createSQLExpress(FilterNode node, DataSqlSource source, final EntityInfo<T> info, final Map<Class, String> joinTabalis) {
|
private static <T> CharSequence createSQLExpress(FilterNode node, AbstractDataSqlSource source, final EntityInfo<T> info, final Map<Class, String> joinTabalis) {
|
||||||
try {
|
try {
|
||||||
Method method = FilterNode.class.getDeclaredMethod("createSQLExpress", DataSqlSource.class, EntityInfo.class, Map.class);
|
Method method = FilterNode.class.getDeclaredMethod("createSQLExpress", AbstractDataSqlSource.class, EntityInfo.class, Map.class);
|
||||||
method.setAccessible(true);
|
method.setAccessible(true);
|
||||||
return (CharSequence) method.invoke(node, source, info, joinTabalis);
|
return (CharSequence) method.invoke(node, source, info, joinTabalis);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user