All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cloud.agileframework.sql.WhereIn Maven / Gradle / Ivy

package cloud.agileframework.sql;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

/**
 * @author 佟盟
 * 日期 2020-10-14 16:00
 * 描述 TODO
 * @version 1.0
 * @since 1.0
 */
public class WhereIn {
    private final String oldSql;
    private final List in;

    public WhereIn(String oldSql, List in) {
        this.oldSql = oldSql;
        this.in = in;
    }

    public String sql() {
        return IntStream.range(0, in.size()).mapToObj(i -> oldSql + i + Param.PARAM_INDEX).collect(Collectors.joining(","));
    }
}