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 DateExportWhereStrategy 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  date_format(")
                .append(columnMap.get(key))
                .append(",'%Y-%m-%d') ")
                .append(signType.getOperator())
                .append(" '")
                .append(searchParams.get(key))
                .append("'");

        return columnStr.toString();
    }
}
