package me.chyxion.tigon.mybatis;

/**
 * @author Shaun Chyxion <br>
 * chyxion@163.com <br>
 * 2017/1/23 17:04
 */
class OrSearchProcessor implements SearchProcessor {

    @Override
    public boolean accept(SearchProcessArgs args) {
        return CriterionType.OR.equals(args.getCondition().getType());
    }

    @Override
    public void process(SearchProcessArgs args) {
        if (args.isHasPrevCol()) {
            args.append(" or ");
        }
        else {
            args.setHasPrevOrCol(true);
        }
        args.getResult().addAll(args.getCondition().getSearch().assemble(true));
    }
}
