Browse Source

优化api

zhouhao 6 years ago
parent
commit
470b2c4ef8

+ 9 - 0
hsweb-commons/hsweb-commons-entity/src/main/java/org/hswebframework/web/commons/entity/param/DeleteParamEntity.java

@@ -1,5 +1,7 @@
 package org.hswebframework.web.commons.entity.param;
 
+import org.hswebframework.ezorm.core.dsl.Delete;
+import org.hswebframework.ezorm.core.dsl.Update;
 import org.hswebframework.ezorm.core.param.Param;
 import org.hswebframework.web.commons.entity.Entity;
 import org.hswebframework.web.commons.entity.QueryEntity;
@@ -28,6 +30,13 @@ public class DeleteParamEntity extends Param implements QueryEntity {
         return new DeleteParamEntity();
     }
 
+    /**
+     * @since 3.0.4
+     */
+    public static Delete<DeleteParamEntity> newDelete() {
+        return new Delete<>(new DeleteParamEntity());
+    }
+
     @Override
     public String toString() {
         return toHttpQueryParamString();

+ 8 - 0
hsweb-commons/hsweb-commons-entity/src/main/java/org/hswebframework/web/commons/entity/param/QueryParamEntity.java

@@ -1,5 +1,6 @@
 package org.hswebframework.web.commons.entity.param;
 
+import org.hswebframework.ezorm.core.dsl.Query;
 import org.hswebframework.ezorm.core.param.QueryParam;
 import org.hswebframework.web.commons.entity.Entity;
 import org.hswebframework.web.commons.entity.QueryEntity;
@@ -51,6 +52,13 @@ public class QueryParamEntity extends QueryParam implements QueryEntity {
         return empty().where(field, value);
     }
 
+    /**
+     * @since 3.0.4
+     */
+    public static <T> Query<T, QueryParamEntity> newQuery() {
+        return Query.empty(new QueryParamEntity());
+    }
+
     @Override
     public String toString() {
         return toHttpQueryParamString();

+ 9 - 0
hsweb-commons/hsweb-commons-entity/src/main/java/org/hswebframework/web/commons/entity/param/UpdateParamEntity.java

@@ -1,5 +1,7 @@
 package org.hswebframework.web.commons.entity.param;
 
+import org.hswebframework.ezorm.core.dsl.Query;
+import org.hswebframework.ezorm.core.dsl.Update;
 import org.hswebframework.ezorm.core.param.UpdateParam;
 import org.hswebframework.web.commons.entity.Entity;
 import org.hswebframework.web.commons.entity.QueryEntity;
@@ -54,6 +56,13 @@ public class UpdateParamEntity<T> extends UpdateParam<T> implements QueryEntity
         return new UpdateParamEntity<>(data).where(field, value);
     }
 
+    /**
+     * @since 3.0.4
+     */
+    public static <T> Update<T, UpdateParamEntity<T>> newUpdate() {
+        return new Update<>(new UpdateParamEntity<>());
+    }
+
     @Override
     public String toString() {
         return toHttpQueryParamString();