cn.schoolwow.util.domain.query.instance.QueryInstance Maven / Gradle / Ivy
package cn.schoolwow.util.domain.query.instance;
import cn.schoolwow.quickflow.QuickFlow;
import cn.schoolwow.quickflow.QuickFlowBuilder;
import cn.schoolwow.util.module.query.instance.domain.InstanceQueryOption;
import cn.schoolwow.util.module.query.instance.service.SetInstanceFieldValueFlow;
public class QueryInstance {
private InstanceQueryOption instanceQueryOption = new InstanceQueryOption();
private static QuickFlow quickFlow = QuickFlowBuilder.newInstance();
/**创建实例查询*/
public static QueryInstance newQuery(Object instance){
QueryInstance instanceQuery = new QueryInstance();
instanceQuery.instanceQueryOption.instance = instance;
return instanceQuery;
}
public QueryInstance() {
quickFlow.putContextThreadLocalData("instanceQueryOption", instanceQueryOption);
}
public QueryInstance setFieldValue(String fieldName, Object fieldValue){
quickFlow.startFlow(new SetInstanceFieldValueFlow())
.putCurrentCompositeFlowData("fieldName", fieldName)
.putCurrentCompositeFlowData("fieldValue", fieldValue)
.execute();
return this;
}
public QueryInstanceResponse execute(){
return new QueryInstanceResponse(quickFlow);
}
}