diff --git a/build.gradle b/build.gradle
index 0a93bba..9432f97 100644
--- a/build.gradle
+++ b/build.gradle
@@ -11,6 +11,7 @@ allprojects {
maven {
url 'https://repo.huaweicloud.com/repository/maven/'
}
+ mavenCentral()
}
buildscript {
repositories {
@@ -71,7 +72,7 @@ dependencies {
implementation 'org.springframework:spring-web:5.3.14'
implementation 'org.hibernate:hibernate-core:5.6.8.Final'
implementation 'com.github.vertical-blank:sql-formatter:2.0.3'
- implementation 'com.sondertara:common-tara:0.0.4.0'
+ implementation 'com.sondertara:common-tara:0.1.0'
compileOnly 'org.projectlombok:lombok:1.18.24'
compileOnly 'com.oracle.database.jdbc:ojdbc8:21.5.0.0'
diff --git a/src/main/java/com/sondertara/joya/core/builder/ExtPartBuilder.java b/src/main/java/com/sondertara/joya/core/builder/ExtPartBuilder.java
index 99d8c17..f039cad 100644
--- a/src/main/java/com/sondertara/joya/core/builder/ExtPartBuilder.java
+++ b/src/main/java/com/sondertara/joya/core/builder/ExtPartBuilder.java
@@ -12,27 +12,40 @@
public interface ExtPartBuilder extends SetupBuilder {
/**
- * groupBy
+ * group by
+ *
+ * @param groupBySegment param
+ * @return the builder
*/
ExtPartBuilder groupBy(String groupBySegment);
/**
* having
- * 使用方式: nativeSql.having(h -> h.eq().ne().in())
+ *
+ * example:nativeSql.having(h -> h.eq().ne().in())
+ *
+ * @param func the function
+ * @return the builder
*/
ExtPartBuilder having(UnaryOperator func);
/**
- * orderBy
- * 排序参数如果是前端传进来,用QueryRequest接收的 ===> nativeSql.orderBy( queryRequest.getOrderBy(表别名) )
- * 手写逻辑指定排序字段 ==> nativeSql.orderBy("su.age asc")
+ * order by with function
+ *
+ * example: nativeSql.orderBy("su.age asc")
+ *
+ * @param fn the column function
+ * @param orderBy the order type
+ * @param the type of table class
+ * @return the builder
*/
ExtPartBuilder orderBy(TaraFunction fn, OrderParam.OrderBy orderBy);
/**
- * orderBy
- * 排序参数如果是前端传进来,用QueryRequest接收的 ===> nativeSql.orderBy( queryRequest.getOrderBy(表别名) )
- * 手写逻辑指定排序字段 ==> nativeSql.orderBy("su.age asc")
+ * order by with string
+ *
+ * @param orderBySegment order by params
+ * @return the builder
*/
ExtPartBuilder orderBy(String... orderBySegment);
}
diff --git a/src/main/java/com/sondertara/joya/core/builder/FromBuilder.java b/src/main/java/com/sondertara/joya/core/builder/FromBuilder.java
index 337bbf8..bfe3f3b 100644
--- a/src/main/java/com/sondertara/joya/core/builder/FromBuilder.java
+++ b/src/main/java/com/sondertara/joya/core/builder/FromBuilder.java
@@ -10,12 +10,17 @@
public interface FromBuilder {
/**
- * 字符串格式的from语句
- * from 要查询的表以及关联表
+ * sql from part with string
+ *
+ * @param tableAndJoinTable the sql from segment
+ * @return the next builder
*/
WhereBuilder from(String... tableAndJoinTable);
/**
+ * the table class
+ *
+ * when use it the table alias will set to default like t0,t1...
* 根据class获取表,别名为表的顺序t0,t1,t2,t2
*
* @param clazz form entity class
@@ -24,6 +29,10 @@ public interface FromBuilder {
WhereBuilder from(Class>... clazz);
/**
+ * the table class with join params
+ *
+ * the limit is only support join tree table,if there is complicated sql query just use the native sql
+ * when use it the table alias will set to default like t0,t1...
* 根据class获取表,别名为表的顺序t0,t1,t2,t2
*
* @param func join param
diff --git a/src/main/java/com/sondertara/joya/core/builder/SelectBuilder.java b/src/main/java/com/sondertara/joya/core/builder/SelectBuilder.java
index 6788f36..67a848d 100644
--- a/src/main/java/com/sondertara/joya/core/builder/SelectBuilder.java
+++ b/src/main/java/com/sondertara/joya/core/builder/SelectBuilder.java
@@ -5,35 +5,59 @@
import java.util.function.UnaryOperator;
+/**
+ * (non-javadoc)
+ * the select builder
+ *
+ * @author huangxiaohu
+ */
public interface SelectBuilder {
/**
+ * sql select part
+ *
+ * example: [t0.user_name] or [t0.usr_name AS userName]
* select 要查询的列 格式为[t0.user_name] 或者[t0.usr_name AS userName]
+ *
+ * @param columns the query columns
+ * @return the next builder
*/
FromBuilder select(String... columns);
/**
+ * sql select part
+ *
+ * this function will query all columns (select *),you can use {@link #specificS} together to assign alias
+ *
* 查询表的全部列,对于联表查询 如果字段名字有重复,只保留前面一个字段,可以配置specificS来指定字段别名
+ *
+ * @return the next builder
*/
FromBuilder select();
/**
+ * the special query column like as alias.
+ *
* 特殊select 字段 搭配select(),指定字段的别名
*
- * @param selectFields 特殊字段
+ * @param selectFields the special column,usually is the column alias
+ * @return this builder
*/
SelectBuilder specificS(String... selectFields);
/**
+ * select single column
* 选择一个字段
*
* @param f1 column
* @param entity
- * @return query
+ * @return the next builder
*/
FromBuilder select(TaraFunction f1);
/**
+ * select two column
+ *
* @param f1 column1
* @param f2 column2
* @param entity1
@@ -42,28 +66,58 @@ public interface SelectBuilder {
*/
FromBuilder select(TaraFunction f1, TaraFunction f2);
-
+ /**
+ * (non-javadoc)
+ */
FromBuilder select(TaraFunction f1, TaraFunction f2, TaraFunction f3);
+ /**
+ * (non-javadoc)
+ */
FromBuilder select(TaraFunction f1, TaraFunction f2, TaraFunction f3, TaraFunction f4);
+ /**
+ * (non-javadoc)
+ */
FromBuilder select(TaraFunction f1, TaraFunction f2, TaraFunction f3, TaraFunction f4, TaraFunction f5);
+ /**
+ * (non-javadoc)
+ */
FromBuilder select(TaraFunction f1, TaraFunction f2, TaraFunction f3, TaraFunction f4, TaraFunction f5, TaraFunction f6);
+ /**
+ * (non-javadoc)
+ */
FromBuilder select(TaraFunction f1, TaraFunction f2, TaraFunction f3, TaraFunction f4, TaraFunction f5, TaraFunction f6, TaraFunction f7);
+ /**
+ * (non-javadoc)
+ */
FromBuilder select(TaraFunction f1, TaraFunction f2, TaraFunction f3, TaraFunction f4, TaraFunction f5, TaraFunction f6, TaraFunction f7, TaraFunction f8);
+ /**
+ * (non-javadoc)
+ */
FromBuilder select(TaraFunction f1, TaraFunction f2, TaraFunction f3, TaraFunction f4, TaraFunction f5, TaraFunction f6, TaraFunction f7, TaraFunction f8, TaraFunction f9);
+ /**
+ * (non-javadoc)
+ */
FromBuilder select(TaraFunction f1, TaraFunction f2, TaraFunction f3, TaraFunction f4, TaraFunction f5, TaraFunction f6, TaraFunction f7, TaraFunction f8, TaraFunction f9, TaraFunction f10);
+ /**
+ * (non-javadoc)
+ */
FromBuilder select(TaraFunction f1, TaraFunction f2, TaraFunction f3, TaraFunction f4, TaraFunction f5, TaraFunction f6, TaraFunction f7, TaraFunction f8, TaraFunction f9, TaraFunction f10, TaraFunction f11);
+ /**
+ * (non-javadoc)
+ */
FromBuilder select(TaraFunction f1, TaraFunction f2, TaraFunction f3, TaraFunction f4, TaraFunction f5, TaraFunction f6, TaraFunction f7, TaraFunction f8, TaraFunction f9, TaraFunction f10, TaraFunction f11, TaraFunction f12);
/**
+ * the lambda select, use {@link #specificS(String...)} the resolve alias
* lambda select 同样冲突字段需要调用specificS()
*
* @param func select field
diff --git a/src/main/java/com/sondertara/joya/core/builder/SetupBuilder.java b/src/main/java/com/sondertara/joya/core/builder/SetupBuilder.java
index 96b4bcd..e675a9e 100644
--- a/src/main/java/com/sondertara/joya/core/builder/SetupBuilder.java
+++ b/src/main/java/com/sondertara/joya/core/builder/SetupBuilder.java
@@ -3,10 +3,14 @@
import com.sondertara.joya.core.query.NativeSqlQuery;
/**
+ * (non-javadoc)
+ * the start builder
+ *
* @author huangxiaohu
*/
public interface SetupBuilder {
/**
+ * builder the NativeSqlQuery
* 构造 NativeSqlQuery
*
* @return sql
diff --git a/src/main/java/com/sondertara/joya/core/builder/WhereBuilder.java b/src/main/java/com/sondertara/joya/core/builder/WhereBuilder.java
index 3883de0..43c4f2c 100644
--- a/src/main/java/com/sondertara/joya/core/builder/WhereBuilder.java
+++ b/src/main/java/com/sondertara/joya/core/builder/WhereBuilder.java
@@ -9,19 +9,25 @@
*/
public interface WhereBuilder extends ExtPartBuilder {
+
/**
- * where
- * 使用方式: nativeSql.where(w -> w.eq().ne().in())
+ * lambda where
+ *
+ * example :nativeSql.where(w -> w.eq().ne().in())
+ *
+ * @param func the function
+ * @return the next builder
*/
ExtPartBuilder where(UnaryOperator func);
/**
- * where
+ * where part with appoint the condition link type,default is #AND
* 使用方式: nativeSql.where(w -> w.eq().ne().in())
*
* @param func 条件
* @param linkOr 是否为or查询 默认为and
+ * @return the next builder
*/
ExtPartBuilder where(UnaryOperator func, boolean linkOr);
@@ -30,6 +36,7 @@ public interface WhereBuilder extends ExtPartBuilder {
* 指定字段的别名
*
* @param whereFields 特殊字段
+ * @return this builder
*/
WhereBuilder specificW(String... whereFields);
}
\ No newline at end of file