package com.bcxin.ars.export;

import com.bcxin.ars.enums.SignType;

import java.util.Map;

/**
 * @author linqinglin
 * @date 2020/04/07 0007 9:20
 */
public class NotEmptyExportWhereStrategy implements ExportWhereStrategy {

    @Override
    public String spliceWhereStr(SignType signType, Map<String,String> columnMap, Map<Object, Object> searchParams, Object key) {
        StringBuilder columnStr = new StringBuilder();
        columnStr.append(" and ifnull(")
                .append(columnMap.get(key))
                .append(",'")
                .append(signType.getDefaultValue())
                .append("') ")
                .append(signType.getOperator())
                .append(" ''");

        return columnStr.toString();
    }
}
