cn.schoolwow.util.domain.compare.jsonarray.CompareJSONArray Maven / Gradle / Ivy
The newest version!
package cn.schoolwow.util.domain.compare.jsonarray;
import cn.schoolwow.util.module.compare.jsonarray.domain.CompareJSONArrayQueryOption;
import com.alibaba.fastjson.JSONArray;
import org.apache.commons.lang3.Validate;
public class CompareJSONArray {
private CompareJSONArrayQueryOption compareJSONArrayQueryOption = new CompareJSONArrayQueryOption();
/**创建实例查询*/
public static CompareJSONArray newInstance(){
CompareJSONArray compareInstanceListQueryOption = new CompareJSONArray();
return compareInstanceListQueryOption;
}
/**设置修改前的列表*/
public CompareJSONArray beforeJSONArray(JSONArray beforeJSONArray){
compareJSONArrayQueryOption.beforeJSONArray = beforeJSONArray;
return this;
}
/**设置修改后的列表*/
public CompareJSONArray afterJSONArray(JSONArray afterJSONArray){
compareJSONArrayQueryOption.afterJSONArray = afterJSONArray;
return this;
}
/**检查是否新增时的唯一字段*/
public CompareJSONArray addCheckFieldNames(String[] addCheckFieldNames){
compareJSONArrayQueryOption.addCheckFieldNames = addCheckFieldNames;
return this;
}
/**检查是否更新时的唯一字段*/
public CompareJSONArray updateCheckFieldNames(String[] updateCheckFieldNames){
compareJSONArrayQueryOption.updateCheckFieldNames = updateCheckFieldNames;
return this;
}
public CompareJSONArrayResponse execute(){
Validate.notNull(compareJSONArrayQueryOption.beforeJSONArray, "修改前的列表不能为空");
Validate.notNull(compareJSONArrayQueryOption.afterJSONArray, "修改后的列表不能为空");
Validate.notNull(compareJSONArrayQueryOption.addCheckFieldNames, "检查是否新增时的唯一字段不能为空");
Validate.notNull(compareJSONArrayQueryOption.updateCheckFieldNames, "检查是否更新时的唯一字段不能为空");
return new CompareJSONArrayResponse(compareJSONArrayQueryOption);
}
}