|
@@ -14,9 +14,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.Assert;
|
|
|
import org.webbuilder.sql.*;
|
|
|
+import org.webbuilder.sql.param.ExecuteCondition;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.util.LinkedHashSet;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Set;
|
|
@@ -261,7 +263,7 @@ public class DynamicFormServiceImpl implements DynamicFormService {
|
|
|
|
|
|
public static QueryParamProxy build(QueryParam param) {
|
|
|
QueryParamProxy proxy = new QueryParamProxy();
|
|
|
- // proxy.where(param.getTerm());
|
|
|
+ proxy.setConditions(term2cdt(param.getTerms()));
|
|
|
proxy.exclude(param.getExcludes());
|
|
|
proxy.include(param.getIncludes());
|
|
|
proxy.orderBy(param.getSortOrder(), param.getSortField());
|
|
@@ -274,7 +276,7 @@ public class DynamicFormServiceImpl implements DynamicFormService {
|
|
|
public static class UpdateParamProxy extends org.webbuilder.sql.param.update.UpdateParam {
|
|
|
public static UpdateParamProxy build(UpdateParam<Map<String, Object>> param) {
|
|
|
UpdateParamProxy proxy = new UpdateParamProxy();
|
|
|
- // proxy.where(param.getTerm());
|
|
|
+ proxy.setConditions(term2cdt(param.getTerms()));
|
|
|
proxy.exclude(param.getExcludes());
|
|
|
proxy.include(param.getIncludes());
|
|
|
proxy.set(param.getData());
|
|
@@ -293,8 +295,24 @@ public class DynamicFormServiceImpl implements DynamicFormService {
|
|
|
public static class DeleteParamProxy extends org.webbuilder.sql.param.delete.DeleteParam {
|
|
|
public static DeleteParamProxy build(DeleteParam param) {
|
|
|
DeleteParamProxy proxy = new DeleteParamProxy();
|
|
|
- // proxy.where(param.getTerm());
|
|
|
+ proxy.setConditions(term2cdt(param.getTerms()));
|
|
|
return proxy;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ protected static Set<ExecuteCondition> term2cdt(List<Term> terms) {
|
|
|
+ Set<ExecuteCondition> set = new LinkedHashSet<>();
|
|
|
+ terms.forEach(term -> {
|
|
|
+ ExecuteCondition executeCondition = new ExecuteCondition();
|
|
|
+ executeCondition.setAppendType(term.getType().toString());
|
|
|
+ executeCondition.setField(term.getField());
|
|
|
+ executeCondition.setValue(term.getValue());
|
|
|
+ executeCondition.setQueryType(term.getTermType().toString().toUpperCase());
|
|
|
+ executeCondition.setSql(false);
|
|
|
+ if (!term.getTerms().isEmpty())
|
|
|
+ executeCondition.setNest(term2cdt(term.getTerms()));
|
|
|
+ set.add(executeCondition);
|
|
|
+ });
|
|
|
+ return set;
|
|
|
+ }
|
|
|
}
|