DataSqlMapper

This commit is contained in:
redkale
2024-01-09 15:06:22 +08:00
parent 6c331f733b
commit 4de3d3f505
5 changed files with 24 additions and 39 deletions

View File

@@ -1,33 +0,0 @@
/*
*
*/
package org.redkale.persistence;
import java.lang.annotation.Documented;
import static java.lang.annotation.ElementType.TYPE;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
/**
* 指定Source的资源名
*
* <p>
* 详情见: https://redkale.org
*
*
* @see org.redkale.source.DataSqlMapper
*
* @author zhangjx
*
* @since 2.8.0
*/
@Inherited
@Documented
@Target({TYPE})
@Retention(RUNTIME)
public @interface SourceResource {
String value();
}

View File

@@ -25,6 +25,9 @@ public class DataNativeSqlInfo {
//jdbc版的sql语句, 只有numberSignNames为空时才有值
protected String jdbcSql;
//sql类型
protected SqlMode sqlMode;
protected final List<String> rootParamNames = new ArrayList<>();
@ConvertDisabled
@@ -40,8 +43,15 @@ public class DataNativeSqlInfo {
return jdbcSql;
}
public SqlMode getSqlMode() {
return sqlMode;
}
public List<String> getRootParamNames() {
return rootParamNames;
}
public enum SqlMode {
SELECT, INSERT, DELETE, UPDATE, UPSERT, OTHERS;
}
}

View File

@@ -10,6 +10,7 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Stream;
import org.redkale.asm.AsmDepends;
import org.redkale.util.LambdaFunction;
import org.redkale.util.LambdaSupplier;
import org.redkale.util.SelectColumn;
@@ -17,12 +18,10 @@ import org.redkale.util.Sheet;
/**
* 类似Mybatis的Mapper接口类, 接口系列和DataSource相似度高 <br>
* 子类需要注解数据源{@link org.redkale.persistence.SourceResource}没有指定会找资源名为空的默认DataSqlSource
*
* <p>
* 详情见: https://redkale.org
*
* @see org.redkale.persistence.SourceResource
*
* @author zhangjx
* @param <T> T
@@ -36,6 +35,7 @@ public interface DataSqlMapper<T> {
*
* @return DataSqlSource
*/
@AsmDepends
DataSqlSource dataSource();
/**
@@ -44,6 +44,7 @@ public interface DataSqlMapper<T> {
*
* @return Class
*/
@AsmDepends
Class<T> entityType();
/**
@@ -364,7 +365,6 @@ public interface DataSqlMapper<T> {
* <b>注意</b>:即使字段标记为&#064;Column(updatable=false)也会被更新 <br>
* 等价SQL: UPDATE {table} SET {column} = {value} WHERE {filter node} <br>
*
* @param clazz Entity类
* @param column 待更新的字段名
* @param value 更新值
* @param node 过滤条件
@@ -1557,8 +1557,6 @@ public interface DataSqlMapper<T> {
* 获取符合过滤条件单个记录, 返回null表示不存在值 <br>
* 等价SQL: SELECT * FROM {table} WHERE {column} = {key} <br>
*
* @param <T> Entity泛型
* @param clazz Entity类
* @param column 过滤字段名
* @param colval 过滤字段值
*

View File

@@ -8,11 +8,21 @@ import org.redkale.source.DataSqlMapper;
import org.redkale.source.DataSqlSource;
/**
* DataSqlMapper工厂类
*
* <p>
* 详情见: https://redkale.org
*
*
* @author zhangjx
*
* @since 2.8.0
*/
public final class DataSqlMapperBuilder {
private DataSqlMapperBuilder() {
}
public static <T, M extends DataSqlMapper<T>> M createMapper(DataNativeSqlParser nativeSqlParser, DataSqlSource source, Class<M> mapperType) {
return null;
}

View File

@@ -24,7 +24,7 @@ public interface ThrowSupplier<T> {
* Gets a result.
*
* @return a result
* @throws java.lang.Throwable
* @throws java.lang.Throwable Throwable
*/
T get() throws Throwable;