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 CaseExportWhereStrategy 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 (case contractStatus " +
                "        when effectStartDate>date_format( now(), '%Y-%m-%d' ) then '8' " +
                "        when '1' then '1' " +
                "        when '2' then '2' " +
                "        when '3' then '1' " +
                "        else '2' " +
                "      end ) = '")
                .append(searchParams.get(key))
                .append("' ");
        return columnStr.toString();
    }
}
